From c322dcf4457ba51b8e7fcfed0bc7c75af39d6d23 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 23 Dec 2021 19:31:00 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9AsearchInput=E7=9A=84=E5=9B=9E?= =?UTF-8?q?=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/mixin/routerPathParams.js | 7 ++++--- nezha-fronted/src/components/common/searchInput.vue | 11 +++++++++-- nezha-fronted/src/components/page/alert/alertRule.vue | 10 ++++------ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/nezha-fronted/src/components/common/mixin/routerPathParams.js b/nezha-fronted/src/components/common/mixin/routerPathParams.js index 1dac6db37..a351e9d55 100644 --- a/nezha-fronted/src/components/common/mixin/routerPathParams.js +++ b/nezha-fronted/src/components/common/mixin/routerPathParams.js @@ -37,9 +37,10 @@ export default { setTimeout(() => { const obj = lodash.cloneDeep(val.defaultJson) obj[val.jsonKey] = qv - console.log(obj[val.jsonKey]) - this.$refs[dataList].$refs.searchInput.select_list.push(obj) - this.$refs[dataList].$refs.searchInput.sreach_num++ + if (obj[val.jsonKey]) { + this.$refs[dataList].$refs.searchInput.select_list.push(obj) + this.$refs[dataList].$refs.searchInput.sreach_num++ + } // this.$refs[dataList].$refs.searchInput.searchLabelList = this.$refs[dataList].$refs.searchInput.searchLabelList.filter(item => item.label !== 'projectIds') }, 500) } diff --git a/nezha-fronted/src/components/common/searchInput.vue b/nezha-fronted/src/components/common/searchInput.vue index 28bfc08d7..c1eb5b832 100644 --- a/nezha-fronted/src/components/common/searchInput.vue +++ b/nezha-fronted/src/components/common/searchInput.vue @@ -1480,8 +1480,15 @@ export default { if (this.$route.path === '/exprTemp') { this.getGnameList() } - console.log(this.select_list, this.searchLabelList) - }, 100) + this.searchLabelList = this.searchLabelList.filter(item => !this.select_list.find(select => select.label === item.label)) + setTimeout(() => { + this.select_list.forEach(item => { + if (item.listStr) { + item.val = this[item.listStr].find(r => r.id == item.valnum).name + } + }) + }, 300) + }, 1000) JSON.parse(JSON.stringify(this.searchMsg.searchLabelList)).forEach(val => { if (val.prop == 'common_action') { this.actionSelect = val.doc.data diff --git a/nezha-fronted/src/components/page/alert/alertRule.vue b/nezha-fronted/src/components/page/alert/alertRule.vue index 8470840c5..175027ec5 100644 --- a/nezha-fronted/src/components/page/alert/alertRule.vue +++ b/nezha-fronted/src/components/page/alert/alertRule.vue @@ -345,7 +345,7 @@ export default { ids: { target: this.searchLabel, propertyName: 'ids', - + isSearchInput: true, type: 'string', defaultJson: { disabled: false, @@ -371,11 +371,10 @@ export default { type: 'severity', val: '', valnum: '', - valString: '' + valString: '', + listStr: 'severitySelect' }, jsonKey: 'valnum', - strKey: 'val', - listStr: 'severitySelect' }, type: { target: this.searchLabel, @@ -394,11 +393,10 @@ export default { valString: '' }, jsonKey: 'valnum', - strKey: 'val', - listStr: 'alertTypesSelect' }, name: { target: this.searchLabel, + isSearchInput: true, propertyName: 'name', type: 'string', defaultJson: {