From 6b1e11ffb5d5e6b2f528be2b41b32baf83a90a83 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Wed, 24 Apr 2024 18:01:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=BF=87=E6=BB=A4=E7=BB=84=E4=BB=B6):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=87=E6=BB=A4=E7=BB=84=E4=BB=B6=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=AE=8C=E5=80=BC=E4=B8=A2=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/widget/deWidget/DeSelect.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/core/frontend/src/components/widget/deWidget/DeSelect.vue b/core/frontend/src/components/widget/deWidget/DeSelect.vue index 6716c10cf5..23a5b060e6 100644 --- a/core/frontend/src/components/widget/deWidget/DeSelect.vue +++ b/core/frontend/src/components/widget/deWidget/DeSelect.vue @@ -23,7 +23,7 @@ :is-config="isConfig" :custom-style="customStyle" :radio-style="element.style" - @resetKeyWords="filterMethod" + @resetKeyWords="resetKeyWords" @change="changeValue" @focus="setOptionWidth" @blur="onBlur" @@ -93,6 +93,7 @@ export default { data() { return { showNumber: false, + resetKeyWordsVal: '', selectOptionWidth: 0, show: true, value: null, @@ -322,6 +323,11 @@ export default { searchWithKey: _.debounce(function() { this.refreshOptions() }, 1000), + resetKeyWords() { + this.resetKeyWordsVal = this.value + this.keyWord = '' + this.searchWithKey() + }, filterMethod(key) { if (!key && !this.keyWord) { this.keyWord = key @@ -550,6 +556,12 @@ export default { if (this.isCustomSortWidget && this.element.options.attrs?.sort?.sort === 'custom') { tempData = mergeCustomSortOption(this.element.options.attrs.sort.list, tempData) } + + if (Array.isArray(this.resetKeyWordsVal) && this.resetKeyWordsVal.length) { + tempData = [...new Set([...this.resetKeyWordsVal, ...tempData])] + } else if (!Array.isArray(this.resetKeyWordsVal) && this.resetKeyWordsVal) { + tempData = [...new Set([this.resetKeyWordsVal, ...tempData])] + } this.filterInvalidValue(this.element.options.attrs.showEmpty ? [...tempData, '_empty_$'] : tempData) return tempData.map(item => { return {