From 5b248a9716688d8132cfb02b4ba0abecd4060b06 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期三, 20 五月 2026 11:49:08 +0800
Subject: [PATCH] 审批模板流程化

---
 src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js b/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
index 6d8d1a5..090dbb1 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
@@ -8,6 +8,7 @@
   nodeSignModeLabel,
 } from "../approve-template/approveTemplateConstants.js";
 import { buildFormPayloadFromFields, parseFormConfigToData } from "../approve-template/formConfigUtils.js";
+import { isDynamicOptionSource, selectOptionSourceLabel } from "../approve-template/selectOptionSource.js";
 
 /** 瀹℃壒绫诲瀷锛堜笌鍚庣瀛楁 approvalType 瀵归綈锛屽悗鏈熷彲鍚屾锛� */
 export const APPROVAL_TYPE_OPTIONS = [
@@ -50,10 +51,16 @@
   return {
     id: row?.id,
     key: String(row?.id ?? ""),
+    businessType: row?.businessType ?? cfg.approvalType ?? row?.approvalType ?? "",
     approvalType: cfg.approvalType || row?.approvalType || "",
     label: row?.templateName || "鈥�",
     summaryPlaceholder: (row?.description || "").trim() || cfg.summaryPlaceholder || "鐐瑰嚮濉啓骞舵彁浜�",
   };
+}
+
+export function matchBusinessTypeValue(a, b) {
+  if (a == null || a === "" || b == null || b === "") return false;
+  return a === b || a === Number(b) || Number(a) === b || String(a) === String(b);
 }
 
 /** 瀹℃壒璁板綍 approveAction 鈫� 椤甸潰 result */
@@ -170,6 +177,9 @@
 /** 鍗曞瓧娈靛睍绀哄�硷紙璇︽儏鍙锛� */
 export function formatFieldDisplayValue(field, val) {
   if (val == null || val === "" || (Array.isArray(val) && !val.length)) return "鈥�";
+  if (field?.type === "select" && isDynamicOptionSource(field.optionSource)) {
+    return `${selectOptionSourceLabel(field.optionSource)}锛�${String(val)}`;
+  }
   if (field?.type === "select" && field.options?.length) {
     const hit = field.options.find((o) => String(o.value) === String(val));
     return hit?.label || String(val);
@@ -275,10 +285,17 @@
   const dto = {
     templateId,
     templateName: submitForm?.templateName || tpl.label || "",
+    businessType: tpl.businessType ?? submitForm?.businessType ?? "",
     title,
     formConfig: buildInstanceFormConfigJson({ ...tpl, fields: tpl.fields || submitForm?.formFieldDefs }, payload),
     tasks: taskList,
   };
+
+  const attachments =
+    (Array.isArray(submitForm?.storageBlobDTOs) && submitForm.storageBlobDTOs.length
+      ? submitForm.storageBlobDTOs
+      : null) || tpl.storageBlobDTOs;
+  if (attachments?.length) dto.storageBlobDTOs = attachments;
 
   if (isUpdate) {
     dto.id = existingRow?.id ?? submitForm?.instanceId;
@@ -362,6 +379,7 @@
     templateName: row.templateName || "",
     businessId: row.businessId,
     businessType: row.businessType,
+    businessName: row.businessName || "",
     applicantId: row.applicantId,
     applicantNo: row.applicantId != null ? String(row.applicantId) : "",
     applicantName: row.applicantName || "",
@@ -479,6 +497,10 @@
     formFieldDefs: fields,
     formPayload,
     flowNodes,
+    templateAttachments: initTemplateAttachmentsFromSnapshot(templateSnapshot),
+    storageBlobDTOs: row?.storageBlobDTOs?.length
+      ? JSON.parse(JSON.stringify(row.storageBlobDTOs))
+      : [],
   };
 }
 
@@ -503,5 +525,14 @@
     formFieldDefs: tpl?.fields || [],
     formPayload: payload,
     flowNodes,
+    templateAttachments: tpl?.storageBlobDTOs
+      ? JSON.parse(JSON.stringify(tpl.storageBlobDTOs))
+      : [],
+    storageBlobDTOs: [],
   };
 }
+
+export function initTemplateAttachmentsFromSnapshot(templateSnapshot) {
+  const list = templateSnapshot?.storageBlobDTOs;
+  return list?.length ? JSON.parse(JSON.stringify(list)) : [];
+}

--
Gitblit v1.9.3