fix(audit): 模块下拉中文化,消除 image_embeddings 等英文遗留值
问题 ---- 模块筛选下拉仍出现 image_embeddings、purchase_request、sys_element 等 英文值。它们来自改造前的全局监听器:那时无白名单,系统表/草稿表/向量表 都会被审计,而 _infer_module_name 对未登记的类名直接回退成表名。 下拉取 DISTINCT module,这些英文值就混了进来。 处理 ---- 新增 moduleMap(21 项)+ moduleLabel(),并应用到**三处**渲染: 下拉选项、列表列、详情弹窗的模块标签。 value 保留原始字符串,筛选行为完全不变。 除覆盖现存 3 个英文值外,另预置了 18 个白名单表名(sys_user / stock_buy / trans_outbound 等)。新监听器已保证 module 为中文,但若将来有数据从旧 路径写入或手工导入,这些值会再次出现,预置可避免同类问题复发。 其中 image_embeddings 标注为「图像特征(历史)」以提示其为改造前的产物。 实测:image_embeddings → 图像特征(历史),purchase_request → 采购申请, sys_element → 系统元素;中文模块名原样保留。
This commit is contained in:
@ -21,8 +21,14 @@
|
||||
<el-input v-model="queryParams.username" placeholder="请输入操作人账号" clearable @keyup.enter="handleQuery" style="width: 150px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="模块">
|
||||
<el-select v-model="queryParams.module" placeholder="请选择模块" clearable style="width: 150px">
|
||||
<el-option v-for="item in moduleOptions" :key="item" :label="item" :value="item" />
|
||||
<el-select v-model="queryParams.module" placeholder="请选择模块" clearable style="width: 170px">
|
||||
<!-- ★ label 走中文映射,value 保留原始值以保证筛选命中 -->
|
||||
<el-option
|
||||
v-for="item in moduleOptions"
|
||||
:key="item"
|
||||
:label="moduleLabel(item)"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作类型">
|
||||
@ -70,7 +76,7 @@
|
||||
<el-table-column prop="display_name" label="姓名" width="100" />
|
||||
<el-table-column prop="module" label="模块" width="120">
|
||||
<template #default="scope">
|
||||
<el-tag>{{ scope.row.module }}</el-tag>
|
||||
<el-tag>{{ moduleLabel(scope.row.module) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="action" label="操作类型" width="100">
|
||||
@ -121,7 +127,7 @@
|
||||
<el-descriptions-item label="ID">{{ currentLog.id }}</el-descriptions-item>
|
||||
<el-descriptions-item label="操作人">{{ currentLog.username }} ({{ currentLog.display_name }})</el-descriptions-item>
|
||||
<el-descriptions-item label="模块">
|
||||
<el-tag>{{ currentLog.module }}</el-tag>
|
||||
<el-tag>{{ moduleLabel(currentLog.module) }}</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="操作类型">
|
||||
<el-tag :type="getActionType(currentLog.action)">{{ actionMap[currentLog.action] || currentLog.action }}</el-tag>
|
||||
@ -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<string, string> = {
|
||||
'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),
|
||||
|
||||
Reference in New Issue
Block a user