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