perf: form inputnumber
This commit is contained in:
parent
08656ee070
commit
e175486692
@ -142,9 +142,17 @@ const filterFormSchema = (crudSchema: CrudSchema[]): FormSchema[] => {
|
|||||||
// 判断是否显示
|
// 判断是否显示
|
||||||
if (schemaItem?.form?.show !== false) {
|
if (schemaItem?.form?.show !== false) {
|
||||||
let component = schemaItem?.form?.component || 'Input'
|
let component = schemaItem?.form?.component || 'Input'
|
||||||
const options: ComponentOptions[] = []
|
let defaultValue: any = ''
|
||||||
|
if (schemaItem.form?.value) {
|
||||||
|
defaultValue = schemaItem.form?.value
|
||||||
|
} else {
|
||||||
|
if (component === 'InputNumber') {
|
||||||
|
defaultValue = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
let comonentProps = {}
|
let comonentProps = {}
|
||||||
if (schemaItem.dictType) {
|
if (schemaItem.dictType) {
|
||||||
|
const options: ComponentOptions[] = []
|
||||||
if (schemaItem.dictData && schemaItem.dictData === 'number') {
|
if (schemaItem.dictData && schemaItem.dictData === 'number') {
|
||||||
getIntDictOptions(schemaItem.dictType).forEach((dict) => {
|
getIntDictOptions(schemaItem.dictType).forEach((dict) => {
|
||||||
options.push(dict)
|
options.push(dict)
|
||||||
@ -167,6 +175,7 @@ const filterFormSchema = (crudSchema: CrudSchema[]): FormSchema[] => {
|
|||||||
// 默认为 input
|
// 默认为 input
|
||||||
component: component,
|
component: component,
|
||||||
componentProps: comonentProps,
|
componentProps: comonentProps,
|
||||||
|
value: defaultValue,
|
||||||
...schemaItem.form,
|
...schemaItem.form,
|
||||||
field: schemaItem.field,
|
field: schemaItem.field,
|
||||||
label: schemaItem.form?.label || schemaItem.label
|
label: schemaItem.form?.label || schemaItem.label
|
||||||
|
@ -228,8 +228,12 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => {
|
|||||||
// 默认为 input
|
// 默认为 input
|
||||||
let component = schemaItem?.form?.component || 'Input'
|
let component = schemaItem?.form?.component || 'Input'
|
||||||
let defaultValue: any = ''
|
let defaultValue: any = ''
|
||||||
if (component === 'InputNumber') {
|
if (schemaItem.form?.value) {
|
||||||
defaultValue = 0
|
defaultValue = schemaItem.form?.value
|
||||||
|
} else {
|
||||||
|
if (component === 'InputNumber') {
|
||||||
|
defaultValue = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let comonentProps = {}
|
let comonentProps = {}
|
||||||
if (schemaItem.dictType) {
|
if (schemaItem.dictType) {
|
||||||
@ -253,12 +257,12 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => {
|
|||||||
if (!(schemaItem.form && schemaItem.form.component)) component = 'Select'
|
if (!(schemaItem.form && schemaItem.form.component)) component = 'Select'
|
||||||
}
|
}
|
||||||
const formSchemaItem = {
|
const formSchemaItem = {
|
||||||
...schemaItem.form,
|
|
||||||
field: schemaItem.field,
|
|
||||||
label: schemaItem.form?.label || schemaItem.title,
|
|
||||||
component: component,
|
component: component,
|
||||||
componentProps: comonentProps,
|
componentProps: comonentProps,
|
||||||
value: defaultValue
|
value: defaultValue,
|
||||||
|
...schemaItem.form,
|
||||||
|
field: schemaItem.field,
|
||||||
|
label: schemaItem.form?.label || schemaItem.title
|
||||||
}
|
}
|
||||||
|
|
||||||
formSchema.push(formSchemaItem)
|
formSchema.push(formSchemaItem)
|
||||||
|
Loading…
Reference in New Issue
Block a user