|
|
@@ -203,7 +203,7 @@
|
|
|
<el-link type="primary" @click="openTimelineDialog(scope.row)">
|
|
|
<!-- 修改这里:添加状态判断逻辑 -->
|
|
|
<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" />
|
|
|
+ <dict-tag :type="getStatusDictType(scope.row.deptId)" :value="scope.row.status" />
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
未更新状态
|
|
|
@@ -319,6 +319,7 @@ import * as DeptApi from "@/api/system/dept"; // 引入部门API
|
|
|
import { handleTree } from "@/utils/tree"; // 引入树形处理工具
|
|
|
import { IotProjectTaskScheduleApi } from '@/api/pms/iotprojecttaskschedule'
|
|
|
import { IotRhDailyReportApi } from '@/api/pms/iotrhdailyreport'
|
|
|
+import { IotRdDailyReportApi } from '@/api/pms/iotrddailyreport'
|
|
|
import dayjs from 'dayjs' // 引入 dayjs 用于时间格式化
|
|
|
import { ref, reactive, onMounted, computed, nextTick, watch } from 'vue'
|
|
|
|
|
|
@@ -811,15 +812,26 @@ const openTimelineDialog = async (row: any) => {
|
|
|
try {
|
|
|
// 获取任务进度字典
|
|
|
if (taskScheduleDictOptions.value.length === 0) {
|
|
|
- await getTaskScheduleDictOptions()
|
|
|
+ await getTaskScheduleDictOptions(row.deptId)
|
|
|
}
|
|
|
|
|
|
// 获取计划进度数据
|
|
|
const params = { taskId: row.id }
|
|
|
const response = await IotProjectTaskScheduleApi.getIotProjectTaskSchedules(params)
|
|
|
|
|
|
- // 获取实际进度数据
|
|
|
- const actualProgress = await IotRhDailyReportApi.taskActualProgress(params)
|
|
|
+ // 根据 deptId 决定调用哪个接口获取实际进度
|
|
|
+ let actualProgress = null
|
|
|
+ if (row.deptId === 157) {
|
|
|
+ // 瑞恒 157 - 调用瑞恒日报API
|
|
|
+ actualProgress = await IotRhDailyReportApi.taskActualProgress(params)
|
|
|
+ } else if (row.deptId === 163) {
|
|
|
+ // 瑞都 163 - 调用瑞都日报API
|
|
|
+ actualProgress = await IotRdDailyReportApi.taskActualProgress(params)
|
|
|
+ } else {
|
|
|
+ // 其他情况,可以根据需要添加更多条件或保持为空
|
|
|
+ console.warn(`未知的部门ID: ${row.deptId},无法获取实际进度`)
|
|
|
+ actualProgress = []
|
|
|
+ }
|
|
|
|
|
|
// 处理计划进度数据
|
|
|
if (response && response.length > 0) {
|
|
|
@@ -844,12 +856,16 @@ const openTimelineDialog = async (row: any) => {
|
|
|
const sortedActualProgress = actualProgress.sort((a, b) =>
|
|
|
(a.constructionStartDate || 0) - (b.constructionStartDate || 0)
|
|
|
);
|
|
|
+ // 根据 deptId 决定使用哪个状态字段
|
|
|
+ const statusField = row.deptId === 163 ? 'rdStatus' : 'constructionStatus';
|
|
|
|
|
|
actualStepsData.value = sortedActualProgress.map((item: any) => {
|
|
|
const formattedTimestamp = item.constructionStartDate ?
|
|
|
dayjs(item.constructionStartDate).format('YYYY-MM-DD HH:mm') : '时间未设置'
|
|
|
- const dictItem = taskScheduleDictOptions.value.find(dict => dict.value === item.constructionStatus)
|
|
|
- const statusLabel = dictItem ? dictItem.label : `未知状态 (${item.constructionStatus})`
|
|
|
+ // 使用动态的状态字段
|
|
|
+ const statusValue = item[statusField];
|
|
|
+ const dictItem = taskScheduleDictOptions.value.find(dict => dict.value === statusValue)
|
|
|
+ const statusLabel = dictItem ? dictItem.label : `未知状态 (${statusValue})`
|
|
|
|
|
|
return {
|
|
|
title: `${formattedTimestamp} ${statusLabel}`,
|
|
|
@@ -869,9 +885,10 @@ const openTimelineDialog = async (row: any) => {
|
|
|
}
|
|
|
|
|
|
/** 获取任务进度字典数据 */
|
|
|
-const getTaskScheduleDictOptions = async () => {
|
|
|
+const getTaskScheduleDictOptions = async (deptId: number) => {
|
|
|
try {
|
|
|
- taskScheduleDictOptions.value = getStrDictOptions(DICT_TYPE.PMS_PROJECT_TASK_SCHEDULE)
|
|
|
+ const dictType = getStatusDictType(deptId);
|
|
|
+ taskScheduleDictOptions.value = getStrDictOptions(dictType)
|
|
|
} catch (error) {
|
|
|
console.error('获取任务进度字典失败:', error)
|
|
|
taskScheduleDictOptions.value = []
|
|
|
@@ -935,6 +952,16 @@ const handleExport = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/** 根据部门ID获取状态字典类型 */
|
|
|
+const getStatusDictType = (deptId: number) => {
|
|
|
+ if (deptId === 163) {
|
|
|
+ return DICT_TYPE.PMS_PROJECT_RD_STATUS; // 瑞都
|
|
|
+ } else if (deptId === 157) {
|
|
|
+ return DICT_TYPE.PMS_PROJECT_TASK_SCHEDULE; // 瑞恒
|
|
|
+ }
|
|
|
+ return DICT_TYPE.PMS_PROJECT_TASK_SCHEDULE; // 默认瑞恒
|
|
|
+}
|
|
|
+
|
|
|
// 声明 ResizeObserver 实例
|
|
|
let resizeObserver: ResizeObserver | null = null;
|
|
|
|
|
|
@@ -946,7 +973,7 @@ onMounted(async () => {
|
|
|
deptList.value = handleTree(await DeptApi.companyLevelChildrenDepts());
|
|
|
getList()
|
|
|
// 预加载任务进度字典
|
|
|
- getTaskScheduleDictOptions()
|
|
|
+ // getTaskScheduleDictOptions()
|
|
|
|
|
|
// 创建 ResizeObserver 监听表格容器尺寸变化
|
|
|
if (tableContainerRef.value?.$el) {
|