DG7/MRF7 移动信息架构与展示去重治理

这个提交包含在:
2026-05-12 21:03:36 +08:00
父节点 b6b7b77c41
当前提交 9da0ca9632
共修改 26 个文件,包含 1556 行新增和 258 行删除
+56
查看文件
@@ -0,0 +1,56 @@
import { isUuidLike } from "./reimbursementDisplay";
export type BusinessEntityType = "reimbursement" | "leave" | "purchase_request" | "travel_request" | string | null | undefined;
const ENTITY_NOUN_LABELS: Record<string, string> = {
reimbursement: "报销单",
leave: "请假",
purchase_request: "采购单",
travel_request: "差旅单",
};
const ENTITY_SHORT_LABELS: Record<string, string> = {
reimbursement: "报销",
leave: "请假",
purchase_request: "采购",
travel_request: "差旅",
};
export function businessEntityLabel(entityType: BusinessEntityType, options: { noun?: boolean } = {}) {
if (!entityType) {
return options.noun ? "业务单据" : "业务";
}
const labels = options.noun ? ENTITY_NOUN_LABELS : ENTITY_SHORT_LABELS;
return labels[entityType] ?? String(entityType);
}
export function compactBusinessReference(value: string | null | undefined) {
const trimmed = value?.trim();
if (!trimmed || isUuidLike(trimmed)) {
return null;
}
return trimmed;
}
export function businessPrimaryLabel(input: {
entityType: BusinessEntityType;
reference?: string | null;
title?: string | null;
fallback?: string;
}) {
const reference = compactBusinessReference(input.reference);
if (reference) {
return `${businessEntityLabel(input.entityType, { noun: true })} ${reference}`;
}
const title = input.title?.trim();
if (title && !isUuidLike(title)) {
return title;
}
return input.fallback ?? businessEntityLabel(input.entityType, { noun: true });
}
export function joinBusinessMeta(items: Array<string | null | undefined>) {
return items.map((item) => item?.trim()).filter((item): item is string => Boolean(item)).join(" · ");
}