From 79bb2c7e1da877ebf7220380a6b689603a329922 Mon Sep 17 00:00:00 2001 From: zhangdi <15053473693@163.com> Date: Tue, 30 Dec 2025 13:23:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=BA=8F=E5=90=8D=E7=9B=B8=E5=90=8C?= =?UTF-8?q?=E7=9A=84=E5=90=88=E5=B9=B6=E6=88=90=E4=B8=80=E6=9D=A1=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schedulingDashboard/container.vue | 38 ++++++++++++++++--- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/src/views/productionSchedulingPlan/schedulingDashboard/container.vue b/src/views/productionSchedulingPlan/schedulingDashboard/container.vue index 76e4619..7cdf213 100644 --- a/src/views/productionSchedulingPlan/schedulingDashboard/container.vue +++ b/src/views/productionSchedulingPlan/schedulingDashboard/container.vue @@ -788,11 +788,10 @@ export default { const taskBarWidth = (timeLine * widthPercent) / 100; if (textWidth > taskBarWidth) { - console.log('大于宽度的', textWidth, taskBarWidth,processName); if (processName <= 4) { return -7; // 文字超出任务条时,向左偏移一半文字宽度 } else { - return -textWidth*1.5; // 文字超出任务条时,向左偏移一半文字宽度 + return -textWidth * 1.5; // 文字超出任务条时,向左偏移一半文字宽度 } } else { // console.log('小于宽度的', textWidth, taskBarWidth,processName); @@ -1078,11 +1077,26 @@ export default { } // 处理任务数据 + // 按工序名称分组并合并任务 + const groupedTasks = {}; woTasks.forEach(task => { - tasks.push({ - ...task, - woCode, // 将 woCode 添加到任务数据中,便于后续关联 - }); + if (!groupedTasks[task.processName]) { + groupedTasks[task.processName] = []; + } + groupedTasks[task.processName].push(task); + }); + Object.values(groupedTasks).forEach(group => { + const minStartTime = Math.min(...group.map(t => this.parseTimeToHours(t.planStartTime))); + const maxEndTime = Math.max(...group.map(t => this.parseTimeToHours(t.planEndTime))); + + // 创建合并后的任务 + const mergedTask = { + ...group[0], // 保留第一个任务的基础信息 + planStartTime: this.formatHoursToTime(minStartTime), // 合并后的开始时间 + planEndTime: this.formatHoursToTime(maxEndTime), // 合并后的结束时间 + }; + + tasks.push(mergedTask); }); }); @@ -1093,6 +1107,18 @@ export default { this.updateCurrentPageOrders(); this.loading = false; }, + formatHoursToTime(hours) { + const baseDate = new Date(this.baseDate); + const date = new Date(baseDate.getTime() + hours * 60 * 60 * 1000); + + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hour = String(date.getHours()).padStart(2, '0'); + const minute = String(date.getMinutes()).padStart(2, '0'); + + return `${year}-${month}-${day} ${hour}:${minute}`; + }, // 任务状态计算 calcTaskStatus(startTime, endTime) {