Merge pull request #2512 from dataease/pr@dev@fix_visual_select

fix: 下拉过滤器数据量大卡顿
This commit is contained in:
fit2cloud-chenyw 2022-06-27 15:40:27 +08:00 committed by GitHub
commit fd65e0ac05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -4,8 +4,10 @@
v-model="selectValue"
:class="classId"
popper-class="VisualSelects"
no-match-text=" "
v-bind="$attrs"
v-on="$listeners"
@change="visualChange"
@visible-change="popChange"
>
<el-option v-for="item in options" :key="item.id" :label="item.text" :value="item.id" />
@ -54,6 +56,9 @@ export default {
}
},
watch: {
value(val) {
this.selectValue = val
},
selectValue(val) {
this.$emit('update', val)
if (!val) {
@ -102,6 +107,7 @@ export default {
)
this.scrollbar = document.querySelector(`.${this.classId} .el-select-dropdown .el-scrollbar`)
this.slectBoxDom = document.querySelector(`.${this.classId} .el-select-dropdown__wrap`)
if (!this.slectBoxDom || !this.slectBoxDom.style) return
this.slectBoxDom.style.display = 'flex'
this.slectBoxDom.style.flexDirection = 'row'
this.domList = selectDom.querySelector(
@ -117,6 +123,7 @@ export default {
},
callback() {
if (!this.scrollbar) return
const scrollTop = this.scrollbar.scrollTop
this.startIndex = parseInt(scrollTop / this.itemHeight)
this.endIndex = this.startIndex + this.maxLength
@ -129,6 +136,9 @@ export default {
this.resetList()
this.reCacularHeight()
},
visualChange(val) {
this.$emit('visual-change', val)
}
}

View File

@ -17,6 +17,7 @@
@change="changeValue"
@focus="setOptionWidth"
@blur="onBlur"
@visual-change="visualChange"
>
<el-option
v-for="item in templateDatas || datas"
@ -214,6 +215,9 @@ export default {
this.changeValue(this.value)
}
},
visualChange(value) {
this.value = value
},
changeValue(value) {
if (!this.inDraw) {
if (value === null) {
@ -248,7 +252,6 @@ export default {
value: this.formatFilterValue(),
operator: this.operator
}
console.log(param.value)
this.inDraw && this.$store.commit('addViewFilter', param)
},
formatFilterValue() {

View File

@ -140,8 +140,6 @@ export default {
created() {
this.attrs = this.controlAttrs
console.log(this.childViews)
console.log(this.attrs)
},
methods: {
multipleChange(value) {