From d26274d89d377067c1e2648192cffbf89464b361 Mon Sep 17 00:00:00 2001
From: wsj <593216709@qq.com>
Date: Wed, 28 Oct 2026 23:34:32 +0800
Subject: [PATCH] feat: 拆包

---
 src/pages/platform/audit-logs/components/AuditLogDetailDrawer.tsx |   82 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 82 insertions(+), 0 deletions(-)

diff --git a/src/pages/platform/audit-logs/components/AuditLogDetailDrawer.tsx b/src/pages/platform/audit-logs/components/AuditLogDetailDrawer.tsx
new file mode 100644
index 0000000..a5ebb39
--- /dev/null
+++ b/src/pages/platform/audit-logs/components/AuditLogDetailDrawer.tsx
@@ -0,0 +1,82 @@
+import { useMemo } from 'react';
+import { Descriptions, Drawer, Tag } from 'antd';
+import type { DescriptionsProps } from 'antd';
+import dayjs from 'dayjs';
+import { getActionText, getModuleText, resultStatusMeta } from '../columns';
+import type { AuditLogVO } from '../types';
+import '../AuditLogs.scss';
+
+interface AuditLogDetailDrawerProps {
+  open: boolean;
+  /** 待展示的审计日志,关闭时为 null。 */
+  record: AuditLogVO | null;
+  onClose: () => void;
+}
+
+const renderTag = (meta?: { text: string; color: string }) =>
+  meta ? (
+    <Tag color={meta.color} bordered={false}>
+      {meta.text}
+    </Tag>
+  ) : (
+    '-'
+  );
+
+const AuditLogDetailDrawer = ({ open, record, onClose }: AuditLogDetailDrawerProps) => {
+  const items = useMemo<DescriptionsProps['items']>(() => {
+    if (!record) return [];
+
+    return [
+      { key: 'logId', label: '日志 ID', children: record.logId },
+      {
+        key: 'createdAt',
+        label: '操作时间',
+        children: record.createdAt ? dayjs(record.createdAt).format('YYYY-MM-DD HH:mm:ss') : '-',
+      },
+      {
+        key: 'operator',
+        label: '操作人',
+        children: `${record.operatorName || '-'}${record.operatorRole ? `(${record.operatorRole})` : ''}`,
+      },
+      { key: 'operatorId', label: '操作人 ID', children: record.operatorId ?? '-' },
+      { key: 'tenantId', label: '租户 ID', children: record.tenantId || '-' },
+      { key: 'module', label: '业务模块', children: getModuleText(record.module) },
+      { key: 'action', label: '操作动作', children: getActionText(record.action) },
+      { key: 'operationDesc', label: '操作描述', children: record.operationDesc || '-' },
+      { key: 'entityType', label: '实体类型', children: record.entityType || '-' },
+      { key: 'entityId', label: '实体 ID', children: record.entityId || '-' },
+      { key: 'entityName', label: '实体名称', children: record.entityName || '-' },
+      {
+        key: 'resultStatus',
+        label: '结果状态',
+        children: renderTag(record.resultStatus ? resultStatusMeta[record.resultStatus] : undefined),
+      },
+      { key: 'errorMessage', label: '错误信息', children: record.errorMessage || '-' },
+      { key: 'requestMethod', label: '请求方法', children: record.requestMethod || '-' },
+      { key: 'requestPath', label: '请求路径', children: record.requestPath || '-' },
+      { key: 'requestIp', label: '来源 IP', children: record.requestIp || '-' },
+      {
+        key: 'userAgent',
+        label: 'User-Agent',
+        children: <span className="text-muted">{record.userAgent || '-'}</span>,
+      },
+      {
+        key: 'changeDetail',
+        label: '变更明细',
+        children: record.changeDetail ? (
+          <pre className="audit-log-page__change-detail">{record.changeDetail}</pre>
+        ) : (
+          '-'
+        ),
+      },
+    ];
+  }, [record]);
+
+  return (
+    <Drawer title="审计日志详情" width={560} open={open} onClose={onClose}>
+      {record && <Descriptions column={1} bordered size="small" items={items} />}
+    </Drawer>
+  );
+};
+
+export default AuditLogDetailDrawer;

--
Gitblit v1.9.3