This repository has been archived on 2026-09-13. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
BPOS-TMP-REPO/apps/web/src/shared/gov/domains.ts
T
ChaiHaoandClaude Fable 5 34e207c3e8 三面拆分⑫:UI 打磨 —— 补 10 枚缺失图标,蓝图改因果链,台账收成一个模块
图标注册表缺 arrow-left-right/columns/table/tag 等 10 名,用到即渲染成空 SVG —— 补齐;
蓝图四库改真箭头相连的因果链节点卡(卡即入口,删重复的入库段);
驾驶舱终态分布改五色堆叠条;运营数据收成左轨一枚「台账」,域下沉为 2-3 字短名页签
(受理→寻源→定价→议价→替代→共享,按流程序),进模块自动落首域。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
2026-07-27 22:02:49 +08:00

37 lines
1.4 KiB
TypeScript

/**
* 数据域的人读短名 —— 左轨一枚钮只放得下 2-3 个字。
*
* 域键是活动的复合键(`quote_intake`),给人看要翻译;
* 字典之外的域回落到键的最后一段(截 4 字符)—— 新装的活动没配短名时,轨上先有个能认的名字。
*/
export const DOMAIN_SHORT: Readonly<Record<string, string>> = {
quote_intake: '受理',
quote_sourcing: '寻源',
quote_pricing: '定价',
quote_negotiate: '议价',
quote_alternative: '替代',
shared: '共享',
};
/** 业务序:受理 → 寻源 → 定价 → 议价 → 替代 → 共享 —— 左轨按流程走向排,不按字母 */
const DOMAIN_ORDER = ['quote_intake', 'quote_sourcing', 'quote_pricing', 'quote_negotiate', 'quote_alternative', 'shared'];
export function sortDomains(domains: readonly string[]): string[] {
return [...domains].sort((a, b) => {
const ia = DOMAIN_ORDER.indexOf(a);
const ib = DOMAIN_ORDER.indexOf(b);
// 字典外的域排在已知域之后,彼此按键序稳定
if (ia === -1 && ib === -1) return a.localeCompare(b);
if (ia === -1) return 1;
if (ib === -1) return -1;
return ia - ib;
});
}
export function domainShort(domain: string): string {
const hit = DOMAIN_SHORT[domain];
if (hit !== undefined) return hit;
const tail = domain.split('_').at(-1) ?? domain;
return tail.length <= 4 ? tail : tail.slice(0, 4);
}