Преглед изворни кода

fix: 修改时间报错报错问题

lixuan пре 2 месеци
родитељ
комит
9cc5b03288

+ 5 - 3
src/views/production-safety/productionSafetySystem/safetySystemConstructionWorkPlanManagement/components/safetySystemConstructionWorkPlanManagementDetail.vue

@@ -214,9 +214,11 @@
   //  时间格式化
   const formatDate = (date) => {
     if (!date) return '';
-    const year = date.getFullYear();
-    const month = String(date.getMonth() + 1).padStart(2, '0');
-    const day = String(date.getDate()).padStart(2, '0');
+    const dateObj = typeof date === 'object' && date instanceof Date ? date : new Date(date);
+    if (isNaN(dateObj.getTime())) return '';
+    const year = dateObj.getFullYear();
+    const month = String(dateObj.getMonth() + 1).padStart(2, '0');
+    const day = String(dateObj.getDate()).padStart(2, '0');
     return `${year}-${month}-${day}`; // 输出:****-**-**
   };
   //转部门格式 “2,3“ -> [2,3]

+ 3 - 3
src/views/production-safety/productionSafetySystem/safetySystemConstructionWorkPlanManagementDept/safetySystemConstructionWorkPlanManagementDept.vue

@@ -78,12 +78,12 @@
             </template>
             <template #action="scope">
               <div class="action-container--div" style="justify-content: left">
-                <!-- 进行中(1)/待反馈:查看 -->
-                <template v-if="Number(scope.row.status) === 1">
+                <!-- 进行中(2)/待反馈:查看 -->
+                <template v-if="Number(scope.row.status) === 2">
                   <ActionButton text="反馈" @click="handleIssue(scope.row.id)" />
                 </template>
 
-                <!-- 已完成(2):删除、查看 -->
+                <!-- 已完成(3):删除、查看 -->
                 <template v-else>
                   <ActionButton text="查看" @click="handleView(scope.row.id)" />
                 </template>