工序名相同的合并成一条任务数据

dev-scheduling
zhangdi 9 hours ago
parent a7493fe16b
commit 79bb2c7e1d
  1. 36
      src/views/productionSchedulingPlan/schedulingDashboard/container.vue

@ -788,11 +788,10 @@ export default {
const taskBarWidth = (timeLine * widthPercent) / 100; const taskBarWidth = (timeLine * widthPercent) / 100;
if (textWidth > taskBarWidth) { if (textWidth > taskBarWidth) {
console.log('大于宽度的', textWidth, taskBarWidth,processName);
if (processName <= 4) { if (processName <= 4) {
return -7; // return -7; //
} else { } else {
return -textWidth*1.5; // return -textWidth * 1.5; //
} }
} else { } else {
// console.log('', textWidth, taskBarWidth,processName); // console.log('', textWidth, taskBarWidth,processName);
@ -1078,11 +1077,26 @@ export default {
} }
// //
//
const groupedTasks = {};
woTasks.forEach(task => { woTasks.forEach(task => {
tasks.push({ if (!groupedTasks[task.processName]) {
...task, groupedTasks[task.processName] = [];
woCode, // woCode 便 }
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.updateCurrentPageOrders();
this.loading = false; 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) { calcTaskStatus(startTime, endTime) {

Loading…
Cancel
Save