|
|
|
@ -1,13 +1,13 @@ |
|
|
|
|
<template> |
|
|
|
|
<PageWrapper class="high-form" title="高级表单" content=" 高级表单常见于一次性输入和提交大批量数据的场景。"> |
|
|
|
|
<a-card title="仓库管理" :bordered="false"> |
|
|
|
|
<BasicForm @register="register" /> |
|
|
|
|
<PageWrapper title="基本信息"> |
|
|
|
|
<a-card title="项目概况" :bordered="false"> |
|
|
|
|
<BasicForm @register="registerProjectInfo" /> |
|
|
|
|
</a-card> |
|
|
|
|
<a-card title="任务管理" :bordered="false" class="!mt-5"> |
|
|
|
|
<BasicForm @register="registerTask" /> |
|
|
|
|
<a-card title="项目负责人" :bordered="false" class="!mt-5"> |
|
|
|
|
<BasicForm @register="registerUser" /> |
|
|
|
|
</a-card> |
|
|
|
|
<a-card title="成员管理" :bordered="false"> |
|
|
|
|
<PersonTable ref="tableRef" /> |
|
|
|
|
<a-card title="申请单位概况" :bordered="false" class="!mt-5"> |
|
|
|
|
<BasicForm @register="registerDepart" /> |
|
|
|
|
</a-card> |
|
|
|
|
|
|
|
|
|
<template #rightFooter> |
|
|
|
@ -18,49 +18,59 @@ |
|
|
|
|
<script lang="ts"> |
|
|
|
|
import { BasicForm, useForm } from '@/components/Form'; |
|
|
|
|
import { defineComponent, ref } from 'vue'; |
|
|
|
|
import PersonTable from './PersonTable.vue'; |
|
|
|
|
// import PersonTable from './PersonTable.vue'; |
|
|
|
|
import { PageWrapper } from '@/components/Page'; |
|
|
|
|
import { schemas, taskSchemas } from './data'; |
|
|
|
|
import { projectBaseInfoSchemas, userSchemas, departSchemas } from './data'; |
|
|
|
|
import { Card } from 'ant-design-vue'; |
|
|
|
|
|
|
|
|
|
export default defineComponent({ |
|
|
|
|
name: 'FormHightPage', |
|
|
|
|
components: { BasicForm, PersonTable, PageWrapper, [Card.name]: Card }, |
|
|
|
|
components: { BasicForm, PageWrapper, [Card.name]: Card }, |
|
|
|
|
setup() { |
|
|
|
|
const tableRef = ref<{ getDataSource: () => any } | null>(null); |
|
|
|
|
const [registerProjectInfo, { validate: validateProjectInfoForm }] = useForm({ |
|
|
|
|
baseColProps: { |
|
|
|
|
span: 6, |
|
|
|
|
}, |
|
|
|
|
labelWidth: 200, |
|
|
|
|
layout: 'vertical', |
|
|
|
|
schemas: projectBaseInfoSchemas, |
|
|
|
|
showActionButtonGroup: false, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const [register, { validate }] = useForm({ |
|
|
|
|
const [registerUser, { validate: validateUserForm }] = useForm({ |
|
|
|
|
baseColProps: { |
|
|
|
|
span: 6, |
|
|
|
|
}, |
|
|
|
|
labelWidth: 200, |
|
|
|
|
layout: 'vertical', |
|
|
|
|
schemas: schemas, |
|
|
|
|
schemas: userSchemas, |
|
|
|
|
showActionButtonGroup: false, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const [registerTask, { validate: validateTaskForm }] = useForm({ |
|
|
|
|
const [registerDepart, { validate: validateDepartForm }] = useForm({ |
|
|
|
|
baseColProps: { |
|
|
|
|
span: 6, |
|
|
|
|
}, |
|
|
|
|
labelWidth: 200, |
|
|
|
|
layout: 'vertical', |
|
|
|
|
schemas: taskSchemas, |
|
|
|
|
schemas: departSchemas, |
|
|
|
|
showActionButtonGroup: false, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
async function submitAll() { |
|
|
|
|
try { |
|
|
|
|
if (tableRef.value) { |
|
|
|
|
console.log('table data:', tableRef.value.getDataSource()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const [values, taskValues] = await Promise.all([validate(), validateTaskForm()]); |
|
|
|
|
console.log('form data:', values, taskValues); |
|
|
|
|
// if (tableRef.value) { |
|
|
|
|
// console.log('table data:', tableRef.value.getDataSource()); |
|
|
|
|
// } |
|
|
|
|
const [projectBaseInfoValues, userValues, deaprtValues] = await Promise.all([validateProjectInfoForm(), validateUserForm(), validateDepartForm()]); |
|
|
|
|
console.log('projectBaseInfoValues form data:', projectBaseInfoValues); |
|
|
|
|
console.log('userValuesform data:', userValues); |
|
|
|
|
console.log('deaprtValues form data:', deaprtValues); |
|
|
|
|
} catch (error) {} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return { register, registerTask, submitAll, tableRef }; |
|
|
|
|
// return { register, registerUser, registerDepart, submitAll, tableRef }; |
|
|
|
|
return { registerProjectInfo, registerUser, registerDepart, submitAll }; |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
</script> |
|
|
|
|