From 6c324a234060820d031014ea657af5aa0b0d478e Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期二, 19 五月 2026 13:29:20 +0800
Subject: [PATCH] 审批模板

---
 src/views/officeProcessAutomation/ApproveManage/approve-template/components/TemplateFlowEditor.vue |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-template/components/TemplateFlowEditor.vue b/src/views/officeProcessAutomation/ApproveManage/approve-template/components/TemplateFlowEditor.vue
index 45b32c0..f3f9540 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-template/components/TemplateFlowEditor.vue
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-template/components/TemplateFlowEditor.vue
@@ -127,6 +127,8 @@
   const normalized = normalizeFlowNodes(rows);
   return normalized.map((n) => ({
     _uid: newUid(),
+    id: n.id,
+    templateId: n.templateId,
     nodeOrder: n.nodeOrder,
     signMode: n.signMode,
     approverIds: n.approvers.map((a) => a.approverId),
@@ -137,6 +139,8 @@
 function publicShape(rows) {
   return normalizeFlowNodes(
     (rows || []).map((r) => ({
+      id: r.id,
+      templateId: r.templateId,
       nodeOrder: r.nodeOrder,
       signMode: r.signMode,
       approvers: r.approvers || [],
@@ -165,13 +169,21 @@
 
 function onApproversChange(ids, row) {
   const idList = Array.isArray(ids) ? ids : [];
+  const prevById = new Map((row.approvers || []).map((a) => [String(a.approverId), a]));
   row.approverIds = idList;
   row.approvers = idList.map((id) => {
+    const prev = prevById.get(String(id));
     const u = findUser(id);
-    return {
+    const item = {
       approverId: id,
-      approverName: u ? u.nickName || u.userName || "" : "",
+      approverName: u ? u.nickName || u.userName || "" : prev?.approverName || "",
     };
+    if (prev?.id != null) item.id = prev.id;
+    if (prev?.nodeId != null) item.nodeId = prev.nodeId;
+    else if (row.id != null) item.nodeId = row.id;
+    if (prev?.templateId != null) item.templateId = prev.templateId;
+    else if (row.templateId != null) item.templateId = row.templateId;
+    return item;
   });
   emitOut();
 }

--
Gitblit v1.9.3