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 |  182 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 135 insertions(+), 47 deletions(-)

diff --git a/src/views/safeProduction/emergencyPlanReview/index.vue b/src/views/safeProduction/emergencyPlanReview/index.vue
index 26a3cfe..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"
@@ -52,17 +52,18 @@
       <el-form ref="formRef"
                :model="form"
                :rules="rules"
-               label-width="120px">
+               label-position="top"
+               label-width="150px">
         <el-row :gutter="20">
           <el-col :span="12">
-            <el-form-item label="搴旀�ラ妗堢紪鐮�"
+            <el-form-item label="搴旀�ラ妗堢紪鐮侊細"
                           prop="planCode">
               <el-input v-model="form.planCode"
                         placeholder="璇疯緭鍏ュ簲鎬ラ妗堢紪鐮�" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="搴旀�ラ妗堝悕绉�"
+            <el-form-item label="搴旀�ラ妗堝悕绉帮細"
                           prop="planName">
               <el-input v-model="form.planName"
                         placeholder="璇疯緭鍏ュ簲鎬ラ妗堝悕绉�" />
@@ -99,7 +100,7 @@
         </el-row>
         <el-row :gutter="20">
           <el-col :span="12">
-            <el-form-item label="棰勬绫诲瀷"
+            <el-form-item label="棰勬绫诲瀷锛�"
                           prop="planType">
               <el-select v-model="form.planType"
                          placeholder="璇烽�夋嫨棰勬绫诲瀷"
@@ -112,24 +113,25 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="澶囨敞"
+            <el-form-item label="澶囨敞锛�"
                           prop="remark">
               <el-input v-model="form.remark"
                         placeholder="璇疯緭鍏ュ娉�" />
             </el-form-item>
           </el-col>
         </el-row>
-        <el-form-item label="閫傜敤鑼冨洿"
+        <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="搴旀�ュ缃楠�"
+        <el-form-item label="搴旀�ュ缃楠わ細"
                       prop="execSteps">
           <div class="exec-steps-container"
                style="width:100%">
@@ -164,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>
@@ -201,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>
@@ -216,7 +218,7 @@
               <div v-for="(step, index) in JSON.parse(currentKnowledge.execSteps)"
                    :key="index"
                    class="exec-step-view">
-                <span class="step-number">{{ index + 1 }}.</span>
+                <!-- <span class="step-number">{{ index + 1 }}.</span> -->
                 <span class="step-title">{{ step.step }}锛�</span>
                 <span>{{ step.description }}</span>
               </div>
@@ -249,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,
@@ -325,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);
@@ -359,6 +379,8 @@
     {
       label: "澶囨敞",
       prop: "remark",
+      minWidth: 220,
+      align: "center",
       showOverflowTooltip: true,
     },
     {
@@ -366,7 +388,7 @@
       label: "鎿嶄綔",
       align: "center",
       fixed: "right",
-      width: 200,
+      width: 120,
       operation: [
         {
           name: "缂栬緫",
@@ -391,6 +413,7 @@
     userListNoPage().then(res => {
       userList.value = res.data;
     });
+    loadApplyScopeOptions();
     getList();
     startAutoRefresh();
   });
@@ -425,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(() => {
@@ -444,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;
@@ -455,7 +494,7 @@
   const pagination = obj => {
     page.value.current = obj.page;
     page.value.size = obj.limit;
-    handleQuery();
+    getList();
   };
 
   // 閫夋嫨鍙樺寲澶勭悊
@@ -470,6 +509,7 @@
       dialogTitle.value = "鏂板搴旀�ラ妗�";
       // 閲嶇疆琛ㄥ崟
       Object.assign(form.value, {
+        id: undefined,
         planCode: "", // 棰勬缂栧彿
         applyScope: [], // 閫傜敤鑼冨洿
         planType: "", // 棰勬绫诲瀷
@@ -486,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, // 鍙戝竷鏃堕棿
@@ -506,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),
+    }));
   };
 
   // 鑾峰彇绫诲瀷鏍囩绫诲瀷
@@ -601,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("娣诲姞鎴愬姛");
@@ -618,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("鏇存柊鎴愬姛");
@@ -739,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;
   }
@@ -764,45 +814,83 @@
 
   .exec-steps-container {
     border: 1px solid #e4e7ed;
-    border-radius: 4px;
-    padding: 15px;
+    border-radius: 8px;
+    padding: 20px;
     background-color: #f9fafc;
+    margin-top: 10px;
   }
 
   .exec-step-item {
-    margin-bottom: 10px;
-    padding: 10px;
+    margin-bottom: 12px;
+    padding: 12px;
     background-color: #ffffff;
     border: 1px solid #e4e7ed;
-    border-radius: 4px;
+    border-radius: 6px;
+    transition: all 0.3s ease;
+  }
+
+  .exec-step-item:hover {
+    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+    border-color: #c6e2ff;
   }
 
   .step-header {
     display: flex;
     align-items: flex-start;
     flex-direction: column;
+    gap: 8px;
   }
 
   .exec-step-view {
-    margin-bottom: 8px;
-    padding-left: 20px;
+    margin-bottom: 16px;
+    padding-left: 24px;
     position: relative;
+    line-height: 1.6;
+  }
+
+  .exec-step-view::before {
+    content: "";
+    position: absolute;
+    left: 10px;
+    top: 20px;
+    bottom: -16px;
+    width: 2px;
+    background-color: #eaeaea;
+  }
+
+  .exec-step-view:last-child::before {
+    display: none;
   }
 
   .step-number {
     position: absolute;
     left: 0;
+    top: 0;
+    width: 20px;
+    height: 20px;
+    line-height: 20px;
+    text-align: center;
     font-weight: bold;
-    color: #409eff;
+    color: #ffffff;
+    background-color: #409eff;
+    border-radius: 50%;
+    font-size: 12px;
+    z-index: 1;
   }
 
   .step-title {
-    font-weight: bold;
-    margin-right: 5px;
+    font-weight: 600;
+    margin-right: 8px;
+    color: #395a9c;
   }
 
   .no-data {
     color: #909399;
     font-style: italic;
+    text-align: center;
+    padding: 20px;
+    background-color: #f8f9fa;
+    border-radius: 4px;
+    margin-top: 10px;
   }
 </style>

--
Gitblit v1.9.3