From 4ab0be7d4441f378add1f242b168d80fb27e65fe Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 22 五月 2026 17:57:44 +0800
Subject: [PATCH] OA部分查询条件变更

---
 src/views/officeProcessAutomation/ReimburseManage/cost-reimburse/useCostReimburse.js |   41 ++++++++++++++++++++++++++++++++---------
 1 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/src/views/officeProcessAutomation/ReimburseManage/cost-reimburse/useCostReimburse.js b/src/views/officeProcessAutomation/ReimburseManage/cost-reimburse/useCostReimburse.js
index 638d533..3b90a3b 100644
--- a/src/views/officeProcessAutomation/ReimburseManage/cost-reimburse/useCostReimburse.js
+++ b/src/views/officeProcessAutomation/ReimburseManage/cost-reimburse/useCostReimburse.js
@@ -12,8 +12,11 @@
 import {
   buildCostReimbursementSaveDto,
   buildFinReimbursementListParams,
+  filterReimbursementRowsBySearch,
+  hasActiveReimbursementSearch,
   canDeleteReimbursementRow,
   canEditReimbursementRow,
+  enrichReimbursementListRowsWithApprovalFlow,
   filterRowsByReimbursementType,
   FIN_REIMBURSEMENT_TYPE,
   mapCostReimbursementRow,
@@ -21,6 +24,7 @@
   resolveReimbursementDeleteId,
   unwrapFinReimbursementDetail,
   unwrapFinReimbursementPage,
+  validateReimbursementApprovalNodes,
   validateReimbursementPersistDto,
 } from "../shared/finReimbursementMappers.js";
 import { consumeReimburseEditFromApprove } from "../shared/reimburseApproveBridge.js";
@@ -68,8 +72,6 @@
 
   const searchForm = reactive({
     applicantKeyword: "",
-    applyTimeFrom: "",
-    applyTimeTo: "",
   });
   const tableLoading = ref(false);
   const page = reactive({ current: 1, size: 10, total: 0 });
@@ -105,11 +107,26 @@
         })
       );
       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
+      );
+      if (hasActiveReimbursementSearch(searchForm)) {
+        mapped = filterReimbursementRowsBySearch(mapped, searchForm);
+      }
+      allRows.value = mapped;
+      const dropped = records.length - filtered.length;
+      let nextTotal =
+        dropped > 0 ? Math.max(0, Number(total) - dropped) : Number(total);
+      if (hasActiveReimbursementSearch(searchForm)) {
+        nextTotal = mapped.length;
+      }
+      page.total = nextTotal;
     } catch {
       allRows.value = [];
       page.total = 0;
@@ -264,7 +281,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"));
   }
 
@@ -313,8 +334,6 @@
 
   function resetSearch() {
     searchForm.applicantKeyword = "";
-    searchForm.applyTimeFrom = "";
-    searchForm.applyTimeTo = "";
     handleQuery();
   }
 
@@ -448,7 +467,6 @@
       return;
     }
     syncApplyAmountFromDetails();
-    autoAssignApprovalFlow();
 
     if (submitSaving.value) return;
     const isEdit = formDialog.mode === "edit";
@@ -458,6 +476,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