perf: useCrudSchemas cutom label

This commit is contained in:
kailong321200875 2022-07-01 16:48:50 +08:00
parent 9a3b6177aa
commit 7864d830e2
1 changed files with 4 additions and 4 deletions

View File

@ -95,7 +95,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): F
componentProps: {}, componentProps: {},
...schemaItem.search, ...schemaItem.search,
field: schemaItem.field, field: schemaItem.field,
label: schemaItem.label label: schemaItem.search?.label || schemaItem.label
} }
if (searchSchemaItem.dictName) { if (searchSchemaItem.dictName) {
@ -111,7 +111,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): F
}) })
if (index !== -1) { if (index !== -1) {
allSchemas.searchSchema[index]!.componentProps!.options = filterOptions( allSchemas.searchSchema[index]!.componentProps!.options = filterOptions(
res.data, res,
searchSchemaItem.componentProps.optionsAlias?.labelField searchSchemaItem.componentProps.optionsAlias?.labelField
) )
} }
@ -168,7 +168,7 @@ const filterFormSchema = (crudSchema: CrudSchema[]): FormSchema[] => {
component: (schemaItem.form && schemaItem.form.component) || 'Input', component: (schemaItem.form && schemaItem.form.component) || 'Input',
...schemaItem.form, ...schemaItem.form,
field: schemaItem.field, field: schemaItem.field,
label: schemaItem.label label: schemaItem.form?.label || schemaItem.label
} }
// 删除不必要的字段 // 删除不必要的字段
@ -191,7 +191,7 @@ const filterDescriptionsSchema = (crudSchema: CrudSchema[]): DescriptionsSchema[
const descriptionsSchemaItem = { const descriptionsSchemaItem = {
...schemaItem.detail, ...schemaItem.detail,
field: schemaItem.field, field: schemaItem.field,
label: schemaItem.label label: schemaItem.detail?.label || schemaItem.label
} }
// 删除不必要的字段 // 删除不必要的字段