Commit ab67540d5f2a6fc1c81277f2af8cb8488251012a
1 parent
373eff60
fix: crud bug
Showing
3 changed files
with
10 additions
and
8 deletions
yudao-ui-admin-vue3/package.json
| @@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
| 25 | }, | 25 | }, |
| 26 | "dependencies": { | 26 | "dependencies": { |
| 27 | "@iconify/iconify": "^3.0.1", | 27 | "@iconify/iconify": "^3.0.1", |
| 28 | - "@vueuse/core": "^9.8.2", | 28 | + "@vueuse/core": "^9.9.0", |
| 29 | "@wangeditor/editor": "^5.1.23", | 29 | "@wangeditor/editor": "^5.1.23", |
| 30 | "@wangeditor/editor-for-vue": "^5.1.10", | 30 | "@wangeditor/editor-for-vue": "^5.1.10", |
| 31 | "@zxcvbn-ts/core": "^2.1.0", | 31 | "@zxcvbn-ts/core": "^2.1.0", |
| @@ -57,7 +57,7 @@ | @@ -57,7 +57,7 @@ | ||
| 57 | "devDependencies": { | 57 | "devDependencies": { |
| 58 | "@commitlint/cli": "^17.3.0", | 58 | "@commitlint/cli": "^17.3.0", |
| 59 | "@commitlint/config-conventional": "^17.3.0", | 59 | "@commitlint/config-conventional": "^17.3.0", |
| 60 | - "@iconify/json": "^2.1.156", | 60 | + "@iconify/json": "^2.1.157", |
| 61 | "@intlify/unplugin-vue-i18n": "^0.8.1", | 61 | "@intlify/unplugin-vue-i18n": "^0.8.1", |
| 62 | "@purge-icons/generated": "^0.9.0", | 62 | "@purge-icons/generated": "^0.9.0", |
| 63 | "@types/intro.js": "^5.1.0", | 63 | "@types/intro.js": "^5.1.0", |
| @@ -104,7 +104,7 @@ | @@ -104,7 +104,7 @@ | ||
| 104 | "vite-plugin-svg-icons": "^2.0.1", | 104 | "vite-plugin-svg-icons": "^2.0.1", |
| 105 | "vite-plugin-vue-setup-extend": "^0.4.0", | 105 | "vite-plugin-vue-setup-extend": "^0.4.0", |
| 106 | "vite-plugin-windicss": "^1.8.10", | 106 | "vite-plugin-windicss": "^1.8.10", |
| 107 | - "vue-tsc": "^1.0.16", | 107 | + "vue-tsc": "^1.0.17", |
| 108 | "windicss": "^3.5.6" | 108 | "windicss": "^3.5.6" |
| 109 | }, | 109 | }, |
| 110 | "engines": { | 110 | "engines": { |
yudao-ui-admin-vue3/src/hooks/web/useCrudSchemas.ts
| @@ -7,7 +7,7 @@ import { useI18n } from '@/hooks/web/useI18n' | @@ -7,7 +7,7 @@ import { useI18n } from '@/hooks/web/useI18n' | ||
| 7 | import { FormSchema } from '@/types/form' | 7 | import { FormSchema } from '@/types/form' |
| 8 | import { TableColumn } from '@/types/table' | 8 | import { TableColumn } from '@/types/table' |
| 9 | import { DescriptionsSchema } from '@/types/descriptions' | 9 | import { DescriptionsSchema } from '@/types/descriptions' |
| 10 | -import { ComponentOptions } from '@/types/components' | 10 | +import { ComponentOptions, ComponentProps } from '@/types/components' |
| 11 | 11 | ||
| 12 | export type CrudSchema = Omit<TableColumn, 'children'> & { | 12 | export type CrudSchema = Omit<TableColumn, 'children'> & { |
| 13 | isSearch?: boolean // 是否在查询显示 | 13 | isSearch?: boolean // 是否在查询显示 |
| @@ -98,7 +98,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): F | @@ -98,7 +98,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): F | ||
| 98 | if (schemaItem?.isSearch || schemaItem.search?.show) { | 98 | if (schemaItem?.isSearch || schemaItem.search?.show) { |
| 99 | let component = schemaItem?.search?.component || 'Input' | 99 | let component = schemaItem?.search?.component || 'Input' |
| 100 | const options: ComponentOptions[] = [] | 100 | const options: ComponentOptions[] = [] |
| 101 | - let comonentProps = {} | 101 | + let comonentProps: ComponentProps = {} |
| 102 | if (schemaItem.dictType) { | 102 | if (schemaItem.dictType) { |
| 103 | const allOptions: ComponentOptions = { label: '全部', value: '' } | 103 | const allOptions: ComponentOptions = { label: '全部', value: '' } |
| 104 | options.push(allOptions) | 104 | options.push(allOptions) |
| @@ -187,7 +187,7 @@ const filterFormSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): For | @@ -187,7 +187,7 @@ const filterFormSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): For | ||
| 187 | defaultValue = 0 | 187 | defaultValue = 0 |
| 188 | } | 188 | } |
| 189 | } | 189 | } |
| 190 | - let comonentProps = {} | 190 | + let comonentProps: ComponentProps = {} |
| 191 | if (schemaItem.dictType) { | 191 | if (schemaItem.dictType) { |
| 192 | const options: ComponentOptions[] = [] | 192 | const options: ComponentOptions[] = [] |
| 193 | if (schemaItem.dictClass && schemaItem.dictClass === 'number') { | 193 | if (schemaItem.dictClass && schemaItem.dictClass === 'number') { |
| @@ -264,7 +264,8 @@ const filterDescriptionsSchema = (crudSchema: CrudSchema[]): DescriptionsSchema[ | @@ -264,7 +264,8 @@ const filterDescriptionsSchema = (crudSchema: CrudSchema[]): DescriptionsSchema[ | ||
| 264 | descriptionsSchemaItem.dictType = schemaItem.dictType | 264 | descriptionsSchemaItem.dictType = schemaItem.dictType |
| 265 | } | 265 | } |
| 266 | if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') { | 266 | if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') { |
| 267 | - descriptionsSchemaItem.dateFormat = schemaItem.dateFormat | 267 | + // 优先使用 detail 下的配置,如果没有默认为 YYYY-MM-DD HH:mm:ss |
| 268 | + descriptionsSchemaItem.dateFormat = schemaItem?.detail?.dateFormat | ||
| 268 | ? schemaItem?.detail?.dateFormat | 269 | ? schemaItem?.detail?.dateFormat |
| 269 | : 'YYYY-MM-DD HH:mm:ss' | 270 | : 'YYYY-MM-DD HH:mm:ss' |
| 270 | } | 271 | } |
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts
| @@ -314,7 +314,8 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema | @@ -314,7 +314,8 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema | ||
| 314 | descriptionsSchemaItem.dictType = schemaItem.dictType | 314 | descriptionsSchemaItem.dictType = schemaItem.dictType |
| 315 | } | 315 | } |
| 316 | if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') { | 316 | if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') { |
| 317 | - descriptionsSchemaItem.dateFormat = schemaItem.dateFormat | 317 | + // 优先使用 detail 下的配置,如果没有默认为 YYYY-MM-DD HH:mm:ss |
| 318 | + descriptionsSchemaItem.dateFormat = schemaItem?.detail?.dateFormat | ||
| 318 | ? schemaItem?.detail?.dateFormat | 319 | ? schemaItem?.detail?.dateFormat |
| 319 | : 'YYYY-MM-DD HH:mm:ss' | 320 | : 'YYYY-MM-DD HH:mm:ss' |
| 320 | } | 321 | } |