mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	perf: vxe
This commit is contained in:
		| @@ -26,33 +26,18 @@ type VxeCrudColumns = Omit<VxeTableColumn, 'children'> & { | |||||||
|   field: string |   field: string | ||||||
|   title?: string |   title?: string | ||||||
|   formatter?: VxeColumnPropTypes.Formatter |   formatter?: VxeColumnPropTypes.Formatter | ||||||
|   search?: CrudSearchParams |   isSearch?: boolean | ||||||
|   table?: CrudTableParams |   search?: VxeFormItemProps | ||||||
|   form?: CrudFormParams |   isTable?: boolean | ||||||
|   detail?: CrudDescriptionsParams |   table?: VxeTableDefines.ColumnOptions | ||||||
|  |   isForm?: boolean | ||||||
|  |   form?: FormSchema | ||||||
|  |   isDetail?: boolean | ||||||
|  |   detail?: DescriptionsSchema | ||||||
|   print?: CrudPrintParams |   print?: CrudPrintParams | ||||||
|   children?: VxeCrudColumns[] |   children?: VxeCrudColumns[] | ||||||
|   dictType?: string |   dictType?: string | ||||||
| } | } | ||||||
| type CrudSearchParams = { |  | ||||||
|   // 是否显示在查询项 |  | ||||||
|   show?: boolean |  | ||||||
| } & Omit<VxeFormItemProps, 'field'> |  | ||||||
|  |  | ||||||
| type CrudTableParams = { |  | ||||||
|   // 是否显示表头 |  | ||||||
|   show?: boolean |  | ||||||
| } & Omit<VxeTableDefines.ColumnOptions, 'field'> |  | ||||||
|  |  | ||||||
| type CrudFormParams = { |  | ||||||
|   // 是否显示表单项 |  | ||||||
|   show?: boolean |  | ||||||
| } & Omit<FormSchema, 'field'> |  | ||||||
|  |  | ||||||
| type CrudDescriptionsParams = { |  | ||||||
|   // 是否显示表单项 |  | ||||||
|   show?: boolean |  | ||||||
| } & Omit<DescriptionsSchema, 'field'> |  | ||||||
|  |  | ||||||
| type CrudPrintParams = { | type CrudPrintParams = { | ||||||
|   // 是否显示表单项 |   // 是否显示表单项 | ||||||
| @@ -108,7 +93,7 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema): VxeFormItemProps[] => { | |||||||
|   const searchSchema: VxeFormItemProps[] = [] |   const searchSchema: VxeFormItemProps[] = [] | ||||||
|   eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { |   eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { | ||||||
|     // 判断是否显示 |     // 判断是否显示 | ||||||
|     if (schemaItem?.search?.show) { |     if (schemaItem?.isSearch) { | ||||||
|       let itemRenderName = schemaItem?.search?.itemRender?.name || '$input' |       let itemRenderName = schemaItem?.search?.itemRender?.name || '$input' | ||||||
|       const options: any[] = [] |       const options: any[] = [] | ||||||
|       let itemRender: FormItemRenderOptions = { |       let itemRender: FormItemRenderOptions = { | ||||||
| @@ -122,7 +107,7 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema): VxeFormItemProps[] => { | |||||||
|           options.push(dict) |           options.push(dict) | ||||||
|         }) |         }) | ||||||
|         itemRender.options = options |         itemRender.options = options | ||||||
|         if (!schemaItem.search.itemRender?.name) itemRenderName = '$select' |         if (!schemaItem?.search?.itemRender?.name) itemRenderName = '$select' | ||||||
|         itemRender = { |         itemRender = { | ||||||
|           name: itemRenderName, |           name: itemRenderName, | ||||||
|           options: options, |           options: options, | ||||||
| @@ -174,7 +159,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns | |||||||
|   } |   } | ||||||
|   eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { |   eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { | ||||||
|     // 判断是否显示 |     // 判断是否显示 | ||||||
|     if (schemaItem?.table?.show !== false) { |     if (schemaItem?.isTable !== false) { | ||||||
|       const tableSchemaItem = { |       const tableSchemaItem = { | ||||||
|         ...schemaItem.table, |         ...schemaItem.table, | ||||||
|         field: schemaItem.field, |         field: schemaItem.field, | ||||||
| @@ -190,9 +175,6 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns | |||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       // 删除不必要的字段 |  | ||||||
|       delete tableSchemaItem.show |  | ||||||
|  |  | ||||||
|       tableSchema.push(tableSchemaItem) |       tableSchema.push(tableSchemaItem) | ||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
| @@ -217,7 +199,7 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => { | |||||||
|  |  | ||||||
|   eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { |   eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { | ||||||
|     // 判断是否显示 |     // 判断是否显示 | ||||||
|     if (schemaItem?.form?.show !== false) { |     if (schemaItem?.isForm !== false) { | ||||||
|       let component = schemaItem?.form?.component || 'Input' |       let component = schemaItem?.form?.component || 'Input' | ||||||
|       const options: ComponentOptions[] = [] |       const options: ComponentOptions[] = [] | ||||||
|       let comonentProps = {} |       let comonentProps = {} | ||||||
| @@ -239,9 +221,6 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => { | |||||||
|         label: schemaItem.form?.label || schemaItem.title |         label: schemaItem.form?.label || schemaItem.title | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       // 删除不必要的字段 |  | ||||||
|       delete formSchemaItem.show |  | ||||||
|  |  | ||||||
|       formSchema.push(formSchemaItem) |       formSchema.push(formSchemaItem) | ||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
| @@ -255,16 +234,13 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema | |||||||
|  |  | ||||||
|   eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { |   eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { | ||||||
|     // 判断是否显示 |     // 判断是否显示 | ||||||
|     if (schemaItem?.detail?.show !== false) { |     if (schemaItem?.isDetail !== false) { | ||||||
|       const descriptionsSchemaItem = { |       const descriptionsSchemaItem = { | ||||||
|         ...schemaItem.detail, |         ...schemaItem.detail, | ||||||
|         field: schemaItem.field, |         field: schemaItem.field, | ||||||
|         label: schemaItem.detail?.label || schemaItem.title |         label: schemaItem.detail?.label || schemaItem.title | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       // 删除不必要的字段 |  | ||||||
|       delete descriptionsSchemaItem.show |  | ||||||
|  |  | ||||||
|       descriptionsSchema.push(descriptionsSchemaItem) |       descriptionsSchema.push(descriptionsSchemaItem) | ||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
|   | |||||||
| @@ -20,23 +20,17 @@ const crudSchemas = reactive<VxeCrudSchema>({ | |||||||
|       title: '错误码类型', |       title: '错误码类型', | ||||||
|       field: 'type', |       field: 'type', | ||||||
|       dictType: DICT_TYPE.SYSTEM_ERROR_CODE_TYPE, |       dictType: DICT_TYPE.SYSTEM_ERROR_CODE_TYPE, | ||||||
|       search: { |       isSearch: true | ||||||
|         show: true |  | ||||||
|       } |  | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       title: '应用名', |       title: '应用名', | ||||||
|       field: 'applicationName', |       field: 'applicationName', | ||||||
|       search: { |       isSearch: true | ||||||
|         show: true |  | ||||||
|       } |  | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       title: '错误码编码', |       title: '错误码编码', | ||||||
|       field: 'code', |       field: 'code', | ||||||
|       search: { |       isSearch: true | ||||||
|         show: true |  | ||||||
|       } |  | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       title: '错误码错误提示', |       title: '错误码错误提示', | ||||||
| @@ -46,11 +40,9 @@ const crudSchemas = reactive<VxeCrudSchema>({ | |||||||
|       title: t('common.createTime'), |       title: t('common.createTime'), | ||||||
|       field: 'createTime', |       field: 'createTime', | ||||||
|       formatter: 'formatDate', |       formatter: 'formatDate', | ||||||
|       form: { |       isForm: false, | ||||||
|         show: false |       isSearch: true, | ||||||
|       }, |  | ||||||
|       search: { |       search: { | ||||||
|         show: true, |  | ||||||
|         itemRender: { |         itemRender: { | ||||||
|           name: 'XDataTimePicker' |           name: 'XDataTimePicker' | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -21,16 +21,12 @@ const crudSchemas = reactive<VxeCrudSchema>({ | |||||||
|     { |     { | ||||||
|       title: '岗位名称', |       title: '岗位名称', | ||||||
|       field: 'name', |       field: 'name', | ||||||
|       search: { |       isSearch: true | ||||||
|         show: true |  | ||||||
|       } |  | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       title: '岗位编码', |       title: '岗位编码', | ||||||
|       field: 'code', |       field: 'code', | ||||||
|       search: { |       isSearch: true | ||||||
|         show: true |  | ||||||
|       } |  | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       title: '岗位顺序', |       title: '岗位顺序', | ||||||
| @@ -40,24 +36,18 @@ const crudSchemas = reactive<VxeCrudSchema>({ | |||||||
|       title: t('common.status'), |       title: t('common.status'), | ||||||
|       field: 'status', |       field: 'status', | ||||||
|       dictType: DICT_TYPE.COMMON_STATUS, |       dictType: DICT_TYPE.COMMON_STATUS, | ||||||
|       search: { |       isSearch: true | ||||||
|         show: true |  | ||||||
|       } |  | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       title: '备注', |       title: '备注', | ||||||
|       field: 'remark', |       field: 'remark', | ||||||
|       table: { |       isTable: false | ||||||
|         show: false |  | ||||||
|       } |  | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       title: t('common.createTime'), |       title: t('common.createTime'), | ||||||
|       field: 'createTime', |       field: 'createTime', | ||||||
|       formatter: 'formatDate', |       formatter: 'formatDate', | ||||||
|       form: { |       isForm: false | ||||||
|         show: false |  | ||||||
|       } |  | ||||||
|     } |     } | ||||||
|   ] |   ] | ||||||
| }) | }) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 xingyu4j
					xingyu4j