天气窗口与执行约束 温度和速度显示
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import {
|
||||
Row, Col, Card, Button, Space, Table, Tag, Typography, Progress, Badge,
|
||||
Tabs, Input, Switch, Divider, Tooltip, Timeline, Select, message, DatePicker,
|
||||
@@ -24,6 +24,7 @@ import dayjs from 'dayjs';
|
||||
import utils from '@/lib/utils';
|
||||
import CesiumMap from '../Map';
|
||||
import { getUAVState } from '@/api/device';
|
||||
import { fix2, getVal } from '@/lib/utils';
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
const { RangePicker } = DatePicker;
|
||||
@@ -38,9 +39,40 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
|
||||
// 任务列表 独立筛选状态
|
||||
const [listDrone, setListDrone] = useState(null);
|
||||
const [listDroneRealtime, setListDroneRealtime] = useState(null);
|
||||
const [listDateRange, setListDateRange] = useState(null);
|
||||
const [taskList, setTaskList] = useState([]);
|
||||
|
||||
const listDroneTimerRef = useRef<any>(null);
|
||||
|
||||
// 定时获取任务列表所选无人机的实时状态
|
||||
useEffect(() => {
|
||||
const fetchRealtime = async () => {
|
||||
if (listDrone?.gateway_sn && listDrone?.device_sn) {
|
||||
try {
|
||||
const res = await getUAVState({
|
||||
sn: listDrone.gateway_sn,
|
||||
droneSn: listDrone.device_sn
|
||||
});
|
||||
if (res.code === 200) {
|
||||
setListDroneRealtime(res.data);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取列表无人机实时状态失败', err);
|
||||
}
|
||||
} else {
|
||||
setListDroneRealtime(null);
|
||||
}
|
||||
};
|
||||
|
||||
fetchRealtime();
|
||||
listDroneTimerRef.current = setInterval(fetchRealtime, 3000);
|
||||
|
||||
return () => {
|
||||
if (listDroneTimerRef.current) clearInterval(listDroneTimerRef.current);
|
||||
};
|
||||
}, [listDrone]);
|
||||
|
||||
// 工作看板 独立筛选状态
|
||||
const [boardDrone, setBoardDrone] = useState(null);
|
||||
const [boardDateRange, setBoardDateRange] = useState(null);
|
||||
@@ -62,7 +94,9 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
if (res.code === 200 && res.data) {
|
||||
setFocusLocation({
|
||||
lon: res.data.longitude,
|
||||
lat: res.data.latitude
|
||||
lat: res.data.latitude,
|
||||
type: drone.type || 'plane',
|
||||
name: drone.drone_callsign || drone.name || drone.device_sn
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -465,11 +499,11 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
utils.message.success('航线执行任务创建成功');
|
||||
setRthModalVisible(false);
|
||||
getListTask();
|
||||
if (onRefresh) {
|
||||
setTimeout(() => {
|
||||
onRefresh();
|
||||
}, 1500)
|
||||
}
|
||||
//if (onRefresh) {
|
||||
// setTimeout(() => {
|
||||
// onRefresh();
|
||||
// }, 1500)
|
||||
//}
|
||||
|
||||
//await getTrackFn({
|
||||
// uuid: res.data.task_uuid
|
||||
@@ -502,7 +536,7 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
|
||||
const topCards = [
|
||||
{
|
||||
title: '今日航线计划', value: todayCount, unit: '条', trend: trend, trendColor: trendColor,
|
||||
title: '今日航线计划', value: todayCount, unit: '条', desc: '进行中', trend: trend, trendColor: trendColor,
|
||||
icon: <LayoutGrid size={22} />, color: '#165DFF'
|
||||
},
|
||||
{ title: '执行中任务', value: runList.length, unit: '个', desc: '进行中', icon: <Plane size={22} />, color: '#165DFF' },
|
||||
@@ -906,7 +940,7 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
</div>
|
||||
<div>
|
||||
<div style={{ fontSize: 12, color: '#86909C' }}>风速</div>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: '#1D2129' }}>{listDrone?.wind_speed ?? '-'} m/s</div>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: '#1D2129' }}>{fix2((listDroneRealtime || listDrone)?.wind_speed)} m/s</div>
|
||||
<div style={{ fontSize: 12, color: '#00B42A' }}>适宜</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -917,7 +951,7 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
</div>
|
||||
<div>
|
||||
<div style={{ fontSize: 12, color: '#86909C' }}>温度</div>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: '#1D2129' }}>{listDrone?.environment_temperature ?? '-'}℃</div>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: '#1D2129' }}>{fix2((listDroneRealtime || listDrone)?.environment_temperature)}℃</div>
|
||||
<div style={{ fontSize: 12, color: '#00B42A' }}>适宜</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -927,9 +961,11 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
<Droplets size={20} style={{ color: '#FF7D00' }} />
|
||||
</div>
|
||||
<div>
|
||||
<div style={{ fontSize: 12, color: '#86909C' }}>降水概率</div>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: '#1D2129' }}>10%</div>
|
||||
<div style={{ fontSize: 12, color: '#00B42A' }}>低</div>
|
||||
<div style={{ fontSize: 12, color: '#86909C' }}>降水状态</div>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: '#1D2129' }}>{getVal((listDroneRealtime || listDrone)?.rainfall)}</div>
|
||||
<div style={{ fontSize: 12, color: (listDroneRealtime || listDrone)?.rainfall === 'no_rain' ? '#00B42A' : '#F53F3F' }}>
|
||||
{(listDroneRealtime || listDrone)?.rainfall === 'no_rain' ? '低风险' : '有雨'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -939,8 +975,12 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
</div>
|
||||
<div>
|
||||
<div style={{ fontSize: 12, color: '#86909C' }}>GNSS质量</div>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: '#1D2129' }}>良好</div>
|
||||
<div style={{ fontSize: 12, color: '#00B42A' }}>适宜</div>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: '#1D2129' }}>
|
||||
{(listDroneRealtime || listDrone)?.position_state?.rtk_number ?? 0} RTK
|
||||
</div>
|
||||
<div style={{ fontSize: 12, color: (listDroneRealtime || listDrone)?.position_state?.is_fixed === 'fixing_successful' ? '#00B42A' : '#FF7D00' }}>
|
||||
{(listDroneRealtime || listDrone)?.position_state?.is_fixed === 'fixing_successful' ? '已固定' : '未固定'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user