无人机组件 终于可以显示两个视频了!!!!
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
import dayjs from 'dayjs';
|
||||
import utils from '@/lib/utils';
|
||||
import CesiumMap from '../Map';
|
||||
import { getUAVState } from '@/api/device';
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
const { RangePicker } = DatePicker;
|
||||
@@ -47,13 +48,32 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
|
||||
// ✅ 航线列表 独立无人机筛选(新增)
|
||||
const [waylineDrone, setWaylineDrone] = useState(null);
|
||||
const [focusLocation, setFocusLocation] = useState(null);
|
||||
|
||||
const [points, setPoints] = useState([]);
|
||||
|
||||
const fetchAndFocusDrone = async (drone) => {
|
||||
if (!drone?.gateway_sn || !drone?.device_sn) return;
|
||||
try {
|
||||
const res = await getUAVState({
|
||||
sn: drone.gateway_sn,
|
||||
droneSn: drone.device_sn
|
||||
});
|
||||
if (res.code === 200 && res.data) {
|
||||
setFocusLocation({
|
||||
lon: res.data.longitude,
|
||||
lat: res.data.latitude
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取无人机位置失败', err);
|
||||
}
|
||||
};
|
||||
|
||||
// 航线列表相关状态
|
||||
const [selectedWayline, setSelectedWayline] = useState(null);
|
||||
const [rthModalVisible, setRthModalVisible] = useState(false);
|
||||
const [tempRthAltitude, setTempRthAltitude] = useState(100);
|
||||
const [tempRthAltitude, setTempRthAltitude] = useState(20);
|
||||
const [waylineSearch, setWaylineSearch] = useState('');
|
||||
|
||||
// 任务控制相关状态
|
||||
@@ -75,7 +95,7 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
name: '',
|
||||
sn: '',
|
||||
landing_dock_sn: '',
|
||||
rth_altitude: 100,
|
||||
rth_altitude: 10,
|
||||
rth_mode: 'optimal',
|
||||
wayline_precision_type: 'gps',
|
||||
resumable_status: 'auto',
|
||||
@@ -144,7 +164,7 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
name: '',
|
||||
sn: waylineDrone?.gateway_sn || '',
|
||||
landing_dock_sn: '',
|
||||
rth_altitude: 100,
|
||||
rth_altitude: 10,
|
||||
rth_mode: 'optimal',
|
||||
wayline_precision_type: 'gps',
|
||||
resumable_status: 'auto',
|
||||
@@ -413,9 +433,12 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
return;
|
||||
}
|
||||
setSelectedWayline(wayline);
|
||||
setTempRthAltitude(100);
|
||||
setTempRthAltitude(20);
|
||||
setRthModalVisible(true);
|
||||
};
|
||||
useEffect(() => {
|
||||
fetchAndFocusDrone(waylineDrone);
|
||||
}, [waylineDrone])
|
||||
|
||||
// 确认执行航线任务
|
||||
const confirmExecuteWayline = async () => {
|
||||
@@ -442,7 +465,11 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
utils.message.success('航线执行任务创建成功');
|
||||
setRthModalVisible(false);
|
||||
getListTask();
|
||||
if (onRefresh) onRefresh();
|
||||
if (onRefresh) {
|
||||
setTimeout(() => {
|
||||
onRefresh();
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
//await getTrackFn({
|
||||
// uuid: res.data.task_uuid
|
||||
@@ -615,7 +642,7 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
style={{ ...cardStyle, marginBottom: 10 }}
|
||||
>
|
||||
<div style={{ width: '100%', height: 420, background: '#e8f3ff url(https://picsum.photos/seed/solar_map_v2/1600/1000) center/cover', position: 'relative' }}>
|
||||
<CesiumMap points={points} from="device-control" />
|
||||
<CesiumMap devices={planedevices} points={points} focusLocation={focusLocation} from="device-control" />
|
||||
<div style={{ position: 'absolute', top: 16, left: 16, background: 'rgba(255,255,255,0.92)', backdropFilter: 'blur(8px)', padding: '14px 16px', borderRadius: 10, width: 150, boxShadow: '0 4px 12px rgba(0,0,0,0.1)' }}>
|
||||
<div style={{ fontSize: fontSmall, display: 'flex', flexDirection: 'column', gap: 10 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ width: 14, height: 2, background: '#165DFF' }}></span> 无人机航线</div>
|
||||
@@ -658,6 +685,7 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
onChange={(val) => {
|
||||
const find = planedevices.find(i => i.device_sn === val);
|
||||
setListDrone(find || null);
|
||||
|
||||
}}
|
||||
/>
|
||||
</Space>
|
||||
@@ -677,7 +705,7 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
}
|
||||
bordered={false}
|
||||
bodyStyle={{ padding: 0, display: 'flex', flexDirection: 'column', height: "calc(100% - 40px)", overflow: "auto" }}
|
||||
style={{ ...cardStyle, height: "240px", flex: 1, marginBottom: 0 }}
|
||||
style={{ ...cardStyle, maxHeight: "250px", flex: 1, marginBottom: 0 }}
|
||||
>
|
||||
<Table
|
||||
size="small"
|
||||
@@ -859,7 +887,7 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>天气窗口与执行约束</span>}
|
||||
bordered={false}
|
||||
bodyStyle={{ padding: '16px' }}
|
||||
style={{ ...cardStyle, flex: 1 }}
|
||||
style={{ ...cardStyle, flex: 1, }}
|
||||
>
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(5, 1fr)', gap: '8px', marginBottom: 16 }}>
|
||||
<div style={{ background: '#F7F8FA', borderRadius: 10, padding: '12px', display: 'flex', alignItems: 'center', gap: 10 }}>
|
||||
@@ -953,6 +981,7 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
onChange={(val) => {
|
||||
const find = planedevices.find(i => i.device_sn === val);
|
||||
setWaylineDrone(find || null);
|
||||
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
@@ -1096,6 +1125,7 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
onChange={(val) => {
|
||||
const find = planedevices.find(i => i.device_sn === val);
|
||||
setBoardDrone(find || null);
|
||||
|
||||
}}
|
||||
/>
|
||||
</Space>
|
||||
@@ -1461,10 +1491,10 @@ export default function WayLinePage({ planedevices, onRefresh }) {
|
||||
<div>
|
||||
<div style={{ marginBottom: 8 }}><Text strong>返航高度 (m):</Text></div>
|
||||
<InputNumber
|
||||
min={20}
|
||||
min={10}
|
||||
max={500}
|
||||
value={tempRthAltitude}
|
||||
onChange={val => setTempRthAltitude(val || 100)}
|
||||
onChange={val => setTempRthAltitude(val || 20)}
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user