From 9816d2c27a8b986ffbf640c8737e902849ff45e7 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 14 Apr 2025 17:01:33 +0800
Subject: [PATCH] feat:修复视频监控
---
src/views/Home/HomeLeft/MachineNestList.vue | 22 ++++++-----
src/views/SignMachineNest/MachineRight/MachineMonitor.vue | 37 ++++++++++++++++--
src/api/home/machineNest.js | 4 +-
src/views/SignMachineNest/MachineRight/InspectionRaskList.vue | 9 ++--
src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue | 19 ++++++---
src/views/SignMachineNest/SignMachineNest.vue | 3 -
src/views/Home/HomeLeft/components/MachineNestTotal.vue | 6 +-
src/api/home/index.js | 2
8 files changed, 69 insertions(+), 33 deletions(-)
diff --git a/src/api/home/index.js b/src/api/home/index.js
index 7712d6e..f28a9f2 100644
--- a/src/api/home/index.js
+++ b/src/api/home/index.js
@@ -111,7 +111,7 @@
export const flyByJobId = jobId => {
return request({
url: '/drone-device-core/wayline/api/v1/workspaces/flyByJobId?jobId=' + jobId,
- method: 'get',
+ method: 'post',
})
}
// 再次执行
diff --git a/src/api/home/machineNest.js b/src/api/home/machineNest.js
index d91121e..cc2c476 100644
--- a/src/api/home/machineNest.js
+++ b/src/api/home/machineNest.js
@@ -27,9 +27,9 @@
})
}
// 机巢直播/无人机直播 均可使用
-export const liveStart = deviceSn => {
+export const liveStart = (deviceSn, quality) => {
return request({
- url: `/drone-device-core/manage/api/v1/live/streams/liveStart?deviceSn=${deviceSn}`,
+ url: `/drone-device-core/manage/api/v1/live/streams/liveStart?deviceSn=${deviceSn}&quality=${quality}`,
method: 'post',
data: {},
headers: {
diff --git a/src/views/Home/HomeLeft/MachineNestList.vue b/src/views/Home/HomeLeft/MachineNestList.vue
index edd2d42..5b12d6e 100644
--- a/src/views/Home/HomeLeft/MachineNestList.vue
+++ b/src/views/Home/HomeLeft/MachineNestList.vue
@@ -16,27 +16,29 @@
<div
:class="[index % 2 === 1 ? 'table-itemeven' : 'table-item']"
v-for="(item, index) in tableList"
- :key="index"
+ :key="index" @click="signMachineNestClick(item)"
>
<img src="/src/assets/images/home/homeLeft/machinenestlist-sign.png" alt="" />
<div class="middle">
<div class="title">{{ item.nickname }}</div>
<div class="number">
- 飞行次数:<span>{{ item.fly_count }}</span
- >次 飞行里程:<span>{{ item.flight_mileage }}</span
- >km
+ 飞行次数:
+ <span>{{ item.fly_count }}</span>
+ 次 飞行里程:
+ <span>{{ item.flight_mileage }}</span>
+ km
</div>
<div class="result">
- 任务成果:<span>{{ item.accumulate_data }}</span
- >个 飞行时长:<span>{{ item.hour }}</span
- >h
+ 任务成果:
+ <span>{{ item.accumulate_data }}</span>
+ 个 飞行时长:
+ <span>{{ item.hour }}</span>
+ h
</div>
</div>
<div
class="right"
- :class="item.status === 'WORKING' ? 'atcive' : item.status === 'OFFLINE' ? 'offine' : 'freetime'"
- @click="signMachineNestClick(item)"
- >
+ :class="item.status === 'WORKING' ? 'atcive' : item.status === 'OFFLINE' ? 'offine' : 'freetime'">
{{ item.status === 'OFFLINE' ? '离线中' : item.status === 'WORKING' ? '作业中' : '空闲中' }}
</div>
</div>
diff --git a/src/views/Home/HomeLeft/components/MachineNestTotal.vue b/src/views/Home/HomeLeft/components/MachineNestTotal.vue
index 8a7c04b..9a49e07 100644
--- a/src/views/Home/HomeLeft/components/MachineNestTotal.vue
+++ b/src/views/Home/HomeLeft/components/MachineNestTotal.vue
@@ -34,9 +34,9 @@
let total = ref(0);
// 机巢统计
let listNum = ref([
- { name: '空闲中', value: 89, color: '#FFA768' },
- { name: '作业中', value: 100, color: '#8EFFAC' },
- { name: '离线中', value: 66, color: '#FFFFFF' },
+ { name: '空闲中', value: 0, color: '#FFA768' },
+ { name: '作业中', value: 0, color: '#8EFFAC' },
+ { name: '离线中', value: 0, color: '#FFFFFF' },
// { name: '异常', value: 10, color: '#FF8E8E' },
]);
// 获取机巢列表
diff --git a/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue b/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue
index 2c44b48..14b2c12 100644
--- a/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue
+++ b/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue
@@ -34,11 +34,11 @@
<img src="../../../assets/images/signMachineNest/machineRight/name.png" alt="" />{{ item.creator_name || '' }}
</div>
</div>
- <div class="right" v-if="tabIndex===1" @click="returnImmediately(item.id)">
+ <div class="right" v-if="tabIndex===1" @click="reExecute(item.dock_sn)">
<span>立即返航</span>
<img src="../../../assets/images/signMachineNest/machineRight/return-fly.png" alt="">
</div>
- <div class="right" v-else @click="reExecute(item.dock_sn)">
+ <div class="right" v-else @click="returnImmediately(item.job_id)">
<span>再次执行</span>
<img src="../../../assets/images/signMachineNest/machineRight/return-fly.png" alt="">
</div>
@@ -55,6 +55,7 @@
<script setup>
import { Search } from '@element-plus/icons-vue';
+import { ElMessage } from 'element-plus';
import CommonTitle from '@/components/CommonTitle.vue';
import { getBeforeJob, getTodayJob, flyByJobId, returnHome } from '@/api/home';
import { useStore } from 'vuex';
@@ -148,7 +149,7 @@
const returnImmediately = (id) => {
flyByJobId(id).then(result => {
if (result.data.code === 0) {
- ElMessage.success('返航成功');
+ ElMessage.success('执行成功');
} else {
ElMessage.error(result.data.message);
}
@@ -158,7 +159,7 @@
const reExecute = (dock_sn) => {
returnHome(dock_sn).then(result => {
if (result.data.code === 0) {
- ElMessage.success('执行成功');
+ ElMessage.success('返航成功');
} else {
ElMessage.error(result.data.message);
}
diff --git a/src/views/SignMachineNest/MachineRight/MachineMonitor.vue b/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
index 5c8d29e..d8ca2db 100644
--- a/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
+++ b/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
@@ -1,6 +1,6 @@
<!-- 机巢监控 -->
<template>
- <CommonTitle title="机巢监控" />
+ <CommonTitle title="视频监控" />
<div :style="{ marginLeft: pxToRem(14) }">
<div class="machine-monitor">
<LiveVideo :videoUrl="airPortUrl" />
@@ -22,14 +22,43 @@
// 直播地址
let airPortUrl = ref('');
// 获取直播地址
-const getVideoUrl = () => {
- liveStart(singleUavHome.value.device_sn).then(res => {
+const getVideoUrl = (sn,quality) => {
+ liveStart(sn, quality).then(res => {
if (res.data.code !== 0) return;
airPortUrl.value = res.data.data.rtcs_url;
});
};
+let isCurrentSn = ref(false);
+let CurrentSn = ref('');
+// 监听ws消息
+watch(
+ () => store.state.home.deviceState.deviceInfo,
+ (newValue) => {
+ CurrentSn.value = Object.keys(newValue)[0];
+ const currentDevice = newValue[CurrentSn.value];
+ if (currentDevice.mode_code > 0) {
+ isCurrentSn.value = true;
+ } else if (currentDevice.mode_code === 14) {
+ isCurrentSn.value = false;
+ } else {
+ isCurrentSn.value = false;
+ }
+ },
+ {
+ immediate: true,
+ deep: true,
+ }
+);
+// 监听 isCurrentSn
+watch(isCurrentSn, (newVal) => {
+ if (newVal) {
+ getVideoUrl(CurrentSn.value, 2);
+ } else {
+ getVideoUrl(singleUavHome.value.device_sn,1);
+ }
+}, { immediate: true,deep: true });
onMounted(() => {
- getVideoUrl();
+ getVideoUrl(singleUavHome.value.device_sn,1);
});
</script>
diff --git a/src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue b/src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue
index eae7efb..1449a87 100644
--- a/src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue
+++ b/src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue
@@ -6,7 +6,8 @@
<div class="info">
<img src="../../../../assets/images/signMachineNest/machineRight/wrj.png" alt="">
<div class="info-right">
- <div class="name">{{ osdVisible?.callsign || '--' }}</div>
+ <!-- <div class="name">{{ osdVisible?.callsign || '--' }}</div> -->
+ <div class="name">{{ singleUavHome?.nickname || '--' }}</div>
<div class="wz">
<span class="left">当前位置:</span>
<span class="right">{{ detailInfo.longitude }},{{ detailInfo.latitude }}</span>
@@ -80,6 +81,7 @@
const store = useStore();
// 获取机巢信息
let osdVisible = computed(() => store.state.home.osdVisible);
+const singleUavHome = computed(() => store.state.home.singleUavHome);
// 单个机巢统计数据
const singleTotal = computed(() => store.state.home.singleTotal);
// 是否展示机机巢状态详情
@@ -141,11 +143,11 @@
(newValue) => {
if (newValue.mode_code === 14) return
if (Object.keys(newValue).length === 0) return
- // console.log(newValue, '顶顶顶111')
detailInfo.value.longitude = newValue?.longitude.toFixed(6) || '--';
detailInfo.value.latitude = newValue?.latitude.toFixed(6) || '--';
- getLnglatAltitude(Number(detailInfo.value.longitude), Number(detailInfo.value.latitude)).then((res) => {
- console.log(res, '顶顶顶')
+
+ getLnglatAltitude(Number(detailInfo.value.longitude), Number(detailInfo.value.latitude),window.$viewer).then((res) => {
+ // console.log('333333333', res);
const height = newValue?.height - res?.height;
//针对西安实时高度进行降低
const wId = localStorage.getItem('bs_workspace_id');
@@ -166,9 +168,9 @@
// 获取最新机场状态
watch(store.state.home.deviceState, (newValue) => {
// if (data.currentSn !== osdVisible.gateway_sn) return;
- if (newValue.currentType === EDeviceTypeName.Dock && newValue.dockInfo[newValue.currentSn]) {
+ if (newValue.currentType === EDeviceTypeName.Dock && newValue?.dockInfo[newValue.currentSn]) {
// 机场状态
- mode_code.value = EDockModeText[newValue.dockInfo[newValue.currentSn]?.basic_osd?.mode_code];
+ mode_code.value = EDockModeText[newValue?.dockInfo[newValue.currentSn]?.basic_osd?.mode_code];
// this.$emit('updateModeCode', mode_code.value);
// 舱内状态
AircraftStatus.value =
@@ -178,7 +180,7 @@
]?.mode_code
];
// 舱内关机时显示的电量
- let child_sn = newValue.dockInfo[newValue.currentSn].basic_osd.sub_device.device_sn;
+ let child_sn = newValue?.dockInfo[newValue.currentSn].basic_osd.sub_device.device_sn;
// 飞机在线时取飞机中的电量
if(newValue.deviceInfo[child_sn]) {
drone_charge_state.value = {
@@ -296,6 +298,9 @@
font-size: 24px;
color: #0BE5F5;
line-height: 28px;
+ overflow: hidden; // 添加溢出隐藏
+ text-overflow: ellipsis; // 显示省略号
+ white-space: nowrap; // 不换行
}
.wz {
font-family: Source Han Sans CN, Source Han Sans CN;
diff --git a/src/views/SignMachineNest/SignMachineNest.vue b/src/views/SignMachineNest/SignMachineNest.vue
index c2d013d..c23ce1d 100644
--- a/src/views/SignMachineNest/SignMachineNest.vue
+++ b/src/views/SignMachineNest/SignMachineNest.vue
@@ -38,6 +38,7 @@
break
}
case EBizCode.DeviceOsd: {
+ // console.log(payload, 'DeviceOsd')
store.commit('setDeviceInfo', payload)
store.commit('setWsMessage', payload)
break
@@ -82,8 +83,6 @@
getFlightStatistics(singleUavHome.value.device_sn).then(res => {
if (res.data.code !== 0) return;
const result = res.data.data;
- console.log(result);
- console.log(result);
store.commit('setSingleTotal', result);
})
};
--
Gitblit v1.9.3