From 6d6e3204f92d763e5df11d26702f6642a993e49e Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期四, 21 五月 2026 10:21:40 +0800
Subject: [PATCH] 增强审批模板功能,新增内置模板类型支持,优化模板编辑和导入逻辑,确保内置模板不可编辑和删除,提升用户体验和代码可维护性。
---
src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js | 35 +++++++++++++++++++++++++++++------
1 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js b/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
index 517e01c..727f896 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
@@ -1,6 +1,9 @@
import dayjs from "dayjs";
import { getTypeEnums } from "@/api/basicData/enum.js";
-import { TEMPLATE_TYPE_CUSTOM } from "@/api/officeProcessAutomation/approvalTemplate.js";
+import {
+ TEMPLATE_TYPE_BUILTIN,
+ TEMPLATE_TYPE_CUSTOM,
+} from "@/api/officeProcessAutomation/approvalTemplate.js";
import { APPROVAL_TYPE_OPTIONS } from "../approve-list/approveListConstants.js";
import {
buildFormConfigJson,
@@ -42,6 +45,11 @@
} catch {
return [];
}
+}
+
+/** 鏄惁涓虹郴缁熷唴缃ā鏉匡紙templateType === 0锛� */
+export function isBuiltinTemplate(row) {
+ return Number(row?.templateType) === TEMPLATE_TYPE_BUILTIN;
}
/** 鑺傜偣鍐呭鎵规柟寮忥細浼氱 / 鎴栫 */
@@ -178,6 +186,18 @@
return data;
}
+/** 鍚庣闄勪欢瀛楁 鈫� 椤甸潰 storageBlobDTOs */
+export function mapAttachmentsFromApi(row) {
+ const list =
+ row?.storageBlobDTOs ||
+ row?.storageBlobDTOS ||
+ row?.storageBlobVOS ||
+ row?.storageBlobVOList ||
+ row?.attachmentList ||
+ [];
+ return Array.isArray(list) ? list : [];
+}
+
/** 鍒嗛〉鍒楄〃椤� 鈫� 椤甸潰琛屾暟鎹紙涓昏〃 + 鑺傜偣锛� */
export function mapTemplateFromApi(row) {
if (!row) return {};
@@ -193,6 +213,7 @@
businessType: row.businessType ?? "",
formConfig: row.formConfig,
formConfigData: parseFormConfigToData(row.formConfig),
+ storageBlobDTOs: mapAttachmentsFromApi(row),
createdUser: row.createdUser,
createdUserName: row.createdUserName,
...times,
@@ -209,7 +230,8 @@
templateName: (form.templateName || "").trim(),
description: (form.description || "").trim(),
enabled: mapEnabledToApi(form.enabled),
- templateType: TEMPLATE_TYPE_CUSTOM,
+ templateType:
+ form.templateType != null ? Number(form.templateType) : TEMPLATE_TYPE_CUSTOM,
businessType: form.businessType ?? "",
formConfig: buildFormConfigJson(form.formConfigData),
nodes: nodes.map((n, i) => {
@@ -236,16 +258,15 @@
}),
};
if (templateId) dto.id = templateId;
+ const attachments = Array.isArray(form.storageBlobDTOs) ? form.storageBlobDTOs : [];
+ if (attachments.length) dto.storageBlobDTOs = attachments;
return dto;
}
-export function buildApprovalTemplateListParams({ page, searchForm, templateType = TEMPLATE_TYPE_CUSTOM }) {
+export function buildApprovalTemplateListParams({ page, searchForm }) {
const params = {
current: page.current,
size: page.size,
- templateType: searchForm?.templateType != null && searchForm.templateType !== ""
- ? searchForm.templateType
- : templateType,
};
const kw = (searchForm?.keyword || "").trim();
if (kw) params.templateName = kw;
@@ -275,11 +296,13 @@
templateName: "",
description: "",
templateType: TEMPLATE_TYPE_CUSTOM,
+ lockedFormFieldUids: [],
businessType: "",
formConfig: "",
formConfigData: createEmptyFormConfigData(),
enabled: true,
flowNodes: [createEmptyNode(1)],
+ storageBlobDTOs: [],
};
}
--
Gitblit v1.9.3