diff --git a/frontend/src/components/ElVisualSelect/index.vue b/frontend/src/components/ElVisualSelect/index.vue index 844c8ba0f9..96596484aa 100644 --- a/frontend/src/components/ElVisualSelect/index.vue +++ b/frontend/src/components/ElVisualSelect/index.vue @@ -40,6 +40,10 @@ export default { value: { type: [String, Number, Array], default: '' + }, + keyWord: { + type: String, + default: '' } }, data() { @@ -80,7 +84,16 @@ export default { this.init() }) }) - } + }, + keyWord(val, old) { + if(val === old) return + const results = val ? this.list.filter(item => item.text.includes(val)) : null + this.resetList(results) + this.reCacularHeight() + this.$nextTick(() => { + this.callback() + }) + }, }, mounted() { this.resetList() diff --git a/frontend/src/components/widget/DeWidget/DeSelect.vue b/frontend/src/components/widget/DeWidget/DeSelect.vue index 6845f3bd2e..969c2b556e 100644 --- a/frontend/src/components/widget/DeWidget/DeSelect.vue +++ b/frontend/src/components/widget/DeWidget/DeSelect.vue @@ -12,6 +12,8 @@ :popper-append-to-body="inScreen" :size="size" :filterable="true" + :filter-method="filterMethod" + :key-word="keyWord" popper-class="coustom-de-select" :list="datas" @change="changeValue" @@ -71,7 +73,8 @@ export default { show: true, value: null, datas: [], - onFocus: false + onFocus: false, + keyWord: '' } }, computed: { @@ -203,6 +206,9 @@ export default { bus.$off('reset-default-value', this.resetDefaultValue) }, methods: { + filterMethod(key) { + this.keyWord = key + }, onScroll() { if (this.onFocus) { this.$refs.deSelect.blur() @@ -215,7 +221,7 @@ export default { } }, onBlur() { - this.onFocus = false + // this.onFocus = false }, handleElTagStyle() { setTimeout(() => {