diff --git a/src/views/productionSchedulingPlan/schedulingDashboard/index.vue b/src/views/productionSchedulingPlan/schedulingDashboard/index.vue index 92c7861..fb571aa 100644 --- a/src/views/productionSchedulingPlan/schedulingDashboard/index.vue +++ b/src/views/productionSchedulingPlan/schedulingDashboard/index.vue @@ -35,7 +35,12 @@ - + @@ -211,27 +216,27 @@ >
-
{{ tooltipData.woCode }}
-
{{ tooltipData.teamName }}
-
{{ tooltipData.equipName }}
+
{{ tooltipData.woCode }}
+
{{ tooltipData.teamName }}
+
{{ tooltipData.equipName }}
@@ -270,7 +273,7 @@ export default { searchType: '', formLabelAlign: { type: '1', //维度类型 - startTime: '', //时间 + startTime: null, //时间 teamName: '', //班组 equipName: '', //设备 woCode: '', //车间订单号 @@ -313,6 +316,7 @@ export default { }, mounted() { this.searchType = this.formLabelAlign.type; + this.formLabelAlign.startTime = new Date().toISOString().substr(0, 10); this.getData(); }, methods: { @@ -474,6 +478,49 @@ export default { hideTooltip() { this.tooltipVisible = false; }, + // 在methods中添加处理重叠任务的方法 + getLayeredTasks(device) { + const tasks = this.getDeviceTasks(device); + if (!tasks.length) return []; + + // 按开始时间排序 + const sortedTasks = [...tasks].sort((a, b) => { + return this.timeToMinutes(a.startTime) - this.timeToMinutes(b.startTime); + }); + + const layers = []; + sortedTasks.forEach(task => { + // 尝试找到可以放置当前任务的层级 + let placed = false; + for (let i = 0; i < layers.length; i++) { + const lastTask = layers[i][layers[i].length - 1]; + if (this.timeToMinutes(task.startTime) >= this.timeToMinutes(lastTask.endTime)) { + layers[i].push(task); + placed = true; + break; + } + } + if (!placed) { + layers.push([task]); + } + }); + + return layers; + }, + + // 计算任务所在层级的垂直偏移 + getLayerOffset(layerIndex, totalLayers) { + if (totalLayers <= 1) return 0; + // 每层高度 = 行高 / 总层数 + const layerHeight = this.rowHeight / totalLayers; + return layerIndex * layerHeight + 2; // 加2px间距 + }, + + // 计算任务在层级中的高度 + getLayerTaskHeight(totalLayers) { + if (totalLayers <= 1) return this.rowHeight - 4; // 减4px间距 + return this.rowHeight / totalLayers - 4; + }, }, }; @@ -779,35 +826,35 @@ export default { margin: 3px 0; } .wo-code-title { - font-size: 18px; - font-weight: bold; - color: #1f2d3d; - margin-bottom: 15px; - padding-bottom: 10px; - border-bottom: 1px solid #e6e6e6; - } + font-size: 18px; + font-weight: bold; + color: #1f2d3d; + margin-bottom: 15px; + padding-bottom: 10px; + border-bottom: 1px solid #e6e6e6; +} - .detail-list { - list-style: none; - padding: 0; - margin: 0; - - .detail-item { - display: flex; - align-items: center; - margin-bottom: 12px; - line-height: 24px; - - .label { - width: 100px; - color: #666; - font-weight: 500; - } +.detail-list { + list-style: none; + padding: 0; + margin: 0; - .value { - flex: 1; - color: #333; - } + .detail-item { + display: flex; + align-items: center; + margin-bottom: 12px; + line-height: 24px; + + .label { + width: 100px; + color: #666; + font-weight: 500; + } + + .value { + flex: 1; + color: #333; } } +}