diff --git a/src/views/oa/erp/erpProjectChange/index.vue b/src/views/oa/erp/erpProjectChange/index.vue index 39c4860..bbe872f 100644 --- a/src/views/oa/erp/erpProjectChange/index.vue +++ b/src/views/oa/erp/erpProjectChange/index.vue @@ -205,7 +205,7 @@ - + -
- {{ msg.type }} - {{ msg.desc }} +
+ {{ msg.type }} + {{ msg.desc }}
-
本次变更未修改预算金额与进度计划。
+
本次变更未修改预算金额与进度计划。
@@ -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 = {}; const previousProgressContent: Record = {}; + const previousBasicInfo: Record = { + 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(); }