From 5dd35a1c9f325b03d0a65aedfcf9f59219e347b0 Mon Sep 17 00:00:00 2001 From: wangdl Date: Fri, 19 Jun 2026 13:07:59 +0800 Subject: [PATCH] feat(ADMIN-INFO-015): add userName render to userId columns across 8 pages - Billing, ChatLogs, ContentSafety, NotificationAdmin, SecurityEvents - ComplianceAdmin (deletions + exports) - MemberManagement (members + deletion requests) - ComplianceAdmin status labels also fixed Co-Authored-By: Claude Opus 4.7 --- src/pages/Billing.tsx | 2 +- src/pages/ChatLogs.tsx | 2 +- src/pages/ComplianceAdmin.tsx | 11 ++++++----- src/pages/ContentSafety.tsx | 2 +- src/pages/MemberManagement.tsx | 4 ++-- src/pages/NotificationAdmin.tsx | 2 +- src/pages/SecurityEvents.tsx | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/pages/Billing.tsx b/src/pages/Billing.tsx index dadfacc..b8cd207 100644 --- a/src/pages/Billing.tsx +++ b/src/pages/Billing.tsx @@ -76,7 +76,7 @@ function BillingContent() { ] const topUserCols = [ - { title: '用户', dataIndex: 'userId', width: 180, ellipsis: true }, + { title: '用户', dataIndex: 'userId', width: 180, ellipsis: true , render: (_: any, r: any) => r.userName || r.userId }, { title: '调用量', dataIndex: 'calls', width: 80, align: 'center' as const }, { title: 'Tokens', dataIndex: 'tokens', width: 100, align: 'center' as const, render: (v: number) => v.toLocaleString() }, { title: '成本', dataIndex: 'cost', width: 100, align: 'center' as const, render: (v: string) => ${v} }, diff --git a/src/pages/ChatLogs.tsx b/src/pages/ChatLogs.tsx index 31055fe..da4f7aa 100644 --- a/src/pages/ChatLogs.tsx +++ b/src/pages/ChatLogs.tsx @@ -42,7 +42,7 @@ export default function ChatLogsPage() { pagination={{ pageSize: 20 }} size="small" columns={[ { title: '标题', dataIndex: 'title', width: 200, ellipsis: true }, - { title: '用户', dataIndex: 'userId', width: 140, ellipsis: true }, + { title: '用户', dataIndex: 'userId', width: 140, ellipsis: true , render: (_: any, r: any) => r.userName || r.userId }, { title: '知识库', dataIndex: 'knowledgeBaseId', width: 140, ellipsis: true }, { title: '消息数', dataIndex: ['_count','messages'], width: 70, align: 'center' }, { title: '更新时间', dataIndex: 'updatedAt', width: 140, render: (d: string) => dayjs(d).format('MM-DD HH:mm') }, diff --git a/src/pages/ComplianceAdmin.tsx b/src/pages/ComplianceAdmin.tsx index beeadde..99398cb 100644 --- a/src/pages/ComplianceAdmin.tsx +++ b/src/pages/ComplianceAdmin.tsx @@ -3,6 +3,7 @@ import { Table, Button, Modal, Form, Input, Tag, Typography, Tabs, DatePicker } import { PlusOutlined, EditOutlined, SafetyOutlined, CheckOutlined } from '@ant-design/icons' import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query' import { api } from '@/services/http-client' +import { complianceStatusLabels } from '@/constants/labels' import { message } from 'antd' import dayjs from 'dayjs' @@ -83,14 +84,14 @@ export default function ComplianceAdmin() { const filingColumns = [ { title: '类型', dataIndex: 'type', width: 100 }, { title: '标题', dataIndex: 'title', width: 200, ellipsis: true }, - { title: '状态', dataIndex: 'status', width: 70, render: (s: string) => {s} }, + { title: '状态', dataIndex: 'status', width: 70, render: (s: string) => {complianceStatusLabels[s] || s} }, { title: '备注', dataIndex: 'notes', width: 200, ellipsis: true, render: (n: string) => n || '-' }, { title: '创建时间', dataIndex: 'createdAt', width: 110, render: (d: string) => new Date(d).toLocaleDateString() }, ] const deletionColumns = [ - { title: '用户', dataIndex: 'userId', width: 100, ellipsis: true }, - { title: '状态', dataIndex: 'status', width: 70, render: (s: string) => {s} }, + { title: '用户', dataIndex: 'userId', width: 100, ellipsis: true , render: (_: any, r: any) => r.userName || r.userId }, + { title: '状态', dataIndex: 'status', width: 70, render: (s: string) => {complianceStatusLabels[s] || s} }, { title: '申请时间', dataIndex: 'requestedAt', width: 110, render: (d: string) => new Date(d).toLocaleDateString() }, { title: '冷却结束', dataIndex: 'coolingEndsAt', width: 110, render: (d: string) => new Date(d).toLocaleDateString() }, { title: '操作', width: 60, render: (_: any, r: any) => r.status === 'pending' ? : null }, @@ -109,8 +110,8 @@ export default function ComplianceAdmin() { { key: 'filings', label: '备案台账', children:
}, { key: 'deletions', label: '数据删除', children:
}, { key: 'exports', label: '数据导出', children:
{s} }, + { title: '用户', dataIndex: 'userId', width: 100, ellipsis: true , render: (_: any, r: any) => r.userName || r.userId }, + { title: '状态', dataIndex: 'status', width: 70, render: (s: string) => {complianceStatusLabels[s] || s} }, { title: '创建时间', dataIndex: 'createdAt', width: 110, render: (d: string) => new Date(d).toLocaleDateString() }, ]} rowKey="id" loading={eLoading} size="small" /> }, { key: 'security', label: '安全事件', children:
}, diff --git a/src/pages/ContentSafety.tsx b/src/pages/ContentSafety.tsx index b768874..d3cca04 100644 --- a/src/pages/ContentSafety.tsx +++ b/src/pages/ContentSafety.tsx @@ -82,7 +82,7 @@ function CSPage() { const violationCols = [ { title: '时间', dataIndex: 'createdAt', width: 130, render: (d: string) => dayjs(d).format('MM-DD HH:mm') }, - { title: '用户', dataIndex: 'userId', width: 140, ellipsis: true }, + { title: '用户', dataIndex: 'userId', width: 140, ellipsis: true , render: (_: any, r: any) => r.userName || r.userId }, { title: '类型', dataIndex: 'contentType', width: 100 }, { title: '内容', dataIndex: 'content', ellipsis: true, render: (v: string) => {v?.slice(0, 60)} }, { title: '风险', dataIndex: 'riskLevel', width: 70, render: (v: string) => {v} }, diff --git a/src/pages/MemberManagement.tsx b/src/pages/MemberManagement.tsx index 6da65fa..5658505 100644 --- a/src/pages/MemberManagement.tsx +++ b/src/pages/MemberManagement.tsx @@ -45,7 +45,7 @@ export default function MemberManagement() { ] const membershipCols = [ - { title: '用户ID', dataIndex: 'userId', width: 160, ellipsis: true }, + { title: '用户ID', dataIndex: 'userId', width: 160, ellipsis: true , render: (_: any, r: any) => r.userName || r.userId }, { title: '计划', dataIndex: ['plan', 'name'], width: 120, render: (_: any, r: any) => r.plan?.name || '-' }, { title: '开始', dataIndex: 'startedAt', width: 120, render: (d: string) => d ? dayjs(d).format('YYYY-MM-DD') : '-' }, { title: '到期', dataIndex: 'expiresAt', width: 120, render: (d: string) => d ? dayjs(d).format('YYYY-MM-DD') : '永久' }, @@ -53,7 +53,7 @@ export default function MemberManagement() { ] const deletionCols = [ - { title: '用户ID', dataIndex: 'userId', width: 160, ellipsis: true }, + { title: '用户ID', dataIndex: 'userId', width: 160, ellipsis: true , render: (_: any, r: any) => r.userName || r.userId }, { title: '状态', dataIndex: 'status', width: 80, render: (v: string) => v === 'pending' ? 待处理 : v === 'completed' ? 已注销 : 已取消 }, { title: '申请时间', dataIndex: 'requestedAt', width: 130, render: (d: string) => dayjs(d).format('MM-DD HH:mm') }, { title: '冷静期截止', dataIndex: 'coolingEndsAt', width: 130, render: (d: string) => dayjs(d).format('MM-DD HH:mm') }, diff --git a/src/pages/NotificationAdmin.tsx b/src/pages/NotificationAdmin.tsx index e6b6b85..6218bea 100644 --- a/src/pages/NotificationAdmin.tsx +++ b/src/pages/NotificationAdmin.tsx @@ -89,7 +89,7 @@ export default function NotificationAdmin() { const logColumns = [ { title: 'ID', dataIndex: 'id', width: 100, ellipsis: true }, - { title: '用户', dataIndex: 'userId', width: 100, ellipsis: true }, + { title: '用户', dataIndex: 'userId', width: 100, ellipsis: true , render: (_: any, r: any) => r.userName || r.userId }, { title: '类型', dataIndex: 'type', width: 100 }, { title: '标题', dataIndex: 'title', width: 200, ellipsis: true }, { diff --git a/src/pages/SecurityEvents.tsx b/src/pages/SecurityEvents.tsx index fd299f9..a1ade21 100644 --- a/src/pages/SecurityEvents.tsx +++ b/src/pages/SecurityEvents.tsx @@ -13,7 +13,7 @@ export default function SecurityEventsPage() { const cols = [ { title: '时间', dataIndex: 'createdAt', width: 140, render: (d: string) => dayjs(d).format('MM-DD HH:mm:ss') }, { title: '类型', dataIndex: 'contentType', width: 100 }, - { title: '用户', dataIndex: 'userId', width: 100, ellipsis: true }, + { title: '用户', dataIndex: 'userId', width: 100, ellipsis: true , render: (_: any, r: any) => r.userName || r.userId }, { title: '风险', dataIndex: 'riskLevel', width: 70, render: (v: string) => {v} }, { title: '结果', dataIndex: 'result', width: 80, render: (v: string) => {v} }, { title: '匹配词', dataIndex: 'matchedWords', ellipsis: true, width: 150, render: (v: string) => v || '-' },