|
|
|
|
@ -327,6 +327,10 @@ |
|
|
|
|
@mouseenter="showTooltip($event, task, order.woCode)" |
|
|
|
|
@mouseleave="hideTooltip()" |
|
|
|
|
> |
|
|
|
|
<div class="task-icon" v-if="task.remindStatus=='2'||task.remindStatus=='1'"> |
|
|
|
|
<el-icon v-if="task.remindStatus == '2'" class="task-icon-red"><WarningFilled /></el-icon> |
|
|
|
|
<el-icon v-else-if="task.remindStatus == '1'" class="task-icon-yellow"><WarningFilled /></el-icon> |
|
|
|
|
</div> |
|
|
|
|
<div |
|
|
|
|
class="task-text-wrapper" |
|
|
|
|
:class="{ |
|
|
|
|
@ -345,29 +349,6 @@ |
|
|
|
|
> |
|
|
|
|
{{ task.processName }} |
|
|
|
|
</div> |
|
|
|
|
<!-- <div |
|
|
|
|
class="task-label" |
|
|
|
|
v-if="getWidthPercent(task.planStartTime, task.planEndTime) >= 1.5" |
|
|
|
|
> |
|
|
|
|
<span class="task-label-txt task-label-txt-inside">{{ |
|
|
|
|
task.processName |
|
|
|
|
}}</span> |
|
|
|
|
</div> |
|
|
|
|
<div |
|
|
|
|
v-else |
|
|
|
|
class="task-overlay-text" |
|
|
|
|
:style="{ |
|
|
|
|
width: `${getWidthPercent(task.planStartTime, task.planEndTime)}%`, |
|
|
|
|
top: `${getNarrowTaskOffsetByLayer(layerIndex)}px`, |
|
|
|
|
left: `${getNarrowTaskOffsetByLayerLeft( |
|
|
|
|
task.processName, |
|
|
|
|
getWidthPercent(task.planStartTime, task.planEndTime), |
|
|
|
|
layerIndex |
|
|
|
|
)}px`, |
|
|
|
|
}" |
|
|
|
|
> |
|
|
|
|
{{ task.processName }} |
|
|
|
|
</div> --> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</div> |
|
|
|
|
@ -859,8 +840,6 @@ export default { |
|
|
|
|
// this.formLabelAlign.teamName = this.tsName; |
|
|
|
|
|
|
|
|
|
this.updateTime(); |
|
|
|
|
// 根据参数加载数据 |
|
|
|
|
// this.getData(); |
|
|
|
|
}, |
|
|
|
|
// 计算重叠的窄任务的垂直偏移量 |
|
|
|
|
getNarrowTaskOffset(orderWoCode, taskIndex, layerIndex) { |
|
|
|
|
@ -962,7 +941,14 @@ export default { |
|
|
|
|
// 格式化为 YYYY-MM-DD |
|
|
|
|
const format = date => date.toISOString().split('T')[0]; |
|
|
|
|
this.formLabelAlign.timeRange = [format(startDate), format(endDate)]; |
|
|
|
|
|
|
|
|
|
const savedLegend = sessionStorage.getItem('legendStatus'); |
|
|
|
|
if (savedLegend) { |
|
|
|
|
try { |
|
|
|
|
this.legendStatus = JSON.parse(savedLegend); |
|
|
|
|
} catch (e) { |
|
|
|
|
console.warn('Failed to parse legendStatus from sessionStorage', e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 如果是重置操作,也应触发图例状态同步 |
|
|
|
|
if (type === 'reset') { |
|
|
|
|
this.legendStatus.completed = false; |
|
|
|
|
@ -977,6 +963,7 @@ export default { |
|
|
|
|
handleLegendChange(type) { |
|
|
|
|
// 如果需要重新加载数据,可以调用 |
|
|
|
|
this.formLabelAlign.planStatusList = []; |
|
|
|
|
|
|
|
|
|
if (this.legendStatus.completed) { |
|
|
|
|
this.formLabelAlign.planStatusList.push('5'); |
|
|
|
|
} |
|
|
|
|
@ -986,8 +973,9 @@ export default { |
|
|
|
|
if (this.legendStatus.pending) { |
|
|
|
|
this.formLabelAlign.planStatusList.push('1'); |
|
|
|
|
} |
|
|
|
|
if (type == 'reset') { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// sessionStorage.setItem('formLabelAlign', JSON.stringify(this.formLabelAlign)); |
|
|
|
|
sessionStorage.setItem('legendStatus', JSON.stringify(this.legendStatus)); // 新增 |
|
|
|
|
|
|
|
|
|
this.getData(); |
|
|
|
|
}, |
|
|
|
|
@ -1091,6 +1079,10 @@ export default { |
|
|
|
|
// this.formLabelAlign.planStatusList = []; |
|
|
|
|
// } |
|
|
|
|
let seeData = sessionStorage.getItem('formLabelAlign'); |
|
|
|
|
let seeLegend = sessionStorage.getItem('legendStatus'); |
|
|
|
|
if (seeLegend) { |
|
|
|
|
this.legendStatus = JSON.parse(seeLegend); |
|
|
|
|
} |
|
|
|
|
if (seeData) { |
|
|
|
|
this.formLabelAlign = JSON.parse(seeData); |
|
|
|
|
} |
|
|
|
|
@ -1302,6 +1294,7 @@ export default { |
|
|
|
|
|
|
|
|
|
console.log(this.formLabelAlign, '99999'); |
|
|
|
|
sessionStorage.setItem('formLabelAlign', JSON.stringify(this.formLabelAlign)); |
|
|
|
|
sessionStorage.setItem('legendStatus', JSON.stringify(this.legendStatus)); // 新增 |
|
|
|
|
|
|
|
|
|
this.getData(); |
|
|
|
|
}, |
|
|
|
|
@ -1328,6 +1321,7 @@ export default { |
|
|
|
|
|
|
|
|
|
// this.updateTime('reset'); |
|
|
|
|
sessionStorage.setItem('formLabelAlign', JSON.stringify(this.formLabelAlign)); |
|
|
|
|
sessionStorage.setItem('legendStatus', JSON.stringify(this.legendStatus)); // 新增 |
|
|
|
|
|
|
|
|
|
this.getData(); |
|
|
|
|
}, |
|
|
|
|
@ -1344,15 +1338,6 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 任务 样式计算 |
|
|
|
|
getStatusColor(row) { |
|
|
|
|
if (row.planStatus === '1') { |
|
|
|
|
if (row.remindStatus === '1') { |
|
|
|
|
return '#FFD700'; // 黄色(可自定义) |
|
|
|
|
} else if (row.remindStatus === '2') { |
|
|
|
|
return '#dc3545'; // 红色(与返工状态一致,或自定义) |
|
|
|
|
} |
|
|
|
|
// 如果没有 remindStatus,默认保持原灰色 |
|
|
|
|
return '#6c757d'; |
|
|
|
|
} |
|
|
|
|
switch (row.planStatus) { |
|
|
|
|
case '5': |
|
|
|
|
return '#007bff'; |
|
|
|
|
@ -1361,6 +1346,8 @@ export default { |
|
|
|
|
return '#28a745'; |
|
|
|
|
case '6': |
|
|
|
|
return '#dc3545'; |
|
|
|
|
case '1': |
|
|
|
|
return '#6c757d'; |
|
|
|
|
default: |
|
|
|
|
return '#ccc'; |
|
|
|
|
} |
|
|
|
|
@ -1606,7 +1593,6 @@ export default { |
|
|
|
|
const containerWidth = this.$refs.timelineContainer.scrollWidth; |
|
|
|
|
if (containerWidth <= 0) return false; // 防止除零或无效计算 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const taskPixelWidth = (containerWidth * taskWidthPercent) / 100; |
|
|
|
|
const textWidth = this.getTextWidth(text, 10); // 确保字体大小匹配实际样式 |
|
|
|
|
return taskPixelWidth >= textWidth + 4; // 4px 是左右 padding 缓冲 |
|
|
|
|
@ -1624,7 +1610,9 @@ export default { |
|
|
|
|
// 根据是否能容纳文字,返回不同的样式 |
|
|
|
|
getTaskTextStyle(task, layerIndex) { |
|
|
|
|
const canFit = this.canFitText(task.processName, task.planStartTime, task.planEndTime); |
|
|
|
|
|
|
|
|
|
const bgColor = this.getStatusColor(task); |
|
|
|
|
// 判断是否为黄色(提醒状态) |
|
|
|
|
const isYellow = bgColor === '#FFD700'; |
|
|
|
|
if (canFit) { |
|
|
|
|
// 文字在内部居中 |
|
|
|
|
return { |
|
|
|
|
@ -1632,7 +1620,7 @@ export default { |
|
|
|
|
top: '50%', |
|
|
|
|
left: '50%', |
|
|
|
|
transform: 'translate(-50%, -50%)', |
|
|
|
|
color: 'white', |
|
|
|
|
color: isYellow ? '#000' : 'white', |
|
|
|
|
fontSize: '10px', |
|
|
|
|
whiteSpace: 'nowrap', |
|
|
|
|
textShadow: '0 0 2px rgba(0,0,0,0.5)', |
|
|
|
|
@ -1645,7 +1633,7 @@ export default { |
|
|
|
|
top: isEvenLayer ? '-15px' : 'calc(100% )', |
|
|
|
|
left: '50%', |
|
|
|
|
transform: 'translateX(-50%)', |
|
|
|
|
color: '#333', |
|
|
|
|
color: isYellow ? '#000' : '#333', |
|
|
|
|
fontSize: '10px', |
|
|
|
|
whiteSpace: 'nowrap', |
|
|
|
|
padding: '2px 6px', |
|
|
|
|
@ -1654,6 +1642,14 @@ export default { |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
getTaskIcon(task) { |
|
|
|
|
// 示例:根据 planStatus 返回不同图标 |
|
|
|
|
if (task.remindStatus == '2' || task.remindStatus == '1') { |
|
|
|
|
return 'el-icon-warning'; |
|
|
|
|
} else { |
|
|
|
|
return ''; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
@ -2014,9 +2010,50 @@ export default { |
|
|
|
|
border: 1px solid rgba(255, 255, 255, 0.3); |
|
|
|
|
min-width: 5px; |
|
|
|
|
z-index: 1; |
|
|
|
|
.task-icon { |
|
|
|
|
position: absolute; |
|
|
|
|
top: -14px; |
|
|
|
|
left: -8px; |
|
|
|
|
width: 16px; |
|
|
|
|
height: 16px; |
|
|
|
|
border-radius: 50%; |
|
|
|
|
display: flex; |
|
|
|
|
align-items: center; |
|
|
|
|
justify-content: center; |
|
|
|
|
z-index: 2; |
|
|
|
|
font-size: 12px; |
|
|
|
|
color: #666; |
|
|
|
|
|
|
|
|
|
i { |
|
|
|
|
font-weight: bold; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.task-icon-red { |
|
|
|
|
color: #ff4d4f; /* 红色 - 与 current-time-indicator 一致 */ |
|
|
|
|
background-color: white; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.task-icon-yellow { |
|
|
|
|
color: #faad14; /* Element UI 警告黄色 */ |
|
|
|
|
background-color: white; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.task-bar.task-bar-narrow { |
|
|
|
|
overflow: visible; /* 允许覆盖元素超出边界 */ |
|
|
|
|
.task-icon { |
|
|
|
|
top: -14px; |
|
|
|
|
left: 0; |
|
|
|
|
transform: translateX(-50%); |
|
|
|
|
} |
|
|
|
|
.task-icon-red { |
|
|
|
|
color: #ff4d4f; /* 红色 - 与 current-time-indicator 一致 */ |
|
|
|
|
background-color: white; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.task-icon-yellow { |
|
|
|
|
color: #faad14; /* Element UI 警告黄色 */ |
|
|
|
|
background-color: white; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.task-bar:hover { |
|
|
|
|
|