From f24084d0173639e56801f63c638eaa0bd8ecb421 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期一, 15 六月 2026 15:24:19 +0800
Subject: [PATCH] 人员薪资只能审核人可以进行审核

---
 src/views/personnelManagement/monthlyStatistics/index.vue               |   12 +++++++++---
 src/views/personnelManagement/monthlyStatistics/components/auditDia.vue |   17 ++++++++++++-----
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/views/personnelManagement/monthlyStatistics/components/auditDia.vue b/src/views/personnelManagement/monthlyStatistics/components/auditDia.vue
index 48a41f0..e615402 100644
--- a/src/views/personnelManagement/monthlyStatistics/components/auditDia.vue
+++ b/src/views/personnelManagement/monthlyStatistics/components/auditDia.vue
@@ -86,7 +86,7 @@
 <script setup>
 import { ref, computed, reactive, toRefs, getCurrentInstance, watch } from "vue";
 import { ElMessage } from "element-plus";
-import Cookies from "js-cookie";
+import useUserStore from "@/store/modules/user";
 import FormDialog from "@/components/Dialog/FormDialog.vue";
 import { staffSalaryMainUpdate } from "@/api/personnelManagement/staffSalaryMain.js";
 
@@ -98,6 +98,7 @@
 });
 
 const { proxy } = getCurrentInstance();
+const userStore = useUserStore();
 
 const dialogVisible = computed({
   get: () => props.modelValue,
@@ -176,15 +177,21 @@
       return;
     }
     
-    const username = Cookies.get("username") || "";
-    const userIdRaw = Cookies.get("userId");
-    const auditUserId = userIdRaw ? Number(userIdRaw) : undefined;
+    const username = userStore.name || "";
+    const currentUserId = Number(userStore.id);
+    const assignedAuditUserId = Number(row?.auditUserId);
+    
+    // 鏉冮檺楠岃瘉锛氬彧鏈夋寚瀹氱殑瀹℃牳浜烘墠鑳借繘琛屽鏍�
+    if (!currentUserId || currentUserId !== assignedAuditUserId) {
+      ElMessage.warning("鎮ㄤ笉鏄寚瀹氱殑瀹℃牳浜猴紝鏃犳硶杩涜瀹℃牳鎿嶄綔");
+      return;
+    }
     
     // 鏋勫缓瀹℃牳鏁版嵁
     const submitData = {
       id: row.id,
       status: Number(auditResult.value) === 2 ? 2 : 4, // 2=涓嶉�氳繃 4=閫氳繃(寰呭彂鏀�)
-      auditUserId,
+      auditUserId: currentUserId,
       auditUserName: username,
     };
     loading.value = true;
diff --git a/src/views/personnelManagement/monthlyStatistics/index.vue b/src/views/personnelManagement/monthlyStatistics/index.vue
index 451daf3..f581070 100644
--- a/src/views/personnelManagement/monthlyStatistics/index.vue
+++ b/src/views/personnelManagement/monthlyStatistics/index.vue
@@ -107,7 +107,7 @@
   nextTick,
 } from "vue";
 import { ElMessageBox } from "element-plus";
-import Cookies from "js-cookie";
+import useUserStore from "@/store/modules/user";
 import FormDia from "./components/formDia.vue";
 import BankSettingDia from "./components/bankSettingDia.vue";
 import AuditDia from "./components/auditDia.vue";
@@ -167,7 +167,12 @@
       {
         name: "瀹℃牳",
         type: "text",
-        disabled: (row) => Number(row?.status) !== 3,
+        disabled: (row) => {
+          const currentUserId = Number(userStore.id);
+          const auditUserId = Number(row?.auditUserId);
+          // 鐘舵�佷笉鏄緟瀹℃牳 鎴� 褰撳墠鐢ㄦ埛涓嶆槸鎸囧畾鐨勫鏍镐汉锛屽垯绂佺敤瀹℃牳鎸夐挳
+          return Number(row?.status) !== 3 || !currentUserId || currentUserId !== auditUserId;
+        },
         clickFun: (row) => openAudit(row),
       },
       {
@@ -193,6 +198,7 @@
 const operationType = ref("add");
 const currentRow = ref({});
 const { proxy } = getCurrentInstance();
+const userStore = useUserStore();
 const bankSetting = ref({});
 const bankDialogVisible = ref(false);
 const bankDiaRef = ref(null);
@@ -404,4 +410,4 @@
 .table_list {
   margin-top: 20px;
 }
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.3