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 {