提交 45236902 作者: 翁进城

fix:

1. 【机库】发送操作区域的控制指令飞控中心未收到,指令发送失败
2. 【机库】1、无人机飞行状态显示有误2、运行日志未显示出来
3. 【无人机控制面板】飞行时间需转换格式为时分秒
4. 【无人机飞行-监控日志】无人机飞行缺少监控日志
5. 【无人机飞行】-开始录屏和结束录屏按钮弄反了
上级 adb6adee
流水线 #9818 已失败 于阶段
...@@ -31,9 +31,8 @@ ...@@ -31,9 +31,8 @@
</div> </div>
<div class="infoBox cf"> <div class="infoBox cf">
<div class="dib title"> <div class="dib title">
{{ _uavData.flyTime }} {{ flyTimeFormat }}
</div> </div>
min
<div class="cf">飞行时间</div> <div class="cf">飞行时间</div>
</div> </div>
<div class="infoBox cf"> <div class="infoBox cf">
...@@ -80,6 +79,12 @@ export default { ...@@ -80,6 +79,12 @@ export default {
velocityZ: Number(this.uavData?.velocityZ || 0).toFixed(0), velocityZ: Number(this.uavData?.velocityZ || 0).toFixed(0),
}; };
}, },
flyTimeFormat() {
const minutes = this._uavData.flyTime;
const hours = Math.floor(minutes / 60);
const mins = minutes % 60;
return `${hours}:${mins}`;
},
}, },
watch: { watch: {
uavData: function (val, old) { uavData: function (val, old) {
......
<template> <template>
<div class="qingliu" :class="classNames" id="qinglliu" ref="qingliu"> <div class="qingliu" id="qinglliu" ref="qingliu">
<div :id="'qingliu_' + name" class="qingcanvas" ref="qingcanvas"> <div :id="'qingliu_' + name" class="qingcanvas" ref="qingcanvas">
</div> </div>
</div> </div>
...@@ -40,13 +40,13 @@ export default { ...@@ -40,13 +40,13 @@ export default {
// 监听窗口大小变化事件 // 监听窗口大小变化事件
window.addEventListener("resize", this.handResize); window.addEventListener("resize", this.handResize);
var canvas_qinliu = document.getElementById("qingliu_" + this.name); /* var canvas_qinliu = document.getElementById("qingliu_" + this.name);
var resizeObserver = new ResizeObserver((e) => { var resizeObserver = new ResizeObserver((e) => {
for (let i of e) { for (let i of e) {
window.kbt_player_resize("qingliu_" + this.name); window.kbt_player_resize("qingliu_" + this.name);
} }
}); });
resizeObserver.observe(canvas_qinliu); resizeObserver.observe(canvas_qinliu); */
}, },
handResize() { handResize() {
// 获取 Canvas 元素 // 获取 Canvas 元素
...@@ -78,7 +78,7 @@ export default { ...@@ -78,7 +78,7 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.qingliu ::v-deep { .qingliu ::v-deep {
width: 100%; width: 100%;
height: calc(100% - 46px); height: 200px;
.qingcanvas { .qingcanvas {
width: 100%; width: 100%;
height: 100%; height: 100%;
......
<template> <template>
<div <div class="cpt-nest-logger" :class="{ chang: dakai == true, }">
class="cpt-nest-logger"
:class="{ chang: dakai == true, }"
>
<div class="title-box" v-interact> <div class="title-box" v-interact>
<div class="title"> <div class="title">
<img src="../../../../../../../../assets/images/mount_head.png" /> <img src="../../../../../../../../assets/images/mount_head.png" />
<div class="font">运行监控日志</div> <div class="font">运行监控日志</div>
<div effect="dark" class="status"> <div effect="dark" class="status">{{ getprocessStatus(hangarRealTimeData.processStatus) }}</div>
{{ getprocessStatus(hangarData.processStatus) }}
</div>
</div> </div>
<div style="display: flex"> <div style="display: flex">
<div class="icon-box" @click="$emit('clearMsg')"> <div class="icon-box" @click="onClear">
<span class="iconfont icon-qingchushuju"></span> <span class="iconfont icon-qingchushuju"></span>
<!-- <span class="icon-text pr20">清除数据</span> --> <!-- <span class="icon-text pr20">清除数据</span> -->
</div> </div>
<!-- <div class="icon-box" @click="$emit('step')"> <!-- <div class="icon-box" @click="$emit('step')">
<span class="icon-text">运行流程</span> <span class="icon-text">运行流程</span>
</div> --> </div>-->
<div class="close" @click="$emit('exit')">关闭</div> <div class="close" @click="$emit('exit')">关闭</div>
</div> </div>
</div> </div>
...@@ -50,14 +45,11 @@ ...@@ -50,14 +45,11 @@
<div class="time">时间</div> <div class="time">时间</div>
</div> </div>
<div class="list-box mt7"> <div class="list-box mt7">
<div class="item-box" v-for="(item, index) in _hangarMsgList" :key="index"> <div class="item-box" v-for="(item, index) in hangarMsgList" :key="index">
<div class="text-box"> <div class="text-box">
<div <div class="type-box" :class="{ emerg: item.type == 1, ordinary: item.type == 8 }">
class="type-box" <span class="type" v-if="item.type == 1">紧急</span>
:class="{ emerg: item.type === 1, ordinary: item.type === 8 }" <span class="type" v-else-if="item.type == 8">普通</span>
>
<span class="type" v-if="item.type === 1">紧急</span>
<span class="type" v-else-if="item.type === 8">普通</span>
<span class="type" v-else>未知</span> <span class="type" v-else>未知</span>
</div> </div>
<div class="text">{{ item.text }}</div> <div class="text">{{ item.text }}</div>
...@@ -67,14 +59,17 @@ ...@@ -67,14 +59,17 @@
</div> </div>
</div> </div>
<div class="jiantou" @click="jiantou" :class="{ zhaun: dakai == true }"> <div class="jiantou" @click="jiantou" :class="{ zhaun: dakai == true }">
<img :src="jian" style="width: 100%; height: 100%" alt="" /> <img :src="jian" style="width: 100%; height: 100%" alt />
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import jiantouIMG from './assets/images/jiantou.png'; import jiantouIMG from "./assets/images/jiantou.png";
import { mapState } from "vuex";
export default { export default {
name: "HangarLogger",
data() { data() {
return { return {
jian: jiantouIMG, jian: jiantouIMG,
...@@ -82,25 +77,9 @@ export default { ...@@ -82,25 +77,9 @@ export default {
productType: false, // 产品类型 productType: false, // 产品类型
}; };
}, },
props: { props: {},
// 无人机消息type: 270的数据
uavMsg: {
type: Object,
default: () => ({}),
},
// 机库type为2063的日志消息
hangarMsgList: {
type: Array,
default: () => [],
},
// 机库mqtt实时数据
hangarData: {
type: Object,
default: () => ({}),
},
},
watch: { watch: {
hangarData: function (val) { hangarRealTimeData: function (val) {
// 产品类型 明达康机库:305 ,百胜将机库II(入云龙II换电式):304 ,百胜将机库II(入云龙II充电式):303 ,百胜将机库II翻盖式:302 ,百胜将机库I:301 // 产品类型 明达康机库:305 ,百胜将机库II(入云龙II换电式):304 ,百胜将机库II(入云龙II充电式):303 ,百胜将机库II翻盖式:302 ,百胜将机库I:301
if (val?.productType == 302 || val?.productType == 305) { if (val?.productType == 302 || val?.productType == 305) {
this.productType = false; //翻盖 this.productType = false; //翻盖
...@@ -110,40 +89,67 @@ export default { ...@@ -110,40 +89,67 @@ export default {
}, },
}, },
computed: { computed: {
// 消息反序显示 ...mapState("MMCFlightControlCenter/hangar", ["hangar", "hangarRealTimeData"]),
_hangarMsgList(){ ...mapState("MMCFlightControlCenter/uav", ["uavRealTimeData"]),
return this.hangarMsgList.reverse(); hangarMsgList() {
return this.hangarRealTimeData.msgList.slice().reverse();
},
// 无人机消息type: 270的数据
uavMsg() {
return (
this.uavRealTimeData.msgList[this.uavRealTimeData.length - 1] || {}
);
}, },
rtkPower() { rtkPower() {
let { hangarData } = this; let { hangarRealTimeData } = this;
if (hangarData.rtkPower) { if (hangarRealTimeData.rtkPower) {
return hangarData.rtkPower; return hangarRealTimeData.rtkPower;
} }
return 0; return 0;
}, },
folder() { folder() {
let { hangarData } = this; let { hangarRealTimeData } = this;
if (hangarData.folder) { if (hangarRealTimeData.folder) {
return hangarData.folder; return hangarRealTimeData.folder;
} }
return 0; return 0;
}, },
lifts() { lifts() {
let { hangarData } = this; let { hangarRealTimeData } = this;
if (hangarData.lifts) { if (hangarRealTimeData.lifts) {
return hangarData.lifts; return hangarRealTimeData.lifts;
} }
return 0; return 0;
}, },
cover() { cover() {
let { hangarData } = this; let { hangarRealTimeData } = this;
if (hangarData.cover) { if (hangarRealTimeData.cover) {
return hangarData.cover; return hangarRealTimeData.cover;
} }
return 0; return 0;
}, },
}, },
methods: { methods: {
/**
* 清理日志
*/
onClear() {
let dataSet = this.$store.state.MMCMQTT.dataSet;
dataSet[this.hangar.hardId][3] = null;
this.$store.commit("MMCMQTT/setState", {
key: "dataSet",
value: {
...dataSet,
},
});
this.$store.commit("MMCFlightControlCenter/hangar/setState", {
key: "hangarRealTimeData",
value: {
...this.hangarRealTimeData,
msgList: [],
},
});
},
getprocessStatus(val) { getprocessStatus(val) {
let title = ""; let title = "";
if (val == 0) { if (val == 0) {
......
...@@ -39,12 +39,8 @@ ...@@ -39,12 +39,8 @@
</div> </div>
</div> </div>
<Logger <Logger
:uavMsg="uavRealTimeData.msg"
:hangarMsgList="hangarRealTimeData.msgList"
:hangarData="hangarRealTimeData"
class="logger" class="logger"
@exit="showLogger = false" @exit="showLogger = false"
@clearMsg="onClearMsg"
v-if="showLogger" v-if="showLogger"
></Logger> ></Logger>
<HangarMonitor <HangarMonitor
...@@ -193,18 +189,7 @@ export default { ...@@ -193,18 +189,7 @@ export default {
this.showHangar = false; this.showHangar = false;
} }
}, },
/**
* 清理日志
*/
onClearMsg() {
this.$store.commit("MMCFlightControlCenter/hangar/setState", {
key: "hangarRealTimeData",
value: {
...this.hangarRealTimeData,
msgList: [],
},
});
},
}, },
}; };
</script> </script>
......
...@@ -31,13 +31,6 @@ export default { ...@@ -31,13 +31,6 @@ export default {
key: 'listCollapse', key: 'listCollapse',
value: false value: false
}) })
if (this.uav) {
this.$store.dispatch("MMCFlightControlCenter/uav/unsubscribe");
}
if (this.hangar) {
this.$store.dispatch("MMCFlightControlCenter/hangar/unsubscribe");
}
this.$store.dispatch('MMCFlightControlCenter/uav/end');
}, },
}; };
</script> </script>
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
} }
}, },
}, },
async created() { async mounted() {
// 启动mqtt服务 // 启动mqtt服务
try { try {
this.$store this.$store
...@@ -33,4 +33,15 @@ export default { ...@@ -33,4 +33,15 @@ export default {
console.log("mqtt失败", e); console.log("mqtt失败", e);
} }
}, },
beforeDestroy(){
console.log('断开mqtt连接');
if (this.uav) {
this.$store.dispatch("MMCFlightControlCenter/uav/unsubscribe");
}
if (this.hangar) {
this.$store.dispatch("MMCFlightControlCenter/hangar/unsubscribe");
}
this.$store.dispatch('MMCFlightControlCenter/uav/end');
}
}; };
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="font">运行监控日志</div> <div class="font">运行监控日志</div>
</div> </div>
<div style="display: flex"> <div style="display: flex">
<div class="icon-box" @click="list = []"> <div class="icon-box" @click="onClear">
<span class="iconfont icon-qingchushuju"></span> <span class="iconfont icon-qingchushuju"></span>
<!-- <span class="icon-text pr20">清除数据</span> --> <!-- <span class="icon-text pr20">清除数据</span> -->
</div> </div>
...@@ -15,24 +15,16 @@ ...@@ -15,24 +15,16 @@
</div> </div>
<div class="ctx-box"> <div class="ctx-box">
<div class="head mt7"> <div class="head mt7">
<div class="text">消息等级</div> <div class="text">CODE</div>
<div class="text con">消息内容</div> <div class="text con">消息内容</div>
<div class="time">时间</div> <div class="time">时间</div>
</div> </div>
<div class="list-box mt7"> <div class="list-box mt7">
<div class="item-box" v-for="(item,index) in list" :key="index"> <div class="item-box" v-for="(item,index) in msgList" :key="index">
<div <div class="text-box">
class="text-box" <span class="code">{{ item.code }}</span>
:style="item.id && item.id ==99 || item.id && item.id <= 2 ? 'color: #FF4040': item.id && item.id > 2 && item.id < 5 ? 'color: #FFFF40': item.id && item.id == 5 ? 'color: #8E1DB8':''" <div class="text">{{ item.text }}</div>
> <div class="time">{{ item.time }}</div>
<div v-if="item.id" class="type-box">
<span class="type">{{ item.id }}</span>
</div>
<div
class="text"
:style="item.id && item.id == 99 || item.id && item.id <= 2 ? 'color: #FF4040': item.id && item.id > 2 && item.id < 5 ? 'color: #FFFF40': item.id && item.id == 5 ? 'color: #8E1DB8':''"
>{{ item.cmd_title }}</div>
<div class="time">{{ item.time_strap }}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -48,43 +40,17 @@ import dayjs from "dayjs"; ...@@ -48,43 +40,17 @@ import dayjs from "dayjs";
export default { export default {
data() { data() {
return { return {
list: [
// {
// id: 1,
// cmd_title: '测试数据1',
// time_strap: new Date().toLocaleString()
// },
// {
// id: 2,
// cmd_title: '测试数据2',
// time_strap: new Date().toLocaleString()
// },
// {
// id: 3,
// cmd_title: '测试数据3',
// time_strap: new Date().toLocaleString()
// },
],
Time: null, Time: null,
}; };
}, },
computed: { computed: {
...mapState("MMCFlightControlCenter/uav", ["uav"]), ...mapState("MMCFlightControlCenter/uav", ["uav", "uavRealTimeData"]),
}, msgList() {
watch: { return this.uavRealTimeData.msgList.slice().reverse();
async uav(newVal) {
if (newVal) {
this.list = [];
await this.getUavLog();
}
}, },
}, },
async created() { watch: {},
await this.getUavLog(); async created() {},
this.Time = setInterval(() => {
this.getUavLog();
}, 1000);
},
beforeDestroy() { beforeDestroy() {
if (this.Time) clearInterval(this.Time); if (this.Time) clearInterval(this.Time);
}, },
...@@ -92,24 +58,23 @@ export default { ...@@ -92,24 +58,23 @@ export default {
onClose() { onClose() {
this.$emit("onCloseOperationLog"); this.$emit("onCloseOperationLog");
}, },
async getUavLog() { onClear() {
const res = await Control_API.getUavAllLog({ let dataSet = this.$store.state.MMCMQTT.dataSet;
page: 1, dataSet[this.uav.hardId][270] = null;
pageSize: 999, this.$store.commit("MMCMQTT/setState", {
deviceId: this.uav.hardId, key: "dataSet",
startDateId: dayjs().format("YYYY-MM-DD"), value: {
endDateId: dayjs().format("YYYY-MM-DD"), ...dataSet,
},
});
this.$store.commit("MMCFlightControlCenter/uav/setState", {
key: "uavRealTimeData",
value: {
...this.uavRealTimeData,
msgList: [],
},
}); });
if (res.status === 1) {
this.list = res.data.data;
this.list = this.list.filter((item) => {
const current_date = new Date();
const difference =
current_date.getTime() - new Date(item.time_strap).getTime();
const hoursMilli = 1000 * 60 * 30; // 半个小时内
return Math.abs(difference) < hoursMilli;
});
}
}, },
}, },
}; };
...@@ -232,7 +197,7 @@ export default { ...@@ -232,7 +197,7 @@ export default {
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.type-box { .code {
width: 20%; width: 20%;
height: 20px; height: 20px;
text-align: center; text-align: center;
...@@ -245,21 +210,6 @@ export default { ...@@ -245,21 +210,6 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
&.ordinary {
background-color: #298ad3;
}
&.emerg {
background-color: #ff3c3c;
}
.type {
width: 100px;
text-align: center;
font-size: 10px;
white-space: nowrap;
}
} }
.text { .text {
......
...@@ -127,6 +127,10 @@ export default { ...@@ -127,6 +127,10 @@ export default {
type: String, type: String,
default: () => "", default: () => "",
}, },
isHangar: {
type: Boolean,
default: false
}
}, },
data() { data() {
return { return {
...@@ -196,6 +200,14 @@ export default { ...@@ -196,6 +200,14 @@ export default {
"routeControl", "routeControl",
"isTakeOver", "isTakeOver",
]), ]),
async isTake(){
// 判断是否已接管
if (!this.isHangar && !(await this.isTakeOver())) {
this.$message.warning("请先接管无人机");
return false;
}
return true;
},
/** /**
* 显示隐藏航线 * 显示隐藏航线
*/ */
...@@ -209,8 +221,7 @@ export default { ...@@ -209,8 +221,7 @@ export default {
*/ */
async onPauseFly() { async onPauseFly() {
// 判断是否已接管 // 判断是否已接管
if (!(await this.isTakeOver())) { if (!await this.isTake()) {
this.$message.warning("请先接管无人机");
return; return;
} }
this.pauseFly({ this.pauseFly({
...@@ -224,8 +235,7 @@ export default { ...@@ -224,8 +235,7 @@ export default {
*/ */
async onContinueFly() { async onContinueFly() {
// 判断是否已接管 // 判断是否已接管
if (!(await this.isTakeOver())) { if (!await this.isTake()) {
this.$message.warning("请先接管无人机");
return; return;
} }
this.continueFly({ this.continueFly({
...@@ -239,8 +249,7 @@ export default { ...@@ -239,8 +249,7 @@ export default {
*/ */
async onLand() { async onLand() {
// 判断是否已接管 // 判断是否已接管
if (!(await this.isTakeOver())) { if (!await this.isTake()) {
this.$message.warning("请先接管无人机");
return; return;
} }
this.safetyNotice = false; this.safetyNotice = false;
...@@ -251,8 +260,7 @@ export default { ...@@ -251,8 +260,7 @@ export default {
*/ */
async onInfieldControl() { async onInfieldControl() {
// 判断是否已接管 // 判断是否已接管
if (!(await this.isTakeOver())) { if (!await this.isTake()) {
this.$message.warning("请先接管无人机");
return; return;
} }
if (this.online === 0) if (this.online === 0)
...@@ -294,8 +302,7 @@ export default { ...@@ -294,8 +302,7 @@ export default {
*/ */
async guideFlight() { async guideFlight() {
// 判断是否已接管 // 判断是否已接管
if (!(await this.isTakeOver())) { if (!await this.isTake()) {
this.$message.warning("请先接管无人机");
return; return;
} }
if (this.uav.online === 0) if (this.uav.online === 0)
...@@ -339,8 +346,7 @@ export default { ...@@ -339,8 +346,7 @@ export default {
*/ */
async onGuideFlightConfirm() { async onGuideFlightConfirm() {
// 判断是否已接管 // 判断是否已接管
if (!(await this.isTakeOver())) { if (!await this.isTake()) {
this.$message.warning("请先接管无人机");
return; return;
} }
console.log( console.log(
......
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
@closeIconShow="iconShow = false" @closeIconShow="iconShow = false"
@exit="showControlList = false" @exit="showControlList = false"
v-if="showControlList" v-if="showControlList"
:isHangar="isHangar"
></ControlList> ></ControlList>
<Health v-if="showHealth" @exit="showHealth = false"></Health> <Health v-if="showHealth" @exit="showHealth = false"></Health>
<Mount v-if="showMount"></Mount> <Mount v-if="showMount"></Mount>
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<div class="livenvr pr" :class="className"> <div class="livenvr pr" :class="className">
<!-- <video style="width:100%;height:100%" controls ref="video" src="./1.mp4"></video> --> <!-- <video style="width:100%;height:100%" controls ref="video" src="./1.mp4"></video> -->
<LivePlayer <LivePlayer
ref="livePlayer"
:dblclick-fullscreen="false" :dblclick-fullscreen="false"
aspect="fulllscreen" aspect="fulllscreen"
:class="{ :class="{
...@@ -10,11 +11,13 @@ ...@@ -10,11 +11,13 @@
vUrl: isStatus && !smallFPV, vUrl: isStatus && !smallFPV,
vUrlDeffault: !isStatus && !smallFPV, vUrlDeffault: !isStatus && !smallFPV,
}" }"
ref="livePlayer" :controls="false"
:videoUrl="data.vUrl" :videoUrl="data.vUrl"
live
/> />
<LivePlayer <LivePlayer
ref="fpvPlayer"
v-if="fpvUrl.vUrl" v-if="fpvUrl.vUrl"
:dblclick-fullscreen="false" :dblclick-fullscreen="false"
:class="{ :class="{
...@@ -23,16 +26,19 @@ ...@@ -23,16 +26,19 @@
small: smallFPV, small: smallFPV,
'livenvr-player': !smallFPV, 'livenvr-player': !smallFPV,
}" }"
ref="fpvPlayer"
:controls="false" :controls="false"
:videoUrl="fpvUrl.vUrl" :videoUrl="fpvUrl.vUrl"
live
/> />
</div> </div>
</template> </template>
<script> <script>
import LivePlayer from "@liveqing/liveplayer"; import LivePlayer from "@liveqing/liveplayer";
import { dataURLToBlob, canvasToDataURL } from "../../../../../../utils/image-tool"; import {
dataURLToBlob,
canvasToDataURL,
} from "../../../../../../utils/image-tool";
export default { export default {
props: { props: {
......
...@@ -96,4 +96,12 @@ export default { ...@@ -96,4 +96,12 @@ export default {
object-fit: fill; object-fit: fill;
} }
} }
video::-webkit-media-controls-panel {
display:none !important;
}
video::-webkit-media-controls-timeline {
display: none !important;
}
</style> </style>
\ No newline at end of file
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
<div v-show="!isStatus" class="close" @click="close()">关闭</div> <div v-show="!isStatus" class="close" @click="close()">关闭</div>
</div> </div>
<!-- <videoModelChange <!-- <videoModelChange
:data="data" :data="data"
v-if="streamSelect == 'QINGLIU' && !isStatus" v-if="streamSelect == 'QINGLIU' && !isStatus"
class="cp pa cf modelStyle" class="cp pa cf modelStyle"
@click="VideoModelChange" @click="VideoModelChange"
:uavRealTimeData="uavRealTimeData" :uavRealTimeData="uavRealTimeData"
:NXdata="NXdata" :NXdata="NXdata"
></videoModelChange> --> ></videoModelChange>-->
<components <components
:is="playerCom" :is="playerCom"
...@@ -329,12 +329,12 @@ ...@@ -329,12 +329,12 @@
</div> </div>
</el-tooltip> </el-tooltip>
<el-tooltip v-if="!screenRecordingStatus" content="开始录像" placement="bottom"> <el-tooltip v-if="!screenRecordingStatus" content="开始录像" placement="bottom">
<div class="record menu-item" @click="getrecord"> <div class="record menu-item" @click="getRecord">
<img src="./assets/images/record.png" /> <img src="./assets/images/record.png" />
</div> </div>
</el-tooltip> </el-tooltip>
<el-tooltip v-else content="停止录像" placement="bottom"> <el-tooltip v-else content="停止录像" placement="bottom">
<div class="record menu-item" @click="getrecord"> <div class="record menu-item" @click="getRecord">
<img src="./assets/images/stop.png" /> <img src="./assets/images/stop.png" />
</div> </div>
</el-tooltip> </el-tooltip>
...@@ -428,7 +428,6 @@ import svg3 from "./assets/images/异物检测.svg"; ...@@ -428,7 +428,6 @@ import svg3 from "./assets/images/异物检测.svg";
import svg4 from "./assets/images/跌倒检测.svg"; import svg4 from "./assets/images/跌倒检测.svg";
import svg5 from "./assets/images/游泳检测.svg"; import svg5 from "./assets/images/游泳检测.svg";
export default { export default {
name: "Player", name: "Player",
components: { components: {
...@@ -460,7 +459,7 @@ export default { ...@@ -460,7 +459,7 @@ export default {
}, },
data() { data() {
return { return {
backgroundStyle: { backgroundStyle: {
"background-position-y": 0, "background-position-y": 0,
}, },
aiIdentifyList: [ aiIdentifyList: [
...@@ -502,14 +501,14 @@ export default { ...@@ -502,14 +501,14 @@ export default {
}, },
], ],
ygisCenterFlag: false, ygisCenterFlag: false,
ygValue: null, ygValue: null,
showCenter: false, //开启瞄准 showCenter: false, //开启瞄准
screenRecordingStatus: false, //是否录制中 screenRecordingStatus: false, //是否录制中
showInfo: false, //清流视频信息展示 showInfo: false, //清流视频信息展示
infoData: null, //清流信息 infoData: null, //清流信息
raw_msg: 0, raw_msg: 0,
carList: [], //车牌识别结果 carList: [], //车牌识别结果
aiVisible: false, //打开ai aiVisible: false, //打开ai
pid: null, pid: null,
...@@ -836,23 +835,27 @@ export default { ...@@ -836,23 +835,27 @@ export default {
/** /**
* 录像 * 录像
*/ */
async getrecord() { async getRecord() {
if (this.healthData.NX.code !== "0x2110000") { if (this.healthData.NX.code !== "0x2110000") {
return this.$message.error("录像失败,NX通信异常!"); return this.$message.error("录像失败,NX通信异常!");
} }
this.screenRecordingStatus = !this.screenRecordingStatus;
this.$store.dispatch("MMCFlightControlCenter/uav/videoTranscribe", { this.$store.dispatch("MMCFlightControlCenter/uav/videoTranscribe", {
playerFormat: this.streamSelect, playerFormat: this.streamSelect,
videoID: 1, // 视频通道ID(需保持唯一) videoID: 1, // 视频通道ID(需保持唯一)
dbID: "929", // 历史记录id dbID: "929", // 历史记录id
name: "z30Pro", // 挂载名称(如果知道挂载名称,将传名称即可,通道号可以不用传) name: "z30Pro", // 挂载名称(如果知道挂载名称,将传名称即可,通道号可以不用传)
taskID: "", // 任务ID,可传可不传 taskID: "", // 任务ID,可传可不传
recordControl: true, // 录制开关、true为开启 recordControl: this.screenRecordingStatus, // 录制开关、true为开启
callback: (isOk) => { callback: (isOk) => {
isOk && if (isOk) {
this.$message.success( this.$message.success(
`${this.screenRecordingStatus ? "开始" : "结束"}录屏` `${this.screenRecordingStatus ? "开始" : "结束"}录屏`
); );
this.screenRecordingStatus = !this.screenRecordingStatus; } else {
this.$message.error(`${this.screenRecordingStatus ? "开始" : "结束"}录屏失败`);
this.screenRecordingStatus = !this.screenRecordingStatus;
}
}, },
}); });
}, },
......
...@@ -59,10 +59,7 @@ export default { ...@@ -59,10 +59,7 @@ export default {
key: 'listCollapse', key: 'listCollapse',
value: false value: false
}) })
if(this.uav){
this.$store.dispatch('MMCFlightControlCenter/uav/unsubscribe');
}
this.$store.dispatch('MMCFlightControlCenter/uav/end');
}, },
methods: { methods: {
getcanvas(val, item) { getcanvas(val, item) {
......
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
} }
}, },
}, },
async created() { async mounted() {
// 模拟飞机数据上报 // 模拟飞机数据上报
// this.$store.dispatch("MMCFlightControlCenter/uav/test", { open: true }); // this.$store.dispatch("MMCFlightControlCenter/uav/test", { open: true });
// 启动mqtt服务 // 启动mqtt服务
...@@ -53,4 +53,11 @@ export default { ...@@ -53,4 +53,11 @@ export default {
// 由于地面站是广播形式的数据传输, 非常消耗性能, 把连接地面站ws的操作挪到了订阅中去, 取消订阅时就断开ws // 由于地面站是广播形式的数据传输, 非常消耗性能, 把连接地面站ws的操作挪到了订阅中去, 取消订阅时就断开ws
}, },
beforeDestroy(){
console.log('断开mqtt与ws连接');
if(this.uav){
this.$store.dispatch('MMCFlightControlCenter/uav/unsubscribe');
}
this.$store.dispatch('MMCFlightControlCenter/uav/end');
}
}; };
import Moment from "moment"; import moment from "moment";
import { Control_API } from "../api"; import { Control_API } from "../api";
let hangarRealTimeData = { let hangarRealTimeData = {
...@@ -72,16 +72,30 @@ const actions = { ...@@ -72,16 +72,30 @@ const actions = {
// mqtt链路 // mqtt链路
const type2065 = data[2065]?.data || {}; const type2065 = data[2065]?.data || {};
const type2063 = data[2063]?.data; //飞控应答消息 const type2063 = data[2063]?.data; //飞控应答消息
data[2063] && console.log("type2063", data[2063]); const type3 = data[3]; //机库流程日志
const type2066 = data[2066]?.data || {}; //气象站数据 const type2066 = data[2066]?.data || {}; //气象站数据
let msgList = state.hangarRealTimeData.msgList || []; let msgList = state.hangarRealTimeData.msgList || [];
if (type2063) { if (type2063) {
let moment = new Moment(); type2063.timestamp = data[2063].timestamp;
type2063.time = moment.format("yyyy-MM-DD hh:mm:ss"); let findMsg = msgList.find((item) => item.timestamp === type2063.timestamp);
msgList.push(type2063); if (!findMsg) {
data[2063] = null; msgList.push({
...type2063,
time: moment(type2063.timestamp).format("YYYY-MM-DD HH:mm:ss"),
});
}
}
if(type3){
let findMsg = msgList.find((item) => item.$time === type3.$time);
if (!findMsg) {
msgList.push({
...type3,
time: moment(type3.$time).format("YYYY-MM-DD HH:mm:ss"),
text: type3.body
});
}
} }
commit("setState", { commit("setState", {
...@@ -108,6 +122,13 @@ const actions = { ...@@ -108,6 +122,13 @@ const actions = {
console.log("mqtt订阅主题", "APRON/RECEIVE/" + state.hangar.hardId); console.log("mqtt订阅主题", "APRON/RECEIVE/" + state.hangar.hardId);
}, },
}); });
window.$mmc.$store.dispatch("MMCMQTT/subscribe", {
topic: "PROCESS/RECEIVE/" + state.hangar.hardId,
callback(ok) {
ok &&
console.log("mqtt订阅主题", "PROCESS/RECEIVE/" + state.hangar.hardId);
},
});
}, },
/** /**
* 取消订阅 * 取消订阅
...@@ -124,6 +145,16 @@ const actions = { ...@@ -124,6 +145,16 @@ const actions = {
); );
}, },
}); });
window.$mmc.$store.dispatch("MMCMQTT/unsubscribe", {
topic: "PROCESS/RECEIVE/" + state.hangar.hardId,
callback(ok) {
ok &&
console.log(
"mqtt取消订阅主题",
"PROCESS/RECEIVE/" + state.hangar.hardId
);
},
});
dispatch("destroy"); dispatch("destroy");
}, },
......
import { Control_API } from "../api"; import { Control_API } from "../api";
import mount from "../components/mount"; import mount from "../components/mount";
import moment from "moment";
let positions = []; // 飞机走过的点, 会一直累计, 每n秒减半一次, 防止爆内存 let positions = []; // 飞机走过的点, 会一直累计, 每n秒减半一次, 防止爆内存
setInterval(() => { setInterval(() => {
...@@ -8,7 +9,7 @@ setInterval(() => { ...@@ -8,7 +9,7 @@ setInterval(() => {
} }
}, 60000); }, 60000);
window.positions = () => { window.positions = () => {
console.log(positions) console.log(positions);
}; };
const defaultPos = { const defaultPos = {
latitude: 22.433, // 纬度 latitude: 22.433, // 纬度
...@@ -151,12 +152,13 @@ const uavRealTimeData = { ...@@ -151,12 +152,13 @@ const uavRealTimeData = {
statusType: 3, // 电池状态 0无效值,1开机,2充电中,3关机 statusType: 3, // 电池状态 0无效值,1开机,2充电中,3关机
}, */ }, */
], ],
msg: { // 飞控应答消息 msg: {
// 飞控应答消息
code: 0, code: 0,
cmd: 0, cmd: 0,
text: "", text: "",
}, },
msgList: [], // 飞控应答消息记录 msgList: [], // 飞控应答消息记录
}; };
const state = { const state = {
...@@ -292,10 +294,20 @@ const actions = { ...@@ -292,10 +294,20 @@ const actions = {
const type2017 = data[2017]?.data; const type2017 = data[2017]?.data;
const type272 = data[272]?.data; // 避障信息 const type272 = data[272]?.data; // 避障信息
const type275 = data[275]?.data; // 健康管理 const type275 = data[275]?.data; // 健康管理
const type270 = data[270]?.data || {}; //飞控应答消息 const type270 = data[270]?.data; //飞控应答消息
let msgList = state.msgList || []; let msgList = state.uavRealTimeData.msgList || [];
msgList.push(type270);
if (type270) {
type270.timestamp = data[270].timestamp;
let findMsg = msgList.find((item) => item.timestamp === type270.timestamp);
if (!findMsg) {
msgList.push({
...type270,
time: moment(type270.timestamp).format("YYYY-MM-DD HH:mm:ss"),
});
}
}
// gps 需要判断使用哪个 // gps 需要判断使用哪个
if (type258.rtk?.isMainSensor) { if (type258.rtk?.isMainSensor) {
......
...@@ -17,6 +17,18 @@ export default { ...@@ -17,6 +17,18 @@ export default {
userInfo: {}, //用户信息 userInfo: {}, //用户信息
}, },
mutations: { mutations: {
/**
* 单纯的给state赋值
* @param {*} param0
* @param {*} data {key: '', value}
*/
setState(state, data) {
try {
state[data.key] = data.value;
} catch (e) {
console.log("setDate err", e);
}
},
setWs(state, data) { setWs(state, data) {
state.ws = data; state.ws = data;
}, },
......
import mqtt from 'mqtt/dist/mqtt'; import mqtt from "mqtt/dist/mqtt";
import orders from "./orders"; import orders from "./orders";
function uint8array2json(uint8array) { function uint8array2json(uint8array) {
...@@ -24,6 +24,18 @@ export default { ...@@ -24,6 +24,18 @@ export default {
orders, //所有指令 orders, //所有指令
}, },
mutations: { mutations: {
/**
* 单纯的给state赋值
* @param {*} param0
* @param {*} data {key: '', value}
*/
setState(state, data) {
try {
state[data.key] = data.value;
} catch (e) {
console.log("setDate err", e);
}
},
setClient(state, data) { setClient(state, data) {
state.client = data; state.client = data;
}, },
...@@ -43,13 +55,12 @@ export default { ...@@ -43,13 +55,12 @@ export default {
}, },
actions: { actions: {
init({ commit, state }, data) { init({ commit, state }, data) {
let protocol = data.url.replace(/(.+)\:\/\/.*/, "$1");
let clientId = Date.now(); let clientId = Date.now();
let client = mqtt.connect(data.url, { let client = mqtt.connect(data.url, {
// protocol,
clientId, clientId,
}); });
console.log("MQTT client", client);
commit("setClient", client); commit("setClient", client);
commit("setClientId", clientId); commit("setClientId", clientId);
...@@ -64,6 +75,8 @@ export default { ...@@ -64,6 +75,8 @@ export default {
if (!state.dataSet[deviceHardId]) { if (!state.dataSet[deviceHardId]) {
state.dataSet[deviceHardId] = {}; state.dataSet[deviceHardId] = {};
} }
data.$time = Date.now(); // 打上时间戳
state.dataSet[deviceHardId][data.type] = data; state.dataSet[deviceHardId][data.type] = data;
commit("setDataSet", state.dataSet); commit("setDataSet", state.dataSet);
}); });
...@@ -92,9 +105,10 @@ export default { ...@@ -92,9 +105,10 @@ export default {
* @param {} param0 * @param {} param0
*/ */
end({ state, commit }) { end({ state, commit }) {
state.client.end(); console.log('MMCMQTT: 断开mqtt连接')
commit('setClient', null); state.client?.end();
commit("setClientId", ''); commit("setClient", null);
commit("setClientId", "");
}, },
/** /**
* 订阅 * 订阅
...@@ -172,4 +186,4 @@ export default { ...@@ -172,4 +186,4 @@ export default {
}); });
}, },
}, },
}; };
\ No newline at end of file
<template> <template>
<div> <div>
<el-form> <el-form>
<el-form-item label="无人机id"> <el-form-item label="类型">
<el-switch v-model="isUav" inactive-text="机库" active-text="无人机"></el-switch>
</el-form-item>
<el-form-item label="设备id">
<el-input v-model="deviceHardId"></el-input> <el-input v-model="deviceHardId"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="操作"> <el-form-item label="操作">
...@@ -25,7 +28,8 @@ export default { ...@@ -25,7 +28,8 @@ export default {
name: 'MQTT', name: 'MQTT',
data(){ data(){
return { return {
deviceHardId: '' deviceHardId: '',
isUav: true
} }
}, },
computed: { computed: {
...@@ -36,7 +40,10 @@ export default { ...@@ -36,7 +40,10 @@ export default {
return this.$store.state.MMCMQTT.orders; return this.$store.state.MMCMQTT.orders;
}, },
topic(){ topic(){
return `PX4/RECEIVE/${this.deviceHardId}`; return `${this.preTopic}${this.deviceHardId}`;
},
preTopic(){
return this.isUav ? 'PX4/RECEIVE/' : 'APRON/RECEIVE/';
} }
}, },
async created(){ async created(){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论