diff --git a/src/views/productionSchedulingPlan/schedulingDashboard/container.vue b/src/views/productionSchedulingPlan/schedulingDashboard/container.vue index bd55b73..33f4144 100644 --- a/src/views/productionSchedulingPlan/schedulingDashboard/container.vue +++ b/src/views/productionSchedulingPlan/schedulingDashboard/container.vue @@ -963,7 +963,7 @@ export default { handleLegendChange(type) { // 如果需要重新加载数据,可以调用 this.formLabelAlign.planStatusList = []; - + console.log('legendStatus', this.legendStatus); if (this.legendStatus.completed) { this.formLabelAlign.planStatusList.push('5'); } @@ -1080,9 +1080,7 @@ export default { // } let seeData = sessionStorage.getItem('formLabelAlign'); let seeLegend = sessionStorage.getItem('legendStatus'); - if (seeLegend) { - this.legendStatus = JSON.parse(seeLegend); - } + if (seeData) { this.formLabelAlign = JSON.parse(seeData); } @@ -1090,6 +1088,20 @@ export default { this.formLabelAlign.startTime = this.formLabelAlign.timeRange[0]; this.formLabelAlign.endTime = this.formLabelAlign.timeRange[1]; } + if (seeLegend) { + this.legendStatus = JSON.parse(seeLegend); + this.formLabelAlign.planStatusList = []; + + if (this.legendStatus.completed) { + this.formLabelAlign.planStatusList.push('5'); + } + if (this.legendStatus.processing) { + this.formLabelAlign.planStatusList.push('2', '3'); + } + if (this.legendStatus.pending) { + this.formLabelAlign.planStatusList.push('1'); + } + } this.loading = true; await getData(this.formLabelAlign).then(res => { this.processData(res.data.data); @@ -1136,32 +1148,32 @@ export default { } const mergedTasks = []; - let currentMergedTask = null; - - for (const task of woTasks) { - if (!currentMergedTask) { - // 初始化第一个任务 - currentMergedTask = { ...task }; + let currentMergedTask = null; + + for (const task of woTasks) { + if (!currentMergedTask) { + // 初始化第一个任务 + currentMergedTask = { ...task }; + } else { + // 仅当当前任务与前一个任务工序名称相同时才合并 + if (currentMergedTask.processName === task.processName) { + // 更新结束时间为当前任务的结束时间(假设顺序正确) + currentMergedTask.planEndTime = task.planEndTime; + // 注意:不更新 startTime,保留第一个的开始时间 } else { - // 仅当当前任务与前一个任务工序名称相同时才合并 - if (currentMergedTask.processName === task.processName) { - // 更新结束时间为当前任务的结束时间(假设顺序正确) - currentMergedTask.planEndTime = task.planEndTime; - // 注意:不更新 startTime,保留第一个的开始时间 - } else { - // 工序不同,推入当前合并任务,开启新任务 - mergedTasks.push(currentMergedTask); - currentMergedTask = { ...task }; - } + // 工序不同,推入当前合并任务,开启新任务 + mergedTasks.push(currentMergedTask); + currentMergedTask = { ...task }; } } + } - // 推入最后一个合并任务 - if (currentMergedTask) { - mergedTasks.push(currentMergedTask); - } + // 推入最后一个合并任务 + if (currentMergedTask) { + mergedTasks.push(currentMergedTask); + } - tasks.push(...mergedTasks); + tasks.push(...mergedTasks); }); // >>>>>>>>>> 新增排序逻辑 <<<<<<<<<< @@ -1316,7 +1328,6 @@ export default { }, // 任务 样式计算 getStatusColor(row) { - console.log('计算状态颜色', row.planStatus, row.remindStatus); if (row.planStatus === '1') { if (row.remindStatus === '1') { return '#FFD700'; // 黄色(可自定义)