refactor(frontend): 重构前端第二版

This commit is contained in:
sophie committed 2026-06-11 13:47:06 +08:00
1 parent 2631f78b00
commit 4b562cfa82
205 files changed
+15399 -12015

No files matched your search

@@ -0,0 +1,63 @@
/**
* features/chat/constants/leave.ts
* 请假功能常量:启用 Agent、假别编码、OA 跳转地址。
*/
/** 支持本地请假表单的 Agent 名称白名单 */
export const LEAVE_FEATURE_AGENT_NAMES = new Set(['通用入口', '人事规章']);
/** OA 系统基础地址(自动登录表单提交目标) */
export const OA_BASE_URL = 'http://192.168.100.221:8888';
export const OA_VERIFY_LOGIN_URL = `${OA_BASE_URL}/login/VerifyLogin.jsp`;
export const OA_LEAVE_APPLY_PATH = '/workflow/request/AddRequest.jsp?workflowid=652&isagent=0&beagenter=0&f_weaver_belongto_userid=';
export const OA_REQUEST_VIEW_PATH = '/workflow/request/ViewRequest.jsp?requestid=';
export const OA_AUTO_LOGIN_TARGET = 'hxops-oa-leave-request';
export const OA_PASSWORD_STORAGE_KEY = 'hxops_oa_login_password';
/** 下拉假别选项(value 为 OA 编码) */
export const LEAVE_TYPES = [
{ label: '事假(小时)', value: '005' },
{ label: '病假(小时)', value: '006' },
{ label: '丧假(天)', value: '007' },
{ label: '年假(天)', value: '010' },
{ label: '因公出差(小时)', value: '021' },
{ label: '调休假(小时)', value: '025' },
{ label: '产假(天)', value: '401' },
{ label: '陪产假(天)', value: '402' },
{ label: '婚假(天)', value: '403' },
{ label: '住院病假(小时)', value: '405' },
{ label: '工伤假(天)', value: '406' },
{ label: '返乡假(小时)', value: 'ZZ01' },
{ label: '事假(经理专用小时)', value: 'ZZ04' },
{ label: '病假(经理专用小时)', value: 'ZZ05' },
{ label: '丧假(经理专用天)', value: 'ZZ07' },
{ label: '产假(经理专用天)', value: 'ZZ08' },
{ label: '陪产假(经理专用天)', value: 'ZZ09' },
{ label: '婚假(经理专用天)', value: 'ZZ10' },
{ label: '其他假(小时)', value: '035' },
{ label: '育儿假(小时)', value: '408' },
] as const;
/** 按「天」计价的假别编码 */
export const LEAVE_TYPE_BY_DAY = new Set(['010', '007', '401', '402', '403', '406', 'ZZ07', 'ZZ08', 'ZZ09', 'ZZ10']);
/** 自然语言关键词 → OA 假别编码 */
export const LEAVE_TYPE_MAP: Record<string, string> = {
事假: '005',
病假: '006',
丧假: '007',
年假: '010',
因公出差: '021',
出差: '021',
调休: '025',
产假: '401',
陪产假: '402',
婚假: '403',
住院: '405',
工伤: '406',
育儿假: '408',
返乡: 'ZZ01',
};
/** 发起前需校验余额的假别(年假、育儿假) */
export const NEED_BALANCE_CHECK_TYPES = new Set(['010', '408']);
@@ -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();
};