fix: crud bug

This commit is contained in:
xingyu 2022-12-26 17:47:48 +08:00
parent 373eff605b
commit ab67540d5f
3 changed files with 10 additions and 8 deletions

View File

@ -25,7 +25,7 @@
}, },
"dependencies": { "dependencies": {
"@iconify/iconify": "^3.0.1", "@iconify/iconify": "^3.0.1",
"@vueuse/core": "^9.8.2", "@vueuse/core": "^9.9.0",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.10", "@wangeditor/editor-for-vue": "^5.1.10",
"@zxcvbn-ts/core": "^2.1.0", "@zxcvbn-ts/core": "^2.1.0",
@ -57,7 +57,7 @@
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^17.3.0", "@commitlint/cli": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0", "@commitlint/config-conventional": "^17.3.0",
"@iconify/json": "^2.1.156", "@iconify/json": "^2.1.157",
"@intlify/unplugin-vue-i18n": "^0.8.1", "@intlify/unplugin-vue-i18n": "^0.8.1",
"@purge-icons/generated": "^0.9.0", "@purge-icons/generated": "^0.9.0",
"@types/intro.js": "^5.1.0", "@types/intro.js": "^5.1.0",
@ -104,7 +104,7 @@
"vite-plugin-svg-icons": "^2.0.1", "vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-setup-extend": "^0.4.0", "vite-plugin-vue-setup-extend": "^0.4.0",
"vite-plugin-windicss": "^1.8.10", "vite-plugin-windicss": "^1.8.10",
"vue-tsc": "^1.0.16", "vue-tsc": "^1.0.17",
"windicss": "^3.5.6" "windicss": "^3.5.6"
}, },
"engines": { "engines": {

View File

@ -7,7 +7,7 @@ import { useI18n } from '@/hooks/web/useI18n'
import { FormSchema } from '@/types/form' import { FormSchema } from '@/types/form'
import { TableColumn } from '@/types/table' import { TableColumn } from '@/types/table'
import { DescriptionsSchema } from '@/types/descriptions' import { DescriptionsSchema } from '@/types/descriptions'
import { ComponentOptions } from '@/types/components' import { ComponentOptions, ComponentProps } from '@/types/components'
export type CrudSchema = Omit<TableColumn, 'children'> & { export type CrudSchema = Omit<TableColumn, 'children'> & {
isSearch?: boolean // 是否在查询显示 isSearch?: boolean // 是否在查询显示
@ -98,7 +98,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): F
if (schemaItem?.isSearch || schemaItem.search?.show) { if (schemaItem?.isSearch || schemaItem.search?.show) {
let component = schemaItem?.search?.component || 'Input' let component = schemaItem?.search?.component || 'Input'
const options: ComponentOptions[] = [] const options: ComponentOptions[] = []
let comonentProps = {} let comonentProps: ComponentProps = {}
if (schemaItem.dictType) { if (schemaItem.dictType) {
const allOptions: ComponentOptions = { label: '全部', value: '' } const allOptions: ComponentOptions = { label: '全部', value: '' }
options.push(allOptions) options.push(allOptions)
@ -187,7 +187,7 @@ const filterFormSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): For
defaultValue = 0 defaultValue = 0
} }
} }
let comonentProps = {} let comonentProps: ComponentProps = {}
if (schemaItem.dictType) { if (schemaItem.dictType) {
const options: ComponentOptions[] = [] const options: ComponentOptions[] = []
if (schemaItem.dictClass && schemaItem.dictClass === 'number') { if (schemaItem.dictClass && schemaItem.dictClass === 'number') {
@ -264,7 +264,8 @@ const filterDescriptionsSchema = (crudSchema: CrudSchema[]): DescriptionsSchema[
descriptionsSchemaItem.dictType = schemaItem.dictType descriptionsSchemaItem.dictType = schemaItem.dictType
} }
if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') { if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') {
descriptionsSchemaItem.dateFormat = schemaItem.dateFormat // 优先使用 detail 下的配置,如果没有默认为 YYYY-MM-DD HH:mm:ss
descriptionsSchemaItem.dateFormat = schemaItem?.detail?.dateFormat
? schemaItem?.detail?.dateFormat ? schemaItem?.detail?.dateFormat
: 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ss'
} }

View File

@ -314,7 +314,8 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema
descriptionsSchemaItem.dictType = schemaItem.dictType descriptionsSchemaItem.dictType = schemaItem.dictType
} }
if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') { if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') {
descriptionsSchemaItem.dateFormat = schemaItem.dateFormat // 优先使用 detail 下的配置,如果没有默认为 YYYY-MM-DD HH:mm:ss
descriptionsSchemaItem.dateFormat = schemaItem?.detail?.dateFormat
? schemaItem?.detail?.dateFormat ? schemaItem?.detail?.dateFormat
: 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ss'
} }