...
|
...
|
@@ -1683,6 +1683,8 @@ Handling Information |
|
|
<el-form-item>
|
|
|
<el-input minlength="1" maxlength="20" onkeyup="this.value=this.value.toUpperCase()"
|
|
|
@keyup.native="addForm.hbs.hbs_manifest_description.replace(/[^A-Za-z0-9\s]/g,'')"
|
|
|
:max-length="15"
|
|
|
@paste.native="handlePaste($event, 15)"
|
|
|
v-model="addForm.hbs.hbs_manifest_description" auto-complete="off" placeholder="货物品名" size="mini"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
...
|
...
|
@@ -2384,6 +2386,32 @@ Handling Information |
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
|
handlePaste(event, maxLength) {
|
|
|
// 阻止默认的粘贴行为
|
|
|
event.preventDefault();
|
|
|
// 获取粘贴的内容
|
|
|
let pasteData = (event.clipboardData || window.clipboardData).getData('text').toUpperCase();
|
|
|
// 获取当前输入框的内容
|
|
|
let currentValue = this.addForm.hbs.hbs_manifest_description;
|
|
|
// 计算总长度
|
|
|
let totalLength = currentValue.length + pasteData.length;
|
|
|
if (totalLength > 15) {
|
|
|
// 如果总长度超过15,只粘贴允许的部分
|
|
|
pasteData = pasteData.slice(0, 15 - currentValue.length);
|
|
|
}
|
|
|
// 更新输入框的内容
|
|
|
this.addForm.hbs.hbs_manifest_description += pasteData;
|
|
|
// 再次限制总长度
|
|
|
this.addForm.hbs.hbs_manifest_description = this.limitInputLength(this.addForm.hbs.hbs_manifest_description);
|
|
|
},
|
|
|
|
|
|
limitInputLength(value, maxLength) {
|
|
|
// 如果输入值的长度超过15,则截取前15个字符
|
|
|
if (value.length > 15) {
|
|
|
return value.slice(0, 15);
|
|
|
}
|
|
|
return value;
|
|
|
},
|
|
|
handleInput(value) {
|
|
|
// 这里可以进一步处理输入值,例如去空格等
|
|
|
this.form.bill.waybillNum = value.trim();
|
...
|
...
|
|