From 1160de5142cd2bc08ebc61c247a4857f0c4ab7f1 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 22 五月 2026 10:45:11 +0800
Subject: [PATCH] 特色功能:丰富报销清单并添加审批流程详情——新增功能以丰富报销清单行内容,为费用和差旅报销提供审批流程详情。——引入新的实用函数来处理审批流程节点和汇总信息。——更新组件以利用丰富后的审批流程数据,从而更好地展示审批进度。
---
src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js | 100 ++++++++++++++++++++++++++++++++++++++------------
1 files changed, 76 insertions(+), 24 deletions(-)
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js b/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js
index 09d68fd..a85cf9c 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js
@@ -1,11 +1,8 @@
+import { matchBusinessTypeValue } from "../approve-list/approveListConstants.js";
+
/**
* 鍚勪笟鍔℃ā鍧椾笌瀹℃壒妯℃澘绫诲瀷鐨勬槧灏勶紙閰嶇疆鍖栧叆鍙o級
- *
- * 浣跨敤鏂瑰紡锛�
- * 1. 鍦ㄤ笟鍔¢〉寮曞叆 ApprovalTemplateBindDialog锛屼紶鍏� moduleKey
- * 2. 鎴栧湪琛ㄥ崟鍐呭祵 ApprovalTemplateFormSection + useApprovalTemplateBinding({ moduleKey })
- *
- * businessType锛氳嫢鍚庣 TypeEnums 宸插浐瀹� code锛屽彲鐩存帴鍐欐 value锛涘惁鍒欑敤 typeLabels 鎸夊悕绉板尮閰�
+ * businessType 涓庡悗绔� TypeEnums / listPage 绾﹀畾涓�鑷达紙鍐欐鏋氫妇鍊硷級
*/
export const APPROVAL_MODULE_KEYS = {
REGULAR: "regular",
@@ -16,6 +13,19 @@
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,
};
/** @type {Record<string, import('./approvalModuleRegistry.js').ApprovalModuleConfig>} */
@@ -23,51 +33,64 @@
[APPROVAL_MODULE_KEYS.REGULAR]: {
label: "杞鐢宠",
approvalType: "regular",
+ businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.REGULAR],
typeLabels: ["杞", "杞鐢宠"],
},
[APPROVAL_MODULE_KEYS.TRANSFER]: {
label: "璋冨矖鐢宠",
approvalType: "transfer",
+ businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.TRANSFER],
typeLabels: ["璋冨矖", "璋冨姩", "璋冨矖鐢宠", "璋冨姩鐢宠"],
},
[APPROVAL_MODULE_KEYS.RESIGN]: {
label: "绂昏亴鐢宠",
approvalType: "resign",
- typeLabels: ["绂昏亴", "绂昏亴鐢宠"],
+ typeLabels: ["绂昏亴", "绂昏亴鐢宠", "绂昏亴瀹℃壒"],
},
[APPROVAL_MODULE_KEYS.WORK_HANDOVER]: {
label: "宸ヤ綔浜ゆ帴",
approvalType: "work_handover",
- typeLabels: ["宸ヤ綔浜ゆ帴", "浜ゆ帴"],
+ businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.WORK_HANDOVER],
+ typeLabels: ["宸ヤ綔浜ゆ帴", "浜ゆ帴", "宸ヤ綔浜ゆ帴瀹℃壒"],
},
[APPROVAL_MODULE_KEYS.LEAVE]: {
label: "璇峰亣鐢宠",
approvalType: "leave",
- typeLabels: ["璇峰亣", "璇峰亣鐢宠"],
+ businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.LEAVE],
+ typeLabels: ["璇峰亣", "璇峰亣鐢宠", "璇峰亣瀹℃壒"],
},
[APPROVAL_MODULE_KEYS.OVERTIME]: {
label: "鍔犵彮鐢宠",
approvalType: "overtime",
- typeLabels: ["鍔犵彮", "鍔犵彮鐢宠"],
+ businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.OVERTIME],
+ typeLabels: ["鍔犵彮", "鍔犵彮鐢宠", "鍔犵彮瀹℃壒"],
},
[APPROVAL_MODULE_KEYS.TRAVEL_REIMBURSE]: {
label: "宸梾鎶ラ攢",
approvalType: "travel_reimburse",
- typeLabels: ["宸梾", "宸梾鎶ラ攢"],
+ businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.TRAVEL_REIMBURSE],
+ typeLabels: ["宸梾", "宸梾鎶ラ攢", "鍑哄樊鎶ラ攢"],
},
[APPROVAL_MODULE_KEYS.COST_REIMBURSE]: {
label: "璐圭敤鎶ラ攢",
approvalType: "cost_reimburse",
+ businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.COST_REIMBURSE],
typeLabels: ["璐圭敤", "璐圭敤鎶ラ攢"],
+ },
+ [APPROVAL_MODULE_KEYS.ENTERPRISE_NEWS]: {
+ label: "浼佷笟鏂伴椈",
+ approvalType: "enterprise_news",
+ businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.ENTERPRISE_NEWS],
+ typeLabels: ["浼佷笟鏂伴椈", "鏂伴椈", "鏂伴椈鍙戝竷"],
},
};
/**
* @typedef {object} ApprovalModuleConfig
* @property {string} label
- * @property {string} [approvalType] 鍒楄〃鏍峰紡鐢�
- * @property {string|number} [businessType] 涓� TypeEnums value 涓�鑷存椂鍙啓姝�
- * @property {string[]} [typeLabels] 涓� TypeEnums label 妯$硦鍖归厤
+ * @property {string} [approvalType]
+ * @property {string|number} [businessType]
+ * @property {string[]} [typeLabels]
*/
export function getApprovalModuleConfig(moduleKey) {
@@ -75,28 +98,57 @@
return APPROVAL_MODULE_REGISTRY[moduleKey] || null;
}
-export function listApprovalModuleEntries() {
- return Object.entries(APPROVAL_MODULE_REGISTRY).map(([moduleKey, cfg]) => ({
- moduleKey,
- ...cfg,
- }));
+/** 鍒楄〃鏌ヨ businessType锛堜紭鍏堥厤缃灇涓撅紝涓嶅啀鍥為�� approvalType 瀛楃涓诧級 */
+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] ?? "";
}
-/** 浠� TypeEnums 閫夐」涓В鏋愭湰妯″潡鐨� businessType */
+/** 浠� TypeEnums 瑙f瀽鏈ā鍧� businessType锛涘凡閰嶇疆鏋氫妇鏃剁洿鎺ヨ繑鍥� */
export function resolveModuleBusinessType(moduleKey, typeOptions = []) {
const cfg = getApprovalModuleConfig(moduleKey);
if (!cfg) return null;
- if (cfg.businessType != null && cfg.businessType !== "") return cfg.businessType;
+
+ const fixed = getModuleListBusinessType(moduleKey);
+ if (fixed != null && fixed !== "") return fixed;
const labels = [cfg.label, ...(cfg.typeLabels || [])].filter(Boolean);
- const hit = (typeOptions || []).find((opt) => {
- const optLabel = String(opt?.label || "").trim();
+ const hitByLabel = (typeOptions || []).find((opt) => {
+ const optLabel = String(opt?.label || opt?.name || "").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;
return cfg.approvalType || null;
}
+
+/** 鍒楄〃/妯℃澘杩囨护鐢ㄧ殑 businessType 闆嗗悎 */
+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?.label || opt?.name || "").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];
+}
--
Gitblit v1.9.3