bug修改

This commit is contained in:
qiudan 2023-11-30 16:18:53 +08:00
parent 8df24f5586
commit 41df993d20
7 changed files with 330 additions and 190 deletions

View File

@ -124,7 +124,11 @@ export default {
// for (let i = 0; i < this.avg.length; i++) {
// avgData = this.avg[i];
// }
let arr = this.dataList[0]||{}
let arr = {};
if(this.dataList&&this.dataList.length>0){
arr = this.dataList[0]
}
if (arr && Object.keys(arr).length > 0) {
avgData = arr.avg ? Math.abs(arr.avg).toFixed(2) : 0;
medData = arr.med ? Math.abs(arr.med).toFixed(2) : 0;
@ -317,43 +321,43 @@ export default {
}, 300);
},
watch: {
// intersectionName: {
// handler: function (oldValues, newValues) {
// this.$nextTick(() => {
// this.initEcharts();
// });
// }
// },
// chatShowType: {
// handler: function (oldValues, newValues) {
// let that = this;
// setTimeout(() => {
// that.$nextTick(() => {
// this.chart = this.$echarts.getInstanceByDom(document.getElementById(this.echartsRef));
// if (this.chart == null) {
// this.chart = this.$echarts.init(document.getElementById(this.echartsRef));
// }
// that.initEcharts();
// });
// }, 300);
// }
// },
// echartsRef: {
// handler: function (newValues, oldValues) {
// console.log('old', oldValues);
// console.log('newV', newValues);
// let that = this;
// setTimeout(() => {
// that.$nextTick(() => {
// this.chart = this.$echarts.getInstanceByDom(document.getElementById(this.echartsRef));
// if (this.chart == null) {
// this.chart = this.$echarts.init(document.getElementById(this.echartsRef));
// }
// that.initEcharts();
// });
// }, 300);
// }
// },
intersectionName: {
handler: function (oldValues, newValues) {
this.$nextTick(() => {
this.initEcharts();
});
}
},
chatShowType: {
handler: function (oldValues, newValues) {
let that = this;
setTimeout(() => {
that.$nextTick(() => {
this.chart = this.$echarts.getInstanceByDom(document.getElementById(this.echartsRef));
if (this.chart == null) {
this.chart = this.$echarts.init(document.getElementById(this.echartsRef));
}
that.initEcharts();
});
}, 300);
}
},
echartsRef: {
handler: function (newValues, oldValues) {
// console.log('old', oldValues);
// console.log('newV', newValues);
let that = this;
setTimeout(() => {
that.$nextTick(() => {
this.chart = this.$echarts.getInstanceByDom(document.getElementById(this.echartsRef));
if (this.chart == null) {
this.chart = this.$echarts.init(document.getElementById(this.echartsRef));
}
that.initEcharts();
});
}, 300);
}
},
dataList: {
handler: function (newValues, oldValues) {
// if(newValues&&newValues.length>0) {

View File

@ -254,8 +254,8 @@ export default {
},
echartsRef: {
handler: function (oldValues, newValues) {
console.log('old', oldValues);
console.log('newV', newValues);
// console.log('old', oldValues);
// console.log('newV', newValues);
let that = this;
setTimeout(() => {
that.$nextTick(() => {

View File

@ -277,15 +277,51 @@ export default {
computed: {
latestDataArr() {
//
let latestDataArr = {};
if (this.dataArr && this.dataArr.length > 0) {
let latestDataArr = _.cloneDeep(this.dataArr[0]);
return latestDataArr;
latestDataArr = _.cloneDeep(this.dataArr[0]);
}
if (this.cycleAccumulateData && this.cycleAccumulateData.length > 0) {
let latestDataArr = _.cloneDeep(this.cycleAccumulateData[0]);
return latestDataArr;
latestDataArr = _.cloneDeep(this.cycleAccumulateData[0]);
// console.log('-',latestDataArr)
}
return {};
if (!isNaN(latestDataArr.headway) && (latestDataArr.headway !== -1 || latestDataArr.headway === 0)) {
latestDataArr.headway = latestDataArr.headway;
} else {
latestDataArr.headway = '-';
}
if (!isNaN(latestDataArr.ave_headway) && (latestDataArr.ave_headway !== -1 || latestDataArr.ave_headway === 0)) {
latestDataArr.ave_headway = latestDataArr.ave_headway;
latestDataArr.headway = latestDataArr.ave_headway;
} else {
latestDataArr.ave_headway = '-';
}
if (!isNaN(latestDataArr.n_stay) && (latestDataArr.n_stay !== -1 || latestDataArr.n_stay === 0)) {
latestDataArr.n_stay = latestDataArr.n_stay;
} else {
latestDataArr.n_stay = '-';
}
if (!isNaN(latestDataArr.ave_stay) && (latestDataArr.ave_stay !== -1 || latestDataArr.ave_stay === 0)) {
latestDataArr.n_stay = latestDataArr.ave_stay;
latestDataArr.ave_stay = latestDataArr.ave_stay;
} else {
latestDataArr.ave_stay = '-';
}
if (!isNaN(latestDataArr.n_queue) && (latestDataArr.n_queue !== -1 || latestDataArr.n_queue === 0)) {
latestDataArr.n_queue = latestDataArr.n_queue;
} else {
latestDataArr.n_queue = '-';
}
if (!isNaN(latestDataArr.ave_queue) && (latestDataArr.ave_queue !== -1 || latestDataArr.ave_queue === 0)) {
latestDataArr.n_queue = latestDataArr.ave_queue;
latestDataArr.ave_queue = latestDataArr.ave_queue;
} else {
latestDataArr.ave_queue = '-';
}
return latestDataArr;
},
newDataArr() {
if (this.dataArr && this.dataArr.length > 0) {
@ -307,7 +343,7 @@ export default {
item.speed = '-';
}
if (!isNaN(item.flow) && (item.headway !== -1 || item.headway === 0)) {
if (!isNaN(item.flow) && (item.flow !== -1 || item.flow === 0)) {
item.flow = item.flow;
} else {
item.flow = '-';
@ -319,11 +355,24 @@ export default {
item.headway = '-';
}
if (!isNaN(item.ave_headway) && (item.ave_headway !== -1 || item.ave_headway === 0)) {
item.ave_headway = item.ave_headway;
item.headway = item.ave_headway;
} else {
item.ave_headway = '-';
}
if (!isNaN(item.n_stay) && (item.n_stay !== -1 || item.n_stay === 0)) {
item.n_stay = item.n_stay;
} else {
item.n_stay = '-';
}
if (!isNaN(item.ave_stay) && (item.ave_stay !== -1 || item.ave_stay === 0)) {
item.n_stay = item.ave_stay;
item.ave_stay = item.ave_stay;
} else {
item.ave_stay = '-';
}
if (!isNaN(item.n_queue) && (item.n_queue !== -1 || item.n_queue === 0)) {
item.n_queue = item.n_queue;
@ -332,6 +381,7 @@ export default {
}
if (!isNaN(item.ave_queue) && (item.ave_queue !== -1 || item.ave_queue === 0)) {
item.n_queue = item.ave_queue;
item.ave_queue = item.ave_queue;
} else {
item.ave_queue = '-';
}

View File

@ -81,6 +81,7 @@
</div>
</template>
<script>
import _ from 'lodash';
import newtypeChart from '../../components/target/newtypeChart.vue';
// import {mapMutation} from 'vuex'
import { getComponentSection } from '../../api/index';
@ -179,7 +180,7 @@ export default {
// }, 3000);
},
//tab
getNew() {
getNew(getHistory) {
this.loading = true;
getComponentSection({ VideoId: this.$route.query.id, Number: 10 })
.then((res) => {
@ -187,6 +188,12 @@ export default {
//console.log(res.data.data, '');
this.componentList = res.data.data;
this.siftData();
this.$nextTick(() => {
if (this.$route.query.type == '离线视频' && getHistory) {
getHistory();
}
});
}
})
.finally(() => {
@ -235,13 +242,14 @@ export default {
// console.log('-', this.acticveName);
},
updateSectionData(newVal, updateKey, timeMode) {
let tempNewVal = _.cloneDeep(newVal);
this.sectionData.forEach((item) => {
//item.title == val.combinationName
if (item.children && item.children.length > 0) {
item.children.forEach((cItem) => {
if (cItem.timeMode == timeMode) {
//timeModemqtt
newVal.forEach((nItem) => {
tempNewVal.forEach((nItem) => {
if (cItem.analogAreaComponentId == nItem.component_id) {
if (cItem[updateKey].length > 9) {
this.$set(cItem, updateKey, cItem[updateKey].slice(0, 9));
@ -265,6 +273,28 @@ export default {
});
this.$forceUpdate();
// console.log('sectionData', this.sectionData);
},
// time time
filteredArrayFun(originalArray) {
// time
let uniqueArray = originalArray.reduce((accumulator, currentValue) => {
const existingItemIndex = accumulator.findIndex((item) => item.time === currentValue.time);
if (existingItemIndex === -1) {
accumulator.push(currentValue);
}
return accumulator;
}, []);
//
const sortedArray = uniqueArray.sort((a, b) => {
const dateA = new Date(a.time);
const dateB = new Date(b.time);
return dateA - dateB;
});
return sortedArray;
}
},
mounted() {},
@ -278,21 +308,25 @@ export default {
cycleHistoryData: {
handler(newVal) {
// debugger
// console.log('cycleHistoryData-', newVal);
console.log('历史cycleHistoryData-', newVal);
//
if (newVal && this.sectionData.length > 0) {
//sectionDataanalogAreaComponentIdtimeMode
if (newVal.CycleStatisticsData && newVal.CycleStatisticsData.length > 0) {
newVal.CycleStatisticsData.forEach((ele) => {
if (ele.cycleStatisticsData && ele.cycleStatisticsData.length > 0) {
this.updateSectionData(ele.cycleStatisticsData, 'cycleStatisticsData', '固定间隔');
//
let cycleStatisticsData = this.filteredArrayFun(ele.cycleStatisticsData);
this.updateSectionData(cycleStatisticsData, 'cycleStatisticsData', '固定间隔');
}
});
}
if (newVal.cycleTimeData && newVal.cycleTimeData.length > 0) {
newVal.cycleTimeData.forEach((ele) => {
if (newVal.CycleTimeData && newVal.CycleTimeData.length > 0) {
newVal.CycleTimeData.forEach((ele) => {
if (ele.cycleTimeData && ele.cycleTimeData.length > 0) {
this.updateSectionData(ele.cycleTimeData, 'cycleTimeData', '固定时刻');
//
let cycleTimeData = this.filteredArrayFun(ele.cycleTimeData);
this.updateSectionData(cycleTimeData, 'cycleTimeData', '固定时刻');
}
});
}
@ -305,8 +339,6 @@ export default {
triggerListData: {
handler(newVal) {
// console.log('triggerListData-', newVal);
//this.triggerList = newVal; //
//
if (newVal && newVal.length > 0 && this.sectionData.length > 0) {
//sectionDataanalogAreaComponentIdtimeModetrigger
this.updateSectionData(newVal, 'trigger', '实时触发');
@ -319,7 +351,7 @@ export default {
cycleTimeData: {
handler(newVal) {
//
// console.log(newVal, '');
// console.log('cycleTimeData-', newVal);
if (newVal && newVal.length > 0 && this.sectionData.length > 0) {
this.updateSectionData(newVal, 'cycleTimeData', '固定时刻');
}
@ -330,7 +362,7 @@ export default {
//
cycleStatisticsData: {
handler(newVal) {
// console.log('', newVal);
// console.log('cycleStatisticsData', newVal);
if (newVal && newVal.length > 0 && this.sectionData.length > 0) {
this.updateSectionData(newVal, 'cycleStatisticsData', '固定间隔');
}
@ -341,13 +373,14 @@ export default {
//
cycleAccumulateData: {
handler(newVal) {
// console.log('', newVal);
// console.log('cycleAccumulateData-', newVal);
if (newVal && newVal.length > 0 && this.sectionData.length > 0) {
//
this.updateSectionData(newVal, 'cycleAccumulateData', '固定间隔');
}
},
immediate: true
immediate: true,
deep: true
}
}
};

View File

@ -1059,16 +1059,19 @@ export default {
},
//
handleClick: function (tab, event) {
var that = this;
if (tab._props.name == 'second') {
that.$nextTick(() => {
//
that.$refs.dataBoardRef.getNew();
this.$nextTick(() => {
if (this.$route.query.type == '离线视频') {
this.$refs.dataBoardRef.getNew(this.getHistory);
} else {
this.$refs.dataBoardRef.getNew();
}
// this.$refs.dataBoardRef.getNew(this.getHistory);
// setTimeout(() => {
// debugger
// this.getHistory()
// }, 10000);
this.getHistory();
// this.getHistory();
});
}
},
@ -1100,9 +1103,9 @@ export default {
];
window.PubScribe(this.topicSends, '001', this.realInfo);
this.timer1 = null;
this.timer1 = setTimeout(() => {
this.getHistory();
}, 5000);
// this.timer1 = setTimeout(() => {
// this.getHistory();
// }, 5000);
} else if (this.$route.query.type == '实时视频') {
this.topicSends = [
'stream' + this.number,
@ -1244,6 +1247,7 @@ export default {
},
//线
getHistory() {
console.log('执行获取离线视频固定时刻固定间隔主题')
window.publish('GetCycleHistory', 'Get-' + this.$route.query.id);
},
getZhuanFaMQTT(topic, msg) {
@ -1525,7 +1529,7 @@ export default {
const temp = utf8decoder.decode(u8arr); //
var detId = [];
const msgN = JSON.parse(temp);
//console.log('', msgN);
console.log('历史数据源头', msgN);
this.cycleHistoryData = msgN;
} catch (error) {}
break;
@ -2561,7 +2565,7 @@ export default {
dataBoard
},
beforeDestroy() {
clearTimeout(this.timer1);
// clearTimeout(this.timer1);
clearTimeout(this.timer2);
clearTimeout(this.timer3);
clearTimeout(this.timer4);

View File

@ -1,5 +1,12 @@
<template>
<div class="content-box">
<div class="content-box" v-loading="loading" v-if="offlineVideo">
<div class="container offlineVideo" v-if="!loading">
<!-- TODO -->
<!-- <player></player> -->
<el-empty description="此模块只支持实时视频分析"></el-empty>
</div>
</div>
<div v-else class="content-box" v-loading="loading">
<el-collapse v-model="activeNames">
<el-collapse-item title="监控列表" name="1">
<el-row>
@ -601,7 +608,7 @@
class="buttonList"
@change="changeChat(o.children, o.selectOption)"
>
<el-radio-button :label="m + 1" v-for="(n, m) in o.children" :key="m"></el-radio-button>
<el-radio-button v-for="(n, m) in o.children" :label="m + 1" :key="m"></el-radio-button>
</el-radio-group>
<!--初始化渲染图表-->
<div class="echartList">
@ -615,11 +622,6 @@
{{ e.name }}
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '实时触发'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="e.triggerDataList == null"
></el-empty>
<chartsLine
:echartsRef="'echartsLine' + e.duocgqrhpzId"
:itemData="e"
@ -631,15 +633,11 @@
:flowType="e.flowType"
:dataList="e.triggerDataList"
ref="chartsLine"
v-else-if="e.triggerDataList != null"
v-if="e.triggerDataList"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '固定时刻'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="e.cycleTimeData.length == 0 || e.cycleTimeData.length == null"
></el-empty>
<chartsLine
:echartsRef="'echartsLine' + e.duocgqrhpzId"
:itemData="e"
@ -650,15 +648,11 @@
:componentType="e.componentType"
:dataList="e.cycleTimeData"
:flowType="e.flowType"
v-else
v-if="e.cycleTimeData"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '固定间隔'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="e.cycleStatisticsData == null || e.cycleStatisticsData.length == 0"
></el-empty>
<chartsLine
:echartsRef="'echartsLine' + e.duocgqrhpzId"
style="width: 100%; height: 100%"
@ -669,8 +663,9 @@
:componentType="e.componentType"
:dataList="e.cycleStatisticsData"
:flowType="e.flowType"
v-else
v-if="e.cycleStatisticsData"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
</div>
<div
@ -794,11 +789,6 @@
{{ e.name }}
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '实时触发'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="!e.triggerDataList || e.triggerDataList.length == 0"
></el-empty>
<chartsPie
:echartsRef="'echartsPie' + e.duocgqrhpzId"
style="width: 100%; height: 100%"
@ -806,15 +796,11 @@
:dataList="e.triggerDataList"
:timeMode="'实时触发'"
:intersectionName="intersectionName"
v-else
v-if="e.triggerDataList"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '固定时刻'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="e.cycleTimeData.length == 0 || e.cycleTimeData.length == null"
></el-empty>
<chartsPie
:echartsRef="'echartsPie' + e.duocgqrhpzId"
style="width: 100%; height: 100%"
@ -822,15 +808,11 @@
:dataList="e.cycleTimeData"
:timeMode="'固定时刻'"
:intersectionName="intersectionName"
v-else
v-if="e.cycleTimeData"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '固定间隔'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="e.cycleStatisticsData.length == 0 || e.cycleStatisticsData.length == null"
></el-empty>
<chartsPie
:echartsRef="'echartsPie' + e.duocgqrhpzId"
style="width: 100%; height: 100%"
@ -838,8 +820,9 @@
:timeMode="'固定间隔'"
:dataList="e.cycleStatisticsData"
:intersectionName="intersectionName"
v-else
v-if="e.cycleStatisticsData"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
</div>
<div
@ -851,11 +834,6 @@
{{ e.name }}
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '实时触发'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="!e.triggerDataList || e.triggerDataList.length == 0"
></el-empty>
<chartsBar
:echartsRef="'echartsBar' + e.duocgqrhpzId"
style="width: 100%; height: 90%"
@ -863,15 +841,11 @@
:timeMode="'实时触发'"
:intersectionName="intersectionName"
:dataList="e.triggerDataList"
v-else
v-if="e.triggerDataList"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '固定时刻'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="e.cycleTimeData.length == 0 || e.cycleTimeData.length == null"
></el-empty>
<chartsBar
:echartsRef="'echartsBar' + e.duocgqrhpzId"
style="width: 100%; height: 100%"
@ -879,15 +853,11 @@
:dataList="e.cycleTimeData"
:timeMode="'固定时刻'"
:intersectionName="intersectionName"
v-else
v-if="e.cycleTimeData"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '固定间隔'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="e.cycleStatisticsData.length == 0 || e.cycleStatisticsData.length == null"
></el-empty>
<chartsBar
:echartsRef="'echartsBar' + e.duocgqrhpzId"
style="width: 100%; height: 100%"
@ -895,8 +865,9 @@
:chatShowType="chatShowType"
:dataList="e.cycleStatisticsData"
:intersectionName="intersectionName"
v-else
v-if="e.cycleStatisticsData"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
</div>
<div
@ -908,49 +879,37 @@
{{ e.name }}
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '实时触发'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="!e.triggerDataList || e.triggerDataList.length == 0"
></el-empty>
<meanValue
:echartsRef="'meanValue' + e.duocgqrhpzId"
style="width: 100%; height: 90%"
:chatShowType="chatShowType"
:intersectionName="intersectionName"
:dataList="e.triggerDataList"
v-else
v-if="e.triggerDataList"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '固定时刻'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="e.cycleTimeData.length == 0 || e.cycleTimeData.length == null"
></el-empty>
<meanValue
:echartsRef="'meanValue' + e.duocgqrhpzId"
style="width: 100%; height: 100%"
:chatShowType="chatShowType"
:dataList="e.cycleTimeData"
:intersectionName="intersectionName"
v-else
v-if="e.cycleTimeData"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '固定间隔'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="e.cycleStatisticsData.length == 0 || e.cycleStatisticsData.length == null"
></el-empty>
<meanValue
:echartsRef="'meanValue' + e.duocgqrhpzId"
style="width: 100%; height: 100%"
:chatShowType="chatShowType"
:dataList="e.cycleStatisticsData"
:intersectionName="intersectionName"
v-else
v-if="e.cycleStatisticsData"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
</div>
<div
@ -962,11 +921,6 @@
{{ e.name }}
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '实时触发'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="!e.triggerDataList || e.triggerDataList.length == 0"
></el-empty>
<thermalOD
:echartsRef="'thermalOD' + e.duocgqrhpzId"
style="width: 100%; height: 90%"
@ -977,15 +931,11 @@
:endName="e.endSectionNames"
:dataList="e.triggerDataList"
:intersectionName="intersectionName"
v-else
v-if="e.triggerDataList"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '固定时刻'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="e.cycleTimeData.length == 0 || e.cycleTimeData.length == null"
></el-empty>
<thermalOD
:echartsRef="'thermalOD' + e.duocgqrhpzId"
style="width: 100%; height: 100%"
@ -996,15 +946,11 @@
:endName="e.endSectionNames"
:dataList="e.cycleTimeData"
:intersectionName="intersectionName"
v-else
v-if="e.cycleTimeData"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
<div style="width: 100%; height: 90%" v-if="e.timeMode == '固定间隔'">
<el-empty
:image-size="100"
description="暂无数据"
v-if="e.cycleStatisticsData.length == 0 || e.cycleStatisticsData.length == null"
></el-empty>
<thermalOD
:echartsRef="'thermalOD' + e.duocgqrhpzId"
style="width: 100%; height: 100%"
@ -1015,8 +961,9 @@
:endName="e.endSectionNames"
:dataList="e.cycleStatisticsData"
:intersectionName="intersectionName"
v-else
v-if="e.cycleStatisticsData"
/>
<el-empty :image-size="100" description="暂无数据" v-else></el-empty>
</div>
</div>
</div>
@ -1378,6 +1325,7 @@
<script>
let id = 1000;
// import player from './player.vue';
import chartsLine from '@/components/sensorFusion/echartsLine.vue';
import chartsPie from '@/components/sensorFusion/echartsPie.vue';
import chartsBar from '@/components/sensorFusion/echartsBar.vue';
@ -1397,11 +1345,13 @@ import {
getAssembly, //
getSelectedComponent //
} from '@/api/sensorFusion.js';
import { getVideoMode } from '@/api/index';
import qs from 'qs';
export default {
name: 'sensorFusion',
data() {
return {
offlineVideo: true,
checkList: [],
defaultExpanded: [], //
checkDataList: [],
@ -1420,6 +1370,7 @@ export default {
activeNames: ['1'], //
intersectionName: [], //
videoList: [],
loading: false,
intersectionList: [],
tabPosition: '1',
threeData: [],
@ -1526,6 +1477,9 @@ export default {
disabledCheckList: [] //tree
};
},
created() {
this.getVideoType();
},
mounted() {
//
this.getRealTimeShipjk();
@ -1533,6 +1487,20 @@ export default {
this.getSensorFusionData();
},
methods: {
//
getVideoType() {
this.loading = true;
getVideoMode()
.then((res) => {
//console.log('res', res.data.data);
if (res.data.data && res.data.data == '实时视频') {
this.offlineVideo = false;
}
})
.finally(() => {
this.loading = false;
});
},
//
getTotal(arr, field, field2) {
let total = 0;
@ -1566,35 +1534,35 @@ export default {
},
//
getSensorFusionData() {
this.loading = true;
getAssembly({
Number: 10
}).then((res) => {
this.intersectionList = res.data.data || [];
})
.then((res) => {
if (res.data.data && res.data.data.length > 0) {
this.intersectionList = this.addSelectOptionField(res.data.data) || [];
// this.addSelectOptionField(this.intersectionList);
// this.addTriggerDataField(this.intersectionList);
//mqtt
this.$nextTick(() => {
this.getMqtt();
});
this.addSelectOptionField(this.intersectionList);
// this.addTriggerDataField(this.intersectionList);
//mqtt
this.$nextTick(() => {
this.getMqtt();
});
//console.log(this.intersectionList, 'this.intersectionList');
//
if (this.intersectionList.length > 0) {
let children = this.intersectionList[0].children || [];
if (children.length > 0) {
this.intersectionName = [children[0].name];
//console.log(this.intersectionList, 'this.intersectionList');
//
this.$nextTick(() => {
if (this.intersectionList.length > 0) {
let children = this.intersectionList[0].children || [];
if (children.length > 0) {
this.intersectionName = [children[0].name];
}
}
});
}
}
// for (let i = 0; i < this.intersectionList.length; i++) {
// for (let j = 0; j < this.intersectionList[i].children.length; j++) {
// if (j == 2) {
// this.intersectionName.push(this.intersectionList[i].children[j].name);
// }
// }
// }
// //console.log(this.intersectionName, 'intersectionName');
});
})
.finally(() => {
this.loading = false;
});
},
//option
addSelectOptionField(obj) {
@ -1611,6 +1579,7 @@ export default {
}
}
}
return obj;
},
addTriggerDataField(obj) {
if (Array.isArray(obj)) {
@ -2339,6 +2308,9 @@ export default {
//
changeChat(val, index) {
console.log('changeChat');
console.log(val);
console.log(index);
this.chatShowType = '';
this.$nextTick(() => {
this.chatShowType = val[index - 1].presentationForm;
@ -2375,7 +2347,8 @@ export default {
//
addSuccess() {
this.centerDialogVisible = false;
this.getSensorFusionData();
// this.getSensorFusionData();
this.$router.go(0);
},
//tab
tabChange(val) {
@ -2842,9 +2815,9 @@ export default {
// });
} else if (msgN[j].component_type == '速度') {
// if(msgN[j].component_name=='_3'){
// console.log('trigger-', msgN[j]);
// console.log('trigger-', msgN[j]);
// }
//
let map = {
speed: msgN[j].speed,
@ -3797,13 +3770,19 @@ export default {
MeanValue, //
thermalOD, //OD
tableShow,
regionTable
regionTable,
// player
}
};
</script>
<style lang="less" scoped>
.content-box {
.offlineVideo{
display: flex;
align-items: center;
justify-content: center;
}
/deep/ .el-collapse-item__header {
color: rgb(71, 161, 255);
padding: 0px 1%;

View File

@ -0,0 +1,70 @@
<template>
<div>
<jsmpeg-player :url="url" />
</div>
</template>
<script>
import { JSMpegPlayer } from 'vue-jsmpeg-player';
import 'vue-jsmpeg-player/dist/style.css';
export default {
components: {
[JSMpegPlayer.name]: JSMpegPlayer
},
name: 'player',
data() {
return {
url: 'ws://localhost:8089/xxx',
socket: null,
messages: [],
connected: '',
inputMessage: ''
};
},
methods: {
init() {
const socket = new WebSocket('ws://localhost:3001');
socket.onopen = function () {
//
console.log('已连接到WebSocket服务器');
this.connected = true;
};
socket.onmessage = function (event) {
//
console.log('收到消息:', event.data);
this.messages.push({ id: Date.now(), text: event.data });
};
socket.onclose = function () {
//
console.log('WebSocket连接已关闭');
this.connected = false;
};
socket.onerror = function () {
//
console.log('WebSocket通信发生错误');
};
this.socket = socket;
},
//
sendMessage() {
if (this.socket && this.inputMessage) {
//使
this.socket.send(this.inputMessage);
this.inputMessage = '';
}
}
},
mounted() {
// this.init();
},
beforeDestroy() {
if (this.socket) {
//
this.socket.close();
}
}
};
</script>
<style lang="less" scoped>
</style>