Commit 146a5147 authored by 高滢's avatar 高滢

feat(年度已完成): 资金计划

parent 33cab57b
......@@ -146,9 +146,7 @@ const engineeringProject: AppRouteModule = {
name: 'completedEdit',
component: () => import('@/views/completed//completedEdit/completedEdit.vue'),
meta: {
hideTab: true,
hideMenu: true,
hideBreadcrumb: true,
auth: '/www/dist/index.html#/completed/index',
title: '新建年度工程资金计划',
orderNo: 12,
......
<template>
<div style="margin: 16px">
<PageCard title="统计已竣工验收项目陈欠资金计划">
<PageCard title="统计年度工程资金计划">
<BasicForm ref="formElRef" @register="registerForm">
<template #formFooter>
<a-button type="primary" @click="handleSubmit"> 查询</a-button>
......
<template>
<PageWrapper :title="getTitle" :contentBackground="false" headerSticky v-loading="loading">
<template #extra>
<!-- <a-button type="primary" v-if="!disabled" danger> 删除 </a-button>-->
<a-button type="primary" v-if="!disabled" @click="handleSubmit('0')"> 暂存 </a-button>
<a-button type="primary" v-if="!disabled" @click="handleSubmit('1')"> 提交 </a-button>
<a-button type="primary" @click="history" v-if="historyData">历史记录 </a-button>
<!-- <a-button type="primary" @click="history" v-if="historyData">历史记录 </a-button>-->
<a-button type="default" @click="router.back()"> 返回 </a-button>
</template>
<CollapseContainer v-for="(item, index) in tabsFormSchema" :key="index">
<CollapseContainer v-for="(item, index) in tabsFormSchema" :key="index" v-show="item.show">
<template #title>
<span class="projectName">{{ item.name }}</span>
</template>
......@@ -116,7 +115,6 @@
const getTitle = ref('');
const engineerId = ref('');
const investmentld = ref('');
const routeId = ref('');
let show = ref<Recordable[]>([]);
......@@ -135,8 +133,6 @@
},
],
});
console.log('totalNo', totalNo);
console.log(tabsFormSchema);
return true;
}
function beforeEditSubmitTwo(item, index) {
......@@ -169,8 +165,6 @@
},
],
});
console.log('totalNo', totalNo);
console.log(tabsFormSchema);
return true;
}
......@@ -193,12 +187,10 @@
getTitle.value = '新建' + year.value + '年工程资金计划' + '(' + planType.value + ')';
if (!id) {
historyData.value = false;
// formData.value.biddingQuarter = route.query.quarter;
formData.value.filingCycle = route.query.year;
formData.value.planType = route.query.planType;
formData.value.subList = [];
isUpdate.value = false;
console.log(formData);
} else {
disabled.value = route.query.disabled == '0' ? false : true;
if (disabled.value) {
......@@ -209,7 +201,7 @@
engineerId.value = id;
isUpdate.value = true;
let res = await getItem({ id });
console.log('getItem', res);
console.log('后端返回的数据', res);
for (let i = 0; i < res.length; i++) {
const amountList = res[i].amountList;
let num = 0;
......@@ -228,6 +220,7 @@
governmentGrantNum += Number(sourceList[a].governmentGrant);
}
const item = {
proId: res[i].proId,
year: res[i].filingCycle,
name: '项目:' + res[i].projectName,
forceRender: true,
......@@ -271,23 +264,15 @@
tabsFormSchema.push(item);
const info = res[i];
info.time = [info.startTime, info.endTime];
const data = {
proId: info.proId,
id: info.id,
investmentId: info.investmentId,
};
if (formData.value.subList === undefined) {
formData.value.subList = [];
}
formData.value.subList.push(data);
console.log('info', info);
setTable(item.table[1], info.amountList);
setTable(item.tableTwo[1], info.sourceList);
nextTick(() => {
setFieldsValue(info);
});
}
console.log(res);
}
});
......@@ -298,6 +283,7 @@
});
}
type TabsFormType = {
proId: string;
name: string;
show?: boolean;
sumData?: any;
......@@ -339,6 +325,7 @@
*/
async function handleNew(info: any) {
let item = {
proId: Number(info.id),
year: year.value,
name: '项目:' + info.projectName,
forceRender: true,
......@@ -369,8 +356,6 @@
};
item.table = useTable({
title: '表尾行合计示例',
// api: demoListApi,
// rowSelection: { type: 'checkbox' },
columns: getBasicColumns(),
showSummary: true,
summaryData: item.sumData,
......@@ -378,14 +363,9 @@
maxWidth: 200,
showIndexColumn: false,
pagination: false,
// scroll: { x: 2000 },
// canResize: false,
// showSelectionBar: true, // 显示多选状态栏
});
item.tableTwo = useTable({
title: '表尾行合计示例',
// api: demoListApi,
// rowSelection: { type: 'checkbox' },
columns: getBasicColumnsTwo(),
showSummary: true,
summaryData: item.sumDataTwo,
......@@ -393,9 +373,6 @@
maxWidth: 200,
showIndexColumn: false,
pagination: false,
// scroll: { x: 2000 },
// canResize: false,
// showSelectionBar: true, // 显示多选状态栏
});
const { setFieldsValue } = item.Form[1];
......@@ -448,9 +425,6 @@
governmentGrant: '',
},
]);
formData.value.subList.push({
proId: Number(info.id),
});
nextTick(() => {
setFieldsValue({
projectName: info.projectName,
......@@ -466,8 +440,7 @@
// }
}
async function deleteItem(index: any) {
formData.value.subList.splice(index, 1);
tabsFormSchema.splice(index, 1);
tabsFormSchema[index].show = false;
}
async function handleAdd() {
openDrawer(true, {
......@@ -484,7 +457,10 @@
}
async function handleSubmit(isSubmit) {
loading.value = true;
console.log('页面渲染的表单', tabsFormSchema);
formData.value.subList = [];
try {
let engineerConListIndex = 0;
for (let i = 0; i < tabsFormSchema.length; i++) {
let item = tabsFormSchema[i];
if (item.show) {
......@@ -493,6 +469,7 @@
let dataTwo = getData(item.tableTwo[1]);
await validate();
let res = getFieldsValue();
console.log('表单的数据', res);
for (let a = 0; a < data.length; a++) {
data[a].value = Number(data[a].value);
}
......@@ -502,48 +479,44 @@
dataTwo[j].bankFinancing = Number(dataTwo[j].bankFinancing);
dataTwo[j].ownFunds = Number(dataTwo[j].ownFunds);
}
console.log(' formData()', unref(formData));
console.log('engineerId', engineerId);
formData.value.subList[i] = deepMerge(formData.value.subList[i], res);
formData.value.subList[i].amountList = data;
formData.value.subList[i].sourceList = dataTwo;
formData.value.subList[i].investmentld = investmentld;
formData.value.subList[i].startTime = res.time[0];
formData.value.subList[i].endTime = res.time[1];
formData.value.id = engineerId;
formData.value.isSubmit = isSubmit;
var obj = {
startTime: res.time? res.time[0] : '',
endTime: res.time ? res.time[1] : '',
proId: item.proId,
amountList: data,
sourceList: dataTwo,
};
obj = deepMerge(obj, res);
formData.value.subList.push(obj);
engineerConListIndex = engineerConListIndex + 1;
}
}
console.log(' formData()', unref(formData));
formData.value.id = engineerId;
formData.value.isSubmit = isSubmit;
formData.value.filingCycle = year.value;
formData.value.planType = planType.value;
if (isUpdate.value) {
await updateItem(unref(formData));
addItemData.operateType = operateType.update;
addItemData.businessId = routeId.value;
addItemData.businessType = '已竣工验收项目陈欠资金计划';
console.log('addItemData', addItemData);
await addItemApi(addItemData);
} else if (!isUpdate.value) {
const res = await addItem(unref(formData));
console.log('resresresresrse', res);
addItemData.operateType = operateType.add;
addItemData.businessId = res;
addItemData.businessType = '已竣工验收项目陈欠资金计划';
const showDatem = await addItemApi(addItemData);
console.log(showDatem, '记录添加成功');
await addItemApi(addItemData);
}
loading.value = true;
// console.log(res);
if (isSubmit === '1') {
createMessage.success('提交成功!');
} else if (isSubmit === '0') {
createMessage.success('暂存成功!');
}
// router.back();
} catch (e) {
// 验证失败或出错,切换到对应标签页
console.log(e);
createMessage.error('请将项目' + e.values.projectName + '信息填写完整!');
} finally {
loading.value = false;
}
......
......@@ -371,7 +371,6 @@
createMessage.success('提交成功!');
} catch (e) {
createMessage.error('请将项目' + e.values.projectName + '信息填写完整!');
console.log('122.', e);
} finally {
loading.value = false;
}
......
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