Commit 5ed34be6 authored by mengzixuan's avatar mengzixuan

feat: (工程投资计划): 删除问题修复

parent 9315cea5
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<a-button type="primary" v-if="!disabled" @click="handleSubmit"> 提交 </a-button> <a-button type="primary" v-if="!disabled" @click="handleSubmit"> 提交 </a-button>
<a-button type="default" @click="router.back()"> 返回 </a-button> <a-button type="default" @click="router.back()"> 返回 </a-button>
</template> </template>
<template v-for="(item, index) in tabsFormSchema">
<PageCard v-for="(item, index) in tabsFormSchema" :key="index" :title="item.name"> <PageCard v-if="item.show" :key="index" :title="item.name">
<template #right> <template #right>
<a-button <a-button
type="text" type="text"
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
/> />
</div> </div>
</PageCard> </PageCard>
</template>
<a-button v-if="!disabled" type="dashed" @click="add" preIcon="ei:plus"> <a-button v-if="!disabled" type="dashed" @click="add" preIcon="ei:plus">
从项目库导入 从项目库导入
</a-button> </a-button>
...@@ -189,6 +190,7 @@ ...@@ -189,6 +190,7 @@
const item = { const item = {
name: '序号' + (i + 1), name: '序号' + (i + 1),
forceRender: true, forceRender: true,
show: true,
Form: useForm( Form: useForm(
Object.assign({ schemas: formSchema, disabled }, baseFormConfig) as FormProps, Object.assign({ schemas: formSchema, disabled }, baseFormConfig) as FormProps,
), ),
...@@ -255,6 +257,7 @@ ...@@ -255,6 +257,7 @@
name: string; name: string;
forceRender?: boolean; forceRender?: boolean;
Form: UseFormReturnType; Form: UseFormReturnType;
show?: boolean;
table: any; table: any;
}; };
const baseFormConfig: Partial<FormProps> = { const baseFormConfig: Partial<FormProps> = {
...@@ -263,7 +266,7 @@ ...@@ -263,7 +266,7 @@
layout: 'vertical', layout: 'vertical',
}; };
const tabsFormSchema = reactive<TabsFormType[]>([]); let tabsFormSchema = reactive<TabsFormType[]>([]);
async function add() { async function add() {
openModal(); openModal();
...@@ -286,6 +289,7 @@ ...@@ -286,6 +289,7 @@
const item = { const item = {
name: '序号' + (tabsFormSchema.length + 1), name: '序号' + (tabsFormSchema.length + 1),
forceRender: true, forceRender: true,
show: true,
Form: useForm(Object.assign({ schemas: formSchema }, baseFormConfig) as FormProps), Form: useForm(Object.assign({ schemas: formSchema }, baseFormConfig) as FormProps),
table: useTable({ table: useTable({
title: '表尾行合计示例', title: '表尾行合计示例',
...@@ -351,8 +355,9 @@ ...@@ -351,8 +355,9 @@
}); });
} }
async function deleteItem(index: any) { async function deleteItem(index: any) {
tabsFormSchema.splice(index, 1); tabsFormSchema[index].show = false;
formData.value.investmentPlan.splice(index, 1); // tabsFormSchema.splice(index, 1);
// formData.value.investmentPlan.splice(index, 1);
} }
async function handleAdd() { async function handleAdd() {
openDrawer(true, { openDrawer(true, {
...@@ -369,6 +374,7 @@ ...@@ -369,6 +374,7 @@
try { try {
for (let i = 0; i < tabsFormSchema.length; i++) { for (let i = 0; i < tabsFormSchema.length; i++) {
let item = tabsFormSchema[i]; let item = tabsFormSchema[i];
if (item.show) {
const { validate, getFieldsValue } = item.Form[1]; const { validate, getFieldsValue } = item.Form[1];
const { getDataSource } = item.table[1]; const { getDataSource } = item.table[1];
await validate(); await validate();
...@@ -393,6 +399,7 @@ ...@@ -393,6 +399,7 @@
); );
formData.value.id = engineerId.value; formData.value.id = engineerId.value;
} }
}
formData.value.proNumber = formData.value.investmentPlan.Length; formData.value.proNumber = formData.value.investmentPlan.Length;
console.log(' formData()', unref(formData)); console.log(' formData()', unref(formData));
// console.log(' setTableData()', setTableData); // console.log(' setTableData()', setTableData);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment