From 0a58164ce2ea3f1a2b46781757d78b94b212883b Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期三, 20 五月 2026 15:13:49 +0800
Subject: [PATCH] 工作交接/调岗申请/转正申请/请假申请/加班申请新增调用模板

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

diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js b/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
index 80af992..acbed98 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 = [
@@ -34,26 +35,22 @@
   { value: "cancelled", label: "宸叉挙閿�" },
 ];
 
-export const LEGACY_APPROVE_LIST_STORAGE_KEY = "oa_unified_approve_list_v1";
-
-export function clearLegacyApproveListStorage() {
-  try {
-    localStorage.removeItem(LEGACY_APPROVE_LIST_STORAGE_KEY);
-  } catch {
-    /* ignore */
-  }
-}
-
 /** 鎻愪氦寮圭獥锛氭ā鏉垮崱鐗囷紙鏉ヨ嚜鍚庣鍒楄〃锛� */
 export function mapSubmitTemplateCard(row) {
   const cfg = parseFormConfigToData(row?.formConfig);
   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 +167,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 +275,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;
@@ -480,6 +487,10 @@
     formFieldDefs: fields,
     formPayload,
     flowNodes,
+    templateAttachments: initTemplateAttachmentsFromSnapshot(templateSnapshot),
+    storageBlobDTOs: row?.storageBlobDTOs?.length
+      ? JSON.parse(JSON.stringify(row.storageBlobDTOs))
+      : [],
   };
 }
 
@@ -504,5 +515,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