From e97dc4166d34c5a35cdd365a10168ba13ddfcc55 Mon Sep 17 00:00:00 2001 From: yaojn Date: Thu, 18 Jan 2024 16:02:47 +0800 Subject: [PATCH] =?UTF-8?q?-=20[=E4=BF=AE=E5=A4=8D]=E5=89=8D=E7=AB=AFcombi?= =?UTF-8?q?nesearcher=E7=BB=84=E4=BB=B6(=E5=AE=9E=E6=97=B6/=E9=9D=9E?= =?UTF-8?q?=E5=AE=9E=E6=97=B6)=E6=90=9C=E7=B4=A2=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=20=20-=20[=E5=85=B3=E8=81=94]#[1070801711?= =?UTF-8?q?759360]=E5=89=8D=E7=AB=AFcombinesearcher=E7=BB=84=E4=BB=B6(?= =?UTF-8?q?=E5=AE=9E=E6=97=B6/=E9=9D=9E=E5=AE=9E=E6=97=B6)=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96=20http://192.168.?= =?UTF-8?q?0.96:8090/demo/rdm.html#/bug-detail/939050947543040/93905094754?= =?UTF-8?q?3057/1070801711759360?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CombineSearcher/CombineSearcher.vue | 32 ++++++----------- src/resources/plugins/TsForm/TsForm.vue | 3 +- .../components/common/filter-search.vue | 2 +- src/views/pages/cmdb/asset/asset-manage.vue | 31 +++++++++++------ .../inspect/recentIssues/recent-issues.vue | 34 +++++++++++++------ .../project/viewtab/components/issue-list.vue | 2 +- 6 files changed, 58 insertions(+), 46 deletions(-) diff --git a/src/resources/components/CombineSearcher/CombineSearcher.vue b/src/resources/components/CombineSearcher/CombineSearcher.vue index 773dc702..44c46ff6 100644 --- a/src/resources/components/CombineSearcher/CombineSearcher.vue +++ b/src/resources/components/CombineSearcher/CombineSearcher.vue @@ -329,7 +329,6 @@ export default { let totalSearch = this.getFullSearch(); this.$emit('remove-label'); this.$emit('change', totalSearch); - this.$emit('confirm', totalSearch); }); } //只有在搜索模式下才去匹配输入框的,如果是删除下拉的属性会在watch里触发,如果是删除关键词的还需要在这里触发一次change @@ -339,7 +338,6 @@ export default { let totalSearch = this.getFullSearch(); this.$emit('remove-label'); this.$emit('change', totalSearch); - this.$emit('confirm', totalSearch); } }, addKeyword() { @@ -353,9 +351,6 @@ export default { this.isVisible = false; this.$emit('change', newValue); this.keyword = ''; - if (this.searchMode == 'clickBtnSearch') { - this.$emit('confirm', newValue); // 非实时搜索模式下,需要分发值出去,否则关键字搜索无反应 - } } }, handleCancel() { @@ -380,7 +375,7 @@ export default { if (this.searchMode == 'clickBtnSearch') { this.refreshTextConfig(); // 点击确认时,需要把搜索结果显示在搜索栏中 } - this.$emit('confirm', fullSearch); + this.$emit('change', fullSearch); }, clearSearch() { this.keyword = ''; @@ -390,17 +385,15 @@ export default { this.isVisible = false; this.$refs.form && this.$refs.form.clearFormInput(); // 解决input输入框清空失败的问题 this.$forceUpdate(); - this.$emit('change', {});// 非实时搜索,删除全部数据后,触发change - this.$emit('confirm', {}); + this.$emit('change', {}); }, handleSearch() { this.$emit('change', this.getFullSearch()); - this.$emit('confirm', this.getFullSearch()); }, getFullSearch() { let fullSearch = {}; if (this.searchValue && Object.keys(this.searchValue).length) { - for (var s in this.searchValue) { + for (let s in this.searchValue) { if (this.searchValue[s] != null && this.searchValue[s] != '') { let newitem = {}; newitem[s] = this.searchValue[s]; @@ -421,7 +414,7 @@ export default { //console.log(e); }, updateVal(val) { - this.$nextTick(() => { + this.$nextTick(() => { this.searchValue = this.$utils.deepClone(val); this.totalText = this.$utils.deepClone(val); //清除searchList和关键字(keywordName)中没有定义的属性值,避免回显错误的选项 @@ -564,13 +557,14 @@ export default { }, watch: { searchValue: { - handler: function(val, oldval) { - let _this = this; + handler(val, oldval) { if (val) { - let totalSearch = _this.getFullSearch(); - let isEmit = this.$utils.isSame(totalSearch, _this.value); + let totalSearch = this.getFullSearch(); + let isEmit = this.$utils.isSame(totalSearch, this.value); if (!isEmit) { - this.$emit('change', totalSearch); + if (this.searchMode == 'realtimeSearch') { + this.$emit('change', totalSearch); + } } } }, @@ -609,14 +603,10 @@ export default { textConfig: { handler(val) { if (val && typeof val == 'object') { - if (this.searchMode == 'realtimeSearch') { - this.refreshTextConfig(); - } else if (this.searchMode == 'clickBtnSearch' && !this.isCloseAutomaticSearch) { - // 非实时搜索 + if (this.searchMode == 'realtimeSearch' || (this.searchMode == 'clickBtnSearch' && !this.isCloseAutomaticSearch)) { this.refreshTextConfig(); } } - this.$emit('change-label', this.totalText); }, deep: true, immediate: true diff --git a/src/resources/plugins/TsForm/TsForm.vue b/src/resources/plugins/TsForm/TsForm.vue index 1f5453c5..2752f51a 100755 --- a/src/resources/plugins/TsForm/TsForm.vue +++ b/src/resources/plugins/TsForm/TsForm.vue @@ -212,7 +212,8 @@ export default { handler(val) { this.$emit('update:textConfig', val); }, - deep: true + deep: true, + immediate: true }, dataConfig: { handler(currentval) { diff --git a/src/views/pages/autoexec/components/common/filter-search.vue b/src/views/pages/autoexec/components/common/filter-search.vue index 081458d9..072e3357 100644 --- a/src/views/pages/autoexec/components/common/filter-search.vue +++ b/src/views/pages/autoexec/components/common/filter-search.vue @@ -31,7 +31,7 @@ :isRequired="isRequired" :readonly="readonly" :showSearchNumber="showSearchNumber" - @confirm="simpleModeSearch" + @change="simpleModeSearch" @switchMode="switchMode" > diff --git a/src/views/pages/cmdb/asset/asset-manage.vue b/src/views/pages/cmdb/asset/asset-manage.vue index 4e592272..57620e10 100644 --- a/src/views/pages/cmdb/asset/asset-manage.vue +++ b/src/views/pages/cmdb/asset/asset-manage.vue @@ -48,14 +48,20 @@ ref="combineSearcher" v-model="searchVal" v-bind="searchConfig" - @confirm="changeCombineSearcher" - @change-label="changeLabelCombineSearcher" + @change="changeCombineSearcher" @switchMode="switchMode" > -