From b7acf69e89d4e5cc1b92304add88fd9277a616f7 Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期五, 17 四月 2026 10:22:58 +0800
Subject: [PATCH] fix(报工管理): 修复审核按钮权限控制逻辑

---
 src/views/productionManagement/productionReporting/index.vue |   76 ++++++++++++++++++++++---------------
 1 files changed, 45 insertions(+), 31 deletions(-)

diff --git a/src/views/productionManagement/productionReporting/index.vue b/src/views/productionManagement/productionReporting/index.vue
index f06131a..52e040a 100644
--- a/src/views/productionManagement/productionReporting/index.vue
+++ b/src/views/productionManagement/productionReporting/index.vue
@@ -180,6 +180,9 @@
   import { productionProductMainListPage, productAudit } from "@/api/productionManagement/productionProductMain.js";
   import { userListNoPageByTenantId } from "@/api/system/user.js";
   import InputModal from "@/views/productionManagement/productionReporting/Input.vue";
+  import useUserStore from "@/store/modules/user";
+
+  const userStore = useUserStore();
 
   const data = reactive({
     searchForm: {
@@ -209,14 +212,33 @@
       width: 120,
     },
     {
+      label: "宸ュ簭",
+      prop: "process",
+      width: 120,
+    },
+    {
       label: "鎶ュ伐浜哄憳",
       prop: "nickName",
       width: 120,
     },
-    {
-      label: "宸ュ簭",
-      prop: "process",
+     {
+      label: "瀹℃牳浜�",
+      prop: "auditUserName",
       width: 120,
+    },
+     {
+      label: "瀹℃牳鐘舵��",
+      prop: "auditStatus",
+      width: 120,
+      dataType: "tag",
+      formatData: val => {
+        const statusMap = { 0: "鏈鏍�", 1: "閫氳繃", 2: "涓嶉�氳繃" };
+        return statusMap[val] ?? "鏈煡";
+      },
+      formatType: val => {
+        const typeMap = { 0: "info", 1: "success", 2: "danger" };
+        return typeMap[val] ?? "";
+      },
     },
     {
       label: "宸ュ崟缂栧彿",
@@ -254,23 +276,9 @@
       width: 120,
     },
     {
-      label: "瀹℃牳浜�",
-      prop: "auditUserName",
-      width: 120,
-    },
-    {
-      label: "瀹℃牳鐘舵��",
-      prop: "auditStatus",
-      width: 120,
-      dataType: "tag",
-      formatData: val => {
-        const statusMap = { 0: "鏈鏍�", 1: "閫氳繃", 2: "涓嶉�氳繃" };
-        return statusMap[val] ?? "鏈煡";
-      },
-      formatType: val => {
-        const typeMap = { 0: "info", 1: "success", 2: "danger" };
-        return typeMap[val] ?? "";
-      },
+      label: "澶囨敞淇℃伅",
+      prop: "auditOpinion",
+      minWidth: 120,
     },
     {
       label: "鍒涘缓鏃堕棿",
@@ -292,20 +300,18 @@
           },
         },
         {
-          name:"瀹℃牳",
-          // 榛勮壊
-          color: "#E6A23C",
-          clickFun: row => {
-            handleAudit(row);
-          },
-          showHide: row => Number(row?.auditStatus) === 0, // 浠呭綋鏈鏍告椂鏄剧ず瀹℃牳鎸夐挳
-        },
-        {
           name: "鍒犻櫎",
           type: "danger",
           clickFun: row => {
             deleteReport(row);
           },
+        },
+        {
+          name:"瀹℃牳",
+          clickFun: row => {
+            handleAudit(row);
+          },
+          disabled: row => Number(row?.auditStatus) !== 0 || row.auditUserId !== userStore.id, // 宸插鏍告垨涓嶆槸鎸囧畾瀹℃牳浜烘椂绂佺敤
         },
       ],
     },
@@ -499,8 +505,12 @@
 
    // 瀹℃牳
   const handleAudit = (row) => {
-    if (Number(row?.auditStatus) === 1) {
+    if (Number(row?.auditStatus) !== 0) {
       ElMessage.warning("璇ュ伐鍗曞凡瀹℃牳");
+      return;
+    }
+    if (row.auditUserId !== userStore.id) {
+      ElMessage.warning("鎮ㄤ笉鏄宸ュ崟鐨勬寚瀹氬鏍镐汉");
       return;
     }
     // 閲嶇疆琛ㄥ崟锛岄粯璁ら�夋嫨閫氳繃
@@ -544,7 +554,11 @@
       productAudit(auditData)
         .then(res => {
           if (res.code === 200) {
-            proxy.$modal.msgSuccess(auditResult === 1 ? "瀹℃牳閫氳繃" : "瀹℃牳涓嶉�氳繃");
+            if(form.value.auditResult == 1){
+              proxy.$modal.msgSuccess("瀹℃牳閫氳繃");
+            }else{
+              proxy.$modal.msgError("瀹℃牳涓嶉�氳繃");
+            }
             auditDialogVisible.value = false;
             getList();
           } else {

--
Gitblit v1.9.3