diff --git a/inventory-web/src/views/system/AuditLog.vue b/inventory-web/src/views/system/AuditLog.vue index eaf76c1..8b8c998 100644 --- a/inventory-web/src/views/system/AuditLog.vue +++ b/inventory-web/src/views/system/AuditLog.vue @@ -21,8 +21,14 @@ - - + + + @@ -70,7 +76,7 @@ @@ -121,7 +127,7 @@ {{ currentLog.id }} {{ currentLog.username }} ({{ currentLog.display_name }}) - {{ currentLog.module }} + {{ moduleLabel(currentLog.module) }} {{ actionMap[currentLog.action] || currentLog.action }} @@ -380,6 +386,46 @@ const fieldLabel = (key: string | number): string => { return fieldMap[k] || k } +// ============================================================ +// 模块名中文化 +// +// 现行监听器写出的 module 已是中文(出库管理/BOM管理…),但历史数据里残留了 +// 一批英文模块名 —— 它们来自早期全局监听器:那时无白名单,系统表、草稿表、 +// 向量表都会被审计,而 _infer_module_name 对未登记的类名直接回退成表名。 +// 下拉框取 DISTINCT module,于是这些英文值就混了进来。 +// +// 处理:仅在前端做展示翻译,value 仍用原始字符串,筛选行为完全不变。 +// ============================================================ +const moduleMap: Record = { + 'image_embeddings': '图像特征(历史)', + 'purchase_request': '采购申请', + 'sys_element': '系统元素', + 'sys_menu': '系统菜单', + 'sys_user': '系统用户', + 'sys_role': '系统角色', + 'sys_role_permission': '角色权限', + 'sys_warehouse_location': '库位设置', + 'material_base': '物料主数据', + 'material_warning_settings': '物料预警设置', + 'stock_buy': '采购库存', + 'stock_semi': '半成品库存', + 'stock_product': '成品库存', + 'stock_adjustment': '库存调整', + 'trans_outbound': '出库流水', + 'trans_borrow': '借还流水', + 'trans_scrap': '报废流水', + 'trans_repair': '维修单', + 'bom_table': 'BOM配方', + 'bom_draft_table': 'BOM草稿', + 'stocktake_draft': '盘点草稿', +} + +// 模块名解析:命中映射取中文,否则原样返回 +const moduleLabel = (m: string | number): string => { + const k = String(m) + return moduleMap[k] || k +} + // 时间格式化 // // ★ 改造说明:后端 audit_listener 现在显式写入**北京时间**(beijing_time),