Commit 0b2cecb5 by 张立顺

fix bug

1 parent 4799d170
......@@ -4,6 +4,11 @@
<div class="header" slot="header">
<d2-search ref="showSearch" class="show-search" :search-form="searchForm" :label-width="'120px'"
:search-select-obj="searchSelectObj" :form-data="showFormData">
<div class="input" slot="sourceNoInput">
<el-input clear v-model="searchSelectObj.sourceNo" placeholder="请输入来源单号" clearable :maxlength="20" @input="filterSourceNo"
@compositionstart="isComposing = true" @compositionend="handleCompositionEnd"></el-input>
</div>
</d2-search>
<div class="up-btns">
<el-button size="small" type="primary" @click="handleSearch">
......@@ -271,9 +276,10 @@ export default {
{
label: "车源号",
name: "sourceNo",
type: "input",
isClear: true,
maxlength: 20
// type: "input",
// isClear: true,
// maxlength: 20,
addHtml: 'sourceNoInput'
},
{
label: "车型",
......@@ -430,6 +436,26 @@ export default {
})
},
methods: {
// 只允许英文字母/数字/ASCII 可见特殊字符(过滤中文及非 ASCII)
filterSourceNo(val) {
if (this.isComposing) return
const sanitized = (val || "").replace(/[^\x20-\x7E]/g, "")
const limited = sanitized.slice(0, 20)
if (val !== limited) {
this.searchSelectObj.sourceNo = limited
}
},
// 处理中文输入法组合输入结束后统一过滤
handleCompositionEnd() {
this.isComposing = false
const val = this.searchSelectObj.sourceNo || ""
const limited = val.replace(/[^\x20-\x7E]/g, "").slice(0, 20)
if (val !== limited) {
this.$nextTick(() => {
this.searchSelectObj.sourceNo = limited
})
}
},
getStatusItem(baseData, optKey, row, rowKey) {
if (!baseData || !baseData[optKey] || !row) return null
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!