| | |
| | | import {message, notification} from 'ant-design-vue' |
| | | import {onBeforeUnmount, onMounted, ref} from 'vue' |
| | | import { message, notification } from 'ant-design-vue' |
| | | import { onBeforeUnmount, onMounted, ref } from 'vue' |
| | | import EventBus from '/@/event-bus/' |
| | | import {EBizCode, EBizCodeMessage} from '/@/types' |
| | | import {ControlSource} from '/@/types/device' |
| | | import { EBizCode, EBizCodeMessage } from '/@/types' |
| | | import { ControlSource } from '/@/types/device' |
| | | import { |
| | | ControlSourceChangeInfo, |
| | | ControlSourceChangeType, |
| | |
| | | FlyToPointMessage, |
| | | TakeoffToPointMessage |
| | | } from '/@/types/drone-control' |
| | | |
| | | import { useMyStore } from '/@/store' |
| | | export interface UseDroneControlWsEventParams { |
| | | } |
| | | const store = useMyStore() |
| | | |
| | | export function useDroneControlWsEvent (sn: string, payloadSn: string, funcs?: UseDroneControlWsEventParams) { |
| | | const droneControlSource = ref(ControlSource.A) |
| | |
| | | function onControlSourceChange (data: ControlSourceChangeInfo) { |
| | | if (data.type === ControlSourceChangeType.Flight && data.sn === sn) { |
| | | droneControlSource.value = data.control_source |
| | | message.info(`飞行控制改为 ${droneControlSource.value}`) |
| | | store.commit('SET_DRONE_CONTROL_SOURCE', droneControlSource.value) |
| | | // message.info(`飞行控制改为 ${droneControlSource.value}`) |
| | | return |
| | | } |
| | | if (data.type === ControlSourceChangeType.Payload && data.sn === payloadSn) { |
| | |
| | | } |
| | | |
| | | onMounted(() => { |
| | | console.log('弹窗初始化触发?') |
| | | EventBus.on('droneControlWs', handleDroneControlWsEvent) |
| | | }) |
| | | |