From 81c32cfdeab5331d5908a74a2ff930bc8eb8ac84 Mon Sep 17 00:00:00 2001 From: yml2213 Date: Tue, 14 Jul 2026 11:17:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=B3=BB=E7=BB=9F=E8=BF=90?= =?UTF-8?q?=E7=BB=B4=E9=A1=B5=E9=9D=A2=EF=BC=9A=E6=9C=8D=E5=8A=A1=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=9C=8B=E6=9D=BF=E3=80=81=E7=B3=BB=E7=BB=9F=E8=B4=9F?= =?UTF-8?q?=E8=BD=BD=E3=80=81API=E8=AF=B7=E6=B1=82=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E3=80=81=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97=E3=80=81=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E5=85=AC=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/pages/admin/Ops.tsx | 146 ++++++++++++++++++++++++++++++++++-- 1 file changed, 141 insertions(+), 5 deletions(-) diff --git a/web/src/pages/admin/Ops.tsx b/web/src/pages/admin/Ops.tsx index a2ba66f..1ae4370 100644 --- a/web/src/pages/admin/Ops.tsx +++ b/web/src/pages/admin/Ops.tsx @@ -1,6 +1,142 @@ -const Ops = () => ( -
-
系统运维
开发中...
-
-) +import { Card, Table, Tag, Button, Badge, Progress, Space, message } from 'antd' +import { PlusOutlined, EditOutlined, DeleteOutlined, ReloadOutlined } from '@ant-design/icons' +import { Line } from '@ant-design/charts' + +const services = [ + { name: 'API 服务', status: 'normal' as const }, + { name: 'WebSocket 服务', status: 'normal' as const }, + { name: '数据库', status: 'warning' as const }, + { name: '消息队列', status: 'normal' as const }, + { name: 'CDN', status: 'normal' as const }, +] + +const statusDisplay = { normal: { color: 'green', text: '正常' }, warning: { color: 'orange', text: '告警' }, error: { color: 'red', text: '故障' } } + +const loadData = [ + { type: 'CPU 使用率', percent: 45 }, + { type: '内存使用率', percent: 62 }, + { type: '磁盘使用率', percent: 38 }, +] + +const apiData = [ + { time: '10:00', requests: 1250, errors: 2 }, { time: '10:10', requests: 1380, errors: 3 }, + { time: '10:20', requests: 1420, errors: 1 }, { time: '10:30', requests: 1560, errors: 5 }, + { time: '10:40', requests: 1320, errors: 2 }, { time: '10:50', requests: 1480, errors: 0 }, + { time: '11:00', requests: 1620, errors: 3 }, +] + +const logs = [ + { time: '2026-07-14 10:30', operator: '管理员A', action: '开通新租户', detail: '赵六科技', ip: '192.168.1.100' }, + { time: '2026-07-14 09:15', operator: '管理员B', action: '套餐修改', detail: '专业版 → 企业版', ip: '192.168.1.101' }, + { time: '2026-07-13 16:20', operator: '管理员A', action: '公告发布', detail: '系统维护通知', ip: '192.168.1.100' }, + { time: '2026-07-13 14:00', operator: '管理员B', action: '租户暂停', detail: '孙八信息', ip: '192.168.1.101' }, + { time: '2026-07-13 10:45', operator: '管理员A', action: '套餐上架', detail: '专业版', ip: '192.168.1.100' }, +] + +const announcements = [ + { id: '1', title: '系统维护通知', content: '平台将于7月20日 02:00-04:00 进行例行维护', time: '2026-07-13', status: 'published' }, + { id: '2', title: '新功能上线', content: '知识库批量导入功能已上线', time: '2026-07-10', status: 'published' }, + { id: '3', title: '版本更新预告', content: 'V3.0 版本即将发布,新增 AI 助手功能', time: '2026-07-15', status: 'draft' }, +] + +const Ops = () => { + return ( +
+

系统运维

+ + {/* 服务状态 + 系统负载 */} +
+ }> +
+ {services.map(s => ( +
+ {s.name} + + + {statusDisplay[s.status].text} + +
+ ))} +
+
+ + +
+ {loadData.map(l => ( +
+
+ {l.type} + 80 ? 'text-red-500' : l.percent > 60 ? 'text-orange-500' : 'text-green-600'}`}>{l.percent}% +
+ 80 ? '#dc2626' : l.percent > 60 ? '#d97706' : '#16a34a'} /> +
+ ))} +
数据刷新频率:30秒 · 超过 80% 触发告警
+
+
+
+ + {/* API 请求图表 */} + +
+ +
+
+ + {/* 操作日志 + 公告 */} +
+ + {t} }, + { title: '操作人', dataIndex: 'operator', key: 'operator' }, + { title: '操作', dataIndex: 'action', key: 'action' }, + { title: '详情', dataIndex: 'detail', key: 'detail', render: (d: string) => {d} }, + ]} + /> + + + } onClick={() => message.info('公告编辑')}>新建公告} + > +
+ {announcements.map(a => ( +
+
+ {a.title} + {a.status === 'published' ? '已发布' : '草稿'} +
+

{a.content}

+
+ {a.time} + + + + +
+
+ ))} +
+
+ + + ) +} + export default Ops