代码提交

This commit is contained in:
luoshiwen 2023-02-22 21:50:50 +08:00
commit 11fea9c69e
6 changed files with 241 additions and 145 deletions

View File

@ -151,14 +151,21 @@ export default {
},
mounted() {
this.drawLine();
<<<<<<< HEAD
console.log(this.title);
=======
>>>>>>> 1d018c9bfd7d477b50f1c160150339f6011f2622
},
watch: {
list: {
handler(newVal) {
<<<<<<< HEAD
if (newVal) {
console.log(this.title);
console.log(newVal, this.title + '折现图的数据');
=======
if (newVal.length != 0) {
>>>>>>> 1d018c9bfd7d477b50f1c160150339f6011f2622
// x
this.xData = newVal.map(val => {
return val.time;
@ -187,7 +194,7 @@ export default {
confine: true
};
this.series[0].name = '总量';
console.log('折线图', newVal);
//
let arr = newVal.map(function (ele) {
if (ele.type_data != null) {
@ -200,6 +207,7 @@ export default {
mapN.push(arr[t][i]);
}
}
<<<<<<< HEAD
var lineArr = [{
name: '机动车',
type: 'line',
@ -226,6 +234,21 @@ export default {
// });
// });
// }
=======
var lineArr = [];
// 线
if (newVal[0].type_data != undefined) {
newVal[0].type_data.forEach(ele => {
lineArr.push({
name: ele.name,
type: 'line',
data: [],
smooth: true
});
});
}
//
>>>>>>> 1d018c9bfd7d477b50f1c160150339f6011f2622
mapN.forEach(ele => {
if (ele.name == '机动车') {
lineArr[0].data.push(ele.quantity);
@ -270,7 +293,11 @@ export default {
return ele.in_flow + ele.out_flow;
});
} else if (this.title == '车头时距') {
<<<<<<< HEAD
console.log("车头时距", newVal)
=======
console.log('车头时距', newVal);
>>>>>>> 1d018c9bfd7d477b50f1c160150339f6011f2622
this.tooltip = {
formatter: '{a} {b}:{c}/s',
show: true,
@ -303,7 +330,11 @@ export default {
}
},
<<<<<<< HEAD
deep: true
=======
immediate: true
>>>>>>> 1d018c9bfd7d477b50f1c160150339f6011f2622
}
}
};

View File

@ -2,8 +2,13 @@
<div class="setion">
<p class="chartTitle"><span class="titleIcon"></span> {{ componentName }} {{ triggerType }}</p>
<!-- 触发数据数值渲染 -->
<<<<<<< HEAD
<div class="typeContent">
<div v-if="dataArr && dataArr.length != 0">
=======
<div class="typeContent" v-if="triggerType == '触发' || '周期时刻'">
<div v-if="dataArr && dataArr.length != 0 && dataArr!=undefined">
>>>>>>> 1d018c9bfd7d477b50f1c160150339f6011f2622
<div v-if="title == '类型'" style="display:flex">
<el-card v-for="(n, i) in typeValue.type_data" :key="i"
style="width: 150px; margin-bottom: 20px; text-align: center">
@ -13,14 +18,18 @@
</div>
<div>
<div>
{{ typeValue.time }}
{{ typeValue.time ? typeValue.time : '' }}
</div>
</div>
</el-card>
</div>
</div>
<el-card v-show="echartArr.includes('数值')" style="width: 150px; margin-bottom: 20px; text-align: center">
<<<<<<< HEAD
<div v-if="dataArr && dataArr.length != 0">
=======
<div v-if="dataArr&& dataArr.length != 0 && dataArr!=undefined">
>>>>>>> 1d018c9bfd7d477b50f1c160150339f6011f2622
<div v-if="title == '类型'">
<span style="font-size: 15px;">类型数量总和</span><br />
<span style="font-size: 30px; font-weight: bold">
@ -54,7 +63,7 @@
</div>
<div>
<div>
{{ dataArr[0].time }}
{{ dataArr[0].time ? dataArr[0].time : '' }}
</div>
</div>
</div>
@ -64,16 +73,22 @@
</el-card>
</div>
<div v-show="echartArr.includes('表格')">
<div class="tableTitle" v-if="dataArr">
<div class="tableTitle" v-if="dataArr&& dataArr.length != 0 && dataArr!=undefined">
<div>
<span
<<<<<<< HEAD
style="width: 10px;height:10px;border-radius: 50%;background-color: #3297ff;display: inline-block;vertical-align: middle;margin-right: 8px;"></span>
<span style="font-size:18px;">{{ this.chartName + '-' + this.componentName + '-' + '表格' + '-' +
triggerType
}}</span>
=======
style="width: 10px;height:10px;border-radius: 50%;background-color: #3297ff;display: inline-block;vertical-align: middle;margin-right: 8px;"
></span>
<span style="font-size:18px;">{{ this.chartName + '-' + this.componentName + '-' + '表格' + '-' + triggerType }}</span>
>>>>>>> 1d018c9bfd7d477b50f1c160150339f6011f2622
</div>
<div class="tableTime">
{{ dataArr[0].time }}
{{ dataArr[0].time ? dataArr[0].time : '' }}
</div>
</div>
<div v-if="pageType == '断面'" style="margin-bottom: 20px; border: 1px solid #e4e7ed">
@ -85,8 +100,21 @@
</div>
<div class="border" v-if="echartArr.includes('曲线图')">
<detailDialog />
<<<<<<< HEAD
<lineChart :componentName="componentName" :chartName="chartName" :pageType="pageType" :list="dataArr"
:status="triggerType" :title="title" :typeValue="typeValue" />
=======
<lineChart
v-if="dataArr && dataArr.length != 0 && dataArr!=undefined"
:componentName="componentName"
:chartName="chartName"
:pageType="pageType"
:list="dataArr"
:status="triggerType"
:title="title"
:typeValue="typeValue"
/>
>>>>>>> 1d018c9bfd7d477b50f1c160150339f6011f2622
</div>
<div class="border" v-if="echartArr.includes('饼状图')">
<detailDialog />
@ -152,7 +180,11 @@ export default {
//
dataArr: {
handler(newVal) {
<<<<<<< HEAD
console.log("dataArr", newVal)
=======
console.log('dataArr', newVal);
>>>>>>> 1d018c9bfd7d477b50f1c160150339f6011f2622
},
immediate: true

View File

@ -67,8 +67,8 @@ export default {
// const host = 'ws://49.234.27.18:10087/'; // urlws://broker.emqx.io:8083/mqtt
var ip = window.location.host.split(":")[0];
console.log("ip",ip)
// const host = `ws://${ip}:10087`;
const host = 'ws://172.16.1.168:10087/';
const host = `ws://${ip}:10087`;
// const host = 'ws://172.16.1.168:10087/';
const options = {
//

View File

@ -3,19 +3,24 @@
<el-empty v-show="sectionData.length == 0" :image-size="400"></el-empty>
<!-- <p class="title" style="margin-bottom: 20px;font-size: 20px;font-weight: 400;">数据看板</p> -->
<el-scrollbar class="scrollbar">
<div class="dataBoard" ref='dataBoard' v-if="activeName == 'second'">
<div class="dataBoard" ref="dataBoard" v-if="activeName == 'second'">
<!-- 断面 -->
<div class="plate1" ref="plate1">
<div :class="sectionData.length <= 2 ? 'sectionBox' : 'section'" ref="section"
v-for="(s, i) in sectionData" :key="s.analogAreaComponentId">
<div
:class="sectionData.length <= 2 ? 'sectionBox' : 'section'"
ref="section"
v-for="(s, i) in sectionData"
:key="s.analogAreaComponentId"
>
<template>
<div ref="sectionContent">
<div>
<p class="board-title">
<span>{{ s.title }}</span>
</p>
<span class="downPull1" data-num="1" @click="sectionHandle(i)"></span>
<!-- <span class="downPull1" data-num="1" @click="sectionHandle(i)"></span> -->
</div>
<<<<<<< HEAD
<div v-if="s.children">
<div v-for="o in s.children" :key="o.analogAreaComponentId">
<OD v-if="o.componentName.includes('OD')" :pageType="o.graphicType" triggerType="触发"
@ -41,6 +46,62 @@
</div>
</div>
<!-- :data="triggerList.length != 0 ? triggerList : tableData" -->
=======
<el-tabs>
<el-collapse v-model="acticveName">
<div v-for="o in s.children" :key="o.analogAreaComponentId">
<el-collapse-item :title="o.componentName" :name="o.analogAreaComponentId">
<OD
v-if="o.componentName.includes('OD')"
:pageType="o.graphicType"
triggerType="触发"
:componentName="o.componentName"
:echartArr="o.presentationForm"
:dataArr="o.trigger"
:title="o.componentName.split('_')[0]"
:chartName="o.combinationName"
/>
<!--触发的组件 -->
<typeChart
v-if="o.timeMode === '触发'"
:pageType="o.graphicType"
:triggerType="o.timeMode"
:componentName="o.componentName"
:dataArr="o.trigger"
:echartArr="o.presentationForm"
:title="o.componentName.split('_')[0]"
:chartName="o.combinationName"
:typeValue="typeTimeMode"
/>
<typeChart
v-if="o.timeMode === '周期时刻'"
:pageType="o.graphicType"
:triggerType="o.timeMode"
:componentName="o.componentName"
:dataArr="o.cycleTimeData"
:echartArr="o.presentationForm"
:title="o.componentName.split('_')[0]"
:chartName="o.combinationName"
:typeValue="typeCycleTimeData"
/>
<!-- 周期统计的组件 -->
<typeChart
style="width: 100%;"
v-if="o.timeMode === '周期统计'"
:pageType="o.graphicType"
:triggerType="o.timeMode"
:componentName="o.componentName"
:dataArr="o.cycleStatistics"
:echartArr="o.presentationForm"
:title="o.componentName.split('_')[0]"
:chartName="o.combinationName"
:typeValue="typeCycleStatistics"
/>
</el-collapse-item>
</div>
</el-collapse>
</el-tabs>
>>>>>>> 1d018c9bfd7d477b50f1c160150339f6011f2622
</div>
</template>
</div>
@ -50,7 +111,6 @@
<!-- 详情框 -->
</div>
</template>
<!-- :data="triggerList.length != 0 ? tripHandle(o) : tableData" -->
<script>
import typeChart from '../../components/target/typeChart.vue';
import OD from '../../components/target/OD.vue';
@ -91,16 +151,20 @@ export default {
default() {
return [];
}
<<<<<<< HEAD
},
componentList:{
type:Array,
default(){
return []
}
=======
>>>>>>> 1d018c9bfd7d477b50f1c160150339f6011f2622
}
},
data() {
return {
acticveName: [],
title1: '01断面',
title2: '01区域',
dialogVisible: false,
@ -319,8 +383,6 @@ export default {
}
],
idVal: '',
//
componentList: [],
@ -329,69 +391,54 @@ export default {
sectionData: [],
//
tableList: [],
// 线
headWay: [],
tripData: [],
sectionArr: [],
//
typeValue: {},
typeTimeMode: {},
//
typeCycleTimeData: {},
typeCycleStatistics: {},
nw: '1'
typeCycleStatistics: {}
};
},
// beforeCeated(){
// },
created() {
this.idVal = this.$route.query.id;
this.sectionData = []
this.sectionArr = []
// if(this.nw=='second'){
// }
this.getNEW()
this.getNew()
},
methods: {
getNEW() {
getComponentSection({ VideoId: this.$route.query.id }).then((res) => {
if (res.data.code == 200) {
this.componentList = res.data.data
this.siftData(this.componentList)
} else if (res.data.code == 404) {
}
});
getNew(){
// this.idVal = ;
getComponentSection({ VideoId: this.$route.query.id }).then(res => {
if (res.data.code == 200) {
this.componentList = res.data.data;
this.siftData();
}
});
},
siftData(list) {
// this.sectionArr = []
// this.sectionData = []
list.forEach((val) => {
siftData() {
// this.sectionArr=[]
// this.sectionData=[]
this.componentList.forEach(val => {
this.sectionArr.push(val.combinationName);
this.sectionArr = Array.from(new Set(this.sectionArr));
});
this.sectionData = this.sectionArr.map((item) => {
if (item.children == undefined) {
item = { title: item, children: [] };
}
list.forEach((val) => {
this.sectionData = this.sectionArr.map(item => {
item = { title: item, children: [] };
this.acticveName = [];
this.componentList.forEach(val => {
if (item.title == val.combinationName) {
item.children.push(val);
}
this.acticveName.push(val.analogAreaComponentId);
});
return item;
});
@ -404,92 +451,71 @@ export default {
let downPulls1 = document.querySelectorAll('.downPull1');
//
downPulls1[i].dataset.num++;
if (downPulls1[i].dataset.num % 2 == 0) {
downPulls1[i].style.cssText = 'transform: rotate(180deg);transition: all 0.5s linear;';
sections[i].style.height = 'auto';
// sections[i].style.height = 'auto';
if (sectionBox[i] != undefined) {
sectionBox[i].style.height = 'auto';
// sectionBox[i].style.height = 'auto';
}
} else {
downPulls1[i].style.cssText = 'transition: all 0.5s linear;';
sections[i].style.height = '500px';
// sections[i].style.height = '500px';
if (sectionBox[i] != undefined) {
sectionBox[i].style.height = '48vh'
// sectionBox[i].style.height = '48vh';
}
}
},
// channge(oldVal, newVal) {
// if (newVal == "second") {
// this.getNEW()
// } else if (oldVal == "second") {
// this.getNEW()
// }
// }
channge(oldVal, newVal){
console.log("old",oldVal)
console.log("newVal",newVal)
if(oldVal=='second'){
this.sectionArr=[]
this.sectionData=[]
this.getNew()
}else if(newVal=='second'){
this.sectionArr=[]
this.sectionData=[]
this.getNew()
}
}
//
},
mounted() {
// getComponentSection({ VideoId: this.$route.query.id }).then(res => {
// if (res.data.code == 200) {
// console.log(res.data.data, '');
// this.componentList = res.data.data;
// this.siftData(this.componentList);
// } else if (res.data.code == 404) {
// }
// });
},
mounted() {},
watch: {
// },
// immediate: true
// },
// activeName: 'channge',
//
triggerData: {
handler(newVal, oldVal) {
},
handler(newVal, oldVal) {},
immediate: true
},
activeName:'channge',
//
triggerListData: {
handler(newVal) {
this.triggerList = newVal
this.triggerList = newVal;
//
if (newVal && this.sectionData.length != 0) {
this.componentList.forEach(ele => {
if (ele.trigger == undefined && ele.timeMode == '触发') {
ele.trigger = []
}
newVal.forEach(item => {
if (ele.analogAreaComponentId == item.component_id && ele.timeMode == '触发') {
if (ele.trigger.length == 10) {
ele.trigger.pop()
// console.log(newVal, 'triggerlistData');
} else {
item.time = item.time.split('.')[0]
//
if (item.type_data != null) {
// console.log(item,'461461');
this.typeValue = item
}
ele.trigger.unshift(item)
this.componentList.forEach(ele => {
if (ele.trigger == undefined && ele.timeMode == '触发') {
ele.trigger = [];
}
newVal.forEach(item => {
if (ele.analogAreaComponentId == item.component_id && ele.timeMode == '触发') {
if (ele.trigger.length == 10) {
ele.trigger.pop();
} else {
item.time = item.time.split('.')[0];
//
if (item.type_data != null) {
// console.log(item,'461461');
this.typeTimeMode = item
}
ele.trigger.unshift(item);
}
})
})
}
// console.log(this.sectionData, '');
}
});
});
},
immediate: true
},
@ -500,23 +526,27 @@ export default {
if (newVal.length != 0 && this.sectionData) {
this.componentList.forEach(ele => {
if (ele.cycleTimeData == undefined && ele.timeMode == '周期时刻') {
ele.cycleTimeData = []
ele.cycleTimeData = [];
}
newVal.forEach(item => {
if (ele.analogAreaComponentId == item.component_id && ele.timeMode == '周期时刻' ) {
if (
ele.analogAreaComponentId == item.component_id &&
ele.timeMode == '周期时刻' &&
ele.analogAreaGraphId == item.graphical_id
) {
if (ele.cycleTimeData.length == 10) {
ele.cycleTimeData.slice(ele.cycleTimeData.length - 1, 0)
ele.cycleTimeData.slice(ele.cycleTimeData.length - 1, 0);
} else {
item.time = item.time.split('.')[0]
item.time = item.time.split('.')[0];
if (item.type_data != null) {
//
this.typeCycleTimeData = item
this.typeCycleTimeData = item;
}
ele.cycleTimeData.unshift(item)
ele.cycleTimeData.unshift(item);
}
}
})
})
});
});
}
},
immediate: true
@ -536,19 +566,14 @@ export default {
ele.cycleStatistics = [];
}
newVal.forEach(item => {
if (
ele.analogAreaComponentId == item.component_id &&
ele.timeMode == '周期统计'
) {
if (ele.analogAreaComponentId == item.component_id && ele.timeMode == '周期统计') {
if (ele.cycleStatistics.length == 10) {
ele.cycleStatistics.pop();
} else {
item.time = item.time.split('.')[0]
item.time = item.time.split('.')[0];
if (item.type_data != null) {
//
this.typeCycleStatistics = item;
}
ele.cycleStatistics.unshift(item);
}
@ -557,12 +582,23 @@ export default {
});
}
}
},
},
}
// activeName: {
// handler(newVal) {
// if (newVal == "second") {
// getComponentSection({ VideoId: this.$route.query.id }).then(res => {
// if (res.data.code == 200) {
// this.componentList = res.data.data;
// this.siftData();
// } else if (res.data.code == 404) {
// }
// });
// }
// },
// immediate: true
// }
}
};
</script>
@ -582,7 +618,7 @@ export default {
/deep/ .el-scrollbar__view {
display: inline-block !important;
width: 100%
width: 100%;
}
/deep/ .el-scrollbar__wrap {
@ -596,7 +632,6 @@ export default {
.dataBoard {
height: 100%;
}
}
.dataBoard .region,
@ -605,7 +640,7 @@ export default {
border: 1px solid #e4e7ed;
box-sizing: border-box;
padding: 15px;
height: 500px;
height: auto;
position: relative;
transition: all 1s;
overflow: hidden;
@ -613,7 +648,7 @@ export default {
.dataBoard .sectionBox {
width: 100%;
height: 48vh;
height: auto;
border: 1px solid #e4e7ed;
box-sizing: border-box;
padding: 15px;
@ -686,4 +721,4 @@ export default {
.active {
transition: all 0.5s linear;
}
</style>
</style>

View File

@ -409,8 +409,6 @@ export default {
getDataByMqtt(url, topic, cIdNum) {
const clientId = "test_id_" + String(new Date().getTime()); //
// const host = 'ws://49.234.27.18:10087/'; // urlws://broker.emqx.io:8083/mqtt
var ip = window.location.host.split(":")[0];
console.log("ip",ip)
const host = `ws://${ip}:10087`;
// const host = 'ws://172.16.1.168:10087/';

View File

@ -1005,14 +1005,14 @@ export default {
message: res.data.msg,
type: 'success'
});
setTimeout(() => {
this.$message({
type: 'warning',
message: '请点击交通分析,获取最新数据!',
showClose: true,
duration: 0
});
}, 5000);
// setTimeout(() => {
// this.$message({
// type: 'warning',
// message: '',
// showClose: true,
// duration: 0
// });
// }, 5000);
console.log('startFigureName', this.startFigureName);
document.getElementById('mapModule').contentWindow.postFigureId(JSON.stringify(res.data.data));
console.log('this.numberNew', this.numberNew);