From 28fc65c34d1642b007dc45b83782e23be58d718c Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期三, 08 七月 2026 16:43:58 +0800
Subject: [PATCH] 已进行排班并且人员已打卡的前提下,对应的班次配置不能编辑删除。

---
 src/views/equipmentManagement/inspectionManagement/index.vue |   97 ++++++++++++++++++++++++++++++++++--------------
 1 files changed, 69 insertions(+), 28 deletions(-)

diff --git a/src/views/equipmentManagement/inspectionManagement/index.vue b/src/views/equipmentManagement/inspectionManagement/index.vue
index 44103ac..8c0d52c 100644
--- a/src/views/equipmentManagement/inspectionManagement/index.vue
+++ b/src/views/equipmentManagement/inspectionManagement/index.vue
@@ -52,7 +52,8 @@
                   total: total,
                   layout: 'total, sizes, prev, pager, next, jumper'
                 }"
-                  :table-style="{ width: '100%', height: 'calc(100vh - 23em)' }">
+                  height="calc(100vh - 23em)"
+                  :table-style="{ width: '100%' }">
           <template #inspector="{ row }">
             <div class="person-tags">
               <!-- 璋冭瘯淇℃伅锛屼笂绾挎椂鍒犻櫎 -->
@@ -71,7 +72,8 @@
             </div>
           </template>
           <template #isEnabled="{ row }">
-            <el-tag :type="row.isEnabled === 1 ? 'success' : 'danger'" size="small">
+            <el-tag :type="row.isEnabled === 1 ? 'success' : 'danger'"
+                    size="small">
               {{ row.isEnabled == 1 ? '鏄�' : '鍚�' }}
             </el-tag>
           </template>
@@ -81,6 +83,9 @@
     <form-dia ref="formDia"
               @closeDia="handleQuery"></form-dia>
     <view-files ref="viewFiles"></view-files>
+    <upload-files ref="uploadFiles"
+                  @success="handleQuery"
+                  @closeDia="handleQuery"></upload-files>
   </div>
 </template>
 
@@ -88,10 +93,12 @@
   import { Delete, Plus } from "@element-plus/icons-vue";
   import { onMounted, ref, reactive, getCurrentInstance, nextTick } from "vue";
   import { ElMessageBox } from "element-plus";
+  import dayjs from "dayjs";
 
   // 缁勪欢寮曞叆
   import PIMTable from "@/components/PIMTable/PIMTable.vue";
   import FormDia from "@/views/equipmentManagement/inspectionManagement/components/formDia.vue";
+  import UploadFiles from "@/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue";
   import ViewFiles from "@/views/equipmentManagement/inspectionManagement/components/viewFiles.vue";
 
   // 鎺ュ彛寮曞叆
@@ -105,6 +112,7 @@
   const { proxy } = getCurrentInstance();
   const formDia = ref();
   const viewFiles = ref();
+  const uploadFiles = ref();
 
   // 鏌ヨ鍙傛暟
   const queryParams = reactive({
@@ -114,8 +122,8 @@
   // 鍗曢�夋閰嶇疆
   const activeRadio = ref("taskManage");
   const radios = reactive([
-    { name: "taskManage", label: "瀹氭椂浠诲姟绠$悊" },
-    { name: "task", label: "瀹氭椂浠诲姟璁板綍" },
+    { name: "taskManage", label: "宸℃浠诲姟" },
+    { name: "task", label: "宸℃璁板綍" },
   ]);
 
   // 琛ㄦ牸鏁版嵁
@@ -130,27 +138,21 @@
 
   // 鍒楅厤缃�
   const columns = ref([
-    { prop: "taskName", label: "宸℃浠诲姟鍚嶇О", minWidth: 160 },
-    { prop: "inspectionProject", label: "宸℃椤圭洰", minWidth: 150 },
-    { prop: "remarks", label: "澶囨敞", minWidth: 150 },
-    { prop: "inspector", label: "鎵ц宸℃浜�", minWidth: 150, slot: "inspector" },
+    { prop: "taskName", label: "宸℃浠诲姟鍚嶇О", minWidth: 200 },
+    { prop: "inspectionProject", label: "宸℃椤圭洰", minWidth: 180 },
+    { prop: "remarks", label: "澶囨敞", minWidth: 180 },
+    { prop: "inspector", label: "鎵ц宸℃浜�", minWidth: 180, slot: "inspector" },
     {
       prop: "isEnabled",
       label: "鏄惁鍚敤",
       minWidth: 100,
       dataType: "slot",
-      slot: "isEnabled"
+      slot: "isEnabled",
     },
     {
       prop: "frequencyType",
       label: "棰戞",
-      minWidth: 150,
-      // formatter: (_, __, val) => ({
-      //   DAILY: "姣忔棩",
-      //   WEEKLY: "姣忓懆",
-      //   MONTHLY: "姣忔湀",
-      //   QUARTERLY: "瀛e害"
-      // }[val] || "")
+      minWidth: 120,
       formatData: params => {
         return params === "DAILY"
           ? "姣忔棩"
@@ -166,7 +168,7 @@
     {
       prop: "frequencyDetail",
       label: "寮�濮嬫棩鏈熶笌鏃堕棿",
-      minWidth: 150,
+      minWidth: 200,
       formatter: (row, column, cellValue) => {
         // 鍏堝垽鏂槸鍚︽槸瀛楃涓�
         if (typeof cellValue !== "string") return "";
@@ -187,8 +189,33 @@
         );
       },
     },
-    { prop: "registrant", label: "鐧昏浜�", minWidth: 100 },
-    { prop: "createTime", label: "鐧昏鏃ユ湡", minWidth: 100 },
+    { prop: "registrant", label: "鐧昏浜�", minWidth: 120 },
+    {
+      prop: "createTime",
+      label: "鐧昏鏃ユ湡",
+      minWidth: 180,
+      formatData: cell => {
+        if (!cell) return "-";
+        try {
+          return dayjs(cell).format("YYYY-MM-DD HH:mm:ss");
+        } catch {
+          return cell;
+        }
+      },
+    },
+    // {
+    //   prop: "inspectionResult",
+    //   label: "宸℃缁撴灉",
+    //   minWidth: 100,
+    //   dataType: "tag",
+    //   formatData: val => {
+    //     return val == 1 ? "姝e父" : "寮傚父";
+    //   },
+    //   formatType: val => {
+    //     return val == 1 ? "success" : "danger";
+    //   },
+    // },
+    { prop: "abnormalDescription", label: "寮傚父鎻忚堪", minWidth: 150 },
   ]);
 
   // 鎿嶄綔鍒楅厤缃�
@@ -197,8 +224,9 @@
 
     const operationConfig = {
       label: "鎿嶄綔",
-      width: 130,
+      width: operations.length > 1 ? 180 : 130,
       fixed: "right",
+      align: "center",
       dataType: "action",
       operation: operations
         .map(op => {
@@ -207,6 +235,12 @@
               return {
                 name: "缂栬緫",
                 clickFun: handleAdd,
+                color: "#409EFF",
+              };
+            case "upload":
+              return {
+                name: "涓婁紶",
+                clickFun: openUploadDialog,
                 color: "#409EFF",
               };
             case "viewFile":
@@ -239,14 +273,14 @@
       ];
       operationsArr.value = ["edit"];
     } else if (value === "task") {
-      const operationColumn = getOperationColumn(["viewFile"]);
-      // 瀹氭椂浠诲姟璁板綍涓嶅睍绀�"鏄惁鍚敤"鍒�
+      const operationColumn = getOperationColumn(["upload", "viewFile"]);
+      // 宸℃璁板綍涓嶅睍绀�"鏄惁鍚敤"鍒�
       const taskColumns = columns.value.filter(col => col.prop !== "isEnabled");
       tableColumns.value = [
         ...taskColumns,
         ...(operationColumn ? [operationColumn] : []),
       ];
-      operationsArr.value = ["viewFile"];
+      operationsArr.value = ["upload", "viewFile"];
     }
     pageNum.value = 1;
     pageSize.value = 10;
@@ -288,6 +322,7 @@
         // 澶勭悊 inspector 瀛楁锛屽皢瀛楃涓茶浆鎹负鏁扮粍锛堥�傜敤浜庢墍鏈夋儏鍐碉級
         tableData.value = rawData.map(item => {
           const processedItem = { ...item };
+          processedItem.__raw = { ...item };
 
           // 澶勭悊 inspector 瀛楁
           if (processedItem.inspector) {
@@ -340,6 +375,12 @@
     });
   };
 
+  const openUploadDialog = row => {
+    nextTick(() => {
+      uploadFiles.value?.openDialog(row);
+    });
+  };
+
   // 鍒犻櫎鎿嶄綔
   const handleDelete = () => {
     if (!selectedRows.value.length) {
@@ -376,11 +417,11 @@
       .then(() => {
         // 鏍规嵁褰撳墠閫変腑鐨勬爣绛鹃〉璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
         if (activeRadio.value === "taskManage") {
-          // 瀹氭椂浠诲姟绠$悊
-          proxy.download("/timingTask/export", {}, "瀹氭椂浠诲姟绠$悊.xlsx");
+          // 宸℃浠诲姟
+          proxy.download("/timingTask/export", {}, "宸℃浠诲姟.xlsx");
         } else if (activeRadio.value === "task") {
-          // 瀹氭椂浠诲姟璁板綍
-          proxy.download("/inspectionTask/export", {}, "瀹氭椂浠诲姟璁板綍.xlsx");
+          // 宸℃璁板綍
+          proxy.download("/inspectionTask/export", {}, "宸℃璁板綍.xlsx");
         }
       })
       .catch(() => {
@@ -405,4 +446,4 @@
     color: #909399;
     font-size: 14px;
   }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3