设备状态界面

This commit is contained in:
mmc
2026-05-12 08:34:13 +08:00
parent daf93a50e2
commit 0999d1b739
51 changed files with 1788 additions and 31 deletions

BIN
src/assets/images/a1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

BIN
src/assets/images/a2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1003 KiB

BIN
src/assets/images/a3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
src/assets/images/a4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
src/assets/images/a5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 895 KiB

BIN
src/assets/images/arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
src/assets/images/car.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
src/assets/images/drone.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
src/assets/images/env.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
src/assets/images/img1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

BIN
src/assets/images/img10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

BIN
src/assets/images/img11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

BIN
src/assets/images/img12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 KiB

BIN
src/assets/images/img13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
src/assets/images/img2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

BIN
src/assets/images/img3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

BIN
src/assets/images/img4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 KiB

BIN
src/assets/images/img7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

BIN
src/assets/images/img8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

BIN
src/assets/images/img9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 MiB

BIN
src/assets/images/iot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
src/assets/images/mower.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
src/assets/images/plane.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
src/assets/images/r1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

BIN
src/assets/images/r2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

BIN
src/assets/images/r3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

BIN
src/assets/images/r4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

BIN
src/assets/images/r5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 KiB

BIN
src/assets/images/r6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 KiB

BIN
src/assets/images/r7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
src/assets/images/r8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

1313
src/components/Map.jsx Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -44,11 +44,16 @@ const logs = [
];
// 设备总览组件
export default function DeviceOverviewPage({ devices, planedevices, devicesAll, onViewStatus }) {
const [selectedDevice, setSelectedDevice] = useState(null);
export default function DeviceOverviewPage({ devices, planedevices, devicesAll, onViewStatus, selectedSn, onDeviceSelect }) {
const [planeVideo, setPlaneVideo] = useState([]); // 初始为空数组
const [zoomedVideo, setZoomedVideo] = useState(null); // 放大查看的视频数据
// 衍生状态:从 SN 获取设备对象
const selectedDevice = React.useMemo(() => {
const sn = selectedSn || (devicesAll?.[0]?.device_sn || devicesAll?.[0]?.serialNumber);
return devicesAll?.find(item => (item.device_sn || item.serialNumber) === sn) || null;
}, [devicesAll, selectedSn]);
// 动态计算顶部卡片数据
const dynamicTopCards = React.useMemo(() => {
const totalDrones = planedevices?.length || 0;
@@ -119,19 +124,15 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
const getVal = (val) => val == "no_rain" ? "无" : (val || '-');
// 默认选中第一个
useEffect(() => {
if (devicesAll && devicesAll.length > 0) {
setSelectedDevice(devicesAll[0]); // 🔥 修复:存整个对象
}
}, [devicesAll]);
useEffect(() => {
getLiveDefault();
}, [selectedDevice])
// 切换设备
const handleDeviceChange = (id) => {
const target = devicesAll.find(item => (item.device_sn || item.serialNumber) === id);
setSelectedDevice(target || null); // 🔥 修复:存对象
if (onDeviceSelect) {
onDeviceSelect(id);
}
};
return (
@@ -232,7 +233,7 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
<Row gutter={16}>
<Col span={12}>
<div style={{ marginBottom: 24 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 16 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 16, flexWrap: "wrap" }}>
<span style={{ fontSize: 24, color: '#1890ff' }}><RocketOutlined /></span>
<span style={{ fontSize: 16, fontWeight: 600 }}>{selectedDevice.deviceAlias || selectedDevice.drone_callsign || selectedDevice.callsign || selectedDevice.deviceName}</span>
<Tag color={selectedDevice.onlineStatus === 1 ? "success" : "default"} size="small">

View File

@@ -12,6 +12,7 @@ import {
import XboxController from './XboxController';
import DroneLivePlayer from '../VolcRtcPlayer.jsx';
import { getLiveStream } from '../../api/device.ts';
import CesiumMap from '../Map.jsx';
const { Title, Text } = Typography;
@@ -75,12 +76,13 @@ export default function DeviceStatusPage({ devicesAll, serialNumber, onDeviceCha
const device = useMemo(() => {
const sn = serialNumber || (devicesAll?.[0]?.device_sn || devicesAll?.[0]?.serialNumber);
if (!sn) return null;
return devicesAll?.find(d => (d.device_sn || d.serialNumber) === sn);
return devicesAll?.find(d => (d.device_sn || d.serialNumber) == sn);
}, [devicesAll, serialNumber]);
// 判断是否为无人机
const isUAV = useMemo(() => {
return device && (device.device_sn || device.productName?.includes('无人机'));
return device && (device.device_sn);
}, [device]);
const runningStatus = device?.lastRunningStatus || {};
@@ -185,7 +187,7 @@ export default function DeviceStatusPage({ devicesAll, serialNumber, onDeviceCha
borderRadius: 4,
fontSize: 12
}}>
{stream.camera_position === 'indoor' ? '库内监控' : `画面 ${index + 1}`}
{stream?.camera_position === 'indoor' ? '库内监控' : `画面 ${index + 1}`}
</div>
</div>
))
@@ -203,7 +205,8 @@ export default function DeviceStatusPage({ devicesAll, serialNumber, onDeviceCha
style={{ borderRadius: 12 }}
bodyStyle={{ padding: 12, height: 400 }}
>
<MockMap longitude={device.longitude} latitude={device.latitude} />
<CesiumMap devices={[devicesAll]}
/>
</Card>
</Col>
@@ -309,7 +312,7 @@ export default function DeviceStatusPage({ devicesAll, serialNumber, onDeviceCha
</Card>
{isUAV && (
{!isUAV && (
<Card
title={<><ControlOutlined /> 远程控制</>}
bordered={false}

View File

@@ -51,7 +51,13 @@ export default function DeviceIndexPage() {
setDevices(devData);
setPlaneDevices(planeData);
setDevicesAll([...devData, ...planeData]);
const all = [...devData, ...planeData];
setDevicesAll(all);
// 如果当前没选中,默认选第一个
if (!selectedSn && all.length > 0) {
setSelectedSn(all[0].device_sn || all[0].serialNumber);
}
} catch (err) {
console.error('数据请求失败', err);
@@ -74,6 +80,8 @@ export default function DeviceIndexPage() {
planedevices={planedevices}
devicesAll={devicesAll}
onViewStatus={handleViewStatus}
selectedSn={selectedSn}
onDeviceSelect={(sn) => setSelectedSn(sn)}
/>;
}
if (activeTab === 'status') {