修改foreignInput组件
This commit is contained in:
parent
ef520c2843
commit
50bd12318c
|
@ -8,7 +8,9 @@
|
|||
closable
|
||||
@close="handleClose"
|
||||
>
|
||||
{{ (column.config.instanceKey&&ctx?.[column.config.instanceKey]?.[column.config.nameKey])||value }}
|
||||
{{
|
||||
showValue
|
||||
}}
|
||||
</el-tag>
|
||||
<el-button @click="showSelect" size="small">选择</el-button>
|
||||
</div>
|
||||
|
@ -59,6 +61,19 @@ const handleClose = () => {
|
|||
value.value = null
|
||||
}
|
||||
|
||||
function getValueByNameKey(data, nameKey) {
|
||||
return data ? (typeof nameKey === "string" ? data[nameKey] : nameKey.map(key => [tempValue[key]]).join("-")) : ''
|
||||
}
|
||||
|
||||
const showValue = computed(() => {
|
||||
const nameKey = props.column.config.nameKey
|
||||
//后端关系字段内的值
|
||||
const val1 = getValueByNameKey(props.column.config.instanceKey && props.ctx?.[props.column.config.instanceKey], nameKey)
|
||||
//选择值内的值
|
||||
const val2 = getValueByNameKey(tempValue.value, nameKey)
|
||||
return val2 || (value.value ? (val1 || value.value) : value.value)
|
||||
})
|
||||
|
||||
const handleTempClose = () => {
|
||||
tempValue.value = null
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue