|
|
|
@ -101,21 +101,19 @@
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
<el-row v-if="isFormEditable" :gutter="10" class="mb8">
|
|
|
|
<!-- 预算变更表格:预算行从项目预算中自动带出,不允许新增删除,只能修改变更后预算等字段 -->
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
|
|
|
<el-button type="primary" icon="Plus" @click="handleAddBudget">添加预算行</el-button>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-table :data="form.budgetList" border stripe max-height="400">
|
|
|
|
<el-table :data="form.budgetList" border stripe max-height="400">
|
|
|
|
<el-table-column label="序号" type="index" width="60" align="center" />
|
|
|
|
<el-table-column label="序号" type="index" width="60" align="center" />
|
|
|
|
<el-table-column label="科目名称" width="200" align="center">
|
|
|
|
<el-table-column label="科目名称" width="200" align="center">
|
|
|
|
<template #default="scope">
|
|
|
|
<template #default="scope">
|
|
|
|
<el-input v-model="scope.row.subjectName" placeholder="请输入科目名称" />
|
|
|
|
<!-- 科目名称从项目预算带出,只读显示 -->
|
|
|
|
|
|
|
|
<span>{{ scope.row.subjectName }}</span>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="变更前预算" width="150" align="center">
|
|
|
|
<el-table-column label="变更前预算" width="150" align="center">
|
|
|
|
<template #default="scope">
|
|
|
|
<template #default="scope">
|
|
|
|
<el-input-number v-model="scope.row.budgetBefore" :min="0" :precision="2" controls-position="right" style="width: 100%" />
|
|
|
|
<!-- 变更前预算从项目预算带出,只读显示(已在数据加载时转换为数字类型) -->
|
|
|
|
|
|
|
|
<span>{{ scope.row.budgetBefore?.toFixed(2) }}</span>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="变更后预算" width="150" align="center">
|
|
|
|
<el-table-column label="变更后预算" width="150" align="center">
|
|
|
|
@ -138,13 +136,6 @@
|
|
|
|
<el-input v-model="scope.row.remark" placeholder="请输入备注" />
|
|
|
|
<el-input v-model="scope.row.remark" placeholder="请输入备注" />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column v-if="isFormEditable" label="操作" width="80" align="center" fixed="right">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<!-- 只允许删除新增的预算行,不允许删除从后端带出的原有预算科目 -->
|
|
|
|
|
|
|
|
<el-button v-if="!scope.row.changeBudgetId" type="danger" link icon="Delete" @click="handleDeleteBudget(scope.$index)">删除</el-button>
|
|
|
|
|
|
|
|
<span v-else style="color: #909399; font-size: 12px">原有科目</span>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
|
|
<el-divider content-position="left">进度变更(项目里程碑/关键节点)</el-divider>
|
|
|
|
<el-divider content-position="left">进度变更(项目里程碑/关键节点)</el-divider>
|
|
|
|
@ -238,7 +229,7 @@ import {
|
|
|
|
} from '@/api/oa/erp/erpProjectChange';
|
|
|
|
} from '@/api/oa/erp/erpProjectChange';
|
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
|
import { useUserStore } from '@/store/modules/user';
|
|
|
|
import { useUserStore } from '@/store/modules/user';
|
|
|
|
import type { ErpProjectChangeBudget, ErpProjectChangeForm } from '@/api/oa/erp/erpProjectChange/types';
|
|
|
|
import type { ErpProjectChangeForm } from '@/api/oa/erp/erpProjectChange/types';
|
|
|
|
// import approvalButton from '@/components/Workflow/approvalButton.vue';
|
|
|
|
// import approvalButton from '@/components/Workflow/approvalButton.vue';
|
|
|
|
// import SubmitVerify from '@/components/Workflow/SubmitVerify.vue';
|
|
|
|
// import SubmitVerify from '@/components/Workflow/SubmitVerify.vue';
|
|
|
|
// import ApprovalRecord from '@/components/Workflow/ApprovalRecord.vue';
|
|
|
|
// import ApprovalRecord from '@/components/Workflow/ApprovalRecord.vue';
|
|
|
|
@ -369,16 +360,26 @@ const handleProjectChange = async (projectId: string | number) => {
|
|
|
|
const res = await prepareProjectChangeWithInfo(projectId);
|
|
|
|
const res = await prepareProjectChangeWithInfo(projectId);
|
|
|
|
if (res.code === 200) {
|
|
|
|
if (res.code === 200) {
|
|
|
|
// 保留已填写的变更信息,只更新项目相关信息
|
|
|
|
// 保留已填写的变更信息,只更新项目相关信息
|
|
|
|
|
|
|
|
// 注意:budgetList 和 progressList 应从后端获取,不应保留前端空数组
|
|
|
|
const changeData = {
|
|
|
|
const changeData = {
|
|
|
|
changeType: form.value.changeType,
|
|
|
|
changeType: form.value.changeType,
|
|
|
|
currentStatus: form.value.currentStatus,
|
|
|
|
currentStatus: form.value.currentStatus,
|
|
|
|
changeReason: form.value.changeReason,
|
|
|
|
changeReason: form.value.changeReason,
|
|
|
|
followUpWork: form.value.followUpWork,
|
|
|
|
followUpWork: form.value.followUpWork
|
|
|
|
budgetList: form.value.budgetList,
|
|
|
|
|
|
|
|
progressList: form.value.progressList
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Object.assign(form.value, res.data, changeData);
|
|
|
|
Object.assign(form.value, res.data, changeData);
|
|
|
|
|
|
|
|
// 确保使用后端返回的预算和进度列表,并转换数字类型字段
|
|
|
|
|
|
|
|
form.value.budgetList = (res.data.budgetList ?? []).map((item: any) => ({
|
|
|
|
|
|
|
|
...item,
|
|
|
|
|
|
|
|
budgetBefore: Number(item.budgetBefore || 0),
|
|
|
|
|
|
|
|
budgetAfter: Number(item.budgetAfter || 0),
|
|
|
|
|
|
|
|
amountUsed: Number(item.amountUsed || 0)
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
form.value.progressList = (res.data.progressList ?? []).map((item: any) => ({
|
|
|
|
|
|
|
|
...item,
|
|
|
|
|
|
|
|
completionDegree: Number(item.completionDegree || 0)
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
// 处理变更类型(多选)
|
|
|
|
// 处理变更类型(多选)
|
|
|
|
if (form.value.changeType) {
|
|
|
|
if (form.value.changeType) {
|
|
|
|
@ -415,8 +416,17 @@ const loadProjectDataByProjectId = async (projectId: string | number) => {
|
|
|
|
Object.assign(form.value, res.data);
|
|
|
|
Object.assign(form.value, res.data);
|
|
|
|
const dateOnly = toDateOnly(form.value.applyChangeDate);
|
|
|
|
const dateOnly = toDateOnly(form.value.applyChangeDate);
|
|
|
|
form.value.applyChangeDate = dateOnly ?? formatToday();
|
|
|
|
form.value.applyChangeDate = dateOnly ?? formatToday();
|
|
|
|
form.value.budgetList = res.data.budgetList ?? [];
|
|
|
|
// 转换数字类型字段,确保el-input-number组件正常工作
|
|
|
|
form.value.progressList = res.data.progressList ?? [];
|
|
|
|
form.value.budgetList = (res.data.budgetList ?? []).map((item: any) => ({
|
|
|
|
|
|
|
|
...item,
|
|
|
|
|
|
|
|
budgetBefore: Number(item.budgetBefore || 0),
|
|
|
|
|
|
|
|
budgetAfter: Number(item.budgetAfter || 0),
|
|
|
|
|
|
|
|
amountUsed: Number(item.amountUsed || 0)
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
form.value.progressList = (res.data.progressList ?? []).map((item: any) => ({
|
|
|
|
|
|
|
|
...item,
|
|
|
|
|
|
|
|
completionDegree: Number(item.completionDegree || 0)
|
|
|
|
|
|
|
|
}));
|
|
|
|
// 处理变更类型多选
|
|
|
|
// 处理变更类型多选
|
|
|
|
if (form.value.changeType) {
|
|
|
|
if (form.value.changeType) {
|
|
|
|
changeTypeList.value = form.value.changeType.split(',');
|
|
|
|
changeTypeList.value = form.value.changeType.split(',');
|
|
|
|
@ -428,23 +438,8 @@ const loadProjectDataByProjectId = async (projectId: string | number) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleAddBudget = () => {
|
|
|
|
// 预算行不允许新增删除,数据从项目预算中自动带出
|
|
|
|
const list = form.value.budgetList ?? (form.value.budgetList = []);
|
|
|
|
// handleAddBudget 和 handleDeleteBudget 方法已移除
|
|
|
|
const budget: ErpProjectChangeBudget = {
|
|
|
|
|
|
|
|
subjectName: '',
|
|
|
|
|
|
|
|
budgetBefore: 0,
|
|
|
|
|
|
|
|
budgetAfter: 0,
|
|
|
|
|
|
|
|
amountUsed: 0,
|
|
|
|
|
|
|
|
adjustmentReason: '',
|
|
|
|
|
|
|
|
sortOrder: list.length + 1,
|
|
|
|
|
|
|
|
remark: ''
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
list.push(budget);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleDeleteBudget = (index: number) => {
|
|
|
|
|
|
|
|
form.value.budgetList.splice(index, 1);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 提交按钮(与项目信息保持一致的处理方式) */
|
|
|
|
/** 提交按钮(与项目信息保持一致的处理方式) */
|
|
|
|
const submitForm = (status: string, mode: boolean) => {
|
|
|
|
const submitForm = (status: string, mode: boolean) => {
|
|
|
|
@ -477,7 +472,8 @@ const submitForm = (status: string, mode: boolean) => {
|
|
|
|
projectCode: form.value.projectCode,
|
|
|
|
projectCode: form.value.projectCode,
|
|
|
|
projectManagerId: form.value.projectManagerId,
|
|
|
|
projectManagerId: form.value.projectManagerId,
|
|
|
|
deptHeadId: form.value.deptHeadId,
|
|
|
|
deptHeadId: form.value.deptHeadId,
|
|
|
|
changeType: form.value.changeType
|
|
|
|
changeType: form.value.changeType,
|
|
|
|
|
|
|
|
projectChangeCode: form.value.projectChangeCode
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// 流程实例业务扩展字段
|
|
|
|
// 流程实例业务扩展字段
|
|
|
|
form.value.bizExt = {
|
|
|
|
form.value.bizExt = {
|
|
|
|
|