MVP底座①:数据四域命名 —— 项目/客户/情报/供应商

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
2026-07-27 22:39:49 +08:00
co-authored by Claude Fable 5
parent 5f9625efbb
commit 3edd133230
2 changed files with 20 additions and 20 deletions
@@ -6,9 +6,10 @@ import { domainShort, sortDomains } from '../domains.ts';
describe('domainShort', () => {
it('已知域给 2-3 字人读名', () => {
expect(domainShort('quote_intake')).toBe('受理');
expect(domainShort('quote_sourcing')).toBe('寻源');
expect(domainShort('shared')).toBe('共享');
expect(domainShort('project')).toBe('项目');
expect(domainShort('customer')).toBe('客户');
expect(domainShort('intel')).toBe('情报');
expect(domainShort('supplier')).toBe('供应商');
});
it('未知域回落到键的最后一段,超长截 4 字符', () => {
@@ -18,12 +19,12 @@ describe('domainShort', () => {
});
});
describe('sortDomains —— 左轨按流程走向排', () => {
it('已知域按业务序,未知域殿后', () => {
expect(sortDomains(['shared', 'quote_pricing', 'zzz_custom', 'quote_intake'])).toEqual([
'quote_intake',
'quote_pricing',
'shared',
describe('sortDomains —— 按经营视角排,不按字母', () => {
it('已知域按业务序(项目最前),未知域殿后', () => {
expect(sortDomains(['supplier', 'intel', 'zzz_custom', 'project'])).toEqual([
'project',
'intel',
'supplier',
'zzz_custom',
]);
});
+10 -11
View File
@@ -1,20 +1,19 @@
/**
* 数据域的人读短名 —— 左轨一枚钮只放得下 2-3 个字。
* 数据域的人读短名 —— 导航一枚钮/一个页签只放得下 2-3 个字。
*
* 域键是活动的复合键(`quote_intake`),给人看要翻译;
* 字典之外的域回落到键的最后一段(截 4 字符)—— 新装的活动没配短名时,轨上先有个能认的名字。
* 数据按**经营对象**四分(docs/产品设计.md 附录):
* 项目 = 每一单的流转单据;客户 / 情报 / 供应商 = 沉淀资产。
* 字典之外的域回落到键的最后一段(截 4 字符)—— 新域没配短名时,先有个能认的名字。
*/
export const DOMAIN_SHORT: Readonly<Record<string, string>> = {
quote_intake: '受理',
quote_sourcing: '寻源',
quote_pricing: '定价',
quote_negotiate: '议价',
quote_alternative: '替代',
shared: '共享',
project: '项目',
customer: '客户',
intel: '情报',
supplier: '供应商',
};
/** 业务序:受理 → 寻源 → 定价 → 议价 → 替代 → 共享 —— 左轨按流程走向排,不按字母 */
const DOMAIN_ORDER = ['quote_intake', 'quote_sourcing', 'quote_pricing', 'quote_negotiate', 'quote_alternative', 'shared'];
/** 业务序:项目(每天看的)→ 客户 → 情报 → 供应商 —— 按经营视角排,不按字母 */
const DOMAIN_ORDER = ['project', 'customer', 'intel', 'supplier'];
export function sortDomains(domains: readonly string[]): string[] {
return [...domains].sort((a, b) => {