From 7864d830e2134d814609e722b7bad1754ea9460e Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Fri, 1 Jul 2022 16:48:50 +0800 Subject: [PATCH] perf: useCrudSchemas cutom label --- src/hooks/web/useCrudSchemas.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hooks/web/useCrudSchemas.ts b/src/hooks/web/useCrudSchemas.ts index e7f8a21..aae2bf4 100644 --- a/src/hooks/web/useCrudSchemas.ts +++ b/src/hooks/web/useCrudSchemas.ts @@ -95,7 +95,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): F componentProps: {}, ...schemaItem.search, field: schemaItem.field, - label: schemaItem.label + label: schemaItem.search?.label || schemaItem.label } if (searchSchemaItem.dictName) { @@ -111,7 +111,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): F }) if (index !== -1) { allSchemas.searchSchema[index]!.componentProps!.options = filterOptions( - res.data, + res, searchSchemaItem.componentProps.optionsAlias?.labelField ) } @@ -168,7 +168,7 @@ const filterFormSchema = (crudSchema: CrudSchema[]): FormSchema[] => { component: (schemaItem.form && schemaItem.form.component) || 'Input', ...schemaItem.form, field: schemaItem.field, - label: schemaItem.label + label: schemaItem.form?.label || schemaItem.label } // 删除不必要的字段 @@ -191,7 +191,7 @@ const filterDescriptionsSchema = (crudSchema: CrudSchema[]): DescriptionsSchema[ const descriptionsSchemaItem = { ...schemaItem.detail, field: schemaItem.field, - label: schemaItem.label + label: schemaItem.detail?.label || schemaItem.label } // 删除不必要的字段