From 9f3bc47b98cbc51df7cfcea94d4aa0c35f40cbc5 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期二, 13 十月 2026 14:09:06 +0800
Subject: [PATCH] feat: 添加数字格式化工具,支持去掉小数末尾多余的 0 和四舍五入功能

---
 src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js b/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
index 3f0e99c..02215c9 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
@@ -37,6 +37,7 @@
 import {
   APPROVAL_STATUS_SEARCH_OPTIONS,
   APPROVAL_TYPE_OPTIONS,
+  approvalRecordResultLabel,
   approvalStatusLabel,
   approvalStatusTagType,
   approvalTypeLabel,
@@ -48,6 +49,7 @@
   mapInstanceFromApi,
   mapSubmitTemplateCard,
   matchBusinessTypeValue,
+  normalizeApprovalStatusKey,
   unwrapInstancePage,
 } from "./approveListConstants.js";
 
@@ -138,9 +140,19 @@
     ...buildFormPayloadRules(submitFormFields.value),
   }));
 
+  /** 浠呫�屽彂璧蜂汉鏈汉銆嶅湪銆屽凡椹冲洖銆嶇姸鎬佷笅鍙慨鏀� */
+  function canEditInstanceRow(row) {
+    if (!row) return false;
+    const key = normalizeApprovalStatusKey(row.approvalStatus ?? row.statusRaw ?? row.status);
+    if (key !== "rejected") return false;
+    const applicantId = row.applicantId ?? row.applicantNo;
+    if (applicantId == null || applicantId === "") return false;
+    return String(applicantId) === String(userStore.id);
+  }
+
   const tableColumn = ref([
     // { label: "鐢宠浜虹紪鍙�", prop: "applicantNo", width: 110 },
-    { label: "鐢宠浜哄悕绉�", prop: "applicantName", minWidth: 100 },
+    { label: "鍙戣捣浜�", prop: "applicantName", minWidth: 100 },
     { label: "妯℃澘绫诲瀷", prop: "businessName", minWidth: 120 },
     {
       label: "瀹℃壒绫诲瀷",
@@ -154,7 +166,9 @@
       prop: "unread",
       width: 90,
       align: "center",
+      dataType: "tag",
       formatData: (v) => (v ? "鏄�" : "鍚�"),
+      formatType: (v) => (v ? "success" : "danger"),
     },
     {
       label: "瀹℃壒鐘舵��",
@@ -181,7 +195,7 @@
         {
           name: "淇敼",
           type: "text",
-          disabled: (row) => row.approvalStatus !== "pending",
+          disabled: (row) => !canEditInstanceRow(row),
           clickFun: (row) => openEditDialog(row),
         },
         {
@@ -190,11 +204,11 @@
           disabled: (row) => row.approvalStatus !== "pending" || !row.isApprove,
           clickFun: (row) => openApprove(row),
         },
-        {
-          name: "鍒犻櫎",
-          type: "danger",
-          clickFun: (row) => removeInstance(row),
-        },
+        // {
+        //   name: "鍒犻櫎",
+        //   type: "danger",
+        //   clickFun: (row) => removeInstance(row),
+        // },
       ],
     },
   ]);
@@ -393,8 +407,8 @@
   }
 
   async function openEditDialog(row) {
-    if (row?.approvalStatus !== "pending") {
-      ElMessage.warning("浠呭鏍镐腑鐨勫鎵瑰彲淇敼");
+    if (!canEditInstanceRow(row)) {
+      ElMessage.warning("浠呮湰浜哄彂璧枫�佷笖宸茶椹冲洖鐨勫鎵瑰彲淇敼");
       return;
     }
     const moduleKey = inferReimburseModuleKeyFromInstance(row);
@@ -635,9 +649,7 @@
   }
 
   function approvalActionLabel(result) {
-    if (result === "approved") return "閫氳繃";
-    if (result === "rejected") return "椹冲洖";
-    return "寰呭鐞�";
+    return approvalRecordResultLabel(result);
   }
 
   return {
@@ -686,6 +698,7 @@
     resetSubmitDialogState,
     openSubmitDialog,
     openEditDialog,
+    canEditInstanceRow,
     onBusinessTypePick,
     onTemplatePick,
     backToBusinessTypePick,

--
Gitblit v1.9.3