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