-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Description
版本号:
分支:springboot3
node v22.20.0
问题描述:
JVxeTable 级联,当列设置为字典时,选中后回显了值(应该显示文本)。
以下为部分代码:
子表列定义:
//子表单数据
//子表表格配置
export const testGenComboDetailColumns: JVxeColumn[] = [
{
title: '配方类型',
key: 'formulaType',
type: JVxeTypes.select,
dictCode:"cc_formula_type",
options:[],
width:"200px",
placeholder: '请选择${title}',
linkageKey: 'formulaName',
},
{
title: '配方名称',
key: 'formulaName',
type: JVxeTypes.select,
width:"200px",
placeholder: '请选择${title}',
defaultValue:''
},
组件Modal
<JVxeTable
keep-source
resizable
ref="testGenComboDetail"
:loading="testGenComboDetailTable.loading"
:columns="testGenComboDetailTable.columns"
:dataSource="testGenComboDetailTable.dataSource"
:height="340"
:rowNumber="true"
:rowSelection="true"
:disabled="formDisabled"
:toolbar="true"
@valueChange="handleValueChange"
:linkageConfig="linkageConfig"
>
// 联动配置
const linkageConfig = ref<JVxeLinkageConfig[]>([
{ requestData: formulaTypeData, key: 'formulaType' }
]);
// 模拟数据
const mockData = [
{ text: '叶组配方01', value: '叶组配方01', formulaType: '0' },
{ text: '叶组配方02', value: '叶组配方02', formulaType: '0' },
{ text: '料组配方01', value: '料组配方01', formulaType: '1' },
{ text: '料组配方02', value: '料组配方02', formulaType: '1' },
{ text: '烟支配方01', value: '烟支配方01', formulaType: '2' },
{ text: '烟支配方02', value: '烟支配方02', formulaType: '2' },
]
async function formulaTypeData(value) {
console.log("value:",value)
if (value === '') {
// 不写这行加载不到数据
}else{
return new Promise((resolve) => {
let data = mockData.filter((i) => i.formulaType === value);
setTimeout(() => resolve(data), 500);
});
}
}
错误截图:
1

2

3

4
