fix(AppendForm): 修复 批量添加表单配置 按钮点击事件未使用批量方法 问题; 表单排版改用baseColProps一次配置,减少重复代码 (#2504)
* fix(AppendForm): 修复 批量添加表单配置 按钮点击事件未使用批量方法 问题 * perf(AppendForm): 表单排版改用baseColProps一次配置,减少重复代码 Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
This commit is contained in:
parent
1657439569
commit
b90d3572a9
|
|
@ -4,7 +4,9 @@
|
||||||
<BasicForm @register="register" @submit="handleSubmit">
|
<BasicForm @register="register" @submit="handleSubmit">
|
||||||
<template #add="{ field }">
|
<template #add="{ field }">
|
||||||
<Button v-if="Number(field) === 0" @click="add">+</Button>
|
<Button v-if="Number(field) === 0" @click="add">+</Button>
|
||||||
<Button class="ml-2" v-if="Number(field) === 0" @click="add">批量添加表单配置</Button>
|
<Button class="ml-2" v-if="Number(field) === 0" @click="batchAdd">
|
||||||
|
批量添加表单配置
|
||||||
|
</Button>
|
||||||
<Button v-if="field > 0" @click="del(field)">-</Button>
|
<Button v-if="field > 0" @click="del(field)">-</Button>
|
||||||
</template>
|
</template>
|
||||||
</BasicForm>
|
</BasicForm>
|
||||||
|
|
@ -28,32 +30,24 @@
|
||||||
field: 'field0a',
|
field: 'field0a',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
label: '字段0',
|
label: '字段0',
|
||||||
colProps: {
|
|
||||||
span: 8,
|
|
||||||
},
|
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'field0b',
|
field: 'field0b',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
label: '字段0',
|
label: '字段0',
|
||||||
colProps: {
|
|
||||||
span: 8,
|
|
||||||
},
|
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: '0',
|
field: '0',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
label: ' ',
|
label: ' ',
|
||||||
colProps: {
|
|
||||||
span: 8,
|
|
||||||
},
|
|
||||||
slot: 'add',
|
slot: 'add',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
labelWidth: 100,
|
labelWidth: 100,
|
||||||
actionColOptions: { span: 24 },
|
actionColOptions: { span: 24 },
|
||||||
|
baseColProps: { span: 8 },
|
||||||
});
|
});
|
||||||
|
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
|
|
@ -73,9 +67,6 @@
|
||||||
field: `field${n.value}a`,
|
field: `field${n.value}a`,
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
label: '字段' + n.value,
|
label: '字段' + n.value,
|
||||||
colProps: {
|
|
||||||
span: 8,
|
|
||||||
},
|
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
'',
|
'',
|
||||||
|
|
@ -85,9 +76,6 @@
|
||||||
field: `field${n.value}b`,
|
field: `field${n.value}b`,
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
label: '字段' + n.value,
|
label: '字段' + n.value,
|
||||||
colProps: {
|
|
||||||
span: 8,
|
|
||||||
},
|
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
'',
|
'',
|
||||||
|
|
@ -98,9 +86,6 @@
|
||||||
field: `${n.value}`,
|
field: `${n.value}`,
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
label: ' ',
|
label: ' ',
|
||||||
colProps: {
|
|
||||||
span: 8,
|
|
||||||
},
|
|
||||||
slot: 'add',
|
slot: 'add',
|
||||||
},
|
},
|
||||||
'',
|
'',
|
||||||
|
|
@ -117,27 +102,18 @@
|
||||||
field: `field${n.value}a`,
|
field: `field${n.value}a`,
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
label: '字段' + n.value,
|
label: '字段' + n.value,
|
||||||
colProps: {
|
|
||||||
span: 8,
|
|
||||||
},
|
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: `field${n.value}b`,
|
field: `field${n.value}b`,
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
label: '字段' + n.value,
|
label: '字段' + n.value,
|
||||||
colProps: {
|
|
||||||
span: 8,
|
|
||||||
},
|
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: `${n.value}`,
|
field: `${n.value}`,
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
label: ' ',
|
label: ' ',
|
||||||
colProps: {
|
|
||||||
span: 8,
|
|
||||||
},
|
|
||||||
slot: 'add',
|
slot: 'add',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue