Commit 16b3e910e4d2d7c9cae013780f64bf6532d3c508

Authored by xingyu4j
1 parent b1caa1a1

perf: vxe

yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts
@@ -26,33 +26,18 @@ type VxeCrudColumns = Omit<VxeTableColumn, 'children'> & { @@ -26,33 +26,18 @@ type VxeCrudColumns = Omit<VxeTableColumn, 'children'> & {
26 field: string 26 field: string
27 title?: string 27 title?: string
28 formatter?: VxeColumnPropTypes.Formatter 28 formatter?: VxeColumnPropTypes.Formatter
29 - search?: CrudSearchParams  
30 - table?: CrudTableParams  
31 - form?: CrudFormParams  
32 - detail?: CrudDescriptionsParams 29 + isSearch?: boolean
  30 + search?: VxeFormItemProps
  31 + isTable?: boolean
  32 + table?: VxeTableDefines.ColumnOptions
  33 + isForm?: boolean
  34 + form?: FormSchema
  35 + isDetail?: boolean
  36 + detail?: DescriptionsSchema
33 print?: CrudPrintParams 37 print?: CrudPrintParams
34 children?: VxeCrudColumns[] 38 children?: VxeCrudColumns[]
35 dictType?: string 39 dictType?: string
36 } 40 }
37 -type CrudSearchParams = {  
38 - // 是否显示在查询项  
39 - show?: boolean  
40 -} & Omit<VxeFormItemProps, 'field'>  
41 -  
42 -type CrudTableParams = {  
43 - // 是否显示表头  
44 - show?: boolean  
45 -} & Omit<VxeTableDefines.ColumnOptions, 'field'>  
46 -  
47 -type CrudFormParams = {  
48 - // 是否显示表单项  
49 - show?: boolean  
50 -} & Omit<FormSchema, 'field'>  
51 -  
52 -type CrudDescriptionsParams = {  
53 - // 是否显示表单项  
54 - show?: boolean  
55 -} & Omit<DescriptionsSchema, 'field'>  
56 41
57 type CrudPrintParams = { 42 type CrudPrintParams = {
58 // 是否显示表单项 43 // 是否显示表单项
@@ -108,7 +93,7 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema): VxeFormItemProps[] =&gt; { @@ -108,7 +93,7 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema): VxeFormItemProps[] =&gt; {
108 const searchSchema: VxeFormItemProps[] = [] 93 const searchSchema: VxeFormItemProps[] = []
109 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { 94 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
110 // 判断是否显示 95 // 判断是否显示
111 - if (schemaItem?.search?.show) { 96 + if (schemaItem?.isSearch) {
112 let itemRenderName = schemaItem?.search?.itemRender?.name || '$input' 97 let itemRenderName = schemaItem?.search?.itemRender?.name || '$input'
113 const options: any[] = [] 98 const options: any[] = []
114 let itemRender: FormItemRenderOptions = { 99 let itemRender: FormItemRenderOptions = {
@@ -122,7 +107,7 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema): VxeFormItemProps[] =&gt; { @@ -122,7 +107,7 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema): VxeFormItemProps[] =&gt; {
122 options.push(dict) 107 options.push(dict)
123 }) 108 })
124 itemRender.options = options 109 itemRender.options = options
125 - if (!schemaItem.search.itemRender?.name) itemRenderName = '$select' 110 + if (!schemaItem?.search?.itemRender?.name) itemRenderName = '$select'
126 itemRender = { 111 itemRender = {
127 name: itemRenderName, 112 name: itemRenderName,
128 options: options, 113 options: options,
@@ -174,7 +159,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns @@ -174,7 +159,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns
174 } 159 }
175 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { 160 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
176 // 判断是否显示 161 // 判断是否显示
177 - if (schemaItem?.table?.show !== false) { 162 + if (schemaItem?.isTable !== false) {
178 const tableSchemaItem = { 163 const tableSchemaItem = {
179 ...schemaItem.table, 164 ...schemaItem.table,
180 field: schemaItem.field, 165 field: schemaItem.field,
@@ -190,9 +175,6 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns @@ -190,9 +175,6 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns
190 } 175 }
191 } 176 }
192 177
193 - // 删除不必要的字段  
194 - delete tableSchemaItem.show  
195 -  
196 tableSchema.push(tableSchemaItem) 178 tableSchema.push(tableSchemaItem)
197 } 179 }
198 }) 180 })
@@ -217,7 +199,7 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] =&gt; { @@ -217,7 +199,7 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] =&gt; {
217 199
218 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { 200 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
219 // 判断是否显示 201 // 判断是否显示
220 - if (schemaItem?.form?.show !== false) { 202 + if (schemaItem?.isForm !== false) {
221 let component = schemaItem?.form?.component || 'Input' 203 let component = schemaItem?.form?.component || 'Input'
222 const options: ComponentOptions[] = [] 204 const options: ComponentOptions[] = []
223 let comonentProps = {} 205 let comonentProps = {}
@@ -239,9 +221,6 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] =&gt; { @@ -239,9 +221,6 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] =&gt; {
239 label: schemaItem.form?.label || schemaItem.title 221 label: schemaItem.form?.label || schemaItem.title
240 } 222 }
241 223
242 - // 删除不必要的字段  
243 - delete formSchemaItem.show  
244 -  
245 formSchema.push(formSchemaItem) 224 formSchema.push(formSchemaItem)
246 } 225 }
247 }) 226 })
@@ -255,16 +234,13 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema @@ -255,16 +234,13 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema
255 234
256 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { 235 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
257 // 判断是否显示 236 // 判断是否显示
258 - if (schemaItem?.detail?.show !== false) { 237 + if (schemaItem?.isDetail !== false) {
259 const descriptionsSchemaItem = { 238 const descriptionsSchemaItem = {
260 ...schemaItem.detail, 239 ...schemaItem.detail,
261 field: schemaItem.field, 240 field: schemaItem.field,
262 label: schemaItem.detail?.label || schemaItem.title 241 label: schemaItem.detail?.label || schemaItem.title
263 } 242 }
264 243
265 - // 删除不必要的字段  
266 - delete descriptionsSchemaItem.show  
267 -  
268 descriptionsSchema.push(descriptionsSchemaItem) 244 descriptionsSchema.push(descriptionsSchemaItem)
269 } 245 }
270 }) 246 })
yudao-ui-admin-vue3/src/views/system/errorCode/errorCode.data.ts
@@ -20,23 +20,17 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({ @@ -20,23 +20,17 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({
20 title: '错误码类型', 20 title: '错误码类型',
21 field: 'type', 21 field: 'type',
22 dictType: DICT_TYPE.SYSTEM_ERROR_CODE_TYPE, 22 dictType: DICT_TYPE.SYSTEM_ERROR_CODE_TYPE,
23 - search: {  
24 - show: true  
25 - } 23 + isSearch: true
26 }, 24 },
27 { 25 {
28 title: '应用名', 26 title: '应用名',
29 field: 'applicationName', 27 field: 'applicationName',
30 - search: {  
31 - show: true  
32 - } 28 + isSearch: true
33 }, 29 },
34 { 30 {
35 title: '错误码编码', 31 title: '错误码编码',
36 field: 'code', 32 field: 'code',
37 - search: {  
38 - show: true  
39 - } 33 + isSearch: true
40 }, 34 },
41 { 35 {
42 title: '错误码错误提示', 36 title: '错误码错误提示',
@@ -46,11 +40,9 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({ @@ -46,11 +40,9 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({
46 title: t('common.createTime'), 40 title: t('common.createTime'),
47 field: 'createTime', 41 field: 'createTime',
48 formatter: 'formatDate', 42 formatter: 'formatDate',
49 - form: {  
50 - show: false  
51 - }, 43 + isForm: false,
  44 + isSearch: true,
52 search: { 45 search: {
53 - show: true,  
54 itemRender: { 46 itemRender: {
55 name: 'XDataTimePicker' 47 name: 'XDataTimePicker'
56 } 48 }
yudao-ui-admin-vue3/src/views/system/post/post.data.ts
@@ -21,16 +21,12 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({ @@ -21,16 +21,12 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({
21 { 21 {
22 title: '岗位名称', 22 title: '岗位名称',
23 field: 'name', 23 field: 'name',
24 - search: {  
25 - show: true  
26 - } 24 + isSearch: true
27 }, 25 },
28 { 26 {
29 title: '岗位编码', 27 title: '岗位编码',
30 field: 'code', 28 field: 'code',
31 - search: {  
32 - show: true  
33 - } 29 + isSearch: true
34 }, 30 },
35 { 31 {
36 title: '岗位顺序', 32 title: '岗位顺序',
@@ -40,24 +36,18 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({ @@ -40,24 +36,18 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({
40 title: t('common.status'), 36 title: t('common.status'),
41 field: 'status', 37 field: 'status',
42 dictType: DICT_TYPE.COMMON_STATUS, 38 dictType: DICT_TYPE.COMMON_STATUS,
43 - search: {  
44 - show: true  
45 - } 39 + isSearch: true
46 }, 40 },
47 { 41 {
48 title: '备注', 42 title: '备注',
49 field: 'remark', 43 field: 'remark',
50 - table: {  
51 - show: false  
52 - } 44 + isTable: false
53 }, 45 },
54 { 46 {
55 title: t('common.createTime'), 47 title: t('common.createTime'),
56 field: 'createTime', 48 field: 'createTime',
57 formatter: 'formatDate', 49 formatter: 'formatDate',
58 - form: {  
59 - show: false  
60 - } 50 + isForm: false
61 } 51 }
62 ] 52 ]
63 }) 53 })