From 247dff6a354f42c71db4f9179918078475a440fa Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Fri, 24 Mar 2023 11:51:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=87=E6=BB=A4=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=9A=E9=80=89=E6=97=B6=E5=9B=A0=E4=B8=BA=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=AF=BC=E8=87=B4=E5=85=A8=E9=80=89=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/elVisualSelect/index.vue | 27 ++++++++++++++++--- .../components/widget/deWidget/DeSelect.vue | 1 + 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/elVisualSelect/index.vue b/frontend/src/components/elVisualSelect/index.vue index d05209996f..21be80326c 100644 --- a/frontend/src/components/elVisualSelect/index.vue +++ b/frontend/src/components/elVisualSelect/index.vue @@ -6,6 +6,7 @@ :class="classId" popper-class="VisualSelects coustom-de-select" no-match-text=" " + reserve-keyword clearable v-bind="$attrs" v-on="$listeners" @@ -93,7 +94,7 @@ export default { }, computed: { isIndeterminate() { - return Array.isArray(this.selectValue) && this.selectValue.length > 0 && this.selectValue.length !== this.list.length + return Array.isArray(this.selectValue) && this.selectValue.length > 0 && this.isAllSelect() > 0 && this.selectValue.length !== this.halfSelect() } }, watch: { @@ -218,14 +219,34 @@ export default { this.domList.style.paddingTop = scrollTop - (scrollTop % this.itemHeight) + 'px' }, popChange() { + this.$emit('resetKeyWords', '') this.domList.style.paddingTop = 0 + 'px' - + this.startIndex = 0 + this.$nextTick(() => { + if (this.$attrs.multiple) { + this.selectAll = this.selectValue.length === this.list.length + } + }) this.resetList() this.reCacularHeight() }, + 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 + } + 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 + } + return vals + }, visualChange(val) { if (this.$attrs.multiple) { - this.selectAll = val.length === this.list.length + this.selectAll = val.length === this.halfSelect() } this.$emit('visual-change', val) } diff --git a/frontend/src/components/widget/deWidget/DeSelect.vue b/frontend/src/components/widget/deWidget/DeSelect.vue index 7038e8938b..cc5c68fe96 100644 --- a/frontend/src/components/widget/deWidget/DeSelect.vue +++ b/frontend/src/components/widget/deWidget/DeSelect.vue @@ -16,6 +16,7 @@ :key-word="keyWord" popper-class="coustom-de-select" :list="data" + @resetKeyWords="filterMethod" :custom-style="customStyle" @change="changeValue" @focus="setOptionWidth"