|
@@ -182,7 +182,13 @@
|
|
<el-table-column :label="t('project.status')" align="center" prop="status" min-width="70">
|
|
<el-table-column :label="t('project.status')" align="center" prop="status" min-width="70">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<el-link type="primary" @click="openTimelineDialog(scope.row)">
|
|
<el-link type="primary" @click="openTimelineDialog(scope.row)">
|
|
- <dict-tag :type="DICT_TYPE.PMS_PROJECT_TASK_SCHEDULE" :value="scope.row.status" />
|
|
|
|
|
|
+ <!-- 修改这里:添加状态判断逻辑 -->
|
|
|
|
+ <template v-if="scope.row.status !== null && scope.row.status !== undefined && scope.row.status !== ''">
|
|
|
|
+ <dict-tag :type="DICT_TYPE.PMS_PROJECT_TASK_SCHEDULE" :value="scope.row.status" />
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ 未更新状态
|
|
|
|
+ </template>
|
|
</el-link>
|
|
</el-link>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -687,7 +693,7 @@ const openTimelineDialog = async (row: any) => {
|
|
currentTaskRow.value = row
|
|
currentTaskRow.value = row
|
|
timelineDialogVisible.value = true
|
|
timelineDialogVisible.value = true
|
|
stepsData.value = [] // 清空旧数据
|
|
stepsData.value = [] // 清空旧数据
|
|
- currentStepIndex.value = 0 // 重置步骤索引
|
|
|
|
|
|
+ currentStepIndex.value = -1 // 初始化为-1,不选中任何步骤
|
|
|
|
|
|
try {
|
|
try {
|
|
// 获取任务进度字典
|
|
// 获取任务进度字典
|
|
@@ -712,42 +718,49 @@ const openTimelineDialog = async (row: any) => {
|
|
const dictItem = taskScheduleDictOptions.value.find(dict => dict.value === item.status)
|
|
const dictItem = taskScheduleDictOptions.value.find(dict => dict.value === item.status)
|
|
const statusLabel = dictItem ? dictItem.label : `未知状态 (${item.status})`
|
|
const statusLabel = dictItem ? dictItem.label : `未知状态 (${item.status})`
|
|
|
|
|
|
- // 核心修改:判断当前计划任务状态是否与当前行任务状态匹配
|
|
|
|
- const isCurrentStep = item.status === row.status;
|
|
|
|
return {
|
|
return {
|
|
title: `${formattedTimestamp} ${statusLabel}`,
|
|
title: `${formattedTimestamp} ${statusLabel}`,
|
|
- // 如果匹配,description 设置为“当前进度”,否则设为空字符串
|
|
|
|
- description: isCurrentStep ? '当前进度' : '',
|
|
|
|
- // 可以根据需要设置 status,例如当前节点高亮
|
|
|
|
- status: isCurrentStep ? 'process' : undefined
|
|
|
|
|
|
+ description: '', // 初始为空
|
|
|
|
+ status: undefined // 初始状态为任何特殊状态
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
- // 计算当前步骤索引
|
|
|
|
- const currentStatus = row.status;
|
|
|
|
- let activeIndex = -1;
|
|
|
|
-
|
|
|
|
- // 找到第一个状态大于当前任务状态的计划,当前步骤就是前一个
|
|
|
|
- for (let i = 0; i < sortedSchedules.length; i++) {
|
|
|
|
- if (currentStatus < sortedSchedules[i].status) {
|
|
|
|
- activeIndex = i - 0.5; // 中间状态
|
|
|
|
- break;
|
|
|
|
- } else if (currentStatus === sortedSchedules[i].status) {
|
|
|
|
- activeIndex = i; // 正好在这个节点上
|
|
|
|
- break;
|
|
|
|
|
|
+ // 只有当任务有明确状态时才计算当前步骤
|
|
|
|
+ if (row.status !== null && row.status !== undefined && row.status !== '') {
|
|
|
|
+ const currentStatus = row.status;
|
|
|
|
+ let activeIndex = -1;
|
|
|
|
+
|
|
|
|
+ // 找到第一个状态大于当前任务状态的计划,当前步骤就是前一个
|
|
|
|
+ for (let i = 0; i < sortedSchedules.length; i++) {
|
|
|
|
+ if (currentStatus < sortedSchedules[i].status) {
|
|
|
|
+ activeIndex = i - 0.5; // 中间状态
|
|
|
|
+ break;
|
|
|
|
+ } else if (currentStatus === sortedSchedules[i].status) {
|
|
|
|
+ activeIndex = i; // 正好在这个节点上
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- // 如果当前状态大于所有计划进度状态,则显示最后一步已完成
|
|
|
|
- if (activeIndex === -1 && sortedSchedules.length > 0) {
|
|
|
|
- if (currentStatus > sortedSchedules[sortedSchedules.length - 1].status) {
|
|
|
|
- activeIndex = sortedSchedules.length;
|
|
|
|
- } else {
|
|
|
|
- activeIndex = sortedSchedules.length - 1;
|
|
|
|
|
|
+ // 如果当前状态大于所有计划进度状态,则显示最后一步已完成
|
|
|
|
+ if (activeIndex === -1 && sortedSchedules.length > 0) {
|
|
|
|
+ if (currentStatus > sortedSchedules[sortedSchedules.length - 1].status) {
|
|
|
|
+ activeIndex = sortedSchedules.length;
|
|
|
|
+ } else {
|
|
|
|
+ activeIndex = sortedSchedules.length - 1;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- currentStepIndex.value = Math.max(0, activeIndex);
|
|
|
|
|
|
+ currentStepIndex.value = Math.max(0, activeIndex);
|
|
|
|
+
|
|
|
|
+ // 更新步骤数据,设置当前步骤的描述和状态
|
|
|
|
+ if (currentStepIndex.value >= 0 && currentStepIndex.value < stepsData.value.length) {
|
|
|
|
+ stepsData.value = stepsData.value.map((step, index) => ({
|
|
|
|
+ ...step,
|
|
|
|
+ description: index === currentStepIndex.value ? '当前进度' : '',
|
|
|
|
+ status: index === currentStepIndex.value ? 'process' : undefined
|
|
|
|
+ }))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
stepsData.value = []
|
|
stepsData.value = []
|
|
}
|
|
}
|