main
刘妍 2 months ago
parent c60602277d
commit 007f63e324

@ -34,7 +34,6 @@
v-if="loadControlVisible"
@changeLoadControl="changeLoadControl"
:msgData="msgData"
:uavStatus="uavStatus"
:cameraType="cameraType"
/>
<!-- 飞行控制 -->
@ -42,7 +41,6 @@
@changeFlightControl="changeFlightControl"
@clickTakeOff="clickTakeOff"
@clickFlyTo="clickFlyTo"
:uavStatus="uavStatus"
v-if="flightControlVisible"
/>
<!-- 一键起飞表单 -->
@ -127,9 +125,34 @@
onMounted(() => {
destroyConnection();
createConnection(connectCallback);
// setTimeout(() => {
// changeSelect();
// }, 1000);
setTimeout(() => {
const topicUrl = 'thing/product/' + airPortInfo.sn + '/osd';
const topicUAVUrl = 'thing/product/' + UAVinfo.sn + '/osd';
//
getClient().on('message', (topic, message) => {
const rs = JSON.parse(message);
if (rs) {
msgData.value = {
topic: topic,
message: rs,
};
if (topic == topicUAVUrl) {
if (rs.data.latitude && rs.data.longitude) {
uavTrack.value = rs.data;
}
} else if (topic == topicUrl) {
if (rs.data.latitude && rs.data.longitude) {
airPort.value.latitude = rs.data.latitude;
airPort.value.longitude = rs.data.longitude;
}
if (rs.data.sub_device) {
uavStatus.value = rs.data.sub_device.device_online_status;
}
}
}
});
}, 1000);
});
watch(
() => connected.value,
@ -197,12 +220,11 @@
};
const cameraType = ref('wide');
const changeCameraType = (value: any) => {
console.log(value);
cameraType.value = value;
};
const msgData = ref({});
const changeSelect = async (value?: any) => {
createConnection(connectCallback);
// createConnection(connectCallback);
//
//
airportLiveVisible.value = false;
@ -227,33 +249,6 @@
const topicUAVUrl = 'thing/product/' + UAVinfo.sn + '/osd';
//
clientSubscribe(topicUAVUrl, { qos: 0 });
if (!value) {
//
getClient().on('message', (topic, message) => {
const rs = JSON.parse(message);
if (rs) {
msgData.value = {
topic: topic,
message: rs,
};
if (topic == topicUAVUrl) {
if (rs.data.latitude && rs.data.longitude) {
uavTrack.value = rs.data;
}
} else if (topic == topicUrl) {
if (rs.data.latitude && rs.data.longitude) {
airPort.value.latitude = rs.data.latitude;
airPort.value.longitude = rs.data.longitude;
}
if (rs.data.sub_device) {
uavStatus.value = rs.data.sub_device.device_online_status;
}
}
}
});
}
};
</script>
<style lang="less" scoped>

@ -194,10 +194,7 @@
import { airPortStore } from '@/store/modules/airport';
import { EventBus } from '@/utils/eventBus';
const props = defineProps({
uavStatus: Number,
});
console.log(props.uavStatus);
const uavStatus = ref();
const airPortStoreVal = airPortStore();
const uav = airPortStoreVal.getUAV;
const isTakeOff = ref(false);
@ -255,10 +252,7 @@
};
//
const flyTo = () => {
console.log('飞行器状态', props.uavStatus);
console.log('是否一键起飞', !isTakeOff.value);
console.log(props.uavStatus == 0 && !isTakeOff.value);
if (!props.uavStatus && !isTakeOff.value) {
if (uavStatus.value == 0) {
createMessage.warning('飞行器未开机');
return;
}
@ -273,7 +267,7 @@
createMessage.warning('当前有用户正在操作,请稍后再试');
return;
}
if (props.uavStatus == 0 && !isTakeOff.value) {
if (uavStatus.value == 0) {
createMessage.warning('飞行器未开机');
return;
}
@ -306,7 +300,7 @@
//
const returnBtn = ref(false);
const returnVoyage = () => {
if (props.uavStatus == 0 && !isTakeOff.value) {
if (uavStatus.value == 0) {
createMessage.warning('飞行器未开机');
return;
}
@ -400,7 +394,7 @@
let drc_mode_enter_timer;
const drc_mode_enter_val = ref(1);
const enterDRC = () => {
if (props.uavStatus == 0 && !isTakeOff.value) {
if (uavStatus.value == 0) {
createMessage.warning('飞行器未开机');
return;
}
@ -469,7 +463,7 @@
eventsTopicSubscribe();
};
const exitDRC = () => {
if (props.uavStatus == 0 && !isTakeOff.value) {
if (uavStatus.value == 0) {
createMessage.warning('飞行器未开机');
return;
}
@ -497,6 +491,9 @@
if (rs.data.mode_code || rs.data.mode_code == 0) {
airportVal.value.mode_code = rs.data.mode_code;
}
if (rs.data.sub_device) {
uavStatus.value = rs.data.sub_device.device_online_status;
}
if (rs.method == 'flight_authority_grab' && rs.bid == bid) {
if (rs.data.result == 0) {
flightGrab.value = true;

@ -141,8 +141,8 @@
const props = defineProps({
msgData: Object,
cameraType: String,
uavStatus: Number,
});
const uavStatus = ref();
const monitorDRC = ref(false);
//
const flightGrab = ref(false);
@ -226,7 +226,6 @@
// redis
const lockedClient = () => {
getLockedClients().then((res) => {
console.log(res);
if (res.length > 0) {
res.forEach((item, index) => {
if (item.userId != userInfo.id) {
@ -245,7 +244,7 @@
createMessage.warning('当前有用户正在操作,请稍后再试');
return;
}
if (!props.uavStatus) {
if (uavStatus.value == 0) {
createMessage.warning('飞行器未开机');
return;
}
@ -371,6 +370,9 @@
// //
getClient().on('message', (topic, message) => {
const rs = JSON.parse(message);
if (rs.data.sub_device) {
uavStatus.value = rs.data.sub_device.device_online_status;
}
if (rs.method == 'camera_photo_take') {
if (rs.data.result == 0) {
createMessage.success('拍照成功');

Loading…
Cancel
Save