|
|
|
@ -1,22 +1,22 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<div style="width: 100%; height: 100vh">
|
|
|
|
|
<Map :airRoute="airRoute"></Map>
|
|
|
|
|
<Map :airRoute="airRoute" />
|
|
|
|
|
</div>
|
|
|
|
|
<SelectComponent @selectChange="changeSelect" />
|
|
|
|
|
<AirportInformation
|
|
|
|
|
<!-- <AirportInformation
|
|
|
|
|
@changeLive="changeAirportLive"
|
|
|
|
|
@changeRemote="changeRemote"
|
|
|
|
|
:airportAllVal="airportAllVal"
|
|
|
|
|
/>
|
|
|
|
|
:msgData="msgData"
|
|
|
|
|
/> -->
|
|
|
|
|
<UAVInformation
|
|
|
|
|
:uavAllVal="uavAllVal"
|
|
|
|
|
:msgData="msgData"
|
|
|
|
|
@changeLoadControl="changeLoadControl"
|
|
|
|
|
@changeFlightControl="changeFlightControl"
|
|
|
|
|
/>
|
|
|
|
|
<!-- 远程调试 -->
|
|
|
|
|
<div v-if="remoteVisible">
|
|
|
|
|
<RemoteDebugging @changeRemote="changeRemote" />
|
|
|
|
|
<RemoteDebugging @changeRemote="changeRemote" :msgData="msgData" />
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 负载控制 -->
|
|
|
|
|
<div v-if="loadControlVisible">
|
|
|
|
@ -53,14 +53,11 @@
|
|
|
|
|
FlightControl,
|
|
|
|
|
} from './index';
|
|
|
|
|
import { useMessage } from '@/hooks/web/useMessage';
|
|
|
|
|
import { getClient, createConnection } from '@/utils/mqtt';
|
|
|
|
|
import { getClient, createConnection, clientSubscribe } from '@/utils/mqtt';
|
|
|
|
|
import { buildGUID } from '@/utils/uuid';
|
|
|
|
|
import { vDrag } from '@/utils/drag';
|
|
|
|
|
|
|
|
|
|
const { createMessage } = useMessage();
|
|
|
|
|
const airportAllVal = ref();
|
|
|
|
|
const uavAllVal = ref();
|
|
|
|
|
|
|
|
|
|
const airRoute = ref({
|
|
|
|
|
airLineType: null,
|
|
|
|
|
airType: null,
|
|
|
|
@ -69,6 +66,9 @@
|
|
|
|
|
});
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
createConnection();
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
changeSelect();
|
|
|
|
|
}, 1000);
|
|
|
|
|
});
|
|
|
|
|
const changeSelectValue = ref();
|
|
|
|
|
// 机场直播
|
|
|
|
@ -76,7 +76,7 @@
|
|
|
|
|
// 无人机直播
|
|
|
|
|
const livePreviewVisible = ref(true);
|
|
|
|
|
// 远程调试
|
|
|
|
|
const remoteVisible = ref(false);
|
|
|
|
|
const remoteVisible = ref(true);
|
|
|
|
|
// 负载控制
|
|
|
|
|
const loadControlVisible = ref(false);
|
|
|
|
|
// 飞行控制
|
|
|
|
@ -93,36 +93,20 @@
|
|
|
|
|
const changeFlightControl = () => {
|
|
|
|
|
flightControlVisible.value = !flightControlVisible.value;
|
|
|
|
|
};
|
|
|
|
|
const changeSelect = (value: any) => {
|
|
|
|
|
const msgData = ref();
|
|
|
|
|
const changeSelect = async (value?: any) => {
|
|
|
|
|
console.log(value);
|
|
|
|
|
changeSelectValue.value = value;
|
|
|
|
|
const topic = 'thing/product/8UUXN5400A079H/osd';
|
|
|
|
|
// const topic = 'thing/product/8UUXN5400A079H/requests';
|
|
|
|
|
// const topic = 'thing/product/8UUXN5400A079H/events';
|
|
|
|
|
getClient().subscribe(topic, { qos: 0 }, (error, res) => {
|
|
|
|
|
if (error) {
|
|
|
|
|
createConnection();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 开启定时器接收数据
|
|
|
|
|
const timer = window.setInterval(() => {
|
|
|
|
|
if (getClient() != null) {
|
|
|
|
|
// Received
|
|
|
|
|
getClient().on('message', (topic, message, packet) => {
|
|
|
|
|
const rs = JSON.parse(message);
|
|
|
|
|
console.log(rs);
|
|
|
|
|
airportAllVal.value = rs;
|
|
|
|
|
if (!rs.data.wind_speed) {
|
|
|
|
|
} else {
|
|
|
|
|
// 机场信息
|
|
|
|
|
}
|
|
|
|
|
// 无人机信息
|
|
|
|
|
// uavAllVal.value =
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
console.log('开启定时器接收数据2');
|
|
|
|
|
}
|
|
|
|
|
}, 5000);
|
|
|
|
|
const topicUrl = 'thing/product/8UUXN5400A079H/osd';
|
|
|
|
|
// 订阅
|
|
|
|
|
clientSubscribe(topicUrl, { qos: 0 });
|
|
|
|
|
// 接收消息
|
|
|
|
|
getClient().on('message', (topic, message) => {
|
|
|
|
|
const rs = JSON.parse(message);
|
|
|
|
|
msgData.value = {
|
|
|
|
|
topic: topic,
|
|
|
|
|
message: rs,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|