排产代码提交

dev-scheduling
zhangdi 4 months ago
parent 90c6031f56
commit b1c2bed160
  1. 159
      src/views/productionSchedulingPlan/schedulingDashboard/index.vue
  2. 23
      src/views/productionSchedulingPlan/schedulingException/index.vue

@ -14,7 +14,7 @@
</el-col>
<el-col :span="6" v-if="formLabelAlign.type == '1'">
<el-form-item label="车间订单号:" label-width="120px">
<el-input v-model="formLabelAlign.woCode"></el-input>
<el-input v-model="formLabelAlign.woCode" placeholder="请输入"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" v-if="formLabelAlign.type == '2'">
@ -99,8 +99,12 @@
<div
v-for="(device, index) in devices"
:key="index"
class="device-item"
:style="{ height: rowHeight + 'px' }"
:style="{
height: getRowHeight(device) + 'px',
lineHeight: getRowHeight(device) + 'px',
textAlign: 'center',
borderBottom: '1px solid #ccc',
}"
:title="device"
>
{{ device }}
@ -181,24 +185,33 @@
v-for="(device, devIndex) in devices"
:key="devIndex"
class="device-task-row"
:style="{ height: rowHeight + 'px' }"
:style="{ height: getRowHeight(device) + 'px' }"
>
<div
v-for="(task, taskIndex) in getDeviceTasks(device)"
:key="taskIndex"
class="task-bar"
:style="{
left: `${getPositionPercent(task.startTime)}%`,
width: `${getWidthPercent(task.startTime, task.endTime)}%`,
backgroundColor: getStatusColor(task.status),
}"
@mouseenter="showTooltip($event, task, device)"
@mouseleave="hideTooltip()"
>
<span class="task-label" v-if="searchType == '1'">{{ task.processName }}</span>
<span class="task-label" v-if="searchType == '2'">{{ task.woCode }}</span>
<span class="task-label" v-if="searchType == '3'">{{ task.woCode }}</span>
</div>
<template v-for="(layer, layerIndex) in getLayeredTasks(device)" :key="layerIndex">
<div
v-for="(task, taskIndex) in layer"
:key="taskIndex"
class="task-bar"
:style="{
left: `${getPositionPercent(task.startTime)}%`,
width: `${getWidthPercent(task.startTime, task.endTime)}%`,
backgroundColor: getStatusColor(task),
top: `${getLayerOffset(
layerIndex,
getLayeredTasks(device).length,
device
)}px`,
height: `${getLayerTaskHeight(getLayeredTasks(device).length, device)}px`,
}"
@mouseenter="showTooltip($event, task, device)"
@mouseleave="hideTooltip()"
>
<!-- 任务标签内容不变 -->
<span class="task-label" v-if="searchType == '1'">{{ task.processName }}</span>
<span class="task-label" v-if="searchType == '2'">{{ task.woCode }}</span>
<span class="task-label" v-if="searchType == '3'">{{ task.woCode }}</span>
</div>
</template>
</div>
</div>
</div>
@ -293,6 +306,8 @@ export default {
tooltipData: {},
tooltipX: 0,
tooltipY: 0,
baseRowHeight: 40, //
rowHeights: {}, //
};
},
computed: {
@ -322,7 +337,6 @@ export default {
methods: {
getData() {
getData(this.formLabelAlign).then(res => {
console.log(99999, res.data.data);
this.processData(res.data.data);
});
},
@ -435,13 +449,15 @@ export default {
},
//
getStatusColor(status) {
switch (status) {
case '已完成':
getStatusColor(row) {
let staus=this.searchType=='1'?row.planStatus:row.orderStatus
switch (staus) {
case '3':
return '#28a745';
case '进行中':
case '2':
return '#007bff';
case '未开始':
case '1':
return '#6c757d';
default:
return '#ccc';
@ -478,23 +494,73 @@ export default {
hideTooltip() {
this.tooltipVisible = false;
},
// methods
//
getRowHeight(device) {
const layers = this.getLayeredTasks(device);
const layerCount = layers.length;
// = *
const height = Math.max(this.baseRowHeight, layerCount * this.baseRowHeight);
//
this.rowHeights[device] = height;
return height;
},
//
getLayerOffset(layerIndex, totalLayers, device) {
const rowHeight = this.getRowHeight(device);
if (totalLayers <= 1) return 2; //
//
const totalSpacing = totalLayers * 4; // 4px
const availableHeight = rowHeight - totalSpacing;
const layerHeight = availableHeight / totalLayers;
return layerIndex * (layerHeight + 4) + 2; // 2px
},
//
getLayerTaskHeight(totalLayers, device) {
const rowHeight = this.getRowHeight(device);
if (totalLayers <= 1) {
return rowHeight - 4; //
} else {
const totalSpacing = totalLayers * 4;
const availableHeight = rowHeight - totalSpacing;
return availableHeight / totalLayers;
}
},
//
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 aStart = this.timeToMinutes(a.startTime);
const bStart = this.timeToMinutes(b.startTime);
//
if (this.timeToMinutes(a.endTime) < aStart && this.timeToMinutes(b.endTime) >= bStart) {
return -1;
}
return aStart - bStart;
});
const layers = [];
sortedTasks.forEach(task => {
//
let placed = false;
const taskStart = this.timeToMinutes(task.startTime);
const taskEnd = this.timeToMinutes(task.endTime);
//
const adjustedEnd = taskEnd < taskStart ? taskEnd + 24 * 60 : taskEnd;
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)) {
const lastEnd = this.timeToMinutes(lastTask.endTime);
const lastAdjustedEnd =
lastEnd < this.timeToMinutes(lastTask.startTime) ? lastEnd + 24 * 60 : lastEnd;
if (taskStart >= lastAdjustedEnd) {
layers[i].push(task);
placed = true;
break;
@ -507,20 +573,6 @@ export default {
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;
},
},
};
</script>
@ -633,7 +685,7 @@ export default {
}
}
.device-item-title {
background: var(--el-color-primary);
background: #284c89 !important;
text-align: center;
color: #fff;
}
@ -659,7 +711,7 @@ export default {
width: 100%;
height: 30px;
display: flex;
background-color: var(--el-color-primary);
background-color: #284c89 !important;
}
/* 主刻度标签(小时) */
@ -703,7 +755,7 @@ export default {
left: 0;
width: 100%;
height: 6px;
background-color: var(--el-color-primary);
background-color: #284c89 !important;
}
/* 主刻度线(小时) */
@ -780,13 +832,13 @@ export default {
position: relative;
border-bottom: 1px solid #e9ecef;
box-sizing: border-box;
padding: 0;
margin: 0;
}
.task-bar {
position: absolute;
top: 5px;
height: 26px;
border-radius: 4px;
border-radius: 18px;
display: flex;
align-items: center;
padding: 0 10px;
@ -794,6 +846,7 @@ export default {
cursor: pointer;
overflow: hidden;
transition: all 0.2s;
white-space: nowrap;
}
.task-bar:hover {
@ -857,4 +910,8 @@ export default {
}
}
}
:deep(.el-button--primary){
background-color: #284c89 !important;
color:#fff
}
</style>

@ -16,7 +16,6 @@
@refresh-change="refreshChange"
@on-load="onLoad"
>
</avue-crud>
</basic-container>
</template>
@ -106,14 +105,14 @@ export default {
width: 150,
span: 12,
},
// {
// label: '',
// prop: 'partName',
// search: false,
// sortable: true,
// width: 150,
// span: 12,
// },
// {
// label: '',
// prop: 'partName',
// search: false,
// sortable: true,
// width: 150,
// span: 12,
// },
{
label: '调度员',
prop: 'planUser',
@ -301,3 +300,9 @@ export default {
},
};
</script>
<style lang="scss" scoped>
:deep(.el-button--primary) {
background-color: #284c89 !important;
color: #fff;
}
</style>

Loading…
Cancel
Save