diff --git a/yudao-ui-admin-vue3/src/hooks/web/useCrudSchemas.ts b/yudao-ui-admin-vue3/src/hooks/web/useCrudSchemas.ts index 9ce88605d..d9efaa7b8 100644 --- a/yudao-ui-admin-vue3/src/hooks/web/useCrudSchemas.ts +++ b/yudao-ui-admin-vue3/src/hooks/web/useCrudSchemas.ts @@ -7,14 +7,10 @@ import { DescriptionsSchema } from '@/types/descriptions' import { ComponentOptions } from '@/types/components' export type CrudSchema = Omit & { - isSearch?: boolean // 是否在查询显示 - search?: CrudSearchParams // 查询的详细配置 - isTable?: boolean // 是否在列表显示 - table?: CrudTableParams // 列表的详细配置 - isForm?: boolean // 是否在表单显示 - form?: CrudFormParams // 表单的详细配置 - isDetail?: boolean // 是否在详情显示 - detail?: CrudDescriptionsParams // 详情的详细配置 + search?: CrudSearchParams + table?: CrudTableParams + form?: CrudFormParams + detail?: CrudDescriptionsParams children?: CrudSchema[] dictType?: string // 字典类型 dictData?: 'string' | 'number' | 'boolean' // 字典数据类型 string | number | boolean @@ -84,7 +80,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[]): FormSchema[] => { eachTree(crudSchema, (schemaItem: CrudSchema) => { // 判断是否显示 - if (schemaItem?.isSearch || schemaItem.search?.show) { + if (schemaItem?.search?.show) { let component = schemaItem?.search?.component || 'Input' const options: ComponentOptions[] = [] let comonentProps = {} @@ -97,7 +93,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[]): FormSchema[] => { comonentProps = { options: options } - if (!schemaItem.search?.component) component = 'Select' + if (!schemaItem.search.component) component = 'Select' } const searchSchemaItem = { // 默认为 input @@ -120,7 +116,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[]): FormSchema[] => { const filterTableSchema = (crudSchema: CrudSchema[]): TableColumn[] => { const tableColumns = treeMap(crudSchema, { conversion: (schema: CrudSchema) => { - if (schema?.isTable !== false || schema?.table?.show !== false) { + if (schema?.table?.show !== false) { return { ...schema.table, ...schema @@ -144,7 +140,7 @@ const filterFormSchema = (crudSchema: CrudSchema[]): FormSchema[] => { eachTree(crudSchema, (schemaItem: CrudSchema) => { // 判断是否显示 - if (schemaItem?.isForm !== false || schemaItem?.form?.show == true) { + if (schemaItem?.form?.show !== false) { let component = schemaItem?.form?.component || 'Input' let defaultValue: any = '' if (schemaItem.form?.value) { @@ -201,7 +197,7 @@ const filterDescriptionsSchema = (crudSchema: CrudSchema[]): DescriptionsSchema[ eachTree(crudSchema, (schemaItem: CrudSchema) => { // 判断是否显示 - if (schemaItem?.isDetail !== false || schemaItem.detail?.show !== false) { + if (schemaItem?.detail?.show !== false) { const descriptionsSchemaItem = { ...schemaItem.detail, field: schemaItem.field, diff --git a/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts b/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts index 120d3dbd3..3c1b36483 100644 --- a/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts +++ b/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts @@ -181,7 +181,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns } eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { // 判断是否显示 - if (schemaItem?.isTable !== false && schemaItem?.table?.show !== false) { + if (schemaItem?.isTable !== false) { const tableSchemaItem = { ...schemaItem.table, field: schemaItem.field, @@ -278,7 +278,7 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { // 判断是否显示 - if (schemaItem?.isDetail !== false || schemaItem.detail?.show !== false) { + if (schemaItem?.isDetail !== false) { const descriptionsSchemaItem = { ...schemaItem.detail, field: schemaItem.field, diff --git a/yudao-ui-admin-vue3/src/views/infra/codegen/codegen.data.ts b/yudao-ui-admin-vue3/src/views/infra/codegen/codegen.data.ts index 897a89cfb..27e49ff31 100644 --- a/yudao-ui-admin-vue3/src/views/infra/codegen/codegen.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/codegen/codegen.data.ts @@ -17,28 +17,40 @@ const crudSchemas = reactive([ label: t('common.index'), field: 'id', type: 'index', - isForm: false, - isDetail: false + form: { + show: false + }, + detail: { + show: false + } }, { label: '表名称', field: 'tableName', - isSearch: true + search: { + show: true + } }, { label: '表描述', field: 'tableComment', - isSearch: true + search: { + show: true + } }, { label: '实体', field: 'className', - isSearch: true + search: { + show: true + } }, { label: t('common.createTime'), field: 'createTime', - isForm: false, + form: { + show: false + }, search: { show: true, component: 'DatePicker', @@ -52,14 +64,20 @@ const crudSchemas = reactive([ { label: t('common.updateTime'), field: 'updateTime', - isForm: false + form: { + show: false + } }, { label: t('table.action'), field: 'action', - width: '350px', - isForm: false, - isDetail: false + width: '500px', + form: { + show: false + }, + detail: { + show: false + } } ]) export const { allSchemas } = useCrudSchemas(crudSchemas)