优化了一点 样式和设备控制

This commit is contained in:
mmc
2026-05-11 10:47:51 +08:00
parent 0b514dbace
commit 8c877b3ee2
11 changed files with 651 additions and 949 deletions

View File

@@ -1,342 +1,331 @@
import api from './request';
export function getDeviceListApi(data){
return api({
url: `/iot/device/userDevice?tenantName=${data.tenantName}&deptId=${data.deptId}`,
method: 'get',
});
}
export function getUserList(params) {
return api({
url: '/system/user/list',
method: 'get',
params
})
return api({
url: '/system/user/list',
method: 'get',
params
})
}
// 作业列表
// 作业列表
export function getWorkList(data) {
return api({
url: `/iot/workRecord/selectByUserId?userId=${data.userId}`,
method: 'get',
})
return api({
url: `/iot/workRecord/selectByUserId?userId=${data.userId}`,
method: 'get',
})
}
// /iot/deviceTask/save 新建路线
export function saveDeviceTask(data) {
return api({
url: `/iot/deviceTask/save`,
method: 'post',
data
})
export function saveDeviceTask(data) {
return api({
url: `/iot/deviceTask/save`,
method: 'post',
data
})
}
// 获取任务列表
export function getDeviceTask(data) {
return api({
url: `/iot/deviceTask/getDevicePlan`,
method: 'post',
data
})
export function getDeviceTask(data) {
return api({
url: `/iot/deviceTask/getDevicePlan`,
method: 'post',
data
})
}
// 获取任务分布/iot/deviceTask/devicePlanStatistics
export function getTaskDistribution(params) {
return api({
url: `/iot/deviceTask/devicePlanStatistics`,
method: 'get',
params
})
export function getTaskDistribution(params) {
return api({
url: `/iot/deviceTask/devicePlanStatistics`,
method: 'get',
params
})
}
//选择某一个数据https://serviceri.satabot.com/iot/workRecord/selectByWorkName?workName=${workName}&_t=${Date.now()}
export function getSingleWork(data) {
return api({
url: `/iot/workRecord/selectByWorkName?workName=${data.workName}`,
method: 'get',
})
export function getSingleWork(data) {
return api({
url: `/iot/workRecord/selectByWorkName?workName=${data.workName}`,
method: 'get',
})
}
// 执行结果/iot/deviceTask/devicePlanTaskStatistics
export function getDevicePlanTaskStatistics(params) {
return api({
url: `/iot/deviceTask/devicePlanTaskStatistics`,
method: 'get',
params
})
export function getDevicePlanTaskStatistics(params) {
return api({
url: `/iot/deviceTask/devicePlanTaskStatistics`,
method: 'get',
params
})
}
// 获取当前的设备运行路线/iot/deviceTask/concurrentDeviceRoute
export function getConcurrentDeviceRoute (params) {
return api({
url: `/iot/deviceTask/concurrentDeviceRoute`,
method: 'get',
params
})
export function getConcurrentDeviceRoute(params) {
return api({
url: `/iot/deviceTask/concurrentDeviceRoute`,
method: 'get',
params
})
}
// 获取作业数据/iot/deviceTask/workStatistics
export function getWorkStatistics(params) {
return api({
url: `/iot/deviceTask/workStatistics`,
method: 'get',
params
})
export function getWorkStatistics(params) {
return api({
url: `/iot/deviceTask/workStatistics`,
method: 'get',
params
})
}
// 判断是否能控制
export function getControlRight(params) {
const dataStr = localStorage.getItem('userInfo');
let parse = JSON.parse(dataStr);
var token=parse?.token;
return api({
url: `/websocket/judgeConnection`,
method: 'get',
headers: {
Authorization: token // token 正常带上
},
params
})
const dataStr = localStorage.getItem('userInfo');
let parse = JSON.parse(dataStr);
var token = parse?.token;
return api({
url: `/websocket/judgeConnection`,
method: 'get',
headers: {
Authorization: token // token 正常带上
},
params
})
}
// 登录
export function loginApi(data) {
return api({
url: '/login',
method: 'post',
data
})
return api({
url: '/login',
method: 'post',
data
})
}
// 可视化面板获取无人机信息
export function getPlaneDeviceList() {
return api({
url: '/iot/UAV/getProjectDeviceList',
method: 'get',
})
}
// 获取所有航线
export function getsinglePlan(data) {
return api({
url: `/iot/UAV/getFlightTask?sn=${data.gateway_sn}`,
method: 'get',
})
return api({
url: `/iot/UAV/getFlightTask?sn=${data.gateway_sn}`,
method: 'get',
})
}
// 获取航线轨迹 iot/UAV/getFlightTaskTrack
export function getsinglePlanTrack(data) {
return api({
url: `/iot/UAV/getFlightTaskTrack?taskId=${data.uuid}`,
method: 'get',
})
return api({
url: `/iot/UAV/getFlightTaskTrack?taskId=${data.uuid}`,
method: 'get',
})
}
//上传航线
export function uploadWayLine(data) {
return api({
url: '/iot/UAV/uploadWayline',
method: 'post',
data: data, // 上传文件必须用 data,不能用 params
headers: {
'Content-Type': 'multipart/form-data' // 上传文件必加!
}
})
return api({
url: '/iot/UAV/uploadWayline',
method: 'post',
data: data, // 上传文件必须用 data,不能用 params
headers: {
'Content-Type': 'multipart/form-data' // 上传文件必加!
}
})
}
//创建航线任务
export function createWaylineTask(data) {
return api({
url: '/iot/UAV/createFlightTask',
method: 'post',
data: data,
})
return api({
url: '/iot/UAV/createFlightTask',
method: 'post',
data: data,
})
}
export function updateFlightTaskStatus(taskId, status) {
return api({
url: '/iot/UAV/updateFlightTaskStatus',
method: 'post',
params: { taskId, status }
})
return api({
url: '/iot/UAV/updateFlightTaskStatus',
method: 'post',
params: { taskId, status }
})
}
export function getFlightTaskDetail(taskId) {
return api({
url: '/iot/UAV/getFlightTaskDetail',
method: 'get',
params: { taskId }
})
return api({
url: '/iot/UAV/getFlightTaskDetail',
method: 'get',
params: { taskId }
})
}
/// 航线列表
export function getWayLine() {
return api({
url: '/iot/UAV/getWayline',
method: 'get',
})
return api({
url: '/iot/UAV/getWayline',
method: 'get',
})
}
//直播流
export function getLiveStream(data) {
return api({
url: '/iot/UAV/liveStream',
method: 'post',
data
})
return api({
url: '/iot/UAV/liveStream',
method: 'post',
data
})
}
///iot/UAV/flightTaskCommand
export function postFlightCommmand(data) {
return api({
url: '/iot/UAV/flightTaskCommand',
method: 'post',
data
})
return api({
url: '/iot/UAV/flightTaskCommand',
method: 'post',
data
})
}
//切换相机
export function changeCamera(data) {
return api({
url: '/iot/UAV/changeCamera',
method: 'post',
data
})
return api({
url: '/iot/UAV/changeCamera',
method: 'post',
data
})
}
//直播心跳
export function postLiveHeartbeat(data) {
return api({
url: `/iot/UAV/liveHeartbeat?sn=${data.sn}&cameraIndex=${data.cameraIndex}`,
method: 'post',
})
return api({
url: `/iot/UAV/liveHeartbeat?sn=${data.sn}&cameraIndex=${data.cameraIndex}`,
method: 'post',
})
}
//热成像分析
export function getThermalDefault() {
return api({
url: `/api/thermal/defaults`,
method: 'get',
})
return api({
url: `/api/thermal/defaults`,
method: 'get',
})
}
//点击分析
export function getThermalAnalyzelt(data) {
return api({
url: `/api/thermal/analyze`,
method: 'post',
data
})
return api({
url: `/api/thermal/analyze`,
method: 'post',
data
})
}
//像素点信息/api/thermal/probe
export function getThermalProbe(data) {
return api({
url: `/api/thermal/probe`,
method: 'post',
data
})
return api({
url: `/api/thermal/probe`,
method: 'post',
data
})
}
//获取报告
export function getThermalReport(data) {
return api({
url: `/api/thermal/downloadReport`,
method: 'get',
data
})
return api({
url: `/api/thermal/downloadReport`,
method: 'get',
data
})
}
//下载报告
export function downloadReport(data) {
return api({
url: `/api/thermal/report`,
method: 'get',
params: data,
})
return api({
url: `/api/thermal/report`,
method: 'get',
params: data,
})
}
//获取 用户设备任务列表
export function getUserWorkRecord(params) {
return api({
url: `/iot/workRecord/selectByUserId`,
method: 'get',
params
})
return api({
url: `/iot/workRecord/selectByUserId`,
method: 'get',
params
})
}
//获取 任务数据
export function getWorkData(params) {
return api({
url: `/iot/workRecord/selectByWorkName`,
method: 'get',
params
})
return api({
url: `/iot/workRecord/selectByWorkName`,
method: 'get',
params
})
}
export function getAlimage(params) {
return api({
url: `/api/thermal/image`,
method: 'get',
params,
//responseType: "blob", // 必须加这个
})
return api({
url: `/api/thermal/image`,
method: 'get',
params,
//responseType: "blob", // 必须加这个
})
}
// 远程遥控 判断是否有权限/forward/device/remoteControl platform:web
export function getJurisdiction(data) {
return api({
url: '/forward/device/remoteControl',
method: 'post',
data
})
return api({
url: '/forward/device/remoteControl',
method: 'post',
data
})
}
//下载割草任务记录
//
export function downloadOperationReport() {
return api({
url: '/iot/device/generateOperationReport',
method: 'get',
responseType: 'arraybuffer' // 👈 只需要加这一行!
})
return api({
url: '/iot/device/generateOperationReport',
method: 'get',
responseType: 'arraybuffer' // 👈 只需要加这一行!
})
}
//
export function getDeviceIntradayData(params) {
return api({
url: '/iot/device/getDeviceIntradayData',
method: 'get',
return api({
url: '/iot/device/getDeviceIntradayData',
method: 'get',
params
})
})
}
//释放控制权限/forward/device/releaseControl
export function releaseControl(data) {
return api({
url: '/forward/device/releaseControl',
method: 'post',
data
})
return api({
url: '/forward/device/releaseControl',
method: 'post',
data
})
}

17
src/api/device.ts Normal file
View File

@@ -0,0 +1,17 @@
import request from './request';
export function getDeviceListApi(data) {
return request({
url: `/iot/device/userDevice?tenantName=${data.tenantName}&deptId=${data.deptId}`,
method: 'get',
});
}
export function getPlaneDeviceList() {
return request({
url: '/iot/UAV/getProjectDeviceList',
method: 'get',
})
}

View File

@@ -181,7 +181,7 @@ export default function AppLayout() {
/>
</Sider>
<Content style={{ background: '#f4f7f9', overflowY: 'auto', padding: '16px' }}>
<Content style={{ background: '#f4f7f9', overflowY: 'auto', padding: '0px 16px' }}>
<Outlet />
</Content>
</Layout>

View File

@@ -0,0 +1,290 @@
import React, { useState, useEffect } from 'react';
import {
Layout, Card, Row, Col, Statistic, Tag, Button, Table,
Typography, Space, Progress, Badge, Timeline, message,
Select
} from 'antd';
import {
EnvironmentOutlined, RobotOutlined, BranchesOutlined,
ThunderboltOutlined, CheckCircleOutlined, PauseOutlined,
RocketOutlined, SyncOutlined, WarningOutlined,
CloudOutlined, ClockCircleOutlined, ReloadOutlined,
AimOutlined, ApiOutlined, SettingOutlined,
PlusOutlined, ArrowRightOutlined,
EditOutlined
} from '@ant-design/icons';
import { useSelector } from 'react-redux';
import { getDeviceListApi, getPlaneDeviceList } from '../../api/device.ts';
import { RootState } from '@/src/store';
const { Content } = Layout;
const { Text, Title } = Typography;
// 模拟数据
const topCards = [
{ title: '无人机机场状态', icon: <EnvironmentOutlined />, value: '2 / 2', desc: '在线', sub: '可调度 2 架', color: '#1890ff' },
{ title: '巡检机器人', icon: <RobotOutlined />, value: '3 台', desc: '', sub: '执行中 2', color: '#722ed1' },
{ title: '除草机器人', icon: <BranchesOutlined />, value: '2 台', desc: '', sub: '作业中 1', color: '#13c2c2' },
{ title: '清洗无人机', icon: <CloudOutlined />, value: '2 架', desc: '', sub: '待命 1', color: '#eb2f96' },
{ title: '设备平均电量', icon: <ThunderboltOutlined />, value: '86%', desc: '', sub: '', color: '#52c41a' },
{ title: '今日任务执行', icon: <CheckCircleOutlined />, value: '12 / 15', desc: '', sub: '完成率 80%', color: '#2f54eb' },
];
const scheduleList = [
{ id: 1, name: '无人机机场 A01', type: '无人机机场', status: '在线', mode: '待命', battery: 100, position: '开压站旁', task: '待命', comm: '良好' },
{ id: 2, name: '巡检机器人 RBT-01', type: '巡检机器人', status: '作业中', mode: '自主巡检', battery: 68, position: '区块 B-03', task: '巡检航线 P-02', comm: '良好' },
{ id: 3, name: '巡检机器人 RBT-02', type: '巡检机器人', status: '在线', mode: '待命', battery: 92, position: '区块 D-06', task: '待命', comm: '良好' },
{ id: 4, name: '除草机器人 GR-01', type: '除草机器人', status: '充电中', mode: '回充', battery: 35, position: '充电桩 1', task: '回充中', comm: '良好' },
{ id: 5, name: '清洗无人机 UAV-C01', type: '清洗无人机', status: '作业中', mode: '自主清洗', battery: 72, position: '清洗区 C-05', task: '清洗航线 C-05', comm: '良好' },
{ id: 6, name: '清洗无人机 UAV-C02', type: '清洗无人机', status: '待命', mode: '待命', battery: 96, position: '无人机机场 A01', task: '待命', comm: '良好' },
];
const taskTimeline = [
{ time: '10:24:18', color: 'blue', text: 'UAV-C01 开始执行清洗航线 C-05', status: '任务开始' },
{ time: '10:21:35', color: 'orange', text: 'RBT-01 开始执行巡检航线 P-02', status: '任务开始' },
{ time: '10:18:02', color: 'green', text: 'GR-02 开始除草作业 G-01', status: '任务开始' },
{ time: '10:15:47', color: 'gray', text: 'UAV-C02 任务待命就绪', status: '待命就绪' },
{ time: '10:12:33', color: 'blue', text: 'UAV-C01 再次返机补水', status: '返机补给' },
{ time: '09:58:10', color: 'green', text: 'RBT-02 完成巡检航线 P-01', status: '任务完成' },
];
const logs = [
{ time: '10:24:35', device: 'UAV-C01', type: '命令', desc: '起飞指令下发,开始作业' },
{ time: '10:21:40', device: 'RBT-01', type: '命令', desc: '开始巡检任务 P-02' },
{ time: '10:20:11', device: 'UAV-C02', type: '命令', desc: '转入待命状态' },
{ time: '10:18:05', device: 'GR-02', type: '命令', desc: '除草作业开始 G-01' },
{ time: '10:12:35', device: 'UAV-C01', type: '告警', desc: '返航补水' },
{ time: '10:05:22', device: 'RBT-01', type: '事件', desc: '电量较低,建议回充', level: '低电量' },
];
// 设备总览组件
export default function DeviceOverviewPage({ devices, planedevices, devicesAll }) {
console.log(devicesAll)
const [activeTab, setActiveTab] = useState('drone');
const [selectedDevice, setSelectedDevice] = useState('');
const controlTabs = [
{ key: 'airport', label: '无人机机场' },
{ key: 'robot', label: '巡检机器人' },
{ key: 'mower', label: '除草机器人' },
{ key: 'clean', label: '清洗无人机' },
{ key: 'machine', label: '机械设备' },
];
const handleStart = () => message.success('任务已启动');
const handlePause = () => message.info('任务已暂停');
const handleReturn = () => message.info('返航指令已下发');
const handleRecharge = () => message.info('回充指令已下发');
const handleEmergencyStop = () => message.error('已触发急停!');
useEffect(() => {
if (devicesAll.length > 0) {
setSelectedDevice(devicesAll[0].device_sn);
}
}, [devicesAll])
return (
<Content style={{ maxWidth: 1800, margin: '0 auto', }}>
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '16px', marginBottom: 20 }}>
{topCards.map((card, idx) => (
<div key={idx} style={{ flex: 1 }}>
<Card bordered={false} style={{ borderRadius: 12, boxShadow: '0 2px 8px rgba(0,0,0,0.05)', height: '110px', display: 'flex', alignItems: 'center' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 12, width: '100%' }}>
<div style={{ width: 48, height: 48, borderRadius: 10, background: `${card.color}15`, color: card.color, display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 20 }}>
{card.icon}
</div>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 13, color: '#666' }}>{card.title}</div>
<div style={{ fontSize: 24, fontWeight: 700, color: '#222' }}>{card.value}</div>
{card.sub && <div style={{ fontSize: 12, color: '#999' }}>{card.sub}</div>}
</div>
</div>
</Card>
</div>
))}
</div>
<Row gutter={16}>
<Col xs={24} lg={14}>
{/* 装备协同态势图 */}
<Card title={<><EnvironmentOutlined /> 装备协同态势图</>} extra={<Button type="text" icon={<SettingOutlined />} />} bordered={false} style={{ borderRadius: 12, marginBottom: 16 }} bodyStyle={{ padding: 0 }}>
<div style={{ width: '100%', height: 400, background: '#e6f7ff url(https://picsum.photos/seed/solarfarm/1600/800) center/cover', borderRadius: 12, position: 'relative', overflow: 'hidden' }}>
<div style={{ position: 'absolute', top: 16, left: 16, background: 'rgba(255,255,255,0.95)', borderRadius: 8, padding: 12 }}>
<div style={{ fontSize: 12, fontWeight: 600, marginBottom: 8 }}>图例说明</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, fontSize: 11 }}>
<div><span style={{ color: '#1890ff' }}>———</span> 巡检航线</div>
<div><span style={{ color: '#fa8c16' }}>———</span> 机器人路径</div>
<div><span style={{ color: '#52c41a' }}>———</span> 清洗路径</div>
<div><span style={{ color: '#52c41a' }}>●</span> 设备位置</div>
<div><span style={{ color: '#1890ff' }}>●</span> 补给/充电点</div>
<div><span style={{ color: '#ff4d4f' }}>■</span> 障碍/禁入区</div>
</div>
</div>
</div>
</Card>
<Card title={<><SettingOutlined /> 装备调度列表</>} bordered={false} style={{ borderRadius: 12, marginBottom: 16 }}>
<Table rowKey="id" size="small" pagination={false}
columns={[
{ title: '装备名称', dataIndex: 'name', width: 160 },
{ title: '类型', dataIndex: 'type', width: 100 },
{ title: '当前状态', dataIndex: 'status', width: 80, render: s => <Tag color={s === '作业中' ? 'processing' : s === '在线' ? 'success' : 'default'}>{s}</Tag> },
{ title: '模式', dataIndex: 'mode', width: 80 },
{ title: '电量', dataIndex: 'battery', width: 80, render: v => <Progress percent={v} size="small" status={v < 40 ? 'exception' : 'active'} /> },
{ title: '位置', dataIndex: 'position', width: 100 },
{ title: '当前任务', dataIndex: 'task', width: 120 },
{ title: '通讯状态', dataIndex: 'comm', width: 80, render: v => <Badge status="success" text={v} /> },
{ title: '操作', key: 'action', width: 100, render: () => <Space><Button size="small" type="text" icon={<EditOutlined />} /><Button size="small" type="text" icon={<SettingOutlined />} /></Space> }
]}
dataSource={scheduleList}
scroll={{ x: 'max-content' }}
/>
</Card>
<Card title={<><SettingOutlined /> <span style={{ color: '#1890ff' }}>控制日志 / 告警记录</span></>} bordered={false} style={{ borderRadius: 12 }} extra={<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><Button size="small" style={{ borderRadius: 8, border: '1px solid #d9d9d9' }}>全部级别 ▼</Button></div>}>
<Table rowKey="time" size="small" pagination={false} dataSource={logs} scroll={{ x: 'max-content' }}
columns={[
{ title: '时间', dataIndex: 'time', width: 100, render: t => <span style={{ fontSize: 14 }}>{t}</span> },
{ title: '设备', dataIndex: 'device', width: 120, render: t => <span style={{ fontSize: 14 }}>{t}</span> },
{ title: '类型', dataIndex: 'type', width: 80, render: t => { let c = '#52c41a'; if (t === '告警') c = '#fa8c16'; if (t === '事件') c = '#1890ff'; return <div style={{ display: 'flex', alignItems: 'center', gap: 4 }}><span style={{ width: 12, height: 12, borderRadius: 2, background: c }} /><span style={{ fontSize: 14 }}>{t}</span></div> } },
{ title: '描述', dataIndex: 'desc', render: t => <span style={{ fontSize: 14 }}>{t}</span> },
{ title: '', width: 80, render: (_, r) => r.level ? <Tag color="red" style={{ fontSize: 12 }}>{r.level}</Tag> : null }
]}
/>
<div style={{ textAlign: 'center', marginTop: 12 }}><Button type="link" style={{ fontSize: 16, color: '#1890ff' }}>查看更多日志</Button></div>
</Card>
</Col>
<Col xs={24} lg={10}>
<Card title={<> 设备控制面板</>} bordered={false} style={{ borderRadius: 12, marginBottom: 16 }} bodyStyle={{ padding: 16, paddingBottom: 0 }}>
<Select style={{ width: 180, marginBottom: 4 }}
options={devicesAll.map((item) => {
return {
value: item.device_sn,
label: item.drone_callsign
}
})}
value={selectedDevice} // 必须加
onChange={setSelectedDevice}// 必须加
/>
<Row gutter={16}>
<Col span={12}>
<div style={{ marginBottom: 24 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 16 }}>
<span style={{ fontSize: 24, color: '#1890ff' }}><RocketOutlined /></span>
<span style={{ fontSize: 16, fontWeight: 600 }}>清洗无人机 UAV-C01</span>
<Tag color="success" size="small">作业中</Tag>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 6 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
<span style={{ color: '#52c41a' }}><ThunderboltOutlined /></span>
<span style={{ fontSize: 12 }}>电量 72%</span>
</div>
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
<span style={{ fontSize: 12 }}>信号强度</span>
<span style={{ color: '#52c41a' }}>强</span>
</div>
</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, marginBottom: 24 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}><span style={{ color: '#666', fontSize: 12 }}>当前模式</span><span style={{ fontSize: 12 }}>自主清洗模式</span></div>
<div style={{ display: 'flex', justifyContent: 'space-between' }}><span style={{ color: '#666', fontSize: 12 }}>当前位置</span><span style={{ fontSize: 12 }}>清洗区域 C-05</span></div>
<div style={{ display: 'flex', justifyContent: 'space-between' }}><span style={{ color: '#666', fontSize: 12 }}>当前任务</span><span style={{ fontSize: 12 }}>清洗航线 C-05</span></div>
<div style={{ display: 'flex', justifyContent: 'space-between' }}><span style={{ color: '#666', fontSize: 12 }}>预计剩余时间</span><span style={{ fontSize: 12, fontWeight: 600 }}>00:18:36</span></div>
</div>
<div style={{ display: 'flex', justifyContent: "space-between", flexWrap: 'wrap' }}>
<Button type="primary" size="large" style={{ borderRadius: 8, padding: "0 10px", fontSize: "14px" }} onClick={handleStart}>启动任务</Button>
<Button style={{ borderRadius: 8, padding: "0 10px", fontSize: "14px" }} size="large" onClick={handlePause}>暂停</Button>
<Button style={{ borderRadius: 8, padding: "0 10px", fontSize: "14px" }} type="primary" size="large" onClick={handleReturn}>返航</Button>
<Button style={{ background: '#52c41a', padding: "0 10px", fontSize: "14px", borderColor: '#52c41a', borderRadius: 8, color: "#fff" }} size="large" onClick={handleRecharge}>回充</Button>
</div>
</div>
</Col>
<Col span={12}>
<div style={{ marginBottom: 16 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 8 }}>
<span style={{ fontSize: 14, fontWeight: 500, color: "#666" }}>实时画面</span>
<span style={{ fontSize: 13, color: '#999' }}>2025-05-24 10:24:18</span>
</div>
<div style={{ width: '100%', height: 160, background: '#000 url(https://picsum.photos/seed/droneview/800/400) center/cover', borderRadius: 8, position: 'relative', overflow: 'hidden' }}>
<div style={{ position: 'absolute', bottom: 0, left: 0, right: 0, background: 'rgba(0,0,0,0.6)', color: '#fff', display: 'flex', justifyContent: 'space-between', padding: '8px 12px', fontSize: 14 }}>
<span>高度 12.5m</span><span>速度 4.2m/s</span><span>距离 86m</span>
</div>
</div>
</div>
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
<Button size="large" style={{ flex: 1, borderRadius: 8, padding: "0 10px", fontSize: "14px" }}>切换手动</Button>
<Button danger size="large" style={{ flex: 1, borderRadius: 8, padding: "0 10px", fontSize: "14px", backgroundColor: "#ff4d4f", borderColor: "#ff4d4f", color: "#fff" }} onClick={handleEmergencyStop}>急停</Button>
</div>
</Col>
</Row>
</Card>
<Card title={<><ApiOutlined /> AI分析与操作建议</>} bordered={false} style={{ borderRadius: 12, marginBottom: 16 }}>
<Row gutter={16} style={{ marginBottom: 20 }}>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(255,77,79,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#ff4d4f', fontSize: 20 }}><span role="img" aria-label="hotspot">🔥</span></div><div><div style={{ fontSize: 11, color: '#666' }}>热斑疑似</div><div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>2 <span style={{ fontSize: 12 }}>处</span></div></div></div></Col>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(82,196,26,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#52c41a', fontSize: 16 }}><BranchesOutlined /></div><div><div style={{ fontSize: 11, color: '#666' }}>杂草高发区</div><div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>3 <span style={{ fontSize: 12 }}>块</span></div></div></div></Col>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(24,144,255,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#1890ff', fontSize: 16 }}><CloudOutlined /></div><div><div style={{ fontSize: 11, color: '#666' }}>组件风险区</div><div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>4 <span style={{ fontSize: 12 }}>块</span></div></div></div></Col>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(255,77,79,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#ff4d4f', fontSize: 16 }}><WarningOutlined /></div><div><div style={{ fontSize: 11, color: '#666' }}>围栏异常</div><div style={{ fontSize: 22, fontWeight: 700, color: '#ff4d4f' }}>1 <span style={{ fontSize: 12 }}>处</span></div></div></div></Col>
</Row>
<Row gutter={16}>
<Col span={14}>
<div style={{ marginBottom: 12 }}>
<div style={{ fontSize: 16, fontWeight: 600, color: '#1890ff', marginBottom: 12 }}>建议操作</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 2, padding: '16px', borderRadius: 12, border: '1px solid #e8e8e8' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>优先执行巡检航线 P-03</span></div><svg t="1778317171240" className="icon" viewBox="0 0 1024 1024" width="20" height="20"><path d="M384.32 797.512a30.088 30.088 0 0 1-21.288-51.392L597.144 512 363.032 277.816a30.088 30.088 0 0 1 0-42.568 30.088 30.088 0 0 1 42.568 0l255.392 255.464a30.088 30.088 0 0 1 0 42.568L405.6 788.696a30.04 30.04 0 0 1-21.28 8.816z" fill="#666666"></path></svg></div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>先行安排除草任务 G-02</span></div><svg t="1778317171240" className="icon" viewBox="0 0 1024 1024" width="20" height="20"><path d="M384.32 797.512a30.088 30.088 0 0 1-21.288-51.392L597.144 512 363.032 277.816a30.088 30.088 0 0 1 0-42.568 30.088 30.088 0 0 1 42.568 0l255.392 255.464a30.088 30.088 0 0 1 0 42.568L405.6 788.696a30.04 30.04 0 0 1-21.28 8.816z" fill="#666666"></path></svg></div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>建议生成清洗工单</span></div><svg t="1778317171240" className="icon" viewBox="0 0 1024 1024" width="20" height="20"><path d="M384.32 797.512a30.088 30.088 0 0 1-21.288-51.392L597.144 512 363.032 277.816a30.088 30.088 0 0 1 0-42.568 30.088 30.088 0 0 1 42.568 0l255.392 255.464a30.088 30.088 0 0 1 0 42.568L405.6 788.696a30.04 30.04 0 0 1-21.28 8.816z" fill="#666666"></path></svg></div>
</div>
</div>
</Col>
<Col span={10}>
<div style={{ display: 'flex', flexDirection: 'column', paddingBottom: "12px", gap: 16, height: '100%', justifyContent: "end" }}>
<div style={{ display: 'flex', gap: 12 }}>
<Button type="primary" size="large" style={{ flex: 1, borderRadius: 8, fontSize: 16 }}>生成任务</Button>
<Button size="large" style={{ flex: 1, borderRadius: 8, fontSize: 16, border: '1px solid #1890ff', color: '#1890ff' }}>AI优化路径</Button>
</div>
<Button type="primary" size="large" style={{ borderRadius: 8, fontSize: 16 }}>一键联动作业</Button>
</div>
</Col>
</Row>
</Card>
<Card title="环境与飞行条件" bordered={false} style={{ borderRadius: 12, marginBottom: 16 }}>
<div style={{ display: "flex", justifyContent: "space-between", gap: 12, alignItems: "center" }}>
<div style={{ display: "flex", border: "1px solid #e8e8e8", borderRadius: 12, overflow: "hidden", flex: 1 }}>
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>风速</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>2.6 m/s</div><div style={{ fontSize: 11, color: '#666', fontWeight: 600, marginTop: 2 }}>轻风</div></div>
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>温度</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>28.7℃</div><div style={{ fontSize: 11, color: '#52c41a', fontWeight: 600, marginTop: 2 }}>适宜</div></div>
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>辐照度</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>812W/m²</div><div style={{ fontSize: 11, color: '#fa8c16', fontWeight: 600, marginTop: 2 }}>较高</div></div>
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>降雨概率</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>10%</div><div style={{ fontSize: 11, color: '#52c41a', fontWeight: 600, marginTop: 2 }}>低</div></div>
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>GNSS状态</div><div style={{ fontSize: 14, fontWeight: 700, color: '#52c41a', marginTop: 2 }}>正常</div><div style={{ fontSize: 11, color: '#666', fontWeight: 600, marginTop: 2 }}>定位稳定</div></div>
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>禁飞状态</div><div style={{ fontSize: 14, fontWeight: 700, color: '#52c41a', marginTop: 2 }}>未禁飞</div><div style={{ fontSize: 11, color: '#666', fontWeight: 600, marginTop: 2 }}>可执行</div></div>
</div>
<div style={{ width: 110, padding: '12px 8px', borderRadius: 8, background: '#f6ffed', border: '1px solid #b7eb8f', textAlign: 'center', display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 4 }}>
<div style={{ fontSize: 14, fontWeight: 700, color: '#52c41a' }}>适宜执行</div>
<div style={{ width: 18, height: 18, borderRadius: '50%', background: '#52c41a', display: 'flex', alignItems: 'center', justifyContent: 'center' }}><CheckCircleOutlined style={{ fontSize: 12, color: '#fff' }} /></div>
<div style={{ fontSize: 11, color: '#666' }}>可正常开展作业</div>
</div>
</div>
</Card>
<Card title={<><ClockCircleOutlined /> 任务执行时间线</>} bordered={false} style={{ borderRadius: 12 }} extra={<div style={{ fontSize: 12, color: '#666' }}>今天 2025-05-24</div>}>
<Timeline mode="left">
{taskTimeline.map((item, idx) => (
<Timeline.Item key={idx} color={item.color} label={<div style={{ fontSize: 11, color: '#999' }}>{item.time}</div>}>
<div style={{ fontSize: 13 }}>{item.text}</div>
<div style={{ fontSize: 11, color: '#999' }}>{item.status}</div>
</Timeline.Item>
))}
</Timeline>
<div style={{ textAlign: 'center', marginTop: 12 }}><Button type="link">查看更多</Button></div>
</Card>
</Col>
</Row>
</Content>
);
}

View File

@@ -53,8 +53,12 @@
}
.ant-card-body{
padding-top:12px !important;
padding-bottom:12px !important;
}
.ant-select-selector{
border-radius:8px !important;
}
@keyframes sunRotate {

View File

@@ -69,20 +69,23 @@ export default function AlarmCenterPage() {
return (
<Layout style={{ minHeight: '100vh', background: '#fff', overflow: 'hidden' }}>
<div style={{ padding: '20px 24px 0' }}>
<Typography.Title level={4} style={{ margin: 0 }}>告警中心</Typography.Title>
<Text type="secondary">告警处置闭环、规则管理与事件中心</Text>
<div style={{ display: 'flex', paddingBottom: "12px" }}>
<div style={{ padding: '20px 24px 0' }}>
<Typography.Title level={4} style={{ margin: 0 }}>告警中心</Typography.Title>
<Text type="secondary">告警处置闭环、规则管理与事件中心</Text>
</div>
<Header style={{ background: '#fff', padding: 0, borderBottom: '1px solid #f0f0f0', position: 'sticky', top: 0, zIndex: 10 }}>
<Menu
mode="horizontal"
selectedKeys={[activeTab]}
onClick={({ key }) => setActiveTab(key)}
items={showTabs}
style={{ border: 0, height: 64, lineHeight: '64px' }}
/>
</Header>
</div>
<Header style={{ background: '#fff', padding: 0, borderBottom: '1px solid #f0f0f0', position: 'sticky', top: 0, zIndex: 10 }}>
<Menu
mode="horizontal"
selectedKeys={[activeTab]}
onClick={({ key }) => setActiveTab(key)}
items={showTabs}
style={{ border: 0, height: 64, lineHeight: '64px' }}
/>
</Header>
<Content style={{
maxHeight: 'calc(100vh - 64px)', overflowY: 'auto', background: '#f5f7fa',

View File

@@ -1,742 +1,92 @@
import React, { useState } from 'react';
import {
Layout, Card, Row, Col, Statistic, Tag, Button, Table,
Typography, Space, Progress, Badge, Timeline, message
} from 'antd';
import {
EnvironmentOutlined, RobotOutlined, BranchesOutlined,
ThunderboltOutlined, CheckCircleOutlined, PauseOutlined,
RocketOutlined, SyncOutlined, WarningOutlined,
CloudOutlined, ClockCircleOutlined, ReloadOutlined,
AimOutlined, ApiOutlined, SettingOutlined,
PlusOutlined, ArrowRightOutlined,
EditOutlined
} from '@ant-design/icons';
import React, { useState, useEffect } from 'react';
import { Layout, Typography, Menu } from 'antd';
import { AppstoreOutlined, SettingOutlined } from '@ant-design/icons';
import DeviceOverviewPage from '../components/devices/DeviceOverviewPage';
import { getDeviceListApi, getPlaneDeviceList } from '../api/device';
import { useSelector } from 'react-redux';
import { RootState } from '../store';
const { Content } = Layout;
const { Text, Title } = Typography;
const { Header, Content } = Layout;
const { Text } = Typography;
// ------------------- 模拟数据 -------------------
const topCards = [
{ title: '无人机机场状态', icon: <EnvironmentOutlined />, value: '2 / 2', desc: '在线', sub: '可调度 2 架', color: '#1890ff' },
{ title: '巡检机器人', icon: <RobotOutlined />, value: '3 台', desc: '', sub: '执行中 2', color: '#722ed1' },
{ title: '除草机器人', icon: <BranchesOutlined />, value: '2 台', desc: '', sub: '作业中 1', color: '#13c2c2' },
{ title: '清洗无人机', icon: <CloudOutlined />, value: '2 架', desc: '', sub: '待命 1', color: '#eb2f96' },
{ title: '设备平均电量', icon: <ThunderboltOutlined />, value: '86%', desc: '', sub: '', color: '#52c41a' },
{ title: '今日任务执行', icon: <CheckCircleOutlined />, value: '12 / 15', desc: '', sub: '完成率 80%', color: '#2f54eb' },
];
// 设置状态页面(你后续自己填内容)
const DeviceStatusSettingPage = () => (
<div style={{ padding: 20 }}>
<h2>设置状态页面(/devices/status)</h2>
</div>
);
const scheduleList = [
{ id: 1, name: '无人机机场 A01', type: '无人机机场', status: '在线', mode: '待命', battery: 100, position: '开压站旁', task: '待命', comm: '良好' },
{ id: 2, name: '巡检机器人 RBT-01', type: '巡检机器人', status: '作业中', mode: '自主巡检', battery: 68, position: '区块 B-03', task: '巡检航线 P-02', comm: '良好' },
{ id: 3, name: '巡检机器人 RBT-02', type: '巡检机器人', status: '在线', mode: '待命', battery: 92, position: '区块 D-06', task: '待命', comm: '良好' },
{ id: 4, name: '除草机器人 GR-01', type: '除草机器人', status: '充电中', mode: '回充', battery: 35, position: '充电桩 1', task: '回充中', comm: '良好' },
{ id: 5, name: '清洗无人机 UAV-C01', type: '清洗无人机', status: '作业中', mode: '自主清洗', battery: 72, position: '清洗区 C-05', task: '清洗航线 C-05', comm: '良好' },
{ id: 6, name: '清洗无人机 UAV-C02', type: '清洗无人机', status: '待命', mode: '待命', battery: 96, position: '无人机机场 A01', task: '待命', comm: '良好' },
];
export default function DeviceIndexPage() {
const [activeTab, setActiveTab] = useState('overview');
const { userInfo } = useSelector((state: RootState) => state.user);
const [devices, setDevices] = useState([]);
const [planedevices, setPlaneDevices] = useState([]);
const [devicesAll, setDevicesAll] = useState([]);
const taskTimeline = [
{ time: '10:24:18', color: 'blue', text: 'UAV-C01 开始执行清洗航线 C-05', status: '任务开始' },
{ time: '10:21:35', color: 'orange', text: 'RBT-01 开始执行巡检航线 P-02', status: '任务开始' },
{ time: '10:18:02', color: 'green', text: 'GR-02 开始除草作业 G-01', status: '任务开始' },
{ time: '10:15:47', color: 'gray', text: 'UAV-C02 任务待命就绪', status: '待命就绪' },
{ time: '10:12:33', color: 'blue', text: 'UAV-C01 再次返机补水', status: '返机补给' },
{ time: '09:58:10', color: 'green', text: 'RBT-02 完成巡检航线 P-01', status: '任务完成' },
];
const logs = [
{ time: '10:24:35', device: 'UAV-C01', type: '命令', desc: '起飞指令下发,开始作业' },
{ time: '10:21:40', device: 'RBT-01', type: '命令', desc: '开始巡检任务 P-02' },
{ time: '10:20:11', device: 'UAV-C02', type: '命令', desc: '转入待命状态' },
{ time: '10:18:05', device: 'GR-02', type: '命令', desc: '除草作业开始 G-01' },
{ time: '10:12:35', device: 'UAV-C01', type: '告警', desc: '返航补水' },
{ time: '10:05:22', device: 'RBT-01', type: '事件', desc: '电量较低,建议回充', level: '低电量' },
];
// ------------------- 主组件 -------------------
export default function EquipmentCooperationPage() {
const [activeTab, setActiveTab] = useState('drone');
const controlTabs = [
{ key: 'airport', label: '无人机机场' },
{ key: 'robot', label: '巡检机器人' },
{ key: 'mower', label: '除草机器人' },
{ key: 'clean', label: '清洗无人机' },
{ key: 'machine', label: '机械设备' },
const tabs = [
{ key: 'overview', label: '装备总览', icon: <AppstoreOutlined />, path: '/devices/overview' },
{ key: 'status', label: '设置状态', icon: <SettingOutlined />, path: '/devices/status' },
];
const handleStart = () => message.success('任务已启动');
const handlePause = () => message.info('任务已暂停');
const handleReturn = () => message.info('返航指令已下发');
const handleRecharge = () => message.info('回充指令已下发');
const handleEmergencyStop = () => message.error('已触发急停!');
const renderContent = () => {
if (activeTab === 'overview') return <DeviceOverviewPage devices={devices} planedevices={planedevices} devicesAll={devicesAll} />;
if (activeTab === 'status') return <DeviceStatusSettingPage />;
return null;
};
const getPlaneList = () => {
getPlaneDeviceList().then(res => {
if (res?.code == 200) {
const drones = res?.data?.detail;
setPlaneDevices(drones);
setDevicesAll([...devices, ...drones]);
}
});
};
const getDevice = () => {
const data = { tenantName: userInfo.username, deptId: 1 };
getDeviceListApi(data).then(res => {
if (res?.code == 200 && res?.data?.length) {
setDevices(res.data);
setDevicesAll([...planedevices, ...res.data.data]);
}
});
};
useEffect(() => {
getDevice();
getPlaneList();
}, []);
return (
<Layout style={{ background: '#f5f7fa', minHeight: '100vh', padding: '20px' }}>
<Content style={{ maxWidth: 1800, margin: '0 auto' }}>
{/* 顶部统计卡片 */}
{/* 顶部统计卡片 - 正方形 + 自动换行 */}
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '16px', marginBottom: 20 }}>
{topCards.map((card, idx) => (
<div
key={idx}
style={{
flex: 1,
}}
>
<Card
bordered={false}
style={{
borderRadius: 12,
boxShadow: '0 2px 8px rgba(0,0,0,0.05)',
height: '120px', // 固定高度
display: 'flex',
alignItems: 'center',
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: 12, width: '100%' }}>
<div
style={{
width: 48,
height: 48,
borderRadius: 10,
background: `${card.color}15`,
color: card.color,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: 20,
flexShrink: 0,
}}
>
{card.icon}
</div>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 13, color: '#666' }}>{card.title}</div>
<div style={{ fontSize: 24, fontWeight: 700, color: '#222' }}>{card.value}</div>
{card.sub && <div style={{ fontSize: 12, color: '#999' }}>{card.sub}</div>}
</div>
</div>
</Card>
</div>
))}
<Layout style={{ minHeight: '100vh', background: '#fff', overflow: 'hidden' }}>
<div style={{ display: 'flex', paddingBottom: "12px" }}>
<div style={{ padding: '20px 24px 0' }}>
<Typography.Title level={4} style={{ margin: 0 }}>装备控制</Typography.Title>
<Text type="secondary"> 装备总览、状态监控与参数配置</Text>
</div>
<Row gutter={16}>
{/* 左侧:装备协同态势图 */}
<Col xs={24} lg={14}>
<Card
title={<><EnvironmentOutlined /> 装备协同态势图</>}
extra={<Button type="text" icon={<SettingOutlined />} />}
bordered={false}
style={{ borderRadius: 12, marginBottom: 16 }}
bodyStyle={{ padding: 0 }}
>
<div style={{
width: '100%', height: 400,
background: '#e6f7ff url(https://picsum.photos/seed/solarfarm/1600/800) center/cover',
borderRadius: 12,
position: 'relative',
overflow: 'hidden'
}}>
{/* 图例 */}
<div style={{ position: 'absolute', top: 16, left: 16, background: 'rgba(255,255,255,0.95)', borderRadius: 8, padding: 12 }}>
<div style={{ fontSize: 12, fontWeight: 600, marginBottom: 8 }}>图例说明</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, fontSize: 11 }}>
<div><span style={{ color: '#1890ff' }}>———</span> 巡检航线</div>
<div><span style={{ color: '#fa8c16' }}>———</span> 机器人路径</div>
<div><span style={{ color: '#52c41a' }}>———</span> 清洗路径</div>
<div><span style={{ color: '#52c41a' }}>●</span> 设备位置</div>
<div><span style={{ color: '#1890ff' }}>●</span> 补给/充电点</div>
<div><span style={{ color: '#ff4d4f' }}>■</span> 障碍/禁入区</div>
</div>
</div>
{/* 设备标注(示意) */}
<div style={{ position: 'absolute', top: 80, left: 120, background: 'rgba(255,255,255,0.9)', borderRadius: 8, padding: 8, fontSize: 12 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
<Badge status="success" /> 无人机机场 A01
</div>
<div style={{ fontSize: 11, color: '#666' }}>正常</div>
</div>
<div style={{ position: 'absolute', top: 180, left: 280, background: 'rgba(255,255,255,0.9)', borderRadius: 8, padding: 8, fontSize: 12 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
<Badge status="processing" /> 巡检机器人 RBT-01
</div>
<div style={{ fontSize: 11, color: '#666' }}>作业中</div>
</div>
<div style={{ position: 'absolute', top: 80, right: 120, background: 'rgba(255,255,255,0.9)', borderRadius: 8, padding: 8, fontSize: 12 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
<Badge status="processing" /> 清洗无人机 UAV-C01
</div>
<div style={{ fontSize: 11, color: '#666' }}>作业中</div>
</div>
<div style={{ position: 'absolute', bottom: 120, right: 180, background: 'rgba(255,255,255,0.9)', borderRadius: 8, padding: 8, fontSize: 12 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
<Badge status="processing" /> 除草机器人 GR-02
</div>
<div style={{ fontSize: 11, color: '#666' }}>作业中</div>
</div>
</div>
</Card>
<Row gutter={16}>
<Col xs={24} md={12}>
<Card title={<><SettingOutlined /> 装备调度列表</>} bordered={false} style={{ borderRadius: 12, marginBottom: 16 }}>
<Table
rowKey="id"
size="small"
pagination={false}
columns={[
{ title: '装备名称', dataIndex: 'name', width: 160 },
{ title: '类型', dataIndex: 'type', width: 100 },
{ title: '当前状态', dataIndex: 'status', width: 80, render: (s) => <Tag color={s === '作业中' ? 'processing' : s === '在线' ? 'success' : 'default'}>{s}</Tag> },
{ title: '模式', dataIndex: 'mode', width: 80 },
{ title: '电量', dataIndex: 'battery', width: 80, render: (v) => <Progress percent={v} size="small" status={v < 40 ? 'exception' : 'active'} /> },
{ title: '位置', dataIndex: 'position', width: 100 },
{ title: '当前任务', dataIndex: 'task', width: 120 },
{ title: '通讯状态', dataIndex: 'comm', width: 80, render: (v) => <Badge status="success" text={v} /> },
{ title: '操作', key: 'action', width: 100, render: () => <Space><Button size="small" type="text" icon={<EditOutlined />} /><Button size="small" type="text" icon={<SettingOutlined />} /></Space> }
]}
dataSource={scheduleList}
scroll={{ x: 'max-content' }}
/>
</Card>
</Col>
<Col xs={24} md={12}>
<Card title={<><ClockCircleOutlined /> 任务执行时间线</>} bordered={false} style={{ borderRadius: 12 }} extra={<div style={{ fontSize: 12, color: '#666' }}>今天 2025-05-24</div>}>
<Timeline mode="left">
{taskTimeline.map((item, idx) => (
<Timeline.Item key={idx} color={item.color} label={<div style={{ fontSize: 11, color: '#999' }}>{item.time}</div>}>
<div style={{ fontSize: 13 }}>{item.text}</div>
<div style={{ fontSize: 11, color: '#999' }}>{item.status}</div>
</Timeline.Item>
))}
</Timeline>
<div style={{ textAlign: 'center', marginTop: 12 }}><Button type="link">查看更多</Button></div>
</Card>
</Col>
</Row>
<Header style={{ background: '#fff', padding: 0, borderBottom: '1px solid #f0f0f0', position: 'sticky', top: 0, zIndex: 10 }}>
<Menu
mode="horizontal"
selectedKeys={[activeTab]}
onClick={({ key }) => setActiveTab(key)}
items={tabs}
style={{ border: 0, height: 64, lineHeight: '64px' }}
/>
</Header>
</div>
</Col>
{/* 右侧:设备控制面板 */}
<Col xs={24} lg={10}>
<Card title={<><EnvironmentOutlined /> 设备控制面板</>} bordered={false} style={{ borderRadius: 12, marginBottom: 16 }} bodyStyle={{ padding: 16 }}>
{/* 标签栏 */}
<div style={{ display: 'flex', gap: 8, marginBottom: 20, flexWrap: 'wrap' }}>
{controlTabs.map(tab => (
<Button
key={tab.key}
size="large"
type={activeTab === tab.key ? 'primary' : 'text'}
style={{
padding: "0 12px",
height: "36px",
borderRadius: 8,
border: activeTab === tab.key ? '1px solid #1890ff' : '1px solid #d9d9d9',
color: activeTab === tab.key ? '#1890ff' : '#000',
fontSize: "14px",
background: 'transparent', // 无背景
backgroundColor: 'transparent',
borderColor: activeTab === tab.key ? '#1890ff' : '#d9d9d9',
}}
onClick={() => setActiveTab(tab.key)}
>
{tab.label}
</Button>
))}
</div>
{/* 主体:设备信息 + 实时画面 双栏 */}
<Row gutter={16}>
{/* 左侧:设备信息 */}
<Col span={12}>
<div style={{ marginBottom: 24 }}>
{/* 设备标题行 */}
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 16 }}>
<span style={{ fontSize: 24, color: '#1890ff' }}>
<RocketOutlined />
</span>
<span style={{ fontSize: 16, fontWeight: 600 }}>清洗无人机 UAV-C01</span>
<Tag color="success" size="small">作业中</Tag>
</div>
{/* 电量/信号行 */}
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 6 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
<span style={{ color: '#52c41a' }}><ThunderboltOutlined /></span>
<span style={{ fontSize: 12 }}>电量 72%</span>
</div>
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
<span style={{ fontSize: 12 }}>信号强度</span>
<span style={{ color: '#52c41a' }}>强</span>
<span style={{ fontSize: 16, color: '#1890ff' }}></span>
</div>
</div>
{/* 信息列表 */}
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, marginBottom: 24 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ color: '#666', fontSize: 12 }}>当前模式</span>
<span style={{ fontSize: 12, }}>自主清洗模式</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ color: '#666', fontSize: 12 }}>当前位置</span>
<span style={{ fontSize: 12, }}>清洗区域 C-05</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ color: '#666', fontSize: 12 }}>当前任务</span>
<span style={{ fontSize: 12, }}>清洗航线 C-05</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ color: '#666', fontSize: 12 }}>预计剩余时间</span>
<span style={{ fontSize: 12, fontWeight: 600 }}>00:18:36</span>
</div>
</div>
{/* 控制按钮 */}
<div style={{ display: 'flex', justifyContent: "space-between", flexWrap: 'wrap' }}>
<Button type="primary" size="large" style={{ borderRadius: 8, padding: "0 10px", fontSize: "14px" }} onClick={handleStart}>启动任务</Button>
<Button style={{ borderRadius: 8, padding: "0 10px", fontSize: "14px" }} size="large" onClick={handlePause}>暂停</Button>
<Button style={{ borderRadius: 8, padding: "0 10px", fontSize: "14px" }} type="primary" size="large" onClick={handleReturn}>返航</Button>
<Button style={{ background: '#52c41a', padding: "0 10px", fontSize: "14px", borderColor: '#52c41a', borderRadius: 8, color: "#fff" }} size="large" onClick={handleRecharge}>回充</Button>
</div>
</div>
</Col>
{/* 右侧:实时画面 */}
<Col span={12}>
<div style={{ marginBottom: 16 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 8 }}>
<span style={{ fontSize: 14, fontWeight: 500, color: "#666" }}>实时画面</span>
<span style={{ fontSize: 13, color: '#999' }}>2025-05-24 10:24:18</span>
</div>
<div style={{
width: '100%', height: 160,
background: '#000 url(https://picsum.photos/seed/droneview/800/400) center/cover',
borderRadius: 8,
position: 'relative',
overflow: 'hidden'
}}>
{/* 底部参数条 */}
<div style={{ position: 'absolute', bottom: 0, left: 0, right: 0, background: 'rgba(0,0,0,0.6)', color: '#fff', display: 'flex', justifyContent: 'space-between', padding: '8px 12px', fontSize: 14 }}>
<span>高度 12.5m</span>
<span>速度 4.2m/s</span>
<span>距离 86m</span>
<span style={{ color: '#ffd666' }}></span>
</div>
</div>
</div>
{/* 下方按钮 */}
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
<Button size="large" style={{ flex: 1, borderRadius: 8, padding: "0 10px", fontSize: "14px" }}>切换手动</Button>
<Button
danger
size="large"
style={{
flex: 1,
borderRadius: 8,
padding: "0 10px",
fontSize: "14px",
backgroundColor: "#ff4d4f", // 纯红色背景
borderColor: "#ff4d4f",
color: "#fff"
}}
onClick={handleEmergencyStop}
>
急停
</Button> </div>
</Col>
</Row>
</Card>
{/* AI分析与操作建议 */}
<Card
title={<><ApiOutlined /> <span >AI分析与操作建议</span></>}
bordered={false}
style={{ borderRadius: 12, marginBottom: 16 }}
bodyStyle={{ paddingBottom: "12px" }}
>
{/* 顶部指标卡片 */}
<Row gutter={16} style={{ marginBottom: 20 }}>
<Col span={6} >
<div style={{
display: 'flex',
alignItems: 'center',
gap: 10,
padding: '6px 12px 4px',
borderRadius: 12,
border: '1px solid #e8e8e8'
}}>
<div style={{
width: 30,
height: 30,
borderRadius: '50%',
background: 'rgba(255,77,79,0.15)',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: '#ff4d4f',
fontSize: 20
}}>
<span role="img" aria-label="hotspot">🔥</span>
</div>
<div>
<div style={{ fontSize: 11, color: '#666', }}>热斑疑似</div>
<div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>2 <span style={{ fontSize: 12, }}>处</span></div>
</div>
</div>
</Col>
<Col span={6}>
<div style={{
display: 'flex',
alignItems: 'center',
gap: 10,
padding: '6px 12px 4px',
borderRadius: 12,
border: '1px solid #e8e8e8'
}}>
<div style={{
width: 30,
height: 30,
borderRadius: '50%',
background: 'rgba(82,196,26,0.15)',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: '#52c41a',
fontSize: 16
}}>
<BranchesOutlined />
</div>
<div>
<div style={{ fontSize: 11, color: '#666', }}>杂草高发区</div>
<div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>3 <span style={{ fontSize: 12, }}>块</span></div>
</div>
</div>
</Col>
<Col span={6}>
<div style={{
display: 'flex',
alignItems: 'center',
gap: 10,
padding: '6px 12px 4px',
borderRadius: 12,
border: '1px solid #e8e8e8'
}}>
<div style={{
width: 30,
height: 30,
borderRadius: '50%',
background: 'rgba(24,144,255,0.15)',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: '#1890ff',
fontSize: 16
}}>
<CloudOutlined />
</div>
<div>
<div style={{ fontSize: 11, color: '#666', }}>组件风险区</div>
<div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>4 <span style={{ fontSize: 12, }}>块</span></div>
</div>
</div>
</Col>
<Col span={6}>
<div style={{
display: 'flex',
alignItems: 'center',
gap: 10,
padding: '6px 12px 4px',
borderRadius: 12,
border: '1px solid #e8e8e8'
}}>
<div style={{
width: 30,
height: 30,
borderRadius: '50%',
background: 'rgba(255,77,79,0.15)',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: '#ff4d4f',
fontSize: 16
}}>
<WarningOutlined />
</div>
<div>
<div style={{ fontSize: 11, color: '#666', }}>围栏异常</div>
<div style={{ fontSize: 22, fontWeight: 700, color: '#ff4d4f' }}>1 <span style={{ fontSize: 12, }}>处</span></div>
</div>
</div>
</Col>
</Row>
{/* 建议操作 + 按钮 双栏 */}
<Row gutter={16}>
<Col span={14}>
<div style={{ marginBottom: 12 }}>
<div style={{ fontSize: 16, fontWeight: 600, color: '#1890ff', marginBottom: 12 }}>建议操作</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 2, padding: '16px', borderRadius: 12, border: '1px solid #e8e8e8' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<span style={{ color: '#1890ff' }}>⦿</span>
<span style={{ fontSize: 16 }}>优先执行巡检航线 P-03</span>
</div>
<svg t="1778317171240" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5738" width="20" height="20"><path d="M384.32 797.512a30.088 30.088 0 0 1-21.288-51.392L597.144 512 363.032 277.816a30.088 30.088 0 0 1 0-42.568 30.088 30.088 0 0 1 42.568 0l255.392 255.464a30.088 30.088 0 0 1 0 42.568L405.6 788.696a30.04 30.04 0 0 1-21.28 8.816z" fill="#666666" p-id="5739"></path></svg> </div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<span style={{ color: '#1890ff' }}>⦿</span>
<span style={{ fontSize: 16 }}>先行安排除草任务 G-02</span>
</div>
<svg t="1778317171240" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5738" width="20" height="20"><path d="M384.32 797.512a30.088 30.088 0 0 1-21.288-51.392L597.144 512 363.032 277.816a30.088 30.088 0 0 1 0-42.568 30.088 30.088 0 0 1 42.568 0l255.392 255.464a30.088 30.088 0 0 1 0 42.568L405.6 788.696a30.04 30.04 0 0 1-21.28 8.816z" fill="#666666" p-id="5739"></path></svg> </div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<span style={{ color: '#1890ff' }}>⦿</span>
<span style={{ fontSize: 16 }}>建议生成清洗工单</span>
</div>
<svg t="1778317171240" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5738" width="20" height="20"><path d="M384.32 797.512a30.088 30.088 0 0 1-21.288-51.392L597.144 512 363.032 277.816a30.088 30.088 0 0 1 0-42.568 30.088 30.088 0 0 1 42.568 0l255.392 255.464a30.088 30.088 0 0 1 0 42.568L405.6 788.696a30.04 30.04 0 0 1-21.28 8.816z" fill="#666666" p-id="5739"></path></svg>
</div>
</div>
</div>
</Col>
<Col span={10}>
<div style={{ display: 'flex', flexDirection: 'column', paddingBottom: "12px", gap: 16, height: '100%', justifyContent: "end" }}>
<div style={{ display: 'flex', gap: 12 }}>
<Button
type="primary"
size="large"
style={{ flex: 1, borderRadius: 8, fontSize: 16 }}
>
生成任务
</Button>
<Button
size="large"
style={{
flex: 1,
borderRadius: 8, fontSize: 16,
border: '1px solid #1890ff',
color: '#1890ff'
}}
>
AI优化路径
</Button>
</div>
<Button
type="primary"
size="large"
style={{ borderRadius: 8, fontSize: 16 }}
>
一键联动作业
</Button>
</div>
</Col>
</Row>
</Card>
<Card
title={<><span >环境与飞行条件</span></>}
bordered={false}
style={{ borderRadius: 12, marginBottom: 16 }}
bodyStyle={{ paddingBottom: "12px" }}
>
<div style={{ display: "flex", justifyContent: "space-between", gap: 12, alignItems: "center" }}>
{/* 左边六个数据项,统一加外边框和右边框分隔线 */}
<div style={{
display: "flex",
border: "1px solid #e8e8e8",
borderRadius: 12,
overflow: "hidden",
flex: 1,
}}>
{/* 风速 */}
<div style={{
flex: 1,
textAlign: 'center',
whiteSpace: "nowrap",
padding: "12px 4px",
borderRight: "1px solid #e8e8e8"
}}>
<div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>风速</div>
<div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>2.6 m/s</div>
<div style={{ fontSize: 11, color: '#666', fontWeight: 600, marginTop: 2 }}>轻风</div>
</div>
{/* 温度 */}
<div style={{
flex: 1,
textAlign: 'center',
whiteSpace: "nowrap",
padding: "12px 4px",
borderRight: "1px solid #e8e8e8"
}}>
<div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>温度</div>
<div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>28.7℃</div>
<div style={{ fontSize: 11, color: '#52c41a', fontWeight: 600, marginTop: 2 }}>适宜</div>
</div>
{/* 辐照度 */}
<div style={{
flex: 1,
textAlign: 'center',
whiteSpace: "nowrap",
padding: "12px 4px",
borderRight: "1px solid #e8e8e8"
}}>
<div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>辐照度</div>
<div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>812W/m²</div>
<div style={{ fontSize: 11, color: '#fa8c16', fontWeight: 600, marginTop: 2 }}>较高</div>
</div>
{/* 降雨概率 */}
<div style={{
flex: 1,
textAlign: 'center',
whiteSpace: "nowrap",
padding: "12px 4px",
borderRight: "1px solid #e8e8e8"
}}>
<div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>降雨概率</div>
<div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>10%</div>
<div style={{ fontSize: 11, color: '#52c41a', fontWeight: 600, marginTop: 2 }}>低</div>
</div>
{/* GNSS状态 */}
<div style={{
flex: 1,
textAlign: 'center',
whiteSpace: "nowrap",
padding: "12px 4px",
borderRight: "1px solid #e8e8e8"
}}>
<div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>GNSS状态</div>
<div style={{ fontSize: 14, fontWeight: 700, color: '#52c41a', marginTop: 2 }}>正常</div>
<div style={{ fontSize: 11, color: '#666', fontWeight: 600, marginTop: 2 }}>定位稳定</div>
</div>
{/* 禁飞状态 */}
<div style={{
flex: 1,
textAlign: 'center',
whiteSpace: "nowrap",
padding: "12px 4px"
}}>
<div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>禁飞状态</div>
<div style={{ fontSize: 14, fontWeight: 700, color: '#52c41a', marginTop: 2 }}>未禁飞</div>
<div style={{ fontSize: 11, color: '#666', fontWeight: 600, marginTop: 2 }}>可执行</div>
</div>
</div>
{/* 右侧“适宜执行”卡片,保留边框 */}
<div style={{
width: 110,
padding: '12px 8px',
borderRadius: 8,
background: '#f6ffed',
border: '1px solid #b7eb8f',
textAlign: 'center',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
gap: 4,
}}>
<div style={{ fontSize: 14, fontWeight: 700, color: '#52c41a' }}>适宜执行</div>
<div style={{
width: 18,
height: 18,
borderRadius: '50%',
background: '#52c41a',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}>
<CheckCircleOutlined style={{ fontSize: 12, color: '#fff' }} />
</div>
<div style={{ fontSize: 11, color: '#666' }}>可正常开展作业</div>
</div>
</div>
</Card>
{/* 控制日志/告警记录 */}
<Card
title={<><SettingOutlined style={{ color: '#1890ff' }} /> <span style={{ color: '#1890ff' }}>控制日志 / 告警记录</span></>}
bordered={false}
style={{ borderRadius: 12 }}
extra={
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<Button size="small" style={{ borderRadius: 8, border: '1px solid #d9d9d9' }}>
全部级别 <span style={{ marginLeft: 4 }}>▼</span>
</Button>
</div>
}
>
<Table
rowKey="time"
size="small"
pagination={false}
dataSource={logs}
scroll={{ x: 'max-content' }}
columns={[
{
title: '时间',
dataIndex: 'time',
width: 100,
render: (text) => <span style={{ fontSize: 14 }}>{text}</span>
},
{
title: '设备',
dataIndex: 'device',
width: 120,
render: (text) => <span style={{ fontSize: 14 }}>{text}</span>
},
{
title: '类型',
dataIndex: 'type',
width: 80,
render: (text) => {
let color = '#52c41a';
if (text === '告警') color = '#fa8c16';
if (text === '事件') color = '#1890ff';
return (
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
<span style={{
width: 12,
height: 12,
borderRadius: 2,
background: color,
display: 'inline-block'
}} />
<span style={{ fontSize: 14 }}>{text}</span>
</div>
);
}
},
{
title: '描述',
dataIndex: 'desc',
render: (text) => <span style={{ fontSize: 14 }}>{text}</span>
},
{
title: '',
width: 80,
render: (_, record) => record.level ? (
<Tag color="red" style={{ fontSize: 12, padding: '0 6px', borderRadius: 4 }}>
{record.level}
</Tag>
) : null
}
]}
/>
<div style={{ textAlign: 'center', marginTop: 12 }}>
<Button type="link" style={{ fontSize: 16, color: '#1890ff' }}>查看更多日志</Button>
</div>
</Card>
</Col>
</Row>
<Content style={{
maxHeight: 'calc(100vh - 64px)',
overflowY: 'auto',
background: '#f5f7fa',
padding: '20px',
scrollbarWidth: "none"
}}>
{renderContent()}
</Content>
</Layout>
);

View File

@@ -248,7 +248,7 @@ export default function StationDashboard() {
const cardStyle = { borderRadius: 8, };
return (
<div style={{ background: '#f0f2f5', minHeight: '100vh', width: '100%', boxSizing: 'border-box', overflow: "hidden" }}>
<div style={{ background: '#f0f2f5', paddingTop: "12px", minHeight: '100vh', width: '100%', boxSizing: 'border-box', overflow: "hidden" }}>
{/* 顶部一排6个卡片 —— 等宽、不换行、自适应 */}
<Row
gutter={[16, 16]}

View File

@@ -27,16 +27,36 @@ const deviceList = [
{ id: 9, name: '电表 METER-01', type: '电表', status: '正常', data: '66.8 kW', communication: '通讯正常', updateTime: '2026-04-28 11:32:45' }
];
// 👇 改成两天对比数据
const powerTrendData = [
{ time: '00:00', power: 50, rated: 1000 },
{ time: '04:00', power: 70, rated: 1000 },
{ time: '08:00', power: 90, rated: 1000 },
{ time: '12:00', power: 110, rated: 1000 },
{ time: '16:00', power: 100, rated: 1000 },
{ time: '20:00', power: 80, rated: 1000 },
{ time: '24:00', power: 60, rated: 1000 }
];
{ time: '00:00', value: 13.4, type: '今日' },
{ time: '00:00', value: 12.1, type: '昨日' },
{ time: '00:00', value: 1000, type: '额定' },
{ time: '04:00', value: 15.7, type: '今日' },
{ time: '04:00', value: 14.3, type: '昨日' },
{ time: '04:00', value: 1000, type: '额定' },
{ time: '08:00', value: 220.5, type: '今日' },
{ time: '08:00', value: 200.8, type: '昨日' },
{ time: '08:00', value: 1000, type: '额定' },
{ time: '12:00', value: 350.2, type: '今日' },
{ time: '12:00', value: 320.5, type: '昨日' },
{ time: '12:00', value: 1000, type: '额定' },
{ time: '16:00', value: 280.7, type: '今日' },
{ time: '16:00', value: 260.3, type: '昨日' },
{ time: '16:00', value: 1000, type: '额定' },
{ time: '20:00', value: 13.4, type: '今日' },
{ time: '20:00', value: 11.9, type: '昨日' },
{ time: '20:00', value: 1000, type: '额定' },
{ time: '24:00', value: 10.2, type: '今日' },
{ time: '24:00', value: 9.8, type: '昨日' },
{ time: '24:00', value: 1000, type: '额定' },
];
const inverterPowerData = [
{ name: 'INV-01', power: 164.2 },
{ name: 'INV-02', power: 166.8 },
@@ -249,8 +269,36 @@ const RealTimeMonitorPage = () => {
</Col>
</Row>
{/* 👇 修改后的实时功率曲线:两天对比 */}
<Card title="实时功率曲线" style={{ marginBottom: 16, borderRadius: 8 }}>
<Line data={powerTrendData} xField="time" yField={['power', 'rated']} color={['#1890ff', '#52c41a']} height={180} />
<Line
data={powerTrendData}
xField="time"
yField="value"
seriesField="type"
scale={{
color: {
relations: [
['今日', '#1890ff'],
['昨日', '#faad14'],
['额定', '#52c41a']
]
}
}}
tooltip={{
formatter: (datum) => ({
name: datum.type,
value: `${datum.value} kW`
})
}}
lineStyle={{
lineDash: (datum) => (datum.type === '额定' ? [4, 4] : undefined)
}}
point={{
size: 3
}}
height={180}
/>
</Card>
<Card title="逆变器功率对比" style={{ marginBottom: 16, borderRadius: 8 }}>

View File

@@ -119,7 +119,7 @@ export default function ReportCenterPage() {
< div
style={{
flex: '1 1 210px', // 基础宽度 210px,允许扩展
height: '140px', // 固定高度
height: '110px', // 固定高度
flexShrink: 0 // 不压缩
}}
>
@@ -140,7 +140,7 @@ export default function ReportCenterPage() {
< div
style={{
flex: '1 1 210px', // 基础宽度 210px,允许扩展
height: '140px',
height: '110px',
flexShrink: 0
}}
>
@@ -161,7 +161,7 @@ export default function ReportCenterPage() {
< div
style={{
flex: '1 1 210px', // 基础宽度 210px,允许扩展
height: '140px',
height: '110px',
flexShrink: 0
}}
>
@@ -181,7 +181,7 @@ export default function ReportCenterPage() {
< div
style={{
flex: '1 1 210px', // 基础宽度 210px,允许扩展
height: '140px',
height: '110px',
flexShrink: 0
}}
>
@@ -201,7 +201,7 @@ export default function ReportCenterPage() {
< div
style={{
flex: '1 1 210px', // 基础宽度 210px,允许扩展
height: '140px',
height: '110px',
flexShrink: 0
}}
>
@@ -222,7 +222,7 @@ export default function ReportCenterPage() {
< div
style={{
flex: '1 1 210px', // 基础宽度 210px,允许扩展
height: '140px',
height: '110px',
flexShrink: 0
}}
>

View File

@@ -162,6 +162,7 @@ export default function SystemSettings() {
};
return (
<Layout style={{ minHeight: '100vh', background: '#fff', overflow: 'hidden' }}>
<div style={{ padding: '20px 24px 0' }}>
<Typography.Title level={4} style={{ margin: 0 }}>系统设置</Typography.Title>
<Text type="secondary"> 告警规则配置、用户角色、通知管理与系统参数设置