设备状态界面

This commit is contained in:
mmc
2026-05-11 16:34:44 +08:00
parent 86880ac786
commit daf93a50e2
6 changed files with 435 additions and 48 deletions

View File

@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import {
Layout, Card, Row, Col, Statistic, Tag, Button, Table,
Typography, Space, Progress, Badge, Timeline, message,
Select
Select, Modal
} from 'antd';
import {
EnvironmentOutlined, RobotOutlined, BranchesOutlined,
@@ -11,7 +11,7 @@ import {
CloudOutlined, ClockCircleOutlined, ReloadOutlined,
AimOutlined, ApiOutlined, SettingOutlined,
PlusOutlined, ArrowRightOutlined,
EditOutlined
EditOutlined, FullscreenOutlined, InfoCircleOutlined
} from '@ant-design/icons';
import { useSelector } from 'react-redux';
@@ -44,9 +44,10 @@ const logs = [
];
// 设备总览组件
export default function DeviceOverviewPage({ devices, planedevices, devicesAll }) {
export default function DeviceOverviewPage({ devices, planedevices, devicesAll, onViewStatus }) {
const [selectedDevice, setSelectedDevice] = useState(null);
const [planeVideo, setPlaneVideo] = useState('');
const [planeVideo, setPlaneVideo] = useState([]); // 初始为空数组
const [zoomedVideo, setZoomedVideo] = useState(null); // 放大查看的视频数据
// 动态计算顶部卡片数据
const dynamicTopCards = React.useMemo(() => {
@@ -205,8 +206,12 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll }
</Col>
<Col xs={24} lg={10}>
<Card title={<> 设备控制面板</>} bordered={false} style={{ borderRadius: 12, marginBottom: 16 }} bodyStyle={{ padding: 16, paddingBottom: 0 }}>
<Select
<Card
title={<><SettingOutlined style={{ marginRight: 6, }} /> 设备控制面板</>}
bordered={false}
style={{ borderRadius: 12, marginBottom: 16 }}
bodyStyle={{ padding: 16, paddingBottom: 0 }}
> <Select
style={{ width: 220, marginBottom: 10 }}
placeholder="请选择设备"
value={selectedDevice?.device_sn || selectedDevice?.serialNumber}
@@ -233,6 +238,16 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll }
<Tag color={selectedDevice.onlineStatus === 1 ? "success" : "default"} size="small">
{selectedDevice.onlineStatus == 1 ? "在线" : "离线"}
</Tag>
<Button
type="primary"
ghost
size="small"
icon={<InfoCircleOutlined />}
style={{ borderRadius: 4, fontSize: 12, marginLeft: 'auto' }}
onClick={() => onViewStatus && onViewStatus(selectedDevice.device_sn || selectedDevice.serialNumber)}
>
详情
</Button>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 6 }}>
@@ -412,6 +427,19 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll }
</Card>
</Col>
</Row>
<Modal
title="视频预览"
open={!!zoomedVideo}
onCancel={() => setZoomedVideo(null)}
footer={null}
width={1000}
centered
bodyStyle={{ padding: 0, height: 600, background: '#000' }}
destroyOnClose
>
{zoomedVideo && <DroneLivePlayer streamData={zoomedVideo} videoMode="LARGE" />}
</Modal>
</Content>
);
}