diff --git a/src/components/jh-select/index.vue b/src/components/jh-select/index.vue index 33894491..74c421f3 100644 --- a/src/components/jh-select/index.vue +++ b/src/components/jh-select/index.vue @@ -52,10 +52,10 @@ export default { type: String, default: '', // 默认查询字段是 id,可自定义 }, - title: { + title:{ type: String, - default: '新增', - }, + default: '新增' + } }, data() { return { @@ -69,7 +69,6 @@ export default { dropdownVisible: false, bindTimer: null, total: 0, - isSearching: false, // 加这一行 }; }, watch: { @@ -101,14 +100,7 @@ export default { let timeout = null; return (...args) => { clearTimeout(timeout); - // 过滤无效参数,只保留字符串/数字类型 - const validArgs = args - .map(arg => { - if (arg && arg.target) return arg.target.value; // 兼容事件对象 - return arg; - }) - .filter(arg => arg != null); - timeout = setTimeout(() => func.apply(this, validArgs), wait); + timeout = setTimeout(() => func.apply(this, args), wait); }; }, @@ -180,25 +172,7 @@ export default { }, handleSearch(val) { - // 万能处理:不管传什么,最终一定拿到纯字符串 - let searchVal = ''; - - // 处理 InputEvent 事件对象 - if (val && typeof val === 'object' && val.target) { - searchVal = (val.target.value || '').trim(); - } - // 处理正常字符串 - else { - searchVal = String(val || '').trim(); - } - - // 赋值搜索文本 - this.searchText = searchVal; - this.localValue = searchVal; - - // 关键:只要执行了搜索,永远禁止回显! - this.isSearching = true; - + this.searchText = val; this.reset(); this.debounceSearch(); }, @@ -236,7 +210,7 @@ export default { // 新增:通过接口获取完整数据 async getEchoData(val) { try { - const params = { [this.echoParamsKey]: val == null ? '' : val }; + const params = { [this.echoParamsKey]: val==null?'':val }; let res; if (this.echoMethod.toLowerCase() === 'post') { res = await axios.post(this.echoApi, params); @@ -255,10 +229,9 @@ export default { }, async initEcho() { - if (this.isSearching || this.searchText) return; const val = this.localValue; // (!val || !this.echoApi)&& - if (this.title === '新增' || !val) return; + if (this.title=='新增') return; // 处理多选(数组) if (this.multiple && Array.isArray(val)) { diff --git a/src/views/flowManagement/addDialog.vue b/src/views/flowManagement/addDialog.vue index abbdad84..2da6dffc 100644 --- a/src/views/flowManagement/addDialog.vue +++ b/src/views/flowManagement/addDialog.vue @@ -91,7 +91,6 @@