From e06e048e3b6e61ca8d1a8f44b7728d3b4a9819d9 Mon Sep 17 00:00:00 2001
From: husq <931347610@qq.com>
Date: Mon, 25 Sep 2023 11:20:19 +0800
Subject: [PATCH] 无人机操作单独拉开控制
---
src/components/GMap.vue | 18 +++++-
src/components/g-map/DroneControlPanel.vue | 30 +++++++--
src/pages/page-web/projects/implement.vue | 111 ------------------------------------
3 files changed, 39 insertions(+), 120 deletions(-)
diff --git a/src/components/GMap.vue b/src/components/GMap.vue
index d494607..575a8c8 100644
--- a/src/components/GMap.vue
+++ b/src/components/GMap.vue
@@ -360,7 +360,7 @@
</a-col>
<a-col span="11">
<a-button :class="[showOption?'active-color':'unactive-color']" class="width-100" type="primary" :disabled="dockControlPanelVisible" size="small"
- @click="setDockControlPanelVisible(true)">
+ @click="openFlySetting">
操作
</a-button>
</a-col>
@@ -621,7 +621,7 @@
</div>
</div>
<!-- 飞行指令 -->
- <DroneControlPanel :sn="osdVisible.gateway_sn" :deviceInfo="deviceInfo" :payloads="osdVisible.payloads">
+ <DroneControlPanel v-model="openDroneControl" :sn="osdVisible.gateway_sn" :deviceInfo="deviceInfo" :payloads="osdVisible.payloads">
</DroneControlPanel>
</div>
</div>
@@ -703,6 +703,8 @@
label: string,
more?: any
}
+ // 打开飞行控制
+ const openDroneControl = ref(false)
const root = getRoot()
// 监控显示
const showMonitor = ref(false)
@@ -805,9 +807,12 @@
// 打开飞机监控
const openAircra = () => {
showAircraft.value = !showAircraft.value
+ setDockControlPanelVisible(false)
if (showAircraft.value) {
+ openDroneControl.value = true
loadDroneVideo()
} else {
+ openDroneControl.value = false
closeFly()
}
}
@@ -966,6 +971,11 @@
// const videoId = deviceInfo.dock.basic_osd?.sub_device?.device_sn + '/' + aircraSelected.value + '/' + 'normal-0'
aircraftList.value = []
aircraSelected.value = ''
+ }
+ // 打开机场操作
+ const openFlySetting = () => {
+ openDroneControl.value = false
+ setDockControlPanelVisible(true)
}
watch(() => store.state.deviceStatusEvent,
data => {
@@ -1294,7 +1304,9 @@
aircraSelected,
selectChange,
closeOperate,
- closeOsdWindow
+ closeOsdWindow,
+ openDroneControl,
+ openFlySetting
}
}
})
diff --git a/src/components/g-map/DroneControlPanel.vue b/src/components/g-map/DroneControlPanel.vue
index 9064d74..bd5764f 100644
--- a/src/components/g-map/DroneControlPanel.vue
+++ b/src/components/g-map/DroneControlPanel.vue
@@ -1,6 +1,11 @@
<template>
- <div class="drone-control-wrapper">
- <div class="drone-control-header">无人机飞行控制</div>
+ <div class="drone-control-wrapper" v-if="modelValue">
+ <div class="drone-control-header width-100 flex-display flex-align-center flex-justify-between">
+ <span>无人机飞行控制</span>
+ <span @click="closeDrone">
+ <CloseOutlined />
+ </span>
+ </div>
<div class="drone-control-box">
<div class="box">
<div class="row">
@@ -238,13 +243,13 @@
</template>
<script setup lang="ts">
-import { defineProps, reactive, ref, watch, computed, onMounted, watchEffect } from 'vue'
+import { defineProps, reactive, ref, watch, computed, onMounted, watchEffect, defineEmits } from 'vue'
import { Select, message, Button } from 'ant-design-vue'
import { PayloadInfo, DeviceInfoType, ControlSource, DeviceOsdCamera, DrcStateEnum } from '/@/types/device'
import { useMyStore } from '/@/store'
import { postDrcEnter, postDrcExit } from '/@/api/drc'
import { useMqtt, DeviceTopicInfo } from './use-mqtt'
-import { DownOutlined, UpOutlined, LeftOutlined, RightOutlined, PauseCircleOutlined, UndoOutlined, RedoOutlined, ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons-vue'
+import { DownOutlined, UpOutlined, LeftOutlined, RightOutlined, PauseCircleOutlined, UndoOutlined, RedoOutlined, ArrowUpOutlined, ArrowDownOutlined, CloseOutlined } from '@ant-design/icons-vue'
import { useManualControl, KeyCode } from './use-manual-control'
import { usePayloadControl } from './use-payload-control'
import { CameraMode, CameraType, CameraTypeOptions, ZoomCameraTypeOptions, CameraListItem } from '/@/types/live-stream'
@@ -261,7 +266,8 @@
const props = defineProps<{
sn: string,
deviceInfo: DeviceInfoType,
- payloads: null | PayloadInfo[]
+ payloads: null | PayloadInfo[],
+ modelValue: Boolean,
}>()
const store = useMyStore()
@@ -291,7 +297,11 @@
}
cmdItem.loading = false
}
-
+const emits = defineEmits(['update:modelValue'])
+// 关闭弹窗
+const closeDrone = () => {
+ emits('update:modelValue', false)
+}
const { flyToPoint, stopFlyToPoint, takeoffToPoint } = useDroneControl()
const MAX_SPEED = 14
@@ -411,7 +421,6 @@
}
enterFlightControl()
}
-
// 进入飞行控制
async function enterFlightControl () {
try {
@@ -706,7 +715,12 @@
<style lang='scss' scoped>
.drone-control-wrapper{
- // border-bottom: 1px solid #515151;
+ position: absolute;
+ background: #000;
+ color: #fff;
+ left: calc( 100% + 10px);
+ width: 480px;
+ top: 0;
.drone-control-header{
font-size: 14px;
diff --git a/src/pages/page-web/projects/implement.vue b/src/pages/page-web/projects/implement.vue
index 3a5b3b6..d8845e8 100644
--- a/src/pages/page-web/projects/implement.vue
+++ b/src/pages/page-web/projects/implement.vue
@@ -7,7 +7,6 @@
<a-col :span="3"></a-col>
</a-row>
</div>
-
<div>
<div>
<a-row style="padding: 15px 0">
@@ -16,17 +15,15 @@
当前设备
</a-col>
</a-row>
-
<a-row>
<a-col :span="1"></a-col>
<a-col :span="22">
-
<div v-if="onlineDocks.data.length === 0" style="height: 150px; color: white;">
<a-empty style="color: #fff;" :image="simpleImage" description="暂无数据"
:image-style="{ height: '60px' }" />
</div>
<div v-else class="fz12" style="color: white;">
- <div @click="selectOnlineDock(dock)" v-for="dock in onlineDocks.data" :key="dock.sn"
+ <div v-for="dock in onlineDocks.data" :key="dock.sn"
:style="{ background: '#3c3c3c', 'margin-bottom': '10px' }">
<div style="border-radius: 2px; height: 60%; width: 100%;"
class="flex-row flex-justify-between flex-align-center">
@@ -34,11 +31,7 @@
<!-- // 机场设备标题 -->
<div style="width: 80%; height: 30px; line-height: 30px; font-size: 16px;">
<a-tooltip :title="`${dock.gateway.callsign} - ${dock.callsign ?? 'No Drone'}`">
- <div class="text-hidden" style="max-width: 200px;">{{ dock.gateway.callsign
- }} - {{
- dock.callsign ??
- 'No Drone'
-}}
+ <div class="text-hidden" style="max-width: 200px;">{{ dock.gateway.callsign}} - {{ dock.callsign ?? 'No Drone'}}
</div>
</a-tooltip>
</div>
@@ -203,29 +196,20 @@
</a-col>
</a-row>
</div>
-
</div>
</div>
</template>
<script lang="ts" setup>
import {
- PlusOutlined,
- MinusOutlined,
RocketOutlined,
- EyeInvisibleOutlined,
- EyeOutlined,
RobotOutlined,
DoubleRightOutlined,
- FileTextOutlined,
} from '@ant-design/icons-vue'
import { useRoute } from 'vue-router'
import { ERouterName, EHmsLevel } from '/@/types/enums'
import { computed, onMounted, reactive, ref, watch, WritableComputedRef } from 'vue'
import { EDeviceTypeName, ELocalStorageKey } from '/@/types'
-import JessibucaVideo from '/@/components/Jessibuca/Jessibuca.vue'
-import noData from '/@/assets/icons/no-data.png'
-import rc from '/@/assets/icons/rc.png'
import { OnlineDevice, EModeCode, OSDVisible, EDockModeCode, DeviceOsd, EDockModeText, EModeText } from '/@/types/device'
import { useMyStore } from '/@/store'
import { getDeviceTopo, getUnreadDeviceHms, updateDeviceHms } from '/@/api/manage'
@@ -254,19 +238,6 @@
const onlineDevices = reactive({
data: [] as OnlineDevice[]
})
-
-const historyCheckArr = reactive({
- data: [] as OnlineDevice[]
-})
-
-const historyDocks = reactive({
- data: [] as OnlineDevice[]
-})
-
-const osdVisible = ref({} as OSDVisible)
-const onlineCheck = ref(false)
-const historyCheck = ref(false)
-
watch(
() => onlineCheckArr.data,
(newVal) => {
@@ -298,58 +269,6 @@
scorllHeight.value = parent?.clientHeight - parent?.firstElementChild?.clientHeight
})
-// 在线设备全选
-function onlineCheckBoxChange (item: any) {
- onlineDocks.data.forEach(e => {
- e.selected = !e.selected
- })
-
- if (item.target.checked) {
- onlineCheckArr.data = onlineDocks.data
- } else {
- onlineCheckArr.data = []
- }
-}
-
-function historyCheckBoxChange (item: any) {
- historyDocks.data.forEach(e => {
- e.selected = !e.selected
- })
-
- historyCheckArr.data = historyDocks.data
-}
-
-// 在线机场点击
-function selectOnlineDock (item: OnlineDevice) {
- // 当前已被选中,排除
- if (item.selected) {
- onlineCheckArr.data = onlineCheckArr.data.filter(e => e.sn !== item.sn)
- } else {
- // 当前未被选中,push
- onlineCheckArr.data.push(item)
- }
- item.selected = !item.selected
- if (onlineCheckArr.data.length === onlineDocks.data.length) {
- onlineCheck.value = true
- } else {
- onlineCheck.value = false
- }
-}
-
-function selectHistoryDock (item: OnlineDevice) {
- // 当前已被选中,排除
- if (item.selected) {
- historyCheckArr.data = historyCheckArr.data.filter(e => e.sn !== item.sn)
- } else {
- // 当前未被选中,push
- historyCheckArr.data.push(item)
- }
- item.selected = !item.selected
- if (historyCheckArr.data.length === historyDocks.data.length) {
- historyCheck.value = true
- }
-}
-
// 监听ws 消息
// useConnectWebSocket(messageHandler)
function getOnlineTopo () {
@@ -373,9 +292,6 @@
domain: gateway?.domain
},
payload: [],
-
- // 是否选中
- selected: false
}
child?.payloads_list.forEach((payload: any) => {
device.payload.push({
@@ -405,7 +321,6 @@
hmsInfo.value[sn] = res.data
}
})
- console.info(hmsInfo.value)
}
function getOnlineDeviceHms () {
@@ -423,28 +338,6 @@
deviceSnList.forEach(sn => {
getUnreadHms(sn)
})
-}
-
-function switchVisible (e: any, device: OnlineDevice, isDock: boolean, isClick: boolean, sn?: any) {
- // showDrawer.value = !showDrawer.value
- if (!isClick) {
- e.target.style.cursor = 'not-allowed'
- return
- }
- if (device.sn === osdVisible.value.sn) {
- osdVisible.value.visible = !osdVisible.value.visible
- } else {
- osdVisible.value.sn = device.sn
- osdVisible.value.callsign = device.callsign
- osdVisible.value.model = device.model
- osdVisible.value.visible = true
- osdVisible.value.gateway_sn = device.gateway.sn
- osdVisible.value.is_dock = isDock
- osdVisible.value.gateway_callsign = device.gateway.callsign
- osdVisible.value.payloads = device.payload
- }
- store.commit('SET_OSD_VISIBLE_INFO', osdVisible)
- store.commit('SET_HMSInfo_DetailSn', sn)
}
</script>
--
Gitblit v1.9.3