From a1df9699594b0a0e46d26a0394eafb1eb030c68b Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期三, 20 五月 2026 17:42:09 +0800
Subject: [PATCH] 企业新闻

---
 src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js |   37 +++++++++++++++++++++++++++----------
 1 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js b/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js
index ad85890..2bdd35a 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js
@@ -1,6 +1,7 @@
+import { matchBusinessTypeValue } from "../approve-list/approveListConstants.js";
+
 /**
- * 鍚勪笟鍔℃ā鍧椾笌瀹℃壒妯℃澘绫诲瀷鐨勬槧灏勶紙閰嶇疆鍖栧叆鍙o級
- *
+ * 鍚勪笟鍔℃ā鍧椾笌瀹℃壒妯℃澘绫诲瀷鐨勬槧灏勶紙閰嶇疆鍖栧叆鍙o級 *
  * 浣跨敤鏂瑰紡锛�
  * 1. 鍦ㄤ笟鍔¢〉寮曞叆 ApprovalTemplateBindDialog锛屼紶鍏� moduleKey
  * 2. 鎴栧湪琛ㄥ崟鍐呭祵 ApprovalTemplateFormSection + useApprovalTemplateBinding({ moduleKey })
@@ -16,6 +17,7 @@
   OVERTIME: "overtime",
   TRAVEL_REIMBURSE: "travel_reimburse",
   COST_REIMBURSE: "cost_reimburse",
+  ENTERPRISE_NEWS: "enterprise_news",
 };
 
 /** @type {Record<string, import('./approvalModuleRegistry.js').ApprovalModuleConfig>} */
@@ -60,6 +62,11 @@
     approvalType: "cost_reimburse",
     typeLabels: ["璐圭敤", "璐圭敤鎶ラ攢"],
   },
+  [APPROVAL_MODULE_KEYS.ENTERPRISE_NEWS]: {
+    label: "浼佷笟鏂伴椈",
+    approvalType: "enterprise_news",
+    typeLabels: ["浼佷笟鏂伴椈", "鏂伴椈", "鏂伴椈鍙戝竷"],
+  },
 };
 
 /**
@@ -75,28 +82,38 @@
   return APPROVAL_MODULE_REGISTRY[moduleKey] || null;
 }
 
-export function listApprovalModuleEntries() {
-  return Object.entries(APPROVAL_MODULE_REGISTRY).map(([moduleKey, cfg]) => ({
-    moduleKey,
-    ...cfg,
-  }));
+/** 鍒楄〃鏌ヨ榛樿 businessType锛堜笌瀹℃壒鍒楄〃 listPage 绾﹀畾涓�鑷达級 */
+export function getModuleListBusinessType(moduleKey) {
+  const cfg = getApprovalModuleConfig(moduleKey);
+  if (!cfg) return "";
+  if (cfg.businessType != null && cfg.businessType !== "") return cfg.businessType;
+  return cfg.approvalType || "";
 }
 
-/** 浠� TypeEnums 閫夐」涓В鏋愭湰妯″潡鐨� businessType */
+/** 浠� TypeEnums 閫夐」涓В鏋愭湰妯″潡鐨� businessType锛堜笌瀹℃壒鍒楄〃涓嬫媺涓�鑷达級 */
 export function resolveModuleBusinessType(moduleKey, typeOptions = []) {
   const cfg = getApprovalModuleConfig(moduleKey);
   if (!cfg) return null;
   if (cfg.businessType != null && cfg.businessType !== "") return cfg.businessType;
 
   const labels = [cfg.label, ...(cfg.typeLabels || [])].filter(Boolean);
-  const hit = (typeOptions || []).find((opt) => {
+  const hitByLabel = (typeOptions || []).find((opt) => {
     const optLabel = String(opt?.label || "").trim();
     if (!optLabel) return false;
     return labels.some(
       (l) => optLabel === l || optLabel.includes(l) || l.includes(optLabel)
     );
   });
-  if (hit?.value != null && hit.value !== "") return hit.value;
+  if (hitByLabel?.value != null && hitByLabel.value !== "") return hitByLabel.value;
+
+  if (cfg.approvalType) {
+    const hitByValue = (typeOptions || []).find(
+      (opt) =>
+        matchBusinessTypeValue(opt?.value, cfg.approvalType) ||
+        matchBusinessTypeValue(opt?.code, cfg.approvalType)
+    );
+    if (hitByValue?.value != null && hitByValue.value !== "") return hitByValue.value;
+  }
 
   return cfg.approvalType || null;
 }

--
Gitblit v1.9.3