diff --git a/src/views/productionSchedulingPlan/schedulingDashboard/container.vue b/src/views/productionSchedulingPlan/schedulingDashboard/container.vue
index cc7c752..5945124 100644
--- a/src/views/productionSchedulingPlan/schedulingDashboard/container.vue
+++ b/src/views/productionSchedulingPlan/schedulingDashboard/container.vue
@@ -304,7 +304,8 @@
:key="taskIndex"
class="task-bar"
:class="{
- 'task-bar-narrow': getWidthPercent(task.planStartTime, task.planEndTime) < 2.1,
+ 'task-bar-narrow':
+ getWidthPercent(task.planStartTime, task.planEndTime) < 2.1,
}"
:style="{
left: `${getPositionPercent(task.planStartTime)}%`,
@@ -323,23 +324,28 @@
@mouseenter="showTooltip($event, task, order.woCode)"
@mouseleave="hideTooltip()"
>
-
-
-
{{ task.processName }}
+
+ {{
+ task.processName
+ }}
-
+
{{ task.processName }}
@@ -450,7 +456,7 @@ export default {
name: 'GanttChart',
data() {
return {
- valuerrr:'铜合金化学镀镍',//
+ valuerrr: '铜合金化学镀镍', //
loading: false,
formLabelAlign: {
startTime: null, //时间
@@ -775,17 +781,28 @@ export default {
return offset;
},
// 根据层索引确定窄任务文本的垂直偏移
- getNarrowTaskOffsetByLayerLeft(processName,width,layerIndex) {
- // 偶数层在上方显示(负值),奇数层在下方显示(正值)
- const offset = null;
-
- if (processName.length >= 6) {
- return -15;
- }
- if (processName.length >= 5) {
- return -17;
+ getNarrowTaskOffsetByLayerLeft(processName, widthPercent, layerIndex) {
+ // 偶数层在上方显示(负值),奇数层在下方显示(正值)
+ const textWidth = processName.length * 2;
+ const timeLine = this.$refs.timelineContainer.clientWidth;
+ const taskBarWidth = (timeLine * widthPercent) / 100;
+
+ if (textWidth > taskBarWidth) {
+ console.log('大于宽度的', textWidth, taskBarWidth,processName);
+ if (processName <= 4) {
+ return -7; // 文字超出任务条时,向左偏移一半文字宽度
+ } else {
+ return -textWidth*1.5; // 文字超出任务条时,向左偏移一半文字宽度
+ }
+ } else {
+ // console.log('小于宽度的', textWidth, taskBarWidth,processName);
+ if (processName <= 4) {
+ return -7; // 文字超出任务条时,向左偏移一半文字宽度
+ } else {
+ return -textWidth; // 文字超出任务条时,向左偏移一半文字宽度
+ }
}
- return -7
+ // return -7; // 默认偏移
},
handleParamsChange() {
// 参数变化时的处理逻辑