From 1a8a9e21850de38504239011dfb98d0a5432c4ab Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 20 Jul 2023 10:19:42 +0800 Subject: [PATCH] =?UTF-8?q?perf(=E8=BF=87=E6=BB=A4=E5=99=A8):=20=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E8=BF=87=E6=BB=A4=E5=99=A8=E6=A8=A1=E7=B3=8A=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E9=80=89=E9=A1=B9=E5=BF=BD=E7=95=A5=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/elTreeSelect/index.vue | 2 +- frontend/src/components/elVisualSelect/index.vue | 13 +++++++++---- .../src/components/widget/deWidget/DeSelectGrid.vue | 4 ++-- .../src/components/widget/deWidget/DeSelectTree.vue | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/elTreeSelect/index.vue b/frontend/src/components/elTreeSelect/index.vue index 20f09c9dd9..fe57dc5bc9 100644 --- a/frontend/src/components/elTreeSelect/index.vue +++ b/frontend/src/components/elTreeSelect/index.vue @@ -410,7 +410,7 @@ export default { }, _filterFun(value, data, node) { if (!value) return true - return data[this.propsLabel].indexOf(value) !== -1 + return data[this.propsLabel?.toLocaleUpperCase()].indexOf(value.toLocaleUpperCase()) !== -1 }, _treeNodeClickFun(data, node, vm) { const { multiple } = this.selectParams diff --git a/frontend/src/components/elVisualSelect/index.vue b/frontend/src/components/elVisualSelect/index.vue index e5320bad55..326c5af39d 100644 --- a/frontend/src/components/elVisualSelect/index.vue +++ b/frontend/src/components/elVisualSelect/index.vue @@ -121,7 +121,7 @@ export default { }, keyWord(val, old) { if (val === old) return - const results = val ? this.list.filter(item => item.text.includes(val)) : null + const results = val ? this.vagueFilter(val, this.list) : null this.resetList(results) this.reCacularHeight() this.$nextTick(() => { @@ -136,6 +136,11 @@ export default { }) }, methods: { + vagueFilter(val, nodes) { + if (!val || !val.trim()) return nodes + const results = nodes.filter(item => item.text?.toLocaleUpperCase().includes(val.toLocaleUpperCase())) + return results + }, resetSelectAll() { this.selectAll = false }, @@ -148,7 +153,7 @@ export default { selectAllChange(val) { let vals = val ? [...this.list.map(ele => ele.id)] : [] if (this.keyWord.trim() && val) { - vals = this.list.filter(item => item.text.includes(this.keyWord.trim())).map(ele => ele.id) + vals = this.vagueFilter(this.keyWord.trim(), this.list).map(ele => ele.id) } this.visualChange(vals) this.selectValue = vals @@ -233,14 +238,14 @@ export default { isAllSelect() { let vals = this.list.length if (this.keyWord.trim()) { - vals = this.list.filter(item => item.text.includes(this.keyWord.trim())).map(ele => ele.id).filter(ele => this.selectValue.includes(ele)).length + vals = this.vagueFilter(this.keyWord.trim(), this.list).map(ele => ele.id).filter(ele => this.selectValue.includes(ele)).length } return vals }, halfSelect() { let vals = this.list.length if (this.keyWord.trim()) { - vals = this.list.filter(item => item.text.includes(this.keyWord.trim())).map(ele => ele.id).length + vals = this.vagueFilter(this.keyWord.trim(), this.list).map(ele => ele.id).length } return vals }, diff --git a/frontend/src/components/widget/deWidget/DeSelectGrid.vue b/frontend/src/components/widget/deWidget/DeSelectGrid.vue index d4887feb9a..46023bfe7d 100644 --- a/frontend/src/components/widget/deWidget/DeSelectGrid.vue +++ b/frontend/src/components/widget/deWidget/DeSelectGrid.vue @@ -31,7 +31,7 @@ v-model="value" @change="handleCheckedChange" > -