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-template/approveTemplateConstants.js | 67 ++++++++++++++++++++++++++++-----
1 files changed, 57 insertions(+), 10 deletions(-)
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js b/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
index 3325e55..4d7d7a6 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
@@ -1,8 +1,6 @@
import dayjs from "dayjs";
-import {
- TEMPLATE_TYPE_CUSTOM,
- TEMPLATE_TYPE_OPTIONS,
-} from "@/api/officeProcessAutomation/approvalTemplate.js";
+import { getTypeEnums } from "@/api/basicData/enum.js";
+import { TEMPLATE_TYPE_CUSTOM } from "@/api/officeProcessAutomation/approvalTemplate.js";
import { APPROVAL_TYPE_OPTIONS } from "../approve-list/approveListConstants.js";
import {
buildFormConfigJson,
@@ -11,12 +9,39 @@
validateFormConfigData,
} from "./formConfigUtils.js";
-export { TEMPLATE_TYPE_OPTIONS };
+export function unwrapEnumList(data) {
+ if (Array.isArray(data)) return data;
+ if (!data || typeof data !== "object") return [];
+ if (Array.isArray(data.TypeEnums)) return data.TypeEnums;
+ if (Array.isArray(data.typeEnums)) return data.typeEnums;
+ const nested = Object.values(data).find((v) => Array.isArray(v));
+ return nested || [];
+}
-export function templateTypeLabel(type) {
- if (type == null || type === "") return "鈥�";
- const n = Number(type);
- return TEMPLATE_TYPE_OPTIONS.find((x) => x.value === n)?.label || "鈥�";
+export function normalizeBusinessTypeOptions(data) {
+ return unwrapEnumList(data)
+ .map((item) => {
+ const rawValue = item?.value ?? item?.code ?? item?.businessType ?? item?.dictValue ?? item?.key;
+ if (rawValue == null || rawValue === "") return null;
+ const num = Number(rawValue);
+ const value =
+ typeof rawValue === "number" || (Number.isFinite(num) && String(rawValue).trim() !== "")
+ ? num
+ : rawValue;
+ const label =
+ item?.label ?? item?.name ?? item?.desc ?? item?.dictLabel ?? item?.text ?? String(value);
+ return { label, value };
+ })
+ .filter(Boolean);
+}
+
+export async function fetchBusinessTypeOptions() {
+ try {
+ const res = await getTypeEnums();
+ return normalizeBusinessTypeOptions(res?.data);
+ } catch {
+ return [];
+ }
}
/** 鑺傜偣鍐呭鎵规柟寮忥細浼氱 / 鎴栫 */
@@ -153,6 +178,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 {};
@@ -165,8 +202,10 @@
enabled: mapEnabledFromApi(row.enabled),
enabledRaw: row.enabled,
templateType: row.templateType != null ? Number(row.templateType) : undefined,
+ businessType: row.businessType ?? "",
formConfig: row.formConfig,
formConfigData: parseFormConfigToData(row.formConfig),
+ storageBlobDTOs: mapAttachmentsFromApi(row),
createdUser: row.createdUser,
createdUserName: row.createdUserName,
...times,
@@ -183,7 +222,8 @@
templateName: (form.templateName || "").trim(),
description: (form.description || "").trim(),
enabled: mapEnabledToApi(form.enabled),
- templateType: form.templateType ?? TEMPLATE_TYPE_CUSTOM,
+ templateType: TEMPLATE_TYPE_CUSTOM,
+ businessType: form.businessType ?? "",
formConfig: buildFormConfigJson(form.formConfigData),
nodes: nodes.map((n, i) => {
const node = {
@@ -209,6 +249,8 @@
}),
};
if (templateId) dto.id = templateId;
+ const attachments = Array.isArray(form.storageBlobDTOs) ? form.storageBlobDTOs : [];
+ if (attachments.length) dto.storageBlobDTOs = attachments;
return dto;
}
@@ -248,10 +290,12 @@
templateName: "",
description: "",
templateType: TEMPLATE_TYPE_CUSTOM,
+ businessType: "",
formConfig: "",
formConfigData: createEmptyFormConfigData(),
enabled: true,
flowNodes: [createEmptyNode(1)],
+ storageBlobDTOs: [],
};
}
@@ -277,6 +321,9 @@
export function validateTemplateForm(form) {
const name = (form.templateName || "").trim();
if (!name) return { ok: false, message: "璇峰~鍐欐ā鏉垮悕绉�" };
+ if (form.businessType == null || form.businessType === "") {
+ return { ok: false, message: "璇烽�夋嫨妯℃澘绫诲瀷" };
+ }
const nodes = normalizeFlowNodes(form.flowNodes);
if (!nodes.length) return { ok: false, message: "璇疯嚦灏戦厤缃竴涓鎵硅妭鐐�" };
for (let i = 0; i < nodes.length; i++) {
--
Gitblit v1.9.3