From 93b8ceac34e2fbd5c57fe5ab4f5bac32c85408aa Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期五, 22 五月 2026 15:37:09 +0800
Subject: [PATCH] fix(hr): 修正岗位字段映射

---
 src/views/officeProcessAutomation/ReimburseManage/cost-reimburse/useCostReimburse.js |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/views/officeProcessAutomation/ReimburseManage/cost-reimburse/useCostReimburse.js b/src/views/officeProcessAutomation/ReimburseManage/cost-reimburse/useCostReimburse.js
index 638d533..520c2a5 100644
--- a/src/views/officeProcessAutomation/ReimburseManage/cost-reimburse/useCostReimburse.js
+++ b/src/views/officeProcessAutomation/ReimburseManage/cost-reimburse/useCostReimburse.js
@@ -14,6 +14,7 @@
   buildFinReimbursementListParams,
   canDeleteReimbursementRow,
   canEditReimbursementRow,
+  enrichReimbursementListRowsWithApprovalFlow,
   filterRowsByReimbursementType,
   FIN_REIMBURSEMENT_TYPE,
   mapCostReimbursementRow,
@@ -21,6 +22,7 @@
   resolveReimbursementDeleteId,
   unwrapFinReimbursementDetail,
   unwrapFinReimbursementPage,
+  validateReimbursementApprovalNodes,
   validateReimbursementPersistDto,
 } from "../shared/finReimbursementMappers.js";
 import { consumeReimburseEditFromApprove } from "../shared/reimburseApproveBridge.js";
@@ -105,11 +107,19 @@
         })
       );
       const { records, total } = unwrapFinReimbursementPage(res);
-      allRows.value = filterRowsByReimbursementType(
+      const filtered = filterRowsByReimbursementType(
         records,
         FIN_REIMBURSEMENT_TYPE.COST
-      ).map(mapCostReimbursementRow);
-      page.total = total;
+      );
+      let mapped = filtered.map(mapCostReimbursementRow);
+      mapped = await enrichReimbursementListRowsWithApprovalFlow(
+        mapped,
+        FIN_REIMBURSEMENT_TYPE.COST
+      );
+      allRows.value = mapped;
+      const dropped = records.length - filtered.length;
+      page.total =
+        dropped > 0 ? Math.max(0, Number(total) - dropped) : Number(total);
     } catch {
       allRows.value = [];
       page.total = 0;
@@ -264,7 +274,11 @@
 
   function autoAssignApprovalFlow() {
     const amount = Number(form.applyAmount) || detailTotalAmount.value || 0;
-    form.approvalFlowNodes = buildAutoApprovalFlow(amount, form.expenseCategory || "other");
+    form.approvalFlowNodes = buildAutoApprovalFlow(
+      amount,
+      form.expenseCategory || "other",
+      form.approvalFlowNodes
+    );
     nextTick(() => formRef.value?.validateField?.("approvalFlowNodes"));
   }
 
@@ -448,7 +462,6 @@
       return;
     }
     syncApplyAmountFromDetails();
-    autoAssignApprovalFlow();
 
     if (submitSaving.value) return;
     const isEdit = formDialog.mode === "edit";
@@ -458,6 +471,11 @@
       proxy?.$modal?.msgWarning?.(check.message);
       return;
     }
+    const nodeCheck = validateReimbursementApprovalNodes(dto);
+    if (!nodeCheck.ok) {
+      proxy?.$modal?.msgWarning?.(nodeCheck.message);
+      return;
+    }
     submitSaving.value = true;
     try {
       await persistFinReimbursement(dto, isEdit);

--
Gitblit v1.9.3