forked from github/dataease
fix: 过滤组件多选时因为动态加载导致全选无法查看
This commit is contained in:
parent
ef89427017
commit
247dff6a35
@ -6,6 +6,7 @@
|
|||||||
:class="classId"
|
:class="classId"
|
||||||
popper-class="VisualSelects coustom-de-select"
|
popper-class="VisualSelects coustom-de-select"
|
||||||
no-match-text=" "
|
no-match-text=" "
|
||||||
|
reserve-keyword
|
||||||
clearable
|
clearable
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
v-on="$listeners"
|
v-on="$listeners"
|
||||||
@ -93,7 +94,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isIndeterminate() {
|
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: {
|
watch: {
|
||||||
@ -218,14 +219,34 @@ export default {
|
|||||||
this.domList.style.paddingTop = scrollTop - (scrollTop % this.itemHeight) + 'px'
|
this.domList.style.paddingTop = scrollTop - (scrollTop % this.itemHeight) + 'px'
|
||||||
},
|
},
|
||||||
popChange() {
|
popChange() {
|
||||||
|
this.$emit('resetKeyWords', '')
|
||||||
this.domList.style.paddingTop = 0 + 'px'
|
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.resetList()
|
||||||
this.reCacularHeight()
|
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) {
|
visualChange(val) {
|
||||||
if (this.$attrs.multiple) {
|
if (this.$attrs.multiple) {
|
||||||
this.selectAll = val.length === this.list.length
|
this.selectAll = val.length === this.halfSelect()
|
||||||
}
|
}
|
||||||
this.$emit('visual-change', val)
|
this.$emit('visual-change', val)
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
:key-word="keyWord"
|
:key-word="keyWord"
|
||||||
popper-class="coustom-de-select"
|
popper-class="coustom-de-select"
|
||||||
:list="data"
|
:list="data"
|
||||||
|
@resetKeyWords="filterMethod"
|
||||||
:custom-style="customStyle"
|
:custom-style="customStyle"
|
||||||
@change="changeValue"
|
@change="changeValue"
|
||||||
@focus="setOptionWidth"
|
@focus="setOptionWidth"
|
||||||
|
Loading…
Reference in New Issue
Block a user