From 6f1acfd2086a1f8c2cb80afd3db4e534e44d545e Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 14 八月 2026 10:33:51 +0800
Subject: [PATCH] fix: 报工明细创建日期格式化

---
 src/views/safeProduction/emergencyPlanReview/index.vue |  107 +++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 78 insertions(+), 29 deletions(-)

diff --git a/src/views/safeProduction/emergencyPlanReview/index.vue b/src/views/safeProduction/emergencyPlanReview/index.vue
index 93658d4..bf06b32 100644
--- a/src/views/safeProduction/emergencyPlanReview/index.vue
+++ b/src/views/safeProduction/emergencyPlanReview/index.vue
@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <div class="search_form">
+    <div class="search_form mb20">
       <div>
         <span class="search_title">搴旀�ラ妗堝悕绉帮細</span>
         <el-input v-model="searchForm.planName"
@@ -122,12 +122,13 @@
         </el-row>
         <el-form-item label="閫傜敤鑼冨洿锛�"
                       prop="applyScope">
-          <el-checkbox-group v-model="form.applyScope">
-            <el-checkbox label="all">鍏ㄤ綋鍛樺伐</el-checkbox>
-            <el-checkbox label="manager">绠$悊灞�</el-checkbox>
-            <el-checkbox label="hr">浜轰簨閮ㄩ棬</el-checkbox>
-            <el-checkbox label="finance">璐㈠姟閮ㄩ棬</el-checkbox>
-            <el-checkbox label="tech">鎶�鏈儴闂�</el-checkbox>
+          <el-checkbox-group v-model="form.applyScope"
+                             class="apply-scope-checkbox-group">
+            <el-checkbox v-for="dept in applyScopeOptions"
+                         :key="dept.deptId"
+                         :value="String(dept.deptId)">
+              {{ dept.deptName }}
+            </el-checkbox>
           </el-checkbox-group>
         </el-form-item>
         <el-form-item label="搴旀�ュ缃楠わ細"
@@ -165,9 +166,9 @@
       </el-form>
       <template #footer>
         <span class="dialog-footer">
-          <el-button @click="dialogVisible = false">鍙栨秷</el-button>
           <el-button type="primary"
                      @click="submitForm">纭畾</el-button>
+          <el-button @click="dialogVisible = false">鍙栨秷</el-button>
         </span>
       </template>
     </el-dialog>
@@ -202,11 +203,11 @@
         <div class="detail-section">
           <h4>閫傜敤鑼冨洿</h4>
           <div class="key-points">
-            <el-tag v-for="(point, index) in currentKnowledge.applyScope.split(',')"
-                    :key="index"
+            <el-tag v-for="(scope, index) in getApplyScopeTags(currentKnowledge)"
+                    :key="`${scope.value}-${index}`"
                     type="primary"
                     style="margin-right: 8px; margin-bottom: 8px;">
-              {{ getApplyScopeLabel(point.trim()) }}
+              {{ scope.label }}
             </el-tag>
           </div>
         </div>
@@ -250,6 +251,7 @@
   import { ElMessage, ElMessageBox } from "element-plus";
   import PIMTable from "@/components/PIMTable/PIMTable.vue";
   import { userListNoPage } from "@/api/system/user.js";
+  import { listDept } from "@/api/system/dept.js";
   import {
     safeContingencyPlanListPage,
     safeContingencyPlanAdd,
@@ -326,32 +328,49 @@
   // 琛ㄥ崟寮曠敤
   const formRef = ref();
   const execStepsList = ref([]);
+  const applyScopeOptions = ref([]);
+  const applyScopeNameMap = computed(() => {
+    return applyScopeOptions.value.reduce((map, dept) => {
+      map[String(dept.deptId)] = dept.deptName;
+      return map;
+    }, {});
+  });
 
   // 琛ㄦ牸鍒楅厤缃�
   const tableColumn = ref([
     {
       label: "搴旀�ラ妗堢紪鐮�",
       prop: "planCode",
+      minWidth: 200,
+      align: "center",
       showOverflowTooltip: true,
     },
     {
       label: "搴旀�ラ妗堝悕绉�",
       prop: "planName",
+      minWidth: 240,
+      align: "center",
       showOverflowTooltip: true,
     },
     {
       label: "鍙戝竷鐢熸晥鏃堕棿",
       prop: "publishTime",
+      minWidth: 160,
+      align: "center",
       showOverflowTooltip: true,
     },
     {
       label: "鏍稿績璐d换浜�",
       prop: "coreResponsorUserName",
+      minWidth: 140,
+      align: "center",
       showOverflowTooltip: true,
     },
     {
       label: "棰勬绫诲瀷",
       prop: "planType",
+      minWidth: 160,
+      align: "center",
       showOverflowTooltip: true,
       formatData: params => {
         return emergencyPlanTypeLabel(params);
@@ -360,6 +379,8 @@
     {
       label: "澶囨敞",
       prop: "remark",
+      minWidth: 220,
+      align: "center",
       showOverflowTooltip: true,
     },
     {
@@ -367,7 +388,7 @@
       label: "鎿嶄綔",
       align: "center",
       fixed: "right",
-      width: 200,
+      width: 120,
       operation: [
         {
           name: "缂栬緫",
@@ -392,6 +413,7 @@
     userListNoPage().then(res => {
       userList.value = res.data;
     });
+    loadApplyScopeOptions();
     getList();
     startAutoRefresh();
   });
@@ -426,6 +448,22 @@
       execStepsList.value = [];
     }
   };
+
+  const loadApplyScopeOptions = () => {
+    listDept({ status: "0" }).then(res => {
+      applyScopeOptions.value = res.data || [];
+    });
+  };
+
+  const parseApplyScope = scope => {
+    if (Array.isArray(scope)) {
+      return scope.map(item => String(item)).filter(Boolean);
+    }
+    return String(scope || "")
+      .split(",")
+      .map(item => item.trim())
+      .filter(Boolean);
+  };
   // 寮�濮嬭嚜鍔ㄥ埛鏂�
   const startAutoRefresh = () => {
     setInterval(() => {
@@ -445,7 +483,7 @@
       .then(res => {
         tableLoading.value = false;
         tableData.value = res.data.records;
-        page.total = res.data.total;
+        page.value.total = res.data.total;
       })
       .catch(err => {
         tableLoading.value = false;
@@ -456,7 +494,7 @@
   const pagination = obj => {
     page.value.current = obj.page;
     page.value.size = obj.limit;
-    handleQuery();
+    getList();
   };
 
   // 閫夋嫨鍙樺寲澶勭悊
@@ -471,6 +509,7 @@
       dialogTitle.value = "鏂板搴旀�ラ妗�";
       // 閲嶇疆琛ㄥ崟
       Object.assign(form.value, {
+        id: undefined,
         planCode: "", // 棰勬缂栧彿
         applyScope: [], // 閫傜敤鑼冨洿
         planType: "", // 棰勬绫诲瀷
@@ -487,7 +526,7 @@
       Object.assign(form.value, {
         id: row.id,
         planCode: row.planCode, // 棰勬缂栧彿
-        applyScope: row.applyScope ? row.applyScope.split(",") : [], // 閫傜敤鑼冨洿
+        applyScope: parseApplyScope(row.applyScope), // 閫傜敤鑼冨洿
         planType: row.planType, // 棰勬绫诲瀷
         planName: row.planName, // 棰勬鍚嶇О
         publishTime: row.publishTime, // 鍙戝竷鏃堕棿
@@ -507,14 +546,13 @@
     viewDialogVisible.value = true;
   };
   const getApplyScopeLabel = scope => {
-    const scopeMap = {
-      all: "鍏ㄤ綋鍛樺伐",
-      manager: "绠$悊灞�",
-      hr: "浜轰簨閮ㄩ棬",
-      finance: "璐㈠姟閮ㄩ棬",
-      tech: "鎶�鏈儴闂�",
-    };
-    return scopeMap[scope] || scope;
+    return applyScopeNameMap.value[String(scope)] || scope;
+  };
+  const getApplyScopeTags = row => {
+    return parseApplyScope(row?.applyScope).map((scope, index) => ({
+      value: scope,
+      label: getApplyScopeLabel(scope),
+    }));
   };
 
   // 鑾峰彇绫诲瀷鏍囩绫诲瀷
@@ -602,12 +640,14 @@
         }
       }
 
-      // 灏嗗簲鎬ュ缃楠よ浆鎹负JSON瀛楃涓�
-      form.value.execSteps = JSON.stringify(execStepsList.value);
+      const submitData = {
+        ...form.value,
+        applyScope: form.value.applyScope.join(","),
+        execSteps: JSON.stringify(execStepsList.value),
+      };
       if (dialogType.value === "add") {
         // 鏂板搴旀�ラ妗�
-        form.value.applyScope = form.value.applyScope.join(",");
-        safeContingencyPlanAdd({ ...form.value })
+        safeContingencyPlanAdd(submitData)
           .then(res => {
             if (res.code == 200) {
               ElMessage.success("娣诲姞鎴愬姛");
@@ -619,8 +659,7 @@
             ElMessage.error(err.msg);
           });
       } else {
-        form.value.applyScope = form.value.applyScope.join(",");
-        safeContingencyPlanUpdate({ ...form.value })
+        safeContingencyPlanUpdate(submitData)
           .then(res => {
             if (res.code == 200) {
               ElMessage.success("鏇存柊鎴愬姛");
@@ -740,6 +779,16 @@
     gap: 8px;
   }
 
+  .apply-scope-checkbox-group {
+    display: flex;
+    flex-wrap: wrap;
+    gap: 8px 16px;
+  }
+
+  .apply-scope-checkbox-group :deep(.el-checkbox) {
+    margin-right: 0;
+  }
+
   .usage-stats {
     margin-top: 16px;
   }

--
Gitblit v1.9.3