| | |
| | | NProgress.done(); |
| | | const status = res.data.error_code || res.data.code || res.status; |
| | | const statusWhiteList = website.statusWhiteList || []; |
| | | const message = res.data.msg || res.data.error_description || '系统错误'; |
| | | const message = res.data.msg || res.data.error_description || res.data.message ||'系统错误'; |
| | | const config = res.config; |
| | | const cryptoData = config.cryptoData === true; |
| | | //如果在白名单里则自行catch逻辑处理 |
| | |
| | | return Promise.reject(new Error(message)); |
| | | } |
| | | // 如果请求为非200默认统一处理 |
| | | if (status !== 200) { |
| | | if (status !== 200 && status !== 0) { |
| | | if (!isErrorShown) { |
| | | ElMessage({ |
| | | message: message, |
| | |
| | | logsFlag: (state, getters) => getters.logsLen === 0, |
| | | flowRoutes: state => state.dict.flowRoutes, |
| | | devicesCmdExecuteInfo: state => state.device.devicesCmdExecuteInfo, |
| | | deviceState: state => state.device.deviceState, |
| | | }; |
| | | export default getters; |
| | |
| | | LinkWorkModeEnum[(LinkWorkModeEnum['SDR'] = 0)] = 'SDR'; |
| | | LinkWorkModeEnum[(LinkWorkModeEnum['FourG_FUSION_MODE'] = 1)] = 'FourG_FUSION_MODE'; |
| | | })(LinkWorkModeEnum || (LinkWorkModeEnum = {})); |
| | | |
| | | // 空调模式 0:空闲模式 1:制冷 2:制热 3:除湿 |
| | | export let AirConditioningModeEnum; |
| | | (function (AirConditioningModeEnum) { |
| | | AirConditioningModeEnum[(AirConditioningModeEnum['CLOSE'] = 0)] = 'CLOSE'; |
| | | AirConditioningModeEnum[(AirConditioningModeEnum['COOL'] = 1)] = 'COOL'; |
| | | AirConditioningModeEnum[(AirConditioningModeEnum['HEAT'] = 2)] = 'HEAT'; |
| | | AirConditioningModeEnum[(AirConditioningModeEnum['DEHUMIDIFY'] = 3)] = 'DEHUMIDIFY'; |
| | | })(AirConditioningModeEnum || (AirConditioningModeEnum = {})); |
| | |
| | | BatteryStoreModeEnum, |
| | | DroneBatteryModeEnum, |
| | | LinkWorkModeEnum, |
| | | AirConditioningModeEnum |
| | | } from '@/types/airport-tsa'; |
| | | // 机场指令集 |
| | | export let DeviceCmd; |
| | |
| | | DeviceCmd['BatteryStoreModeSwitch'] = 'battery_store_mode_switch'; |
| | | DeviceCmd['DroneBatteryModeSwitch'] = 'battery_maintenance_switch'; |
| | | DeviceCmd['SdrWorkModeSwitch'] = 'sdr_workmode_switch'; |
| | | DeviceCmd['AirConditioningModeSwitch'] = 'air_conditioner_mode_switch'; |
| | | })(DeviceCmd || (DeviceCmd = {})); |
| | | |
| | | export const noDebugCmdList = [ |
| | |
| | | }, |
| | | { |
| | | label: '机场电池存储模式', |
| | | status: '计划', |
| | | operateText: '应急', |
| | | status: '应急', |
| | | operateText: '计划', |
| | | cmdKey: DeviceCmd.BatteryStoreModeSwitch, |
| | | action: BatteryStoreModeEnum.BATTERY_EMERGENCY_STORE, |
| | | func: 'batteryStoreMode', |
| | |
| | | cmdKey: DeviceCmd.SdrWorkModeSwitch, |
| | | action: LinkWorkModeEnum.FourG_FUSION_MODE, |
| | | func: 'sdrWorkMode', |
| | | loading: false, |
| | | }, |
| | | { |
| | | label: '空调模式', |
| | | status: '关', |
| | | operateText: '打开', |
| | | cmdKey: DeviceCmd.AirConditioningModeSwitch, |
| | | action: AirConditioningModeEnum.COOL, |
| | | func: 'airConditionerSwitch', |
| | | loading: false, |
| | | }, |
| | | ]; |
| | |
| | | DeviceCmdStatusText['SdrWorkModeFourGCloseText'] = '关闭中...'; |
| | | DeviceCmdStatusText['SdrWorkModeFourGCloseFailedText'] = '开'; |
| | | DeviceCmdStatusText['SdrWorkModeFourCloseBtnText'] = '开启'; |
| | | // 空调模式 |
| | | DeviceCmdStatusText['AirConditionerModeCoolNormalText'] = '关'; |
| | | DeviceCmdStatusText['AirConditionerModeCoolInProgressText'] = '切换中...'; |
| | | DeviceCmdStatusText['AirConditionerModeCoolFailedText'] = '切换失败'; |
| | | DeviceCmdStatusText['AirConditionerModeHeatText'] = '制热'; |
| | | DeviceCmdStatusText['AirConditionerModeCoolText'] = '制冷'; |
| | | DeviceCmdStatusText['AirConditionerModeDehumdidfyText'] = '除湿'; |
| | | })(DeviceCmdStatusText || (DeviceCmdStatusText = {})); |
| | | |
| | | // cmd ws 消息状态 |
| | |
| | | import { DeviceCmd, DeviceCmdStatusText } from '@/types/device-cmd'; |
| | | import { DeviceCmd, DeviceCmdStatusText,DeviceCmdExecuteStatus } from '@/types/device-cmd'; |
| | | import { |
| | | CoverStateEnum, |
| | | PutterStateEnum, |
| | | ChargeStateEnum, |
| | | SupplementLightStateEnum, |
| | | AlarmModeEnum, |
| | | BatteryStoreModeEnum, |
| | | DroneBatteryStateEnum, |
| | | LinkWorkModeEnum, |
| | | AirConditioningModeEnum, |
| | | DroneBatteryModeEnum |
| | | } from '@/types/airport-tsa'; |
| | | import { DEFAULT_PLACEHOLDER } from './constants'; |
| | | import { DEFAULT_PLACEHOLDER, SIZES as byteSizes, BYTE_SIZES } from './constants' |
| | | |
| | | /** |
| | | * 根据osd 更新信息 |
| | |
| | | } else if (cmdItem.cmdKey === DeviceCmd.SdrWorkModeSwitch) { |
| | | // 增强图传开关 |
| | | getSdrWorkNode(cmdItem, dock); |
| | | } else if (cmdItem.cmdKey === DeviceCmd.AirConditioningModeSwitch) { |
| | | // 空调模式开关 |
| | | getAirConditionerSwitch(cmdItem, dock); |
| | | } |
| | | }); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | // 空调模式开关 |
| | | function getAirConditionerSwitch (cmdItem, airportProperties) { |
| | | const conditionerState = airportProperties?.basic_osd?.air_conditioner?.air_conditioner_state || 0 |
| | | if (conditionerState === 0) { |
| | | cmdItem.status = DeviceCmdStatusText.AirConditionerModeCoolNormalText |
| | | } |
| | | if (conditionerState === 1) { |
| | | cmdItem.status = DeviceCmdStatusText.AirConditionerModeCoolText |
| | | cmdItem.action = AirConditioningModeEnum.CLOSE |
| | | } |
| | | if (conditionerState === 2) { |
| | | cmdItem.status = DeviceCmdStatusText.AirConditionerModeHeatText |
| | | cmdItem.action = AirConditioningModeEnum.CLOSE |
| | | } |
| | | if (conditionerState === 3) { |
| | | cmdItem.status = DeviceCmdStatusText.AirConditionerModeDehumdidfyText |
| | | cmdItem.action = AirConditioningModeEnum.CLOSE |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据指令执行消息更新信息 |
| | | * @param cmd |
| | |
| | | >机场授权 |
| | | </el-button> |
| | | |
| | | <!-- <el-button |
| | | <el-button |
| | | type="primary" |
| | | text |
| | | icon="el-icon-share" |
| | | v-if="permission.per_share && scope.row.domain == 3" |
| | | icon="el-icon-position" |
| | | :disabled="!scope.row.status" |
| | | v-if="permission.rang_con && scope.row.domain == 3" |
| | | @click.stop="handleOpenRemoteDebugging(scope.row, scope.index)" |
| | | >远程调试 |
| | | </el-button> --> |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | |
| | |
| | | <DevicePerShare ref="devicePerShare" /> |
| | | </el-drawer> |
| | | |
| | | <el-drawer title="远程调试" append-to-body v-model="remoteDebuggingShow" size="40%"> |
| | | <el-drawer :title="operateTitle" append-to-body v-model="remoteDebuggingShow" size="40%"> |
| | | <DockControlPanel |
| | | v-if="remoteDebuggingShow" |
| | | :sn="curDeviceInfo.device_sn" |
| | |
| | | |
| | | data() { |
| | | return { |
| | | operateTitle:"", |
| | | rollFirmVersion: '', |
| | | firmList: [], |
| | | rollFirmwareBox: false, |
| | |
| | | that.$refs.devicePerShare.init(row); |
| | | }); |
| | | }, |
| | | |
| | | // 打开远程调试 |
| | | handleOpenRemoteDebugging(row) { |
| | | this.curDeviceInfo = row; |
| | | this.remoteDebuggingShow = true; |
| | | this.operateTitle = row.nickname + " - " + row.device_sn |
| | | }, |
| | | |
| | | // 打开固件管理页面 |
| | |
| | | <div class="control-cmd-header"> |
| | | 远程调试 |
| | | <el-switch |
| | | v-model:checked="debugStatus" |
| | | v-model="debugStatus" |
| | | @change="onDeviceStatusChange" |
| | | active-text="开" |
| | | inactive-text="关" |
| | | class="debug-btn" |
| | | style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949" |
| | | /> |
| | | <el-divider /> |
| | | </div> |
| | | <div class="control-cmd-box"> |
| | | <div v-for="(cmdItem, index) in cmdList" :key="cmdItem.cmdKey" class="control-cmd-item"> |
| | |
| | | import { EBizCode, ELocalStorageKey, ERouterName } from '@/types'; |
| | | import { useConnectWebSocket } from '@/hooks/use-connect-websocket'; |
| | | import { getWebsocketUrl } from '@/websocket/util/config'; |
| | | |
| | | import { defineProps, ref, watch } from 'vue'; |
| | | import { cmdList as baseCmdList } from '@/types/device-cmd'; |
| | | import { useDockControl } from './use-dock-control'; |
| | | import { EDockModeCode } from '@/types/device'; |
| | | import { updateDeviceCmdInfoByOsd, updateDeviceCmdInfoByExecuteInfo } from '@/utils/device-cmd'; |
| | | |
| | | import Store from '@/store'; |
| | | |
| | | const props = defineProps(['sn', 'deviceInfo']); |
| | | const initCmdList = baseCmdList.map(cmdItem => Object.assign({}, cmdItem)); |
| | | const cmdList = ref(initCmdList); |
| | | |
| | | // dock 控制指令 |
| | | const debugStatus = ref(props.deviceInfo.mode_code == EDockModeCode.Remote_Debugging); |
| | | // 根据机场指令执行状态更新信息 |
| | | watch( |
| | | () => Store.getters.devicesCmdExecuteInfo, |
| | |
| | | |
| | | // 根据设备osd信息更新信息 |
| | | watch( |
| | | () => props.deviceInfo, |
| | | () => Store.getters.deviceState, |
| | | value => { |
| | | updateDeviceCmdInfoByOsd(cmdList.value, value); |
| | | // console.log('deviceInfo', value) |
| | | if (props.sn && (value.currentSn===props.deviceInfo.child_sn || value.currentSn===props.deviceInfo.device_sn)) { |
| | | debugStatus.value = value.dockInfo[props.deviceInfo.device_sn]?.basic_osd?.mode_code === EDockModeCode.Remote_Debugging |
| | | const devices = {} |
| | | devices['device'] = value.deviceInfo[props.deviceInfo.child_sn] |
| | | devices['dock'] = value.dockInfo[props.deviceInfo.device_sn] |
| | | devices['gateway'] = value.gatewayInfo |
| | | updateDeviceCmdInfoByOsd(cmdList.value, devices); |
| | | } |
| | | }, |
| | | { |
| | | immediate: true, |
| | |
| | | } |
| | | ); |
| | | |
| | | // dock 控制指令 |
| | | const debugStatus = ref( |
| | | props.deviceInfo.dock?.basic_osd.mode_code === EDockModeCode.Remote_Debugging |
| | | ); |
| | | |
| | | // 远程控制开关 |
| | | async function onDeviceStatusChange(status) { |
| | | let result = false; |
| | | if (status) { |
| | |
| | | } else { |
| | | result = await dockDebugOnOff(props.sn, false); |
| | | } |
| | | |
| | | console.log(result, '---1------'); |
| | | |
| | | if (!result) { |
| | |
| | | }; |
| | | const success = await sendDockControlCmd(params, true); |
| | | if (success) { |
| | | // updateDeviceSingleCmdInfo(cmdList.value[index]) |
| | | updateDeviceSingleCmdInfo(cmdList.value[index]); |
| | | } |
| | | } |
| | | |
| | | // webSocket 监听 |
| | | const messageHandler = async payload => { |
| | | if (!payload) { |
| | | return; |
| | | } |
| | | |
| | | switch (payload.biz_code) { |
| | | case EBizCode.GatewayOsd: { |
| | | Store.commit('SET_GATEWAY_INFO', payload.data); |
| | | break; |
| | | } |
| | | // 飞行器 |
| | | case EBizCode.DeviceOsd: { |
| | | Store.commit('SET_DEVICE_INFO', payload.data); |
| | | break; |
| | | } |
| | | // 机场 |
| | | case EBizCode.DockOsd: { |
| | | // if (payload.data.sn === workspace_id.value) { |
| | | Store.commit('SET_DOCK_INFO', payload.data); |
| | | // console.log(payload.data, 'data') |
| | | // } |
| | | break; |
| | | } |
| | | case EBizCode.MapElementCreate: { |
| | |
| | | |
| | | .debug-btn { |
| | | margin-left: 10px; |
| | | border: 1px solid #585858; |
| | | // border: 1px solid #585858; |
| | | } |
| | | } |
| | | |
| | |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | justify-content: space-between; |
| | | padding: 4px 10px; |
| | | padding: 4px 15px; |
| | | .control-cmd-item { |
| | | width: 220px; |
| | | width: 320px; |
| | | height: 58px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | border: 1px solid #666; |
| | | margin: 4px 0; |
| | | margin: 8px 0; |
| | | padding: 0 8px; |
| | | border-radius: 2px; |
| | | |
| | | .control-cmd-item-left { |
| | | display: flex; |
| | |
| | | |
| | | // 发送指令 |
| | | 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; |
| | | } |
| | | |
| | | // 控制面板关闭 |