fix: 修复系统图标与操作日志映射

This commit is contained in:
Nixevol
2026-07-07 02:10:05 +08:00
parent 7c6b0bff4c
commit 98b4b8b079
13 changed files with 165 additions and 29 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg+xml" href="/app-icon.svg" />
<link rel="icon" type="image/svg+xml" href="/admin/app-icon.svg" />
<title></title>
</head>
<body>
+18
View File
@@ -518,6 +518,10 @@
"backups": "Backup & Restore",
"settings": "Settings",
"users": "Users",
"storage": "Storage & CDN",
"certificates": "Certificates",
"nodes": "Trace Nodes",
"blockchainProofs": "Blockchain Proofs",
"upload": "Upload",
"download": "Download",
"export": "Export"
@@ -530,9 +534,23 @@
"paths": {
"outboundPreview": "Outbound import preview",
"outboundCommit": "Confirm outbound import",
"outboundTemplate": "Download outbound import template",
"traceExport": "Export trace codes and QR images",
"traceBatchDelete": "Batch delete trace codes",
"traceOnchain": "Trace code on-chain attestation",
"backupCreate": "Create backup",
"backupDelete": "Delete backup",
"backupDownload": "Download backup package",
"backupRestorePreview": "Upload backup package for pre-check",
"backup": "Backup management",
"restore": "Restore backup",
"storageTest": "Test storage config",
"storageMigrate": "Migrate storage files",
"storageConfirm": "Switch storage config",
"blockchainRetry": "Retry blockchain proof",
"blockchainConfirm": "Query blockchain confirmation",
"changePassword": "Change password",
"login": "Sign in to admin",
"upload": "Upload file"
}
},
+18
View File
@@ -518,6 +518,10 @@
"backups": "备份恢复",
"settings": "系统设置",
"users": "用户管理",
"storage": "存储与 CDN",
"certificates": "认证文件",
"nodes": "溯源节点",
"blockchainProofs": "区块链存证",
"upload": "文件上传",
"download": "文件下载",
"export": "数据导出"
@@ -530,9 +534,23 @@
"paths": {
"outboundPreview": "出库批量导入预览",
"outboundCommit": "确认出库批量导入",
"outboundTemplate": "下载出库导入模板",
"traceExport": "导出追溯码与二维码",
"traceBatchDelete": "批量删除追溯码",
"traceOnchain": "追溯码上链存证",
"backupCreate": "创建备份",
"backupDelete": "删除备份",
"backupDownload": "下载备份包",
"backupRestorePreview": "上传备份包预校验",
"backup": "备份管理",
"restore": "恢复备份",
"storageTest": "测试存储配置",
"storageMigrate": "迁移存储文件",
"storageConfirm": "切换存储配置",
"blockchainRetry": "重试区块链存证",
"blockchainConfirm": "查询区块链确认结果",
"changePassword": "修改密码",
"login": "登录后台",
"upload": "上传文件"
}
},
+1 -1
View File
@@ -1,4 +1,4 @@
export const DEFAULT_APP_ICON_URL = '/app-icon.svg';
export const DEFAULT_APP_ICON_URL = '/admin/app-icon.svg';
export function resolveAppIcon(url?: string | null): string {
const value = String(url || '').trim();
+53 -5
View File
@@ -76,6 +76,10 @@ const moduleOptions = [
'backups',
'settings',
'users',
'storage',
'certificates',
'nodes',
'blockchain-proofs',
'upload',
'download',
'export',
@@ -112,7 +116,7 @@ const columns = computed<DataTableColumns<any>>(() => [
width: 120,
align: 'center',
ellipsis: { tooltip: true },
render: (row) => actionLabel(row.action),
render: (row) => actionLabel(effectiveAction(row)),
},
{
title: () => renderTableFilterTitle(t('pages.operationLog.result'), query.status, resultOptions, (value) => setFilter('status', value)),
@@ -149,6 +153,10 @@ function moduleLabel(value?: string) {
backups: t('pages.operationLog.modules.backups'),
settings: t('pages.operationLog.modules.settings'),
users: t('pages.operationLog.modules.users'),
storage: t('pages.operationLog.modules.storage'),
certificates: t('pages.operationLog.modules.certificates'),
nodes: t('pages.operationLog.modules.nodes'),
'blockchain-proofs': t('pages.operationLog.modules.blockchainProofs'),
upload: t('pages.operationLog.modules.upload'),
download: t('pages.operationLog.modules.download'),
export: t('pages.operationLog.modules.export'),
@@ -177,22 +185,62 @@ function roleLabel(value?: string) {
return value ? t(`common.role.${value}`) : '-';
}
function pathLabel(path?: string) {
function effectiveAction(row: any) {
const path = String(row.path || '');
const method = String(row.method || '').toUpperCase();
const cleanPath = path.split('?')[0];
const isBackupRoot = /\/backups\/?$/.test(cleanPath);
if (path.includes('/auth/login')) return 'login';
if (path.includes('/auth/change-password')) return 'update';
if (path.includes('/backups/restore/preview')) return 'upload';
if (path.includes('/backups/restore/commit')) return 'restore';
if (path.includes('/backups') && path.includes('/download')) return 'download';
if (path.includes('/backups') && method === 'DELETE') return 'delete';
if (isBackupRoot && method === 'POST') return 'backup';
if (path.includes('/trace-codes/batch/delete')) return 'delete';
if (path.includes('/outbound/import/preview') || /\/outbound\/import\/?$/.test(cleanPath)) return 'upload';
if (path.includes('/outbound/import-sessions') && path.includes('/commit')) return 'update';
if (path.includes('/storage/test') || path.includes('/storage/migrate') || path.includes('/storage/confirm')) return 'update';
if ((path.includes('/blockchain-proofs') && (path.includes('/retry') || path.includes('/confirm'))) || path.includes('/trace-codes') && path.includes('/onchain')) return 'onchain';
if (path.includes('/export')) return 'export';
if (path.includes('/download') || path.includes('/template')) return 'download';
return row.action;
}
function pathLabel(path?: string, action?: string, method?: string) {
if (!path) return '';
const normalizedMethod = String(method || '').toUpperCase();
const cleanPath = path.split('?')[0];
const isBackupRoot = /\/backups\/?$/.test(cleanPath);
if (path.includes('/auth/change-password')) return t('pages.operationLog.paths.changePassword');
if (path.includes('/auth/login')) return t('pages.operationLog.paths.login');
if (path.includes('/outbound/import/preview')) return t('pages.operationLog.paths.outboundPreview');
if (path.includes('/outbound/import-sessions') && path.includes('/commit')) return t('pages.operationLog.paths.outboundCommit');
if (path.includes('/trace-codes/export')) return t('pages.operationLog.paths.traceExport');
if (path.includes('/backups/restore')) return t('pages.operationLog.paths.restore');
if (path.includes('/trace-codes/batch/delete')) return t('pages.operationLog.paths.traceBatchDelete');
if (path.includes('/outbound/import/template')) return t('pages.operationLog.paths.outboundTemplate');
if (path.includes('/backups/restore/preview')) return t('pages.operationLog.paths.backupRestorePreview');
if (path.includes('/backups/restore/commit')) return t('pages.operationLog.paths.restore');
if (path.includes('/backups') && path.includes('/download')) return t('pages.operationLog.paths.backupDownload');
if (path.includes('/backups') && (normalizedMethod === 'DELETE' || action === 'delete')) return t('pages.operationLog.paths.backupDelete');
if (isBackupRoot && (normalizedMethod === 'POST' || action === 'backup')) return t('pages.operationLog.paths.backupCreate');
if (path.includes('/backups')) return t('pages.operationLog.paths.backup');
if (path.includes('/storage/test')) return t('pages.operationLog.paths.storageTest');
if (path.includes('/storage/migrate')) return t('pages.operationLog.paths.storageMigrate');
if (path.includes('/storage/confirm')) return t('pages.operationLog.paths.storageConfirm');
if (path.includes('/blockchain-proofs') && path.includes('/retry')) return t('pages.operationLog.paths.blockchainRetry');
if (path.includes('/blockchain-proofs') && path.includes('/confirm')) return t('pages.operationLog.paths.blockchainConfirm');
if (path.includes('/trace-codes') && path.includes('/onchain')) return t('pages.operationLog.paths.traceOnchain');
if (path.includes('/upload')) return t('pages.operationLog.paths.upload');
return '';
}
function operationSummary(row: any) {
const readablePath = pathLabel(row.path);
const action = effectiveAction(row);
const readablePath = pathLabel(row.path, action, row.method);
if (readablePath) return readablePath;
const target = row.targetId ? ` #${row.targetId}` : '';
return `${actionLabel(row.action)}${moduleLabel(row.module)}${target}`;
return `${actionLabel(action)}${moduleLabel(row.module)}${target}`;
}
function setFilter(field: 'role' | 'module' | 'action' | 'status', value: string | number | null) {