fix: 修复 web-ele 下 ApiSelect / ApiTreeSelect 误用 antd 的 fieldNames 写法导致下拉无内容

element-plus 适配器走 ApiComponent,识别的是 labelField / valueField / childrenField;
而 fieldNames 是 antd 风格写法,从 web-antd 复制过来未做适配,导致内部数据无法被映射成
{ label, value, children },下拉树/列表显示为空。

涉及:
- CRM 客户 / 联系人 / 线索 新增表单的「地址」树
- CRM 商机状态「应用部门」、产品「产品类型」树
- ERP 销售出库的 客户 / 销售人员 / 结算账户 / 产品 / 创建人 下拉
dev
YunaiV 2026-05-02 18:53:11 +08:00
parent f542db27f9
commit eda6ffaf1e
5 changed files with 24 additions and 28 deletions

View File

@ -35,7 +35,9 @@ export function useFormSchema(): VbenFormSchema[] {
return handleTree(data);
},
multiple: true,
fieldNames: { label: 'name', value: 'id', children: 'children' },
labelField: 'name',
valueField: 'id',
childrenField: 'children',
placeholder: '请选择应用部门',
defaultExpandAll: true,
},

View File

@ -122,7 +122,9 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'ApiTreeSelect',
componentProps: {
api: getAreaTree,
fieldNames: { label: 'name', value: 'id', children: 'children' },
labelField: 'name',
valueField: 'id',
childrenField: 'children',
placeholder: '请选择地址',
},
},

View File

@ -144,7 +144,9 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'ApiTreeSelect',
componentProps: {
api: getAreaTree,
fieldNames: { label: 'name', value: 'id', children: 'children' },
labelField: 'name',
valueField: 'id',
childrenField: 'children',
placeholder: '请选择地址',
},
},

View File

@ -131,7 +131,9 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'ApiTreeSelect',
componentProps: {
api: getAreaTree,
fieldNames: { label: 'name', value: 'id', children: 'children' },
labelField: 'name',
valueField: 'id',
childrenField: 'children',
placeholder: '请选择地址',
allowClear: true,
},

View File

@ -67,10 +67,8 @@ export function useFormSchema(formType: string): VbenFormSchema[] {
allowClear: true,
showSearch: true,
api: getCustomerSimpleList,
fieldNames: {
label: 'name',
value: 'id',
},
labelField: 'name',
valueField: 'id',
},
rules: 'required',
},
@ -83,10 +81,8 @@ export function useFormSchema(formType: string): VbenFormSchema[] {
allowClear: true,
showSearch: true,
api: getSimpleUserList,
fieldNames: {
label: 'nickname',
value: 'id',
},
labelField: 'nickname',
valueField: 'id',
},
},
{
@ -201,10 +197,8 @@ export function useFormSchema(formType: string): VbenFormSchema[] {
allowClear: true,
showSearch: true,
api: getAccountSimpleList,
fieldNames: {
label: 'name',
value: 'id',
},
labelField: 'name',
valueField: 'id',
},
},
{
@ -353,10 +347,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
allowClear: true,
showSearch: true,
api: getProductSimpleList,
fieldNames: {
label: 'name',
value: 'id',
},
labelField: 'name',
valueField: 'id',
},
},
{
@ -377,10 +369,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
allowClear: true,
showSearch: true,
api: getCustomerSimpleList,
fieldNames: {
label: 'name',
value: 'id',
},
labelField: 'name',
valueField: 'id',
},
},
{
@ -405,10 +395,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
allowClear: true,
showSearch: true,
api: getSimpleUserList,
fieldNames: {
label: 'nickname',
value: 'id',
},
labelField: 'nickname',
valueField: 'id',
},
},
{