From 07d766a545881be779de94a800f6494ec46c1001 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期二, 19 五月 2026 17:10:08 +0800
Subject: [PATCH] 模板类型接口获取

---
 src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js |   30 +++++++++++++-----------------
 1 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js b/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
index 1ffdbf5..3b5fb21 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
@@ -1,8 +1,5 @@
 import dayjs from "dayjs";
-import {
-  TEMPLATE_TYPE_CUSTOM,
-  TEMPLATE_TYPE_OPTIONS,
-} from "@/api/officeProcessAutomation/approvalTemplate.js";
+import { TEMPLATE_TYPE_CUSTOM } from "@/api/officeProcessAutomation/approvalTemplate.js";
 import { APPROVAL_TYPE_OPTIONS } from "../approve-list/approveListConstants.js";
 import {
   buildFormConfigJson,
@@ -10,12 +7,6 @@
   parseFormConfigToData,
   validateFormConfigData,
 } from "./formConfigUtils.js";
-
-export { TEMPLATE_TYPE_OPTIONS };
-
-export function templateTypeLabel(type) {
-  return TEMPLATE_TYPE_OPTIONS.find((x) => x.value === type)?.label || "鈥�";
-}
 
 /** 鑺傜偣鍐呭鎵规柟寮忥細浼氱 / 鎴栫 */
 export const NODE_SIGN_MODE_OPTIONS = [
@@ -162,7 +153,8 @@
     description: row.description || "",
     enabled: mapEnabledFromApi(row.enabled),
     enabledRaw: row.enabled,
-    templateType: row.templateType,
+    templateType: row.templateType != null ? Number(row.templateType) : undefined,
+    businessType: row.businessType ?? "",
     formConfig: row.formConfig,
     formConfigData: parseFormConfigToData(row.formConfig),
     createdUser: row.createdUser,
@@ -181,7 +173,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 = {
@@ -210,15 +203,14 @@
   return dto;
 }
 
-/** 鏋勫缓鍒嗛〉鏌ヨ鍙傛暟 */
-export function buildApprovalTemplateListParams({ page, searchForm }) {
+export function buildApprovalTemplateListParams({ page, searchForm, templateType = TEMPLATE_TYPE_CUSTOM }) {
   const params = {
     current: page.current,
     size: page.size,
+    templateType: searchForm?.templateType != null && searchForm.templateType !== ""
+      ? searchForm.templateType
+      : templateType,
   };
-  if (searchForm?.templateType != null && searchForm.templateType !== "") {
-    params.templateType = searchForm.templateType;
-  }
   const kw = (searchForm?.keyword || "").trim();
   if (kw) params.templateName = kw;
   if (searchForm?.enabledOnly) params.enabled = "1";
@@ -247,6 +239,7 @@
     templateName: "",
     description: "",
     templateType: TEMPLATE_TYPE_CUSTOM,
+    businessType: "",
     formConfig: "",
     formConfigData: createEmptyFormConfigData(),
     enabled: true,
@@ -276,6 +269,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