refactor(frontend): 重构前端第二版
This commit is contained in:
1 parent
2631f78b00
commit
4b562cfa82
205 files changed
+15399
-12015
No files matched your search
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* features/chat/constants/shipping.ts
|
||||
* 发货通知功能常量:任务编号正则、菜单动作规格与决策动作集合。
|
||||
*/
|
||||
import type { ShippingMenuAction } from '../types/shipping.types';
|
||||
|
||||
/** 工作区发货任务编号格式(如 SN-20250610-ABCDEF12) */
|
||||
export const SHIPPING_TASK_ID_RE = /SN-\d{8}-[A-F0-9]{8}/i;
|
||||
|
||||
export const SHIPPING_MENU_ACTION_SPECS: Record<
|
||||
ShippingMenuAction,
|
||||
{ id: string; label: string; message: string; variant: 'primary' | 'secondary' | 'danger' }
|
||||
> = {
|
||||
upload: { id: 'upload_inventory_file', label: '选择库存文件', message: '我要上传库存 Excel', variant: 'primary' },
|
||||
paste: { id: 'paste_inventory_json', label: '粘贴库存', message: '我粘贴库存小表', variant: 'secondary' },
|
||||
retry_rpa: { id: 'retry_rpa', label: '重试 RPA', message: '重试 RPA 导出库存', variant: 'secondary' },
|
||||
confirm: { id: 'confirm', label: '确认', message: '确认', variant: 'primary' },
|
||||
reparse: { id: 'reparse', label: '重新解析', message: '重新解析', variant: 'secondary' },
|
||||
reject: { id: 'reject', label: '驳回', message: '驳回', variant: 'danger' },
|
||||
};
|
||||
|
||||
export const SHIPPING_DECISION_ACTIONS = new Set([
|
||||
'confirm',
|
||||
'confirm_inventory_mapping',
|
||||
'correct_inventory_mapping',
|
||||
'reparse_inventory',
|
||||
'reject',
|
||||
'reparse',
|
||||
'rematch',
|
||||
]);
|
||||
|
||||
/** 从文件名或 URL 提取扩展名(小写,不含点) */
|
||||
export const extractExt = (value: string) => {
|
||||
const text = (value || '').trim().toLowerCase();
|
||||
const withoutQuery = (text.split('?')[0] || '').split('#')[0] || '';
|
||||
const idx = withoutQuery.lastIndexOf('.');
|
||||
if (idx < 0) return '';
|
||||
return withoutQuery.slice(idx + 1).trim();
|
||||
};
|
||||
Reference in new issue
Block a user