From 0f7b4287e3184ac86ef93403b69d8e527ec844ee Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Mon, 18 Mar 2024 11:23:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E7=BB=84=E4=BB=B6=E5=A4=9A=E9=80=89=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E8=BE=93=E5=85=A5=E6=90=9C=E7=B4=A2=E9=80=89?= =?UTF-8?q?=E9=A1=B9=EF=BC=8C=E4=BC=9A=E6=8A=8A=E4=B9=8B=E5=89=8D=E5=8B=BE?= =?UTF-8?q?=E9=80=89=E7=9A=84=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/widget/deWidget/DeSelect.vue | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/core/frontend/src/components/widget/deWidget/DeSelect.vue b/core/frontend/src/components/widget/deWidget/DeSelect.vue index 34cf845c1c..fe399b5b2c 100644 --- a/core/frontend/src/components/widget/deWidget/DeSelect.vue +++ b/core/frontend/src/components/widget/deWidget/DeSelect.vue @@ -54,6 +54,7 @@ import { getLinkToken, getToken } from '@/utils/auth' import customInput from '@/components/widget/deWidget/customInput' import { textSelectWidget } from '@/components/widget/deWidget/serviceNameFn.js' import { uuid } from 'vue-uuid' +import _ from 'lodash' export default { components: { ElVisualSelect }, mixins: [customInput], @@ -96,7 +97,6 @@ export default { onFocus: false, keyWord: '', separator: ',', - timeMachine: null, changeIndex: 0, flag: uuid.v1(), hasDestroy: false @@ -313,29 +313,14 @@ export default { this.$refs.deSelect && this.$refs.deSelect.resetSelectAll && this.$refs.deSelect.resetSelectAll() }, - searchWithKey(index) { - this.timeMachine = setTimeout(() => { - if (index === this.changeIndex) { - this.refreshOptions() - } - this.destroyTimeMachine() - }, 1500) - }, - destroyTimeMachine() { - this.timeMachine && clearTimeout(this.timeMachine) - this.timeMachine = null - }, + searchWithKey: _.debounce(function () { + this.refreshOptions() + }, 1000), filterMethod(key) { - if (key === this.keyWord) { - return - } this.keyWord = key - this.destroyTimeMachine() - this.changeIndex++ - this.searchWithKey(this.changeIndex) + this.searchWithKey() }, refreshOptions() { - // this.data = [] let method = multFieldValues const token = this.$store.getters.token || getToken() const linkToken = this.$store.getters.linkToken || getLinkToken() @@ -564,7 +549,7 @@ export default { }) }, filterInvalidValue(data) { - if (this.value === null) { + if (this.value === null || !!this.keyWord) { return } if (!data.length) {