fix: 行权限无法过滤下拉组件默认值#7195

This commit is contained in:
fit2cloud-chenyw 2024-01-24 16:29:26 +08:00
parent 0b5b0304ab
commit 0a546a1821

View File

@ -554,6 +554,7 @@ export default {
if (this.isCustomSortWidget && this.element.options.attrs?.sort?.sort === 'custom') {
tempData = mergeCustomSortOption(this.element.options.attrs.sort.list, tempData)
}
this.filterInvalidValue(tempData)
return tempData.map(item => {
return {
id: item,
@ -561,6 +562,20 @@ export default {
}
})
},
filterInvalidValue(data) {
if (this.value === null) {
return
}
if (!data.length) {
this.value = null
return
}
if (this.element.options.attrs.multiple) {
this.value = this.value.filter(item => data.includes(item))
} else {
this.value = data.includes(this.value) ? this.value : null
}
},
setOptionWidth(event) {
this.onFocus = true
//