修改foreignInput组件
This commit is contained in:
parent
ef520c2843
commit
50bd12318c
|
@ -8,7 +8,9 @@
|
||||||
closable
|
closable
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
>
|
>
|
||||||
{{ (column.config.instanceKey&&ctx?.[column.config.instanceKey]?.[column.config.nameKey])||value }}
|
{{
|
||||||
|
showValue
|
||||||
|
}}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-button @click="showSelect" size="small">选择</el-button>
|
<el-button @click="showSelect" size="small">选择</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,12 +61,25 @@ const handleClose = () => {
|
||||||
value.value = null
|
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 = () => {
|
const handleTempClose = () => {
|
||||||
tempValue.value = null
|
tempValue.value = null
|
||||||
}
|
}
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get() {
|
get() {
|
||||||
console.log(props.ctx,'ctx')
|
console.log(props.ctx, 'ctx')
|
||||||
return props.modelValue;
|
return props.modelValue;
|
||||||
},
|
},
|
||||||
set(newVal) {
|
set(newVal) {
|
||||||
|
|
Loading…
Reference in New Issue