Commit f40a8210 authored by 高滢's avatar 高滢

feat(月度): 累计支付数联动

parent f0bf0f85
......@@ -21,9 +21,11 @@ enum Api {
MothCycelEdit = '/pro/mothCycle/edit',
BusinessComDetails = '/pro/monthEngineer/businessComDetails',
EditStatus = '/pro/mothCycle/editStatus',
SafetyHazard = '/pro/export/safetyHazard'
SafetyHazard = '/pro/export/safetyHazard',
ImportLastPlan = '/pro/monthEngineer/importLastPlan',
}
export const getLastPlan = (params?: ProjectParams) =>
defHttp.post<ProjectModel>({ url: Api.ImportLastPlan, data: params });
export const getMonthlyPlanList = (params?: ProjectParams) =>
defHttp.post<ProjectModel>({ url: Api.GetList, data: params });
......
......@@ -22,11 +22,10 @@
</template>
<script lang="ts" setup>
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { getListByPage } from '@/api/project/project';
import { BasicTable, useTable } from '@/components/Table';
import { columns, searchFormSchema } from '@/components/projectlibraryModel/data';
import { useMessage } from '@/hooks/web/useMessage';
import {getEngineeringProjectList} from "@/api/project/engineeringProject";
import { getEngineeringProjectList } from '@/api/project/engineeringProject';
const [registerTable, { reload, getSelectRows, clearSelectedRowKeys }] = useTable({
api: getEngineeringProjectList,
......@@ -53,7 +52,7 @@
const emit = defineEmits(['close', 'register']);
function handleVisibleChange(v) {
function handleVisibleChange() {
clearSelectedRowKeys();
}
const [register, { closeModal }] = useModalInner((data) => {
......
......@@ -28,6 +28,16 @@ export const formSchema: FormSchema[] = [
required: true,
component: 'Input',
},
{
label: '累计支付数',
field: 'accumulatePayment',
labelWidth: '140px',
required: true,
component: 'InputNumber',
componentProps: {
addonAfter: '万元',
},
},
{
label: '结算金额(万元)',
field: 'investmentAmount',
......
......@@ -69,7 +69,48 @@ export const columns: BasicColumn[] = [
ifShow: deptId != '100',
},
];
export const lastPlanColumns: BasicColumn[] = [
{
title: '项目名称',
dataIndex: 'projectName',
width: 180,
},
{
title: '合同名称',
dataIndex: 'contrcatName',
width: 180,
},
{
title: '填报周期',
dataIndex: 'monthYear',
width: 180,
},
{
title: '累计支付数',
dataIndex: 'accumulatePayment',
width: 180,
},
{
title: '上月实付数',
dataIndex: 'lastMonthActual',
width: 180,
},
{
title: '上月计划数',
dataIndex: 'lastMonthPlan',
width: 180,
},
{
title: '上月实际完成值',
dataIndex: 'completionValueActual',
width: 180,
},
{
title: '本月计划完成值',
dataIndex: 'planCompletionValue',
width: 180,
},
];
export const searchFormSchema: FormSchema[] = [
{
field: 'monthYear',
......
<template>
<BasicModal
width="70%"
v-bind="$attrs"
@register="register"
title="选择项目导入"
:minHeight="30"
okText="导入"
@ok="handleSubmit"
@cancel="handleVisibleChange"
>
<BasicTable @register="registerTable" />
<!-- <button @click="getSelectRowList">获取数据</button>-->
</BasicModal>
</template>
<script setup lang="ts">
import { BasicTable, useTable } from '@/components/Table';
import { BasicModal, useModalInner } from '@/components/Modal';
import { searchFormSchema } from '@/components/projectlibraryModel/data';
import { getLastPlan } from '@/api/project/monthlyPlan';
import { lastPlanColumns } from '@/views/monthlyPlan/data';
import { ref } from 'vue';
const monthYear = ref('');
const [registerTable, { reload, getSelectRows, clearSelectedRowKeys }] = useTable({
api: getLastPlan,
title: '选择资金计划导入',
columns:lastPlanColumns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
},
searchInfo: {
monthYear: monthYear,
},
useSearchForm: true,
showTableSetting: false,
bordered: true,
showIndexColumn: false,
rowSelection: {
type: 'checkbox',
},
});
function getSelectRowList() {
emit('close', getSelectRows());
}
const emit = defineEmits(['close', 'register']);
function handleVisibleChange() {
clearSelectedRowKeys();
}
const [register, { closeModal }] = useModalInner((data) => {
if(data.mothYear){
monthYear.value = getPreviousMonth(data.mothYear);
}
reload();
});
function getPreviousMonth(monthYear) {
// 将输入的字符串转换为 Date 对象
let date = new Date(monthYear + '-01');
// 设置日期为当前月份的前一个月
date.setMonth(date.getMonth() - 1);
// 获取年份和月份,并格式化为两位数
let year = date.getFullYear();
let month = (date.getMonth() + 1).toString().padStart(2, '0');
// 返回格式化的日期字符串
return `${year}-${month}`;
}
function handleSubmit() {
getSelectRowList();
clearSelectedRowKeys();
closeModal();
}
</script>
<style scoped lang="less"></style>
......@@ -66,11 +66,17 @@
<a-button type="dashed" @click="handleAdd" class="ml-2" preIcon="ei:plus" v-if="!disabled">
新建合同
</a-button>
<a-button type="dashed" @click="handleLastAdd" class="ml-2" preIcon="ei:plus" v-if="!disabled">
从上个月资金计划导入
</a-button>
<!-- 新建合同的抽屉-->
<contractDrawer @register="registerDrawer" @success="handleSuccess" />
<!-- 选择合同导入的弹窗-->
<projectlibraryModel @register="register" @close="handleNewData" />
<Operations @register="registerDrawerOperations" />
<!-- 选择上个月的资金计划弹窗-->
<LastMonthPlanModel @register="registerLastPlan" @close="handleNewDataLastPlan" />
</PageWrapper>
</template>
<script lang="ts" setup>
......@@ -92,10 +98,9 @@
import { useModal } from '@/components/Modal';
import { router } from '@/router';
import { useRoute } from 'vue-router';
import { monthListByMonthYear } from '@/api/project/detail/month';
import { forEach } from '@/utils/helper/treeHelper';
import CollapseContainer from '@/components/Container/src/collapse/CollapseContainer.vue';
import { template } from 'xe-utils';
import LastMonthPlanModel from '@/views/monthlyPlan/lastMonthPlanModel/lastMonthPlanModel.vue';
//历史记录是否可查
const historyData = ref(true);
......@@ -106,6 +111,7 @@
const [registerDrawerOperations, { openDrawer: openDrawer2 }] = useDrawer();
const loadingRef = ref(false);
const [register, { openModal: openModal }] = useModal();
const [registerLastPlan, { openModal: openModalLastPLan }] = useModal();
const { createMessage } = useMessage();
const isUpdate = ref(false);
const loading = ref(false);
......@@ -165,6 +171,9 @@
form: from,
});
setFormData(from[1], content);
setFormData(from[1], {
accumulatePaymentReserve: content.accumulatePayment,
});
}
}
}
......@@ -192,64 +201,82 @@
async function handleSuccess(params: any) {
handleNew(params);
}
async function handleNewDataLastPlan(info: any) {
if (info) {
info.map((i) => {
handleNewLastPlan(i);
});
}
}
/* 往表单page页里带入上月计划的数据*/
async function handleNewLastPlan(info: any) {
let item = {};
let res = tabsFormSchema.filter((item) => item.projectId == info.proId && item.show == true);
if (res.length) {
item = res[0];
let from = useForm(Object.assign({ schemas: subFormSchema }, baseFormConfig) as FormProps);
item.list.push({
show: true,
name: '合同:' + info.contrcatName,
form: from,
contractId: info.contractId,
});
setFormData(from[1], {
contrcatName: info.contrcatName,
collectingUnit: info.collectingUnit,
contractAmount: info.contractAmount,
investmentAmount: info.investmentAmount,
});
} else {
item = {
name: '项目:' + info.projectName,
projectId: info.proId,
forceRender: true,
Form: useForm(Object.assign({ schemas: formSchema }, baseFormConfig) as FormProps),
list: [],
show: true,
};
item.list.push({
show: true,
name: '合同:' + info.contrcatName,
form: useForm(Object.assign({ schemas: subFormSchema }, baseFormConfig) as FormProps),
contractId: info.contractId,
});
tabsFormSchema.push(item);
setFormData(item.Form[1], {
proId: info.proId,
projectName: info.projectName,
sourceType: info.fundingSource,
});
setFormData(item.list[0].form[1], {
contractId: info.contractId,
contrcatName: info.contrcatName,
collectingUnit: info.collectingUnit,
contractAmount: info.contractAmount,
investmentAmount: info.investmentAmount,
paymentLevel: info.paymentLevel,
completionValueActual: info.completionValueActual,
accumulateCompletionValue: info.accumulateCompletionValue,
planCompletionValue: info.planCompletionValue,
lastMonthPlan: info.lastMonthPlan,
accumulatePaymentReserve: info.accumulatePayment,
accumulatePayment: info.accumulatePayment,
});
}
}
async function handleNewData(info: any) {
if (info) {
info.map((i) => {
handleNew(i);
});
}
// 2024/8/12 新增:查询并返显上月计划数
for (let i = 0; i < tabsFormSchema.length; i++) {
let projectName = tabsFormSchema[i].name.split(':')[1];
for (let j = 0; j < tabsFormSchema[i].list.length; j++) {
let contractName = tabsFormSchema[i].list[j].name.split(':')[1];
let formSchema = tabsFormSchema[i].list[j].form[1];
const { setFieldsValue } = formSchema;
let year = Number.parseInt(moth.value.split('-')[0]);
let month = Number.parseInt(moth.value.split('-')[1]);
if (month - 1 < 1) {
year -= 1;
month = 12;
} else {
month -= 1;
}
let monthYear = ref('');
if (month < 10) {
monthYear.value = year + '-0' + month;
} else {
monthYear.value = year + '-' + month;
}
let params = {
monthYear: monthYear.value,
};
let results = await monthListByMonthYear(params);
let result = ref('');
if (results) {
forEach(results, (item) => {
if (item.projectName == projectName && item.contrcatName == contractName) {
result.value = item.thisPlanNumber;
}
});
}
console.log(result);
if (result.value != '') {
nextTick(() => {
setFieldsValue({
lastMonthPlan: result.value,
});
});
}
}
}
}
/* 往表单page页里带入新建合同的数据*/
async function handleNew(info: any) {
let item = {};
let res = tabsFormSchema.filter((item) => item.projectId == info.projectId);
let res = tabsFormSchema.filter(
(item) => item.projectId == info.projectId && item.show == true,
);
if (res.length) {
item = res[0];
let from = useForm(Object.assign({ schemas: subFormSchema }, baseFormConfig) as FormProps);
......@@ -259,12 +286,13 @@
form: from,
contractId: info.id,
});
let index = tabsFormSchema.findIndex((item) => item.projectId == info.projectId);
setFormData(from[1], {
contrcatName: info.contrcatName,
collectingUnit: info.collectingUnit,
contractAmount: info.contractAmount,
investmentAmount: info.investmentAmount,
accumulatePaymentReserve: info.accumulatePayment,
accumulatePayment: info.accumulatePayment,
});
} else {
item = {
......@@ -293,6 +321,8 @@
collectingUnit: info.collectingUnit,
contractAmount: info.contractAmount,
investmentAmount: info.investmentAmount,
accumulatePaymentReserve: info.accumulatePayment,
accumulatePayment: info.accumulatePayment,
});
}
}
......@@ -308,6 +338,12 @@
isUpdate: false,
});
}
function handleLastAdd() {
openModalLastPLan(true, {
mothYear: moth.value,
});
}
/*删除合同表单*/
async function deleteItemCon(index: any, key: any) {
// delete formData.value.engineerConList[index].conList[key];
......
......@@ -171,8 +171,24 @@ export const subFormSchema: FormSchema[] = [
label: '上月实付数',
required: true,
component: 'InputNumber',
componentProps: ({ formModel, formActionType }) => ({
addonAfter: '万元',
onChange: (value) => {
console.log(formModel, formModel.accumulatePaymentReserve, value);
formModel.accumulatePayment = (formModel.accumulatePaymentReserve || 0) + value;
},
}),
colProps: { span: 5, offset: 1 },
},
{
field: 'accumulatePaymentReserve',
label: '累计支付数预留',
required: false,
ifShow: false,
component: 'InputNumber',
componentProps: {
addonAfter: '万元',
disabled: true,
},
colProps: { span: 5, offset: 1 },
},
......@@ -183,6 +199,7 @@ export const subFormSchema: FormSchema[] = [
component: 'InputNumber',
componentProps: {
addonAfter: '万元',
disabled: true,
},
colProps: { span: 5, offset: 1 },
},
......
......@@ -36,6 +36,16 @@ export const contractDrawer: FormSchema[] = [
required: true,
component: 'Input',
},
{
label: '累计支付数',
field: 'accumulatePayment',
labelWidth: '140px',
required: true,
component: 'InputNumber',
componentProps: {
addonAfter: '万元',
},
},
{
label: '结算金额',
field: 'investmentAmount',
......
......@@ -170,7 +170,7 @@
});
}
async function handleRegisterSuccess(params: any) {
// handleNew(params);
}
async function handleSuccess(record: any) {
// detail.value = record;
......
......@@ -43,7 +43,6 @@
import { inject } from 'vue';
import ContractDrawer from '@/views/project/contractDrawer/contractDrawer.vue';
import { useDrawer } from '@/components/Drawer';
let detailId = inject('detailId');
console.log('detailId', detailId);
const [registerDrawer, { openDrawer }] = useDrawer();
......
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