From 22002c2b5bf09bb769a51448537fa6a572a3ea88 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 22 五月 2026 10:25:09 +0800
Subject: [PATCH] 费用报销的审批流程
---
src/views/officeProcessAutomation/ReimburseManage/shared/finReimbursementMappers.js | 63 ++++++++++++++++++++++---------
1 files changed, 45 insertions(+), 18 deletions(-)
diff --git a/src/views/officeProcessAutomation/ReimburseManage/shared/finReimbursementMappers.js b/src/views/officeProcessAutomation/ReimburseManage/shared/finReimbursementMappers.js
index 7a82873..c75f6d1 100644
--- a/src/views/officeProcessAutomation/ReimburseManage/shared/finReimbursementMappers.js
+++ b/src/views/officeProcessAutomation/ReimburseManage/shared/finReimbursementMappers.js
@@ -399,6 +399,13 @@
});
}
+/** 琛ㄥ崟涓婄殑瀹℃壒娴侊紙鍏煎 approvalFlowNodes / nodes / flowNodes锛� */
+export function resolveFormApprovalFlowNodes(form) {
+ const list =
+ form?.approvalFlowNodes ?? form?.nodes ?? form?.flowNodes ?? [];
+ return Array.isArray(list) ? list : [];
+}
+
/** 椤甸潰瀹℃壒鑺傜偣 鈫� 鎺ュ彛 nodes */
export function mapApprovalFlowNodesToApi(nodes = [], templateId) {
const list = Array.isArray(nodes) ? nodes : [];
@@ -408,36 +415,50 @@
if (Array.isArray(n.approvers) && n.approvers.length) {
approvers = n.approvers
.filter((a) => a?.approverId != null && a.approverId !== "")
- .map((a, idx) => ({
- id: a.id,
- nodeId: a.nodeId,
- templateId: a.templateId ?? templateId,
- approverId: toNumber(a.approverId) ?? a.approverId,
- approverName: a.approverName || "",
- sortNo: a.sortNo ?? idx + 1,
- }));
+ .map((a, idx) => {
+ const item = {
+ approverId: toNumber(a.approverId) ?? a.approverId,
+ approverName: a.approverName || "",
+ sortNo: a.sortNo ?? idx + 1,
+ };
+ if (a.id != null) item.id = a.id;
+ if (a.nodeId != null) item.nodeId = a.nodeId;
+ if (a.templateId != null) item.templateId = a.templateId;
+ else if (templateId != null) item.templateId = templateId;
+ if (a.roleKey) item.roleKey = a.roleKey;
+ return item;
+ });
} else if (n.approverId != null && n.approverId !== "") {
- approvers = [
- {
- approverId: toNumber(n.approverId) ?? n.approverId,
- approverName: n.approverName || "",
- sortNo: 1,
- },
- ];
+ const item = {
+ approverId: toNumber(n.approverId) ?? n.approverId,
+ approverName: n.approverName || "",
+ sortNo: 1,
+ };
+ if (n.roleKey) item.roleKey = n.roleKey;
+ approvers = [item];
}
if (!approvers.length) return null;
const node = {
- levelNo: n.levelNo ?? n.nodeOrder ?? i + 1,
+ levelNo: n.levelNo ?? n.nodeOrder ?? n.sortOrder ?? i + 1,
approveType: n.approveType || mapSignModeToApi(n.signMode),
approvers,
};
if (n.id != null) node.id = n.id;
if (n.templateId != null) node.templateId = n.templateId;
else if (templateId != null) node.templateId = templateId;
+ if (n.roleKey) node.roleKey = n.roleKey;
return node;
})
.filter(Boolean);
+}
+
+/** 淇濆瓨鍓嶆牎楠� nodes 宸查厤缃� */
+export function validateReimbursementApprovalNodes(dto) {
+ if (Array.isArray(dto?.nodes) && dto.nodes.length > 0) {
+ return { ok: true };
+ }
+ return { ok: false, message: "璇烽厤缃鎵规祦绋嬪苟閫夋嫨瀹℃壒浜�" };
}
function mapDetailsToApi(details = []) {
@@ -532,7 +553,10 @@
withinStandard: form.needSpecialApproval ? "0" : "1",
},
details,
- nodes: mapApprovalFlowNodesToApi(form.approvalFlowNodes, form.templateId),
+ nodes: mapApprovalFlowNodesToApi(
+ resolveFormApprovalFlowNodes(form),
+ form.templateId
+ ),
};
const id = resolveReimbursementId(form);
@@ -574,7 +598,10 @@
billStatus: "IN_APPROVAL",
deptId: toNumber(form.deptId),
details,
- nodes: mapApprovalFlowNodesToApi(form.approvalFlowNodes, form.templateId),
+ nodes: mapApprovalFlowNodesToApi(
+ resolveFormApprovalFlowNodes(form),
+ form.templateId
+ ),
};
const id = resolveReimbursementId(form);
--
Gitblit v1.9.3