From 08656ee0708b116204610c318a7c73fb176e051b Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Thu, 17 Nov 2022 13:27:26 +0800 Subject: [PATCH] fix: form inputnumber --- yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts | 9 +++++++-- yudao-ui-admin-vue3/src/views/system/dept/dept.data.ts | 3 +-- .../src/views/system/oauth2/client/client.data.ts | 6 ++---- .../src/views/system/tenant/tenant.data.ts | 3 +-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts b/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts index 4288e3464..43a44edcb 100644 --- a/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts +++ b/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts @@ -227,9 +227,13 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => { if (schemaItem?.isForm !== false || schemaItem?.form?.show == true) { // 默认为 input let component = schemaItem?.form?.component || 'Input' - const options: ComponentOptions[] = [] + let defaultValue: any = '' + if (component === 'InputNumber') { + defaultValue = 0 + } let comonentProps = {} if (schemaItem.dictType) { + const options: ComponentOptions[] = [] if (schemaItem.dictData && schemaItem.dictData === 'number') { getIntDictOptions(schemaItem.dictType).forEach((dict) => { options.push(dict) @@ -253,7 +257,8 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => { field: schemaItem.field, label: schemaItem.form?.label || schemaItem.title, component: component, - componentProps: comonentProps + componentProps: comonentProps, + value: defaultValue } formSchema.push(formSchemaItem) diff --git a/yudao-ui-admin-vue3/src/views/system/dept/dept.data.ts b/yudao-ui-admin-vue3/src/views/system/dept/dept.data.ts index ae3b5a8b5..87dccfd57 100644 --- a/yudao-ui-admin-vue3/src/views/system/dept/dept.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/dept/dept.data.ts @@ -49,8 +49,7 @@ export const modelSchema = reactive([ { label: '显示排序', field: 'sort', - component: 'InputNumber', - value: 0 + component: 'InputNumber' }, { label: '状态', diff --git a/yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts b/yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts index 766d60060..73f02b63b 100644 --- a/yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts @@ -52,8 +52,7 @@ const crudSchemas = reactive({ title: '访问令牌的有效期', field: 'accessTokenValiditySeconds', form: { - component: 'InputNumber', - value: 0 + component: 'InputNumber' }, table: { slots: { @@ -65,8 +64,7 @@ const crudSchemas = reactive({ title: '刷新令牌的有效期', field: 'refreshTokenValiditySeconds', form: { - component: 'InputNumber', - value: 0 + component: 'InputNumber' }, table: { slots: { diff --git a/yudao-ui-admin-vue3/src/views/system/tenant/tenant.data.ts b/yudao-ui-admin-vue3/src/views/system/tenant/tenant.data.ts index 19a2e530c..bf7951c35 100644 --- a/yudao-ui-admin-vue3/src/views/system/tenant/tenant.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/tenant/tenant.data.ts @@ -82,8 +82,7 @@ const crudSchemas = reactive([ label: '账号额度', field: 'accountCount', form: { - component: 'InputNumber', - value: 0 + component: 'InputNumber' } }, {