From 0333d66e4b397c161c6a44ce1e2a121c2cc41082 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 28 五月 2026 09:20:20 +0800
Subject: [PATCH] Merge branch 'dev_NEW_pro' into dev_天津_中兴实强

---
 src/pages/oa/_utils/approvalModuleRegistry.js |  189 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 189 insertions(+), 0 deletions(-)

diff --git a/src/pages/oa/_utils/approvalModuleRegistry.js b/src/pages/oa/_utils/approvalModuleRegistry.js
new file mode 100644
index 0000000..1019d35
--- /dev/null
+++ b/src/pages/oa/_utils/approvalModuleRegistry.js
@@ -0,0 +1,189 @@
+
+/** 涓� Web approvalModuleRegistry 涓�鑷� */
+export const APPROVAL_MODULE_KEYS = {
+  REGULAR: "regular",
+  TRANSFER: "transfer",
+  WORK_HANDOVER: "work_handover",
+  LEAVE: "leave",
+  OVERTIME: "overtime",
+  TRAVEL_REIMBURSE: "travel_reimburse",
+  COST_REIMBURSE: "cost_reimburse",
+  ENTERPRISE_NEWS: "enterprise_news",
+};
+
+/** 瀹℃壒瀹炰緥 listPage businessType锛堜笌鍚庣绾﹀畾涓�鑷达級 */
+export const APPROVAL_BUSINESS_TYPE = {
+  [APPROVAL_MODULE_KEYS.REGULAR]: 10,
+  [APPROVAL_MODULE_KEYS.TRANSFER]: 11,
+  [APPROVAL_MODULE_KEYS.WORK_HANDOVER]: 13,
+  [APPROVAL_MODULE_KEYS.LEAVE]: 14,
+  [APPROVAL_MODULE_KEYS.OVERTIME]: 15,
+  [APPROVAL_MODULE_KEYS.TRAVEL_REIMBURSE]: 16,
+  [APPROVAL_MODULE_KEYS.COST_REIMBURSE]: 17,
+  [APPROVAL_MODULE_KEYS.ENTERPRISE_NEWS]: 18,
+};
+
+export const APPROVAL_MODULE_REGISTRY = {
+  [APPROVAL_MODULE_KEYS.REGULAR]: {
+    label: "杞鐢宠",
+    approvalType: "regular",
+    businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.REGULAR],
+    typeLabels: ["杞", "杞鐢宠"],
+    listFields: [
+      { label: "瀹℃壒鍗曞彿", prop: "instanceNo" },
+      { label: "鍏ヨ亴鏃ユ湡", prop: "entryDate" },
+      { label: "杞鏃ユ湡", prop: "regularDate" },
+    ],
+  },
+  [APPROVAL_MODULE_KEYS.TRANSFER]: {
+    label: "璋冨矖鐢宠",
+    approvalType: "transfer",
+    businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.TRANSFER],
+    typeLabels: ["璋冨矖", "璋冨姩", "璋冨矖鐢宠", "璋冨姩鐢宠"],
+    listFields: [
+      { label: "瀹℃壒鍗曞彿", prop: "instanceNo" },
+      { label: "鍘熷矖浣�", prop: "fromPost" },
+      { label: "鐩爣宀椾綅", prop: "toPost" },
+    ],
+  },
+  [APPROVAL_MODULE_KEYS.WORK_HANDOVER]: {
+    label: "宸ヤ綔浜ゆ帴",
+    approvalType: "work_handover",
+    businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.WORK_HANDOVER],
+    typeLabels: ["宸ヤ綔浜ゆ帴", "浜ゆ帴", "宸ヤ綔浜ゆ帴瀹℃壒"],
+    listFields: [
+      { label: "瀹℃壒鍗曞彿", prop: "instanceNo" },
+      { label: "浜ゆ帴浜�", prop: "handoverTo" },
+      { label: "浜ゆ帴浜嬮」", prop: "handoverItems" },
+    ],
+  },
+  [APPROVAL_MODULE_KEYS.LEAVE]: {
+    label: "璇峰亣鐢宠",
+    approvalType: "leave",
+    businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.LEAVE],
+    typeLabels: ["璇峰亣", "璇峰亣鐢宠", "璇峰亣瀹℃壒"],
+    listFields: [
+      { label: "瀹℃壒鍗曞彿", prop: "instanceNo" },
+      { label: "璇峰亣绫诲瀷", prop: "leaveType" },
+      { label: "寮�濮嬫椂闂�", prop: "startTime" },
+      { label: "缁撴潫鏃堕棿", prop: "endTime" },
+    ],
+  },
+  [APPROVAL_MODULE_KEYS.OVERTIME]: {
+    label: "鍔犵彮鐢宠",
+    approvalType: "overtime",
+    businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.OVERTIME],
+    typeLabels: ["鍔犵彮", "鍔犵彮鐢宠", "鍔犵彮瀹℃壒"],
+    listFields: [
+      { label: "瀹℃壒鍗曞彿", prop: "instanceNo" },
+      { label: "鍔犵彮鏃ユ湡", prop: "overtimeDate" },
+      { label: "鏃堕暱(灏忔椂)", prop: "hours" },
+    ],
+  },
+  [APPROVAL_MODULE_KEYS.TRAVEL_REIMBURSE]: {
+    label: "宸梾鎶ラ攢",
+    approvalType: "travel_reimburse",
+    businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.TRAVEL_REIMBURSE],
+    typeLabels: ["宸梾", "宸梾鎶ラ攢", "鍑哄樊鎶ラ攢"],
+    listFields: [],
+  },
+  [APPROVAL_MODULE_KEYS.COST_REIMBURSE]: {
+    label: "璐圭敤鎶ラ攢",
+    approvalType: "cost_reimburse",
+    businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.COST_REIMBURSE],
+    typeLabels: ["璐圭敤", "璐圭敤鎶ラ攢"],
+    listFields: [],
+  },
+  [APPROVAL_MODULE_KEYS.ENTERPRISE_NEWS]: {
+    label: "浼佷笟鏂伴椈",
+    approvalType: "enterprise_news",
+    businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.ENTERPRISE_NEWS],
+    typeLabels: ["浼佷笟鏂伴椈", "鏂伴椈", "鏂伴椈鍙戝竷"],
+    listFields: [],
+  },
+};
+
+export function getApprovalModuleConfig(moduleKey) {
+  if (!moduleKey) return null;
+  return APPROVAL_MODULE_REGISTRY[moduleKey] || null;
+}
+
+export function getModuleListBusinessType(moduleKey) {
+  const cfg = getApprovalModuleConfig(moduleKey);
+  if (!cfg) return "";
+  if (cfg.businessType != null && cfg.businessType !== "") return cfg.businessType;
+  return APPROVAL_BUSINESS_TYPE[moduleKey] ?? "";
+}
+
+function matchBiz(a, b) {
+  if (a == null || a === "" || b == null || b === "") return false;
+  return a === b || a === Number(b) || Number(a) === b || String(a) === String(b);
+}
+
+export function resolveModuleBusinessType(moduleKey, typeOptions = []) {
+  const cfg = getApprovalModuleConfig(moduleKey);
+  if (!cfg) return null;
+
+  const fixed = getModuleListBusinessType(moduleKey);
+  if (fixed != null && fixed !== "") return fixed;
+
+  const labels = [cfg.label, ...(cfg.typeLabels || [])].filter(Boolean);
+  const hitByLabel = (typeOptions || []).find(opt => {
+    const optLabel = String(opt?.name || opt?.label || "").trim();
+    if (!optLabel) return false;
+    return labels.some(
+      l => optLabel === l || optLabel.includes(l) || l.includes(optLabel)
+    );
+  });
+  if (hitByLabel?.value != null && hitByLabel.value !== "") return hitByLabel.value;
+
+  if (cfg.approvalType) {
+    const hitByValue = (typeOptions || []).find(
+      opt =>
+        matchBiz(opt?.value, cfg.approvalType) || matchBiz(opt?.code, cfg.approvalType)
+    );
+    if (hitByValue?.value != null && hitByValue.value !== "") return hitByValue.value;
+  }
+
+  return null;
+}
+
+export function getModuleMatchingBusinessTypes(moduleKey, typeOptions = []) {
+  const cfg = getApprovalModuleConfig(moduleKey);
+  if (!cfg) return [];
+
+  const fixed = getModuleListBusinessType(moduleKey);
+  if (fixed != null && fixed !== "") return [fixed];
+
+  const values = new Set();
+  const primary = resolveModuleBusinessType(moduleKey, typeOptions);
+  if (primary != null && primary !== "") values.add(primary);
+
+  const labels = [cfg.label, ...(cfg.typeLabels || [])].filter(Boolean);
+  for (const opt of typeOptions || []) {
+    const optLabel = String(opt?.name || opt?.label || "").trim();
+    if (!optLabel) continue;
+    const matched = labels.some(
+      l => optLabel === l || optLabel.includes(l) || l.includes(optLabel)
+    );
+    if (matched && opt.value != null && opt.value !== "") {
+      values.add(opt.value);
+    }
+  }
+  return [...values];
+}
+
+export const PAGE_KEY_TO_MODULE = {
+  "HrManage/regular-apply": APPROVAL_MODULE_KEYS.REGULAR,
+  "HrManage/transfer-apply": APPROVAL_MODULE_KEYS.TRANSFER,
+  "HrManage/work-handover": APPROVAL_MODULE_KEYS.WORK_HANDOVER,
+  "AttendManage/leave-apply": APPROVAL_MODULE_KEYS.LEAVE,
+  "AttendManage/overtime-apply": APPROVAL_MODULE_KEYS.OVERTIME,
+  "ReimburseManage/travel-reimburse": APPROVAL_MODULE_KEYS.TRAVEL_REIMBURSE,
+  "ReimburseManage/cost-reimburse": APPROVAL_MODULE_KEYS.COST_REIMBURSE,
+  "EnterpriseNews/news-manage": APPROVAL_MODULE_KEYS.ENTERPRISE_NEWS,
+};
+
+export function getModuleKeyFromPageKey(pageKey) {
+  return PAGE_KEY_TO_MODULE[pageKey] || "";
+}

--
Gitblit v1.9.3