diff --git a/src/components/sensorFusion/meanValue.vue b/src/components/sensorFusion/meanValue.vue index e77cfce..205e537 100644 --- a/src/components/sensorFusion/meanValue.vue +++ b/src/components/sensorFusion/meanValue.vue @@ -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) { diff --git a/src/components/sensorFusion/thermalOD.vue b/src/components/sensorFusion/thermalOD.vue index ba68baf..9d14594 100644 --- a/src/components/sensorFusion/thermalOD.vue +++ b/src/components/sensorFusion/thermalOD.vue @@ -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(() => { diff --git a/src/components/target/newtypeChart.vue b/src/components/target/newtypeChart.vue index bebc396..f954103 100644 --- a/src/components/target/newtypeChart.vue +++ b/src/components/target/newtypeChart.vue @@ -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 = '-'; } diff --git a/src/views/bounced/dataBoard.vue b/src/views/bounced/dataBoard.vue index 22aa19c..9541d44 100644 --- a/src/views/bounced/dataBoard.vue +++ b/src/views/bounced/dataBoard.vue @@ -81,6 +81,7 @@ \ No newline at end of file