Parcourir la source

pms 瑞都 任务 更新任务实际状态

zhangcl il y a 1 jour
Parent
commit
b443fdf897

+ 5 - 0
src/api/pms/iotrddailyreport/index.ts

@@ -89,4 +89,9 @@ export const IotRdDailyReportApi = {
   exportIotRdDailyReport: async (params) => {
     return await request.download({ url: `/pms/iot-rd-daily-report/export-excel`, params })
   },
+
+  // 查询项目任务实际进度列表
+  taskActualProgress: async (params: any) => {
+    return await request.get({ url: `/pms/iot-rd-daily-report/taskActualProgress`, params })
+  },
 }

+ 36 - 9
src/views/pms/iotprojectinfo/index.vue

@@ -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) {

+ 2 - 0
src/views/pms/iotrddailyreport/FillDailyReportForm.vue

@@ -752,6 +752,7 @@ const fileUploadRef = ref()
 const formData = ref({
   id: undefined,
   deptId: undefined,
+  taskId: undefined,
   companyId: undefined,
   deptName: undefined,
   constructionStartDate: undefined,
@@ -1523,6 +1524,7 @@ const initFormData = (reportData: any) => {
     ...formData.value,
     id: reportData.id,
     deptId: reportData.deptId,
+    taskId: reportData.taskId,
     rdStatus: reportData.rdStatus || '',
     techniqueIds: techniqueIds,
     productionStatus: reportData.productionStatus || '',

+ 2 - 2
src/views/pms/iotrddailyreport/fillDailyReport.vue

@@ -92,7 +92,7 @@
           <!--
           <el-table-column label="项目类别(钻井 修井 注氮 酸化压裂... )" align="center" prop="projectClassification" /> -->
           <!--
-          <el-table-column label="时间节点-结束" align="center" prop="endTime" /> -->
+          <el-table-column label="时间节点-结束" align="center" prop="endTime" />
           <el-table-column
             label="施工开始日期"
             align="center"
@@ -106,7 +106,7 @@
             prop="constructionEndDate"
             :formatter="dateFormatter"
             width="180px"
-          />
+          /> -->
           <el-table-column label="操作" align="center" min-width="120px">
             <template #default="scope">
               <el-button

+ 2 - 1
src/views/pms/iotrddailyreport/index.vue

@@ -103,6 +103,7 @@
           <el-table-column label="桥塞" align="center" prop="bridgePlug" :width="columnWidths.bridgePlug"/>
           <el-table-column label="水方量" align="center" prop="waterVolume" :width="columnWidths.waterVolume"/>
           <el-table-column label="时间H" align="center" prop="hourCount" :width="columnWidths.hourCount"/>
+          <!--
           <el-table-column
             label="施工开始日期"
             align="center"
@@ -116,7 +117,7 @@
             prop="constructionEndDate"
             :formatter="dateFormatter"
             :width="columnWidths.constructionEndDate"
-          />
+          /> -->
           <el-table-column label="当日生产动态" align="center" prop="productionStatus" :width="columnWidths.productionStatus"/>
           <el-table-column label="下步工作计划" align="center" prop="nextPlan" :width="columnWidths.nextPlan"/>
           <el-table-column label="外租设备" align="center" prop="externalRental" :width="columnWidths.externalRental"/>