|
|
|
|
@ -205,7 +205,7 @@
|
|
|
|
|
<ApprovalRecord ref="approvalRecordRef" />
|
|
|
|
|
|
|
|
|
|
<!-- 项目变更历史记录抽屉 -->
|
|
|
|
|
<el-drawer v-model="historyDrawer.visible" :title="historyDrawer.title" size="700px">
|
|
|
|
|
<el-drawer v-model="historyDrawer.visible" :title="historyDrawer.title" size="700px" :close-on-click-modal="true">
|
|
|
|
|
<el-timeline v-if="historyDrawer.list && historyDrawer.list.length > 0">
|
|
|
|
|
<el-timeline-item
|
|
|
|
|
v-for="(item, index) in historyDrawer.list"
|
|
|
|
|
@ -216,11 +216,17 @@
|
|
|
|
|
size="large"
|
|
|
|
|
>
|
|
|
|
|
<el-card shadow="hover">
|
|
|
|
|
<div v-for="(msg, mIndex) in item.messages" :key="mIndex" style="margin-bottom: 15px; font-size: 14px; line-height: 1.5;">
|
|
|
|
|
<el-tag :type="msg.type === '预算变更' ? 'success' : 'warning'" size="small" style="margin-right: 10px;" effect="dark">{{ msg.type }}</el-tag>
|
|
|
|
|
<span style="color: #606266;">{{ msg.desc }}</span>
|
|
|
|
|
<div v-for="(msg, mIndex) in item.messages" :key="mIndex" style="margin-bottom: 15px; font-size: 14px; line-height: 1.5">
|
|
|
|
|
<el-tag
|
|
|
|
|
:type="msg.type === '预算变更' ? 'success' : msg.type === '情况说明' ? 'info' : 'warning'"
|
|
|
|
|
size="small"
|
|
|
|
|
style="margin-right: 10px"
|
|
|
|
|
effect="dark"
|
|
|
|
|
>{{ msg.type }}</el-tag
|
|
|
|
|
>
|
|
|
|
|
<span style="color: #606266">{{ msg.desc }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="item.messages.length === 0" style="color: #909399; font-size: 13px;">本次变更未修改预算金额与进度计划。</div>
|
|
|
|
|
<div v-if="item.messages.length === 0" style="color: #909399; font-size: 13px">本次变更未修改预算金额与进度计划。</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-timeline-item>
|
|
|
|
|
</el-timeline>
|
|
|
|
|
@ -430,7 +436,7 @@ const historyDrawer = reactive({
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const handleViewHistory = async (row: any) => {
|
|
|
|
|
historyDrawer.title = `每一次变更的历史记录(${row.projectName})`;
|
|
|
|
|
historyDrawer.title = `变更历史记录(${row.projectName})`;
|
|
|
|
|
historyDrawer.visible = true;
|
|
|
|
|
historyDrawer.list = [];
|
|
|
|
|
|
|
|
|
|
@ -440,9 +446,14 @@ const handleViewHistory = async (row: any) => {
|
|
|
|
|
if (res.data) {
|
|
|
|
|
const records = res.data;
|
|
|
|
|
const historyList = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const previousBudget: Record<string, number> = {};
|
|
|
|
|
const previousProgressContent: Record<string, any> = {};
|
|
|
|
|
const previousBasicInfo: Record<string, string> = {
|
|
|
|
|
currentStatus: '',
|
|
|
|
|
changeReason: '',
|
|
|
|
|
followUpWork: ''
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < records.length; i++) {
|
|
|
|
|
const item = records[i];
|
|
|
|
|
@ -470,7 +481,7 @@ const handleViewHistory = async (row: any) => {
|
|
|
|
|
// 2. 进度变更详情提取
|
|
|
|
|
if (item.progressList && item.progressList.length > 0) {
|
|
|
|
|
item.progressList.forEach((progress: any) => {
|
|
|
|
|
const phaseKey = progress.projectPhases;
|
|
|
|
|
const phaseKey = progress.planStageId; // 使用原计划阶段ID作为不变的唯一Key,防止为空时所有阶段混在一起
|
|
|
|
|
const prev = previousProgressContent[phaseKey] || {
|
|
|
|
|
start: progress.originalStart,
|
|
|
|
|
end: progress.originalEnd,
|
|
|
|
|
@ -483,12 +494,16 @@ const handleViewHistory = async (row: any) => {
|
|
|
|
|
|
|
|
|
|
// 对比开始时间
|
|
|
|
|
if (prev.start && progress.changedStart && prev.start !== progress.changedStart) {
|
|
|
|
|
diffs.push(`原计划时间起的 ${proxy?.parseTime(prev.start, '{y}-{m}-{d}')} 变为变更后时间起的 ${proxy?.parseTime(progress.changedStart, '{y}-{m}-{d}')}`);
|
|
|
|
|
diffs.push(
|
|
|
|
|
`原计划时间起的 ${proxy?.parseTime(prev.start, '{y}-{m}-{d}')} 变为变更后时间起的 ${proxy?.parseTime(progress.changedStart, '{y}-{m}-{d}')}`
|
|
|
|
|
);
|
|
|
|
|
startChanged = true;
|
|
|
|
|
}
|
|
|
|
|
// 对比结束时间
|
|
|
|
|
if (prev.end && progress.changedEnd && prev.end !== progress.changedEnd) {
|
|
|
|
|
diffs.push(`原计划时间止的 ${proxy?.parseTime(prev.end, '{y}-{m}-{d}')} 变为变更后时间止的 ${proxy?.parseTime(progress.changedEnd, '{y}-{m}-{d}')}`);
|
|
|
|
|
diffs.push(
|
|
|
|
|
`原计划时间止的 ${proxy?.parseTime(prev.end, '{y}-{m}-{d}')} 变为变更后时间止的 ${proxy?.parseTime(progress.changedEnd, '{y}-{m}-{d}')}`
|
|
|
|
|
);
|
|
|
|
|
endChanged = true;
|
|
|
|
|
}
|
|
|
|
|
// 里程碑变动情况
|
|
|
|
|
@ -503,13 +518,13 @@ const handleViewHistory = async (row: any) => {
|
|
|
|
|
const phaseLabel = proxy?.selectDictLabel(project_phases.value, progress.projectPhases) || progress.projectPhases || '未知';
|
|
|
|
|
const diffStr = diffs.join(',');
|
|
|
|
|
let finalDescText = diffStr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (finalDescText && msDiff) {
|
|
|
|
|
finalDescText += `,同时将${msDiff}`;
|
|
|
|
|
} else if (msDiff) {
|
|
|
|
|
finalDescText = `将${msDiff}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
messages.push({
|
|
|
|
|
type: '进度变更',
|
|
|
|
|
desc: `将进度变更中【${phaseLabel}】阶段的 ` + finalDescText
|
|
|
|
|
@ -524,7 +539,34 @@ const handleViewHistory = async (row: any) => {
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 3. 项目说明信息详情提取
|
|
|
|
|
const basicDiffs = [];
|
|
|
|
|
if (item.currentStatus && item.currentStatus !== previousBasicInfo.currentStatus) {
|
|
|
|
|
const oldVal = previousBasicInfo.currentStatus ? `“${previousBasicInfo.currentStatus}”` : '空白';
|
|
|
|
|
basicDiffs.push(`当前情况由 ${oldVal} 变更为 “${item.currentStatus}”`);
|
|
|
|
|
}
|
|
|
|
|
if (item.changeReason && item.changeReason !== previousBasicInfo.changeReason) {
|
|
|
|
|
const oldVal = previousBasicInfo.changeReason ? `“${previousBasicInfo.changeReason}”` : '空白';
|
|
|
|
|
basicDiffs.push(`变更原因由 ${oldVal} 变更为 “${item.changeReason}”`);
|
|
|
|
|
}
|
|
|
|
|
if (item.followUpWork && item.followUpWork !== previousBasicInfo.followUpWork) {
|
|
|
|
|
const oldVal = previousBasicInfo.followUpWork ? `“${previousBasicInfo.followUpWork}”` : '空白';
|
|
|
|
|
basicDiffs.push(`后续工作由 ${oldVal} 变更为 “${item.followUpWork}”`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (basicDiffs.length > 0) {
|
|
|
|
|
messages.push({
|
|
|
|
|
type: '情况说明',
|
|
|
|
|
desc: basicDiffs.join(',')
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 更新本次基础信息状态供下次对比使用
|
|
|
|
|
previousBasicInfo.currentStatus = item.currentStatus || previousBasicInfo.currentStatus;
|
|
|
|
|
previousBasicInfo.changeReason = item.changeReason || previousBasicInfo.changeReason;
|
|
|
|
|
previousBasicInfo.followUpWork = item.followUpWork || previousBasicInfo.followUpWork;
|
|
|
|
|
|
|
|
|
|
historyList.push({
|
|
|
|
|
changeNumber: item.changeNumber,
|
|
|
|
|
createTime: item.createTime,
|
|
|
|
|
@ -535,7 +577,7 @@ const handleViewHistory = async (row: any) => {
|
|
|
|
|
historyDrawer.list = historyList;
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("加载变更历史记录失败", error);
|
|
|
|
|
console.error('加载变更历史记录失败', error);
|
|
|
|
|
} finally {
|
|
|
|
|
proxy?.$modal.closeLoading();
|
|
|
|
|
}
|
|
|
|
|
|