Commit 512eff6b authored by mengzixuan's avatar mengzixuan

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

parent 1eedb3ba
......@@ -5,8 +5,8 @@
<a-button type="primary" v-if="!disabled" @click="handleSubmit"> 提交 </a-button>
<a-button type="default" @click="router.back()"> 返回 </a-button>
</template>
<PageCard v-for="(item, index) in tabsFormSchema" :key="index" :title="item.name">
<template v-for="(item, index) in tabsFormSchema">
<PageCard v-if="item.show" :key="index" :title="item.name">
<template #right>
<a-button
type="text"
......@@ -25,6 +25,7 @@
/>
</div>
</PageCard>
</template>
<a-button v-if="!disabled" type="dashed" @click="add" preIcon="ei:plus">
从项目库导入
</a-button>
......@@ -185,11 +186,12 @@
engineerId.value = id;
isUpdate.value = true;
let res = await getItem({ id });
console.log('getItem', res);
// console.log('getItem', res);
for (let i = 0; i < res.length; i++) {
const item = {
name: '序号' + (i + 1),
forceRender: true,
show: true,
Form: useForm(
Object.assign({ schemas: formSchema, disabled }, baseFormConfig) as FormProps,
),
......@@ -217,7 +219,9 @@
id: info.id,
investmentId: info.investmentId,
};
if (formData.value.investmentPlan === undefined) {
formData.value.investmentPlan = [];
}
formData.value.investmentPlan.push(data);
console.log('info', info);
const { setTableData } = item.table[1];
......@@ -254,6 +258,7 @@
type TabsFormType = {
name: string;
forceRender?: boolean;
show?: boolean;
Form: UseFormReturnType;
table: any;
};
......@@ -263,7 +268,7 @@
layout: 'vertical',
};
const tabsFormSchema = reactive<TabsFormType[]>([]);
let tabsFormSchema = reactive<TabsFormType[]>([]);
async function add() {
openModal();
......@@ -283,6 +288,7 @@
const item = {
name: '序号' + (tabsFormSchema.length + 1),
forceRender: true,
show: true,
Form: useForm(Object.assign({ schemas: formSchema }, baseFormConfig) as FormProps),
table: useTable({
title: '表尾行合计示例',
......@@ -348,8 +354,9 @@
});
}
async function deleteItem(index: any) {
tabsFormSchema.splice(index, 1);
formData.value.investmentPlan.splice(index, 1);
tabsFormSchema[index].show = false;
// tabsFormSchema.splice(index, 1);
// formData.value.investmentPlan.splice(index, 1);
}
async function handleAdd() {
openDrawer(true, {
......@@ -366,6 +373,7 @@
try {
for (let i = 0; i < tabsFormSchema.length; i++) {
let item = tabsFormSchema[i];
if (item.show) {
const { validate, getFieldsValue } = item.Form[1];
const { getDataSource } = item.table[1];
await validate();
......@@ -390,6 +398,7 @@
);
formData.value.id = engineerId.value;
}
}
formData.value.proNumber = formData.value.investmentPlan.Length;
console.log(' formData()', unref(formData));
// 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