From 31ad252341e3614daab677a9cf2e37f62489484e Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Fri, 18 Nov 2022 18:35:12 +0800
Subject: [PATCH] initial v1.3.0
---
src/components/g-map/useDockControl.ts | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/components/g-map/useDockControl.ts b/src/components/g-map/useDockControl.ts
index 94e302f..5e8c38c 100644
--- a/src/components/g-map/useDockControl.ts
+++ b/src/components/g-map/useDockControl.ts
@@ -1,7 +1,7 @@
import { message } from 'ant-design-vue'
import { ref } from 'vue'
import { postSendCmd } from '/@/api/device-cmd'
-import { DeviceCmd } from '/@/types/device-cmd'
+import { DeviceCmd, DeviceCmdItemAction } from '/@/types/device-cmd'
export function useDockControl () {
const controlPanelVisible = ref(false)
@@ -12,22 +12,30 @@
// 远程调试开关
async function dockDebugOnOff (sn: string, on: boolean) {
- const success = await sendDockControlCmd({
+ const result = await sendDockControlCmd({
sn: sn,
cmd: on ? DeviceCmd.DebugModeOpen : DeviceCmd.DebugModeClose
}, false)
- if (success) {
+ if (result) {
setControlPanelVisible(on)
}
+ return result
}
// 发送指令
async function sendDockControlCmd (params: {
sn: string,
cmd: DeviceCmd
+ action?: DeviceCmdItemAction
}, tip = true) {
try {
- const { code, message: msg } = await postSendCmd({ dock_sn: params.sn, device_cmd: params.cmd })
+ let body = undefined as any
+ if (params.action !== undefined) {
+ body = {
+ action: params.action
+ }
+ }
+ const { code, message: msg } = await postSendCmd({ dock_sn: params.sn, device_cmd: params.cmd }, body)
if (code === 0) {
tip && message.success('指令发送成功')
return true
--
Gitblit v1.9.3