-
- {{ formatTime(row.createdAt) }}
-
-
+
- {{ tenantModuleLabel(row.moduleType) }}
+ {{ formatTime(row.createdAt) }}
-
-
-
-
-
+
- {{ formatDetail(row.detailJson) }}
+
+ {{ tenantModuleLabel(row.moduleType) }}
+
+
+
+
+
+
+
+ {{ actionLabel(row.action) }}
+
+ {{ row.summary || generateSummary(row) }}
+
+
+
+
+
+
+ {{ row.ipAddress || '-' }}
+
+
+
+
+
+
+ 查看
+
+
+
+ {{ item.key }}
+ {{ item.value }}
+
+
+
+ -
@@ -78,7 +119,7 @@
-
+
{{ formatTime(row.createdAt) }}
@@ -153,7 +194,7 @@ async function loadApps() {
updateAppKey.value = apps.value[0].appKey
}
} catch {
- // ignore; empty state will be shown in the selector
+ // ignore
}
}
@@ -201,17 +242,109 @@ function handleUpdateAppChange() {
loadUpdateLogs()
}
+// ── Label mappings ──────────────────────────────────────────────────────────
+
function tenantModuleLabel(moduleType: string) {
return {
CONSOLE: '控制台',
APP: '应用管理',
- SUB_ACCOUNT: '子账号管理',
+ SUB_ACCOUNT: '子账号',
SERVICE: '服务管理',
- APP_SECRET: '应用密钥',
+ APP_SECRET: '密钥管理',
EMAIL_VERIFY: '邮箱验证',
}[moduleType] ?? moduleType
}
+function moduleTagType(moduleType: string): '' | 'success' | 'warning' | 'info' | 'danger' {
+ return {
+ CONSOLE: 'info',
+ APP: '',
+ SUB_ACCOUNT: 'warning',
+ SERVICE: 'success',
+ APP_SECRET: 'danger',
+ EMAIL_VERIFY: 'info',
+ }[moduleType] as any ?? ''
+}
+
+function actionLabel(action: string): string {
+ return {
+ CREATE_APP: '创建',
+ UPDATE_APP: '编辑',
+ DELETE_APP: '删除',
+ RESET_APP_SECRET: '重置密钥',
+ REQUEST_SECRET_VERIFY: '验证',
+ REVEAL_APP_SECRET: '查看密钥',
+ CREATE_SUB_ACCOUNT: '创建',
+ DISABLE_SUB_ACCOUNT: '禁用',
+ SEND_VERIFY_CODE: '发送验证码',
+ VERIFY_EMAIL: '验证邮箱',
+ DISABLE_SERVICE: '停用',
+ UPDATE_SERVICE_CONFIG: '更新配置',
+ REQUEST_SERVICE_ACTIVATION: '申请开通',
+ REGENERATE_KEY: '重新生成密钥',
+ VIEW_DASHBOARD: '查看',
+ }[action] ?? action
+}
+
+function actionTagType(action: string): '' | 'success' | 'warning' | 'info' | 'danger' {
+ if (action.startsWith('CREATE')) return 'success'
+ if (action.startsWith('DELETE')) return 'danger'
+ if (action.startsWith('DISABLE')) return 'danger'
+ if (action.startsWith('RESET') || action.startsWith('REGENERATE')) return 'warning'
+ if (action.startsWith('UPDATE') || action.startsWith('REVEAL')) return ''
+ if (action.startsWith('VIEW')) return 'info'
+ if (action.startsWith('SEND') || action.startsWith('VERIFY') || action.startsWith('REQUEST')) return 'info'
+ return ''
+}
+
+function generateSummary(row: TenantOperationLog): string {
+ const action = actionLabel(row.action)
+ const resource = row.resourceId || ''
+ return `${action} ${resource}`
+}
+
+function hasDetail(detailJson?: string): boolean {
+ if (!detailJson) return false
+ try {
+ const parsed = JSON.parse(detailJson)
+ return parsed && typeof parsed === 'object' && Object.keys(parsed).length > 0
+ } catch {
+ return false
+ }
+}
+
+const DETAIL_KEY_LABELS: Record = {
+ name: '应用名称',
+ packageName: '包名',
+ appKey: 'AppKey',
+ username: '用户名',
+ nickname: '昵称',
+ email: '邮箱',
+ platform: '平台',
+ serviceType: '服务类型',
+ purpose: '用途',
+ applyReason: '申请原因',
+ before: '变更前',
+ after: '变更后',
+ appCount: '应用数',
+ serviceCount: '服务数',
+ subAccountCount: '子账号数',
+}
+
+function parseDetail(detailJson?: string): { key: string; value: string }[] {
+ if (!detailJson) return []
+ try {
+ const parsed = JSON.parse(detailJson)
+ if (!parsed || typeof parsed !== 'object') return []
+ return Object.entries(parsed).map(([k, v]) => ({
+ key: DETAIL_KEY_LABELS[k] ?? k,
+ value: typeof v === 'object' ? JSON.stringify(v, null, 2) : String(v ?? ''),
+ }))
+ } catch {
+ return [{ key: '原始数据', value: detailJson }]
+ }
+}
+
function updateResourceLabel(resourceType: string) {
return {
APP_VERSION: '应用版本',
@@ -255,7 +388,6 @@ function formatDetail(detailJson?: string) {
return detailJson
}
}
-