From f6be59522093cd5fc0f4ee2baeb2096a3e72cae4 Mon Sep 17 00:00:00 2001 From: mmc <1556375442@qq.com> Date: Fri, 8 May 2026 15:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E8=AE=BE=E7=BD=AE=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=20=20=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/deviceAccess.ts | 11 + .../SystemSetting/BasicSettings.tsx | 397 ++++++++++++++++++ .../SystemSetting/DeviceAccessPage.tsx | 127 +++++- .../SystemSetting/DeviceManagement.tsx | 183 ++++++++ src/pages/ReportCenter.tsx | 24 +- src/pages/SystemSetting.tsx | 59 +-- 6 files changed, 720 insertions(+), 81 deletions(-) create mode 100644 src/components/SystemSetting/BasicSettings.tsx create mode 100644 src/components/SystemSetting/DeviceManagement.tsx diff --git a/src/api/deviceAccess.ts b/src/api/deviceAccess.ts index fefb849..e7722e6 100644 --- a/src/api/deviceAccess.ts +++ b/src/api/deviceAccess.ts @@ -28,6 +28,17 @@ export function updateDeviceModel(data) { }); } +//产品增加 + + +export function addProduct(data) { + return request({ + url: '/system/product/add', + method: 'post', + data + }); +} + diff --git a/src/components/SystemSetting/BasicSettings.tsx b/src/components/SystemSetting/BasicSettings.tsx new file mode 100644 index 0000000..0cdba2d --- /dev/null +++ b/src/components/SystemSetting/BasicSettings.tsx @@ -0,0 +1,397 @@ +import React, { useState } from 'react'; +import { + Form, + Input, + Select, + Switch, + Button, + Row, + Col, + Card as AntdCard, + Tag, + Table, + message, + Typography, + Space, + Modal, +} from 'antd'; +import { + CloudOutlined, + TeamOutlined, + BellOutlined, + DatabaseOutlined, + CalendarOutlined, + CheckCircleOutlined, + SyncOutlined, + DownloadOutlined, + FileTextOutlined, + DeleteOutlined, + RestOutlined, +} from '@ant-design/icons'; + +const { Text } = Typography; + +const BasicSettings = () => { + const [form] = Form.useForm(); + const handleSave = () => { + message.success('设置已保存'); + }; + + // 设备接入状态数据 + const deviceStatusData = [ + { name: '逆变器', count: '5/5', status: '正常', color: '#52c41a' }, + { name: '汇流箱', count: '20/20', status: '正常', color: '#52c41a' }, + { name: '摄像头', count: '12/12', status: '正常', color: '#52c41a' }, + { name: '无人机', count: '2/2', status: '正常', color: '#52c41a' }, + { name: 'API接口', count: '正常', status: '正常', color: '#52c41a' }, + { name: 'Modbus', count: '正常', status: '正常', color: '#52c41a' }, + ]; + + // 服务配置数据 + const serviceConfigData = [ + { name: 'MQTT配置', value: 'tcp://localhost:1883', status: '离线', statusColor: '#8c8c8c' }, + { name: '视频服务配置', value: '待接入 RTSP / WebRTC 服务', status: '待处理', statusColor: '#fa8c16' }, + { name: 'AI服务配置', value: 'http://ai-service.local', status: '待处理', statusColor: '#fa8c16' }, + { name: 'API密钥管理', value: '正常', status: '正常', statusColor: '#52c41a' }, + ]; + + // 视频服务配置数据 + const videoServiceData = [ + { name: '视频服务数', value: '1' }, + { name: '启用服务数', value: '1' }, + { name: '摄像头总数', value: '3' }, + { name: '离线摄像头', value: '3' }, + { name: '在线流数量', value: '0' }, + { name: '服务状态', value: 'ONLINE', statusColor: '#52c41a' }, + { name: 'API地址', value: 'http://127.0.0.1:9997' }, + { name: 'HLS地址', value: 'http://127.0.0.1:8888' }, + { name: 'WebRTC地址', value: 'http://127.0.0.1:8889' }, + { name: '检测结果', value: 'HTTP 401 - http://127.0.0.1...' }, + ]; + + // MQTT接入状态数据 + const mqttStatusData = [ + { name: '启用状态', value: '已启用', statusColor: '#52c41a' }, + { name: '连接状态', value: '已连接', statusColor: '#52c41a' }, + { name: 'Broker', value: 'tcp://localhost:1883' }, + { name: '客户端ID', value: 'solar-platform-backend' }, + { name: '遥测主题', value: 'pv/+/device/+/telemetry' }, + { name: '状态主题', value: 'pv/+/device/+/status' }, + { name: '最近连接', value: '2026-05-07 18:30:40' }, + { name: '最近错误', value: '-' }, + ]; + + // MQTT消息日志数据 + const mqttLogData = [ + { topic: 'pv/1/device/ROBOT-01/ack', device: 'ROBOT-01', type: 'ACK', parse: 'SUCCESS' }, + { topic: 'pv/1/device/ROBOT-01/ack', device: 'ROBOT-01', type: 'ACK', parse: 'SUCCESS' }, + { topic: 'pv/1/device/CAM-02/status', device: 'CAM-02', type: 'STATUS', parse: 'SUCCESS' }, + { topic: 'pv/1/device/INV-A02/telemetry', device: 'INV-A02', type: 'TELEMETRY', parse: 'SUCCESS' }, + ]; + + // WebSocket状态数据 + const wsStatusData = [ + { name: '服务状态', value: '已启用', statusColor: '#52c41a' }, + { name: '前端连接', value: '已连接', statusColor: '#52c41a' }, + { name: 'Endpoint', value: '/ws/pv' }, + { name: '在线连接数', value: '2' }, + { name: '最近推送', value: '-' }, + { name: '推送时间', value: '-' }, + { name: '前端端点', value: 'ws://47.100.102.7:10469/de...' }, + { name: '最近错误', value: '-' }, + ]; + + return ( +