| | |
| | | <!-- |
| | | * @Author: shuishen 1109946754@qq.com |
| | | * @Date: 2025-04-19 13:13:15 |
| | | * @LastEditors: shuishen 1109946754@qq.com |
| | | * @LastEditTime: 2025-04-19 14:15:02 |
| | | * @FilePath: \command-center-dashboard\src\components\CurrentTaskDetails\CurrentTaskDetails.vue |
| | | * @Description: |
| | | * |
| | | * Copyright (c) 2025 by shuishen, All Rights Reserved. |
| | | --> |
| | | <!--当前任务详情--> |
| | | <template> |
| | | <el-dialog |
| | |
| | | import { getLiveAiLinkApi } from '@/api/payload' |
| | | import { CURRENT_CONFIG } from '@/utils/http/config' |
| | | import { useDroneWS } from '@/hooks/useDroneWS' |
| | | import { useTaskDetails } from '@/hooks/useTaskDetails/useTaskDetails' |
| | | |
| | | const isAutoControl = ref(true) //是否自动控制 |
| | | const lineQuality = ref(1) //1流畅,2标清 |
| | | const taskDetailsViewer = ref(null) //地图实例 |
| | | let taskDetails = ref({}) //任务详情 |
| | | const deviceOsdInfo = computed(() => wsInfo.value?.device_osd) |
| | | const dockSn = computed(() => taskDetails?.value?.device_sns?.[0]) |
| | | const droneSn = computed(() => deviceOsdInfo?.value?.data?.sn) |
| | |
| | | const isTakeOff = ref(false) // 是在飞行中 |
| | | const isMaxMap = ref(false) //是大地图 |
| | | |
| | | const workspace_id = ref('') |
| | | let { wsInfo,removeWS } = useDroneWS(workspace_id) //ws信息,是一个ref对象 |
| | | // 获取机巢直播 |
| | | const getDeviceLiveUrl = async () => { |
| | | const res = await liveStart(dockSn.value, 2) |
| | | currentLiveUrl.value = res.data.data.rtcs_url |
| | | } |
| | | |
| | | let { taskDetails, workspace_id, getTaskDetails } = useTaskDetails(getDeviceLiveUrl) |
| | | let { wsInfo, removeWS } = useDroneWS(workspace_id) //ws信息,是一个ref对象 |
| | | |
| | | watch( |
| | | wsInfo, |
| | | () => { |
| | |
| | | provide('trueAltitude', trueAltitude) |
| | | provide('isAiLive', isAiLive) |
| | | provide('video_id', video_id) |
| | | |
| | | // 获取机巢直播 |
| | | const getDeviceLiveUrl = async () => { |
| | | const res = await liveStart(dockSn.value, 2) |
| | | currentLiveUrl.value = res.data.data.rtcs_url |
| | | } |
| | | |
| | | const getAiLiveUrl = async () => { |
| | | const res = await getLiveAiLinkApi({ |
| | |
| | | isTakeOff.value = currentIsTakeOff |
| | | isTakeOff.value ? await getDroneLiveUrl() : await getDeviceLiveUrl() |
| | | } |
| | | // 获取任务详情获取航线文件 |
| | | const getTaskDetails = () => { |
| | | if (!props.id) ElMessage.warning('请检查是否传入id') |
| | | getJobDetails({ wayLineJobInfoId: props.id }).then(async res => { |
| | | taskDetails.value = res.data.data |
| | | await getDeviceLiveUrl() |
| | | taskDetails.value.workspace_id = taskDetails.value.way_lines[0]?.workspace_id |
| | | workspace_id.value = taskDetails.value.workspace_id |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getTaskDetails() |
| | | getTaskDetails(props?.id) |
| | | EventBus.on('CurrentTaskDetails-timeStop', changeLineQuality) |
| | | EventBus.on('CurrentTaskDetails-getAiLiveUrl', getAiLiveUrl) |
| | | EventBus.on('CurrentTaskDetails-getDroneLiveUrl', getDroneLiveUrl) |