[update 标准解读流程] 表格回显

This commit is contained in:
danshihao
2024-07-12 19:43:28 +08:00
parent 028498fb16
commit 3b7e9f35f5
3 changed files with 49 additions and 2 deletions
+8
View File
@@ -123,10 +123,18 @@ export default {
val = e
}
console.log(val)
if (this.$listeners.nameChange) {
this.$emit('nameChange', this.getDictLabelByValue(val))
}
this.$emit('change', val)
// 解决数据规则,选择自定义SQL 规则值无法输入空格
this.$emit('input', val)
},
// 通过val获取字典项
getDictLabelByValue (val) {
const dictItem = this.dictOptions.find(item => item.value === val)
return dictItem.text || dictItem.label
},
setCurrentDictOptions (dictOptions) {
this.dictOptions = dictOptions
},
+14 -2
View File
@@ -139,15 +139,27 @@ export default {
selectedValue = this.dictOptions.map(item => item.value)
}
}
this.arrayValue = selectedValue
// 开启全选时,不把全选的value进行返回
if (this.openSelectedAll) {
this.$emit('change', selectedValue.filter(item => item !== selectedAllValue).join(this.spliter))
const list = selectedValue.filter(item => item !== selectedAllValue)
if (this.$listeners.nameChange) {
const labelList = list.map(val => this.getDictLabelByValue(val))
this.$emit('nameChange', labelList.join(this.spliter))
}
this.$emit('change', list.join(this.spliter))
} else {
if (this.$listeners.nameChange) {
this.$emit('nameChange', selectedValue.map(val => this.getDictLabelByValue(val)).join(this.spliter))
}
this.$emit('change', selectedValue.join(this.spliter))
}
},
// 通过val获取字典项
getDictLabelByValue (val) {
const dictItem = this.dictOptions.find(item => item.value === val)
return dictItem.text || dictItem.label
},
// 选中的回调
onSelect (value) {
// 没有开启全选就直接退出