Commit 905385d4ae11c7a61b0155fc0c7ad748a26feeee

Authored by xingyu4j
1 parent 998d23db

Revert "perf: crud"

This reverts commit 0b23ce416e1f58d725faaf96a65d6ee2dffd5bc6.
yudao-ui-admin-vue3/src/hooks/web/useCrudSchemas.ts
@@ -7,14 +7,10 @@ import { DescriptionsSchema } from '@/types/descriptions' @@ -7,14 +7,10 @@ import { DescriptionsSchema } from '@/types/descriptions'
7 import { ComponentOptions } from '@/types/components' 7 import { ComponentOptions } from '@/types/components'
8 8
9 export type CrudSchema = Omit<TableColumn, 'children'> & { 9 export type CrudSchema = Omit<TableColumn, 'children'> & {
10 - isSearch?: boolean // 是否在查询显示  
11 - search?: CrudSearchParams // 查询的详细配置  
12 - isTable?: boolean // 是否在列表显示  
13 - table?: CrudTableParams // 列表的详细配置  
14 - isForm?: boolean // 是否在表单显示  
15 - form?: CrudFormParams // 表单的详细配置  
16 - isDetail?: boolean // 是否在详情显示  
17 - detail?: CrudDescriptionsParams // 详情的详细配置 10 + search?: CrudSearchParams
  11 + table?: CrudTableParams
  12 + form?: CrudFormParams
  13 + detail?: CrudDescriptionsParams
18 children?: CrudSchema[] 14 children?: CrudSchema[]
19 dictType?: string // 字典类型 15 dictType?: string // 字典类型
20 dictData?: 'string' | 'number' | 'boolean' // 字典数据类型 string | number | boolean 16 dictData?: 'string' | 'number' | 'boolean' // 字典数据类型 string | number | boolean
@@ -84,7 +80,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[]): FormSchema[] =&gt; { @@ -84,7 +80,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[]): FormSchema[] =&gt; {
84 80
85 eachTree(crudSchema, (schemaItem: CrudSchema) => { 81 eachTree(crudSchema, (schemaItem: CrudSchema) => {
86 // 判断是否显示 82 // 判断是否显示
87 - if (schemaItem?.isSearch || schemaItem.search?.show) { 83 + if (schemaItem?.search?.show) {
88 let component = schemaItem?.search?.component || 'Input' 84 let component = schemaItem?.search?.component || 'Input'
89 const options: ComponentOptions[] = [] 85 const options: ComponentOptions[] = []
90 let comonentProps = {} 86 let comonentProps = {}
@@ -97,7 +93,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[]): FormSchema[] =&gt; { @@ -97,7 +93,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[]): FormSchema[] =&gt; {
97 comonentProps = { 93 comonentProps = {
98 options: options 94 options: options
99 } 95 }
100 - if (!schemaItem.search?.component) component = 'Select' 96 + if (!schemaItem.search.component) component = 'Select'
101 } 97 }
102 const searchSchemaItem = { 98 const searchSchemaItem = {
103 // 默认为 input 99 // 默认为 input
@@ -120,7 +116,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[]): FormSchema[] =&gt; { @@ -120,7 +116,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[]): FormSchema[] =&gt; {
120 const filterTableSchema = (crudSchema: CrudSchema[]): TableColumn[] => { 116 const filterTableSchema = (crudSchema: CrudSchema[]): TableColumn[] => {
121 const tableColumns = treeMap<CrudSchema>(crudSchema, { 117 const tableColumns = treeMap<CrudSchema>(crudSchema, {
122 conversion: (schema: CrudSchema) => { 118 conversion: (schema: CrudSchema) => {
123 - if (schema?.isTable !== false || schema?.table?.show !== false) { 119 + if (schema?.table?.show !== false) {
124 return { 120 return {
125 ...schema.table, 121 ...schema.table,
126 ...schema 122 ...schema
@@ -144,7 +140,7 @@ const filterFormSchema = (crudSchema: CrudSchema[]): FormSchema[] =&gt; { @@ -144,7 +140,7 @@ const filterFormSchema = (crudSchema: CrudSchema[]): FormSchema[] =&gt; {
144 140
145 eachTree(crudSchema, (schemaItem: CrudSchema) => { 141 eachTree(crudSchema, (schemaItem: CrudSchema) => {
146 // 判断是否显示 142 // 判断是否显示
147 - if (schemaItem?.isForm !== false || schemaItem?.form?.show == true) { 143 + if (schemaItem?.form?.show !== false) {
148 let component = schemaItem?.form?.component || 'Input' 144 let component = schemaItem?.form?.component || 'Input'
149 let defaultValue: any = '' 145 let defaultValue: any = ''
150 if (schemaItem.form?.value) { 146 if (schemaItem.form?.value) {
@@ -201,7 +197,7 @@ const filterDescriptionsSchema = (crudSchema: CrudSchema[]): DescriptionsSchema[ @@ -201,7 +197,7 @@ const filterDescriptionsSchema = (crudSchema: CrudSchema[]): DescriptionsSchema[
201 197
202 eachTree(crudSchema, (schemaItem: CrudSchema) => { 198 eachTree(crudSchema, (schemaItem: CrudSchema) => {
203 // 判断是否显示 199 // 判断是否显示
204 - if (schemaItem?.isDetail !== false || schemaItem.detail?.show !== false) { 200 + if (schemaItem?.detail?.show !== false) {
205 const descriptionsSchemaItem = { 201 const descriptionsSchemaItem = {
206 ...schemaItem.detail, 202 ...schemaItem.detail,
207 field: schemaItem.field, 203 field: schemaItem.field,
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts
@@ -181,7 +181,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns @@ -181,7 +181,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns
181 } 181 }
182 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { 182 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
183 // 判断是否显示 183 // 判断是否显示
184 - if (schemaItem?.isTable !== false && schemaItem?.table?.show !== false) { 184 + if (schemaItem?.isTable !== false) {
185 const tableSchemaItem = { 185 const tableSchemaItem = {
186 ...schemaItem.table, 186 ...schemaItem.table,
187 field: schemaItem.field, 187 field: schemaItem.field,
@@ -278,7 +278,7 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema @@ -278,7 +278,7 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema
278 278
279 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { 279 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
280 // 判断是否显示 280 // 判断是否显示
281 - if (schemaItem?.isDetail !== false || schemaItem.detail?.show !== false) { 281 + if (schemaItem?.isDetail !== false) {
282 const descriptionsSchemaItem = { 282 const descriptionsSchemaItem = {
283 ...schemaItem.detail, 283 ...schemaItem.detail,
284 field: schemaItem.field, 284 field: schemaItem.field,
yudao-ui-admin-vue3/src/views/infra/codegen/codegen.data.ts
@@ -17,28 +17,40 @@ const crudSchemas = reactive&lt;CrudSchema[]&gt;([ @@ -17,28 +17,40 @@ const crudSchemas = reactive&lt;CrudSchema[]&gt;([
17 label: t('common.index'), 17 label: t('common.index'),
18 field: 'id', 18 field: 'id',
19 type: 'index', 19 type: 'index',
20 - isForm: false,  
21 - isDetail: false 20 + form: {
  21 + show: false
  22 + },
  23 + detail: {
  24 + show: false
  25 + }
22 }, 26 },
23 { 27 {
24 label: '表名称', 28 label: '表名称',
25 field: 'tableName', 29 field: 'tableName',
26 - isSearch: true 30 + search: {
  31 + show: true
  32 + }
27 }, 33 },
28 { 34 {
29 label: '表描述', 35 label: '表描述',
30 field: 'tableComment', 36 field: 'tableComment',
31 - isSearch: true 37 + search: {
  38 + show: true
  39 + }
32 }, 40 },
33 { 41 {
34 label: '实体', 42 label: '实体',
35 field: 'className', 43 field: 'className',
36 - isSearch: true 44 + search: {
  45 + show: true
  46 + }
37 }, 47 },
38 { 48 {
39 label: t('common.createTime'), 49 label: t('common.createTime'),
40 field: 'createTime', 50 field: 'createTime',
41 - isForm: false, 51 + form: {
  52 + show: false
  53 + },
42 search: { 54 search: {
43 show: true, 55 show: true,
44 component: 'DatePicker', 56 component: 'DatePicker',
@@ -52,14 +64,20 @@ const crudSchemas = reactive&lt;CrudSchema[]&gt;([ @@ -52,14 +64,20 @@ const crudSchemas = reactive&lt;CrudSchema[]&gt;([
52 { 64 {
53 label: t('common.updateTime'), 65 label: t('common.updateTime'),
54 field: 'updateTime', 66 field: 'updateTime',
55 - isForm: false 67 + form: {
  68 + show: false
  69 + }
56 }, 70 },
57 { 71 {
58 label: t('table.action'), 72 label: t('table.action'),
59 field: 'action', 73 field: 'action',
60 - width: '350px',  
61 - isForm: false,  
62 - isDetail: false 74 + width: '500px',
  75 + form: {
  76 + show: false
  77 + },
  78 + detail: {
  79 + show: false
  80 + }
63 } 81 }
64 ]) 82 ])
65 export const { allSchemas } = useCrudSchemas(crudSchemas) 83 export const { allSchemas } = useCrudSchemas(crudSchemas)