feat(shipping, admin, workspace, docs): 迭代货代模块、补充文档并处理合并冲突问题
This commit is contained in:
1 parent
4587b56900
commit
3c0e08377c
94 files changed
+29222
-1218
No files matched your search
@@ -1,14 +1,16 @@
|
||||
/**
|
||||
* features/chat/constants/shipping.ts
|
||||
* 用途:发货通知功能常量 — 任务编号正则、菜单动作规格与决策动作集合。
|
||||
* 依赖:types/shipping.types(ShippingMenuAction)。
|
||||
* 依赖:types/shipping.types(ShippingMenuAction)、vue-i18n(菜单展示文案)。
|
||||
* 逻辑:shipping/* handler 与 useChatShipping 引用本模块,避免动作 id 硬编码分散。
|
||||
*/
|
||||
import i18n from '@/i18n';
|
||||
import type { ShippingMenuAction } from '../types/shipping.types';
|
||||
|
||||
/** 工作区发货任务编号格式(如 SN-20250610-ABCDEF12) */
|
||||
export const SHIPPING_TASK_ID_RE = /SN-\d{8}-[A-F0-9]{8}/i;
|
||||
|
||||
/** 菜单动作 id / variant(展示文案经 resolveShippingMenuActionSpec 取 i18n) */
|
||||
export const SHIPPING_MENU_ACTION_SPECS: Record<
|
||||
ShippingMenuAction,
|
||||
{ id: string; label: string; message: string; variant: 'primary' | 'secondary' | 'danger' }
|
||||
@@ -20,6 +22,26 @@ export const SHIPPING_MENU_ACTION_SPECS: Record<
|
||||
reject: { id: 'reject', label: '驳回', message: '驳回', variant: 'danger' },
|
||||
};
|
||||
|
||||
/**
|
||||
* 解析菜单动作的展示 label / message(四语言)。
|
||||
* 核心逻辑:id/variant 来自静态规格;文案走 chat.shippingNoticeMenu.*。
|
||||
* @param action - 菜单动作键
|
||||
* @param t - 可选翻译函数;缺省用全局 i18n
|
||||
* @returns 含 id/label/message/variant 的完整动作规格
|
||||
*/
|
||||
export function resolveShippingMenuActionSpec(
|
||||
action: ShippingMenuAction,
|
||||
t?: (key: string, ...args: unknown[]) => string,
|
||||
) {
|
||||
const base = SHIPPING_MENU_ACTION_SPECS[action];
|
||||
const translate = t || ((key: string, ...args: unknown[]) => String(i18n.global.t(key, ...(args as []))));
|
||||
return {
|
||||
...base,
|
||||
label: translate(`chat.shippingNoticeMenu.${action}.label`),
|
||||
message: translate(`chat.shippingNoticeMenu.${action}.message`),
|
||||
};
|
||||
}
|
||||
|
||||
export const SHIPPING_DECISION_ACTIONS = new Set([
|
||||
'confirm',
|
||||
'reparse_inventory',
|
||||
|
||||
Reference in new issue
Block a user