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

---
 src/views/personnelManagement/monthlyStatistics/index.vue               |    9 ++++++++-
 src/views/personnelManagement/monthlyStatistics/components/auditDia.vue |   17 ++++++++++++-----
 2 files changed, 20 insertions(+), 6 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 2532cb0..d46d6da 100644
--- a/src/views/personnelManagement/monthlyStatistics/index.vue
+++ b/src/views/personnelManagement/monthlyStatistics/index.vue
@@ -114,6 +114,7 @@
   } 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";
@@ -126,6 +127,7 @@
     staffSalaryMainUpdate,
   } from "@/api/personnelManagement/staffSalaryMain.js";
 
+  const userStore = useUserStore();
   const data = reactive({
     searchForm: {
       salaryTitle: "",
@@ -179,7 +181,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),
         },
         {

--
Gitblit v1.9.3