diff --git a/src/views/productionSchedulingPlan/schedulingDashboard/container.vue b/src/views/productionSchedulingPlan/schedulingDashboard/container.vue index 902588b..abbf24b 100644 --- a/src/views/productionSchedulingPlan/schedulingDashboard/container.vue +++ b/src/views/productionSchedulingPlan/schedulingDashboard/container.vue @@ -448,7 +448,7 @@ export default { name: 'GanttChart', data() { return { - loading:false, + loading: false, formLabelAlign: { startTime: null, //时间 teamName: '', //班组 @@ -525,7 +525,6 @@ export default { // 监听参数变化 '$route.query': { handler(newQuery) { - console.log('参数变化:', newQuery); this.handleParamsChange(); }, immediate: true, @@ -775,7 +774,7 @@ export default { // 根据层索引确定窄任务文本的垂直偏移 getNarrowTaskOffsetByLayerLeft(processName) { // 偶数层在上方显示(负值),奇数层在下方显示(正值) - const offset = processName.length >= 5 ? -30 : -7; + const offset = processName.length >= 5 ? -30 : -7; return offset; }, handleParamsChange() { @@ -987,7 +986,7 @@ export default { }, // 数据获取 - async getData (params) { + async getData(params) { if (this.formLabelAlign.timeRange.length > 0) { this.formLabelAlign.startTime = this.formLabelAlign.timeRange[0]; this.formLabelAlign.endTime = this.formLabelAlign.timeRange[1]; @@ -995,7 +994,7 @@ export default { if (this.formLabelAlign.planStatusList.length <= 0) { this.formLabelAlign.planStatusList = null; } - this.loading = true + this.loading = true; await getData(this.formLabelAlign).then(res => { this.processData(res.data.data); }); @@ -1020,10 +1019,12 @@ export default { processData(rawData) { const tasks = []; const orders = []; - const workOrders = Object.keys(rawData); - workOrders.forEach(woCode => { - const woTasks = rawData[woCode] || []; + // 遍历数组对象 + rawData.forEach(item => { + const woCode = item.woCode; // 提取车间订单号 + const woTasks = item.workOrderList || []; // 提取任务列表 + // 提取订单信息(取第一个任务的基础信息) if (woTasks.length > 0) { const firstTask = woTasks[0]; @@ -1036,11 +1037,12 @@ export default { priorityAps: firstTask.priorityAps, }); } + // 处理任务数据 woTasks.forEach(task => { tasks.push({ ...task, - // status: this.calcTaskStatus(task.startTime, task.endTime), + woCode, // 将 woCode 添加到任务数据中,便于后续关联 }); }); }); @@ -1048,9 +1050,9 @@ export default { this.allOrders = orders; this.totalOrders = orders.length; this.taskData = tasks; - + this.updateCurrentPageOrders(); - this.loading = false + this.loading = false; }, // 任务状态计算 @@ -1257,7 +1259,6 @@ export default { // 检查是否有时间重叠 if (taskStart >= adjustedLastEnd) { - console.log('layers', tasks, layers); // 没有时间重叠,可以放在这一层 layer.push(task); placed = true;