无人机管理后台前端(已迁走)
罗广辉
2025-10-11 02409bfbe15f22fc3b5dccadabfd860a660a49d9
src/views/device/components/use-dock-control.js
@@ -24,41 +24,33 @@
  // 发送指令
  async function sendDockControlCmd(params, tip = true) {
    try {
      let body = undefined;
      if (params.action !== undefined) {
        if (params.cmd === DeviceCmd.SdrWorkModeSwitch) {
          body = {
            link_workmode: params.action,
          };
        } else {
          body = {
            action: params.action,
          };
        }
    let body = undefined;
    if (params.action !== undefined) {
      if (params.cmd === DeviceCmd.SdrWorkModeSwitch) {
        body = {
          link_workmode: params.action,
        };
      } else {
        body = {
          action: params.action,
        };
      }
      const { code, message: msg } = await postSendCmd(
        { dock_sn: params.sn, device_cmd: params.cmd },
        body
      );
      if (code === 0) {
    }
    try {
      const res = await postSendCmd({ dock_sn: params.sn, device_cmd: params.cmd }, body);
      if (res.data.code === 0) {
        tip &&
          ElMessage({
            message: '指令发送成功',
            type: 'success',
          });
        return true;
        message.error('指令发送失败');
      }
      throw msg;
    } catch (e) {
      tip &&
        ElMessage({
          message: '指令发送失败',
          type: 'error',
        });
    } catch (error) {
      return false;
    }
    return false;
  }
  // 控制面板关闭