From f0dc1b56a04a9d6d6f0b61e3f866362c81a67d4d Mon Sep 17 00:00:00 2001
From: husq <931347610@qq.com>
Date: Mon, 16 Oct 2023 16:51:10 +0800
Subject: [PATCH] 飞行控制修改

---
 src/components/GMap.vue                            |    6 +++++-
 src/components/g-map/use-drone-control-ws-event.ts |    2 +-
 src/store/common.ts                                |    2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/components/GMap.vue b/src/components/GMap.vue
index 9b63e2b..09bc5f8 100644
--- a/src/components/GMap.vue
+++ b/src/components/GMap.vue
@@ -473,13 +473,17 @@
           </a-row>
           <a-row class="p5" align="middle" justify="space-between">
             <a-col span="24">
-              <a-button :class="[openDroneControl ? 'active-color' : 'unactive-color']" class="width-100" type="primary"
+              <a-button v-if="controlStatus != ''" :class="[openDroneControl ? 'active-color' : 'unactive-color']" class="width-100" type="primary"
                 size="small" @click="openDeviceSetting">
                 飞行控制(<DesktopOutlined v-if="controlStatus === 'A'" /> <RobotFilled v-else />{{  controlStatus === 'A' ? 'A控' : 'B控'}}
                 <!-- <template #icon> -->
                   )
                 <!-- </template> -->
               </a-button>
+              <a-button v-else :class="[openDroneControl ? 'active-color' : 'unactive-color']" class="width-100" type="primary"
+                size="small" @click="openDeviceSetting">
+                飞行控制
+              </a-button>
             </a-col>
           </a-row>
         </div>
diff --git a/src/components/g-map/use-drone-control-ws-event.ts b/src/components/g-map/use-drone-control-ws-event.ts
index 7651eef..9c82723 100644
--- a/src/components/g-map/use-drone-control-ws-event.ts
+++ b/src/components/g-map/use-drone-control-ws-event.ts
@@ -17,7 +17,7 @@
 const store = useMyStore()
 
 export function useDroneControlWsEvent (sn: string, payloadSn: string, funcs?: UseDroneControlWsEventParams) {
-  const droneControlSource = ref(ControlSource.A)
+  const droneControlSource = ref('')
   const payloadControlSource = ref(ControlSource.B)
   function onControlSourceChange (data: ControlSourceChangeInfo) {
     if (data.type === ControlSourceChangeType.Flight && data.sn === sn) {
diff --git a/src/store/common.ts b/src/store/common.ts
index 566b858..c3ebb0c 100644
--- a/src/store/common.ts
+++ b/src/store/common.ts
@@ -11,7 +11,7 @@
     mode: 0, // 0为标准地图, 1为卫星地图
     roadLine: true,
   },
-  droneControlSource: ControlSource.A
+  droneControlSource: ''
 })
 export type RootStateType = ReturnType<typeof state>
 const mutations: MutationTree<RootStateType> = {

--
Gitblit v1.9.3