|
|
@@ -4,8 +4,8 @@
|
|
|
<div class="right-page">
|
|
|
<div class="right-page-top-max-big-box">
|
|
|
<div class="right-page-title-box">
|
|
|
- <p>温室一期1区</p>
|
|
|
- <p>使用人:王教授 资环学院</p>
|
|
|
+ <p>{{newData.buildName}}{{newData.floorName}}</p>
|
|
|
+ <p>使用人:{{newData.userName}} {{newData.deptName}}</p>
|
|
|
</div>
|
|
|
<div class="right-page-top-flex-box">
|
|
|
<div class="left-max-big-box">
|
|
|
@@ -14,9 +14,9 @@
|
|
|
<p>温度</p>
|
|
|
</div>
|
|
|
<div class="right-big-box">
|
|
|
- <p>最高值:55.1℃</p>
|
|
|
- <p>当前值:43.5℃</p>
|
|
|
- <p>最低值:22.5℃</p>
|
|
|
+ <p>最高值:{{newData.temperature.max}}℃</p>
|
|
|
+ <p>当前值:{{newData.temperature.last}}℃</p>
|
|
|
+ <p>最低值:{{newData.temperature.min}}℃</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="right-max-big-box">
|
|
|
@@ -25,9 +25,9 @@
|
|
|
<p>湿度</p>
|
|
|
</div>
|
|
|
<div class="right-big-box">
|
|
|
- <p>最高值:71.2%RH</p>
|
|
|
- <p>当前值:67.1%RH</p>
|
|
|
- <p>最低值:45%RH</p>
|
|
|
+ <p>最高值:{{newData.temperature.max}}%RH</p>
|
|
|
+ <p>当前值:{{newData.temperature.last}}%RH</p>
|
|
|
+ <p>最低值:{{newData.temperature.min}}%RH</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -35,21 +35,17 @@
|
|
|
<div id="right-eCharts-1"></div>
|
|
|
<div id="right-eCharts-2"></div>
|
|
|
<div id="right-eCharts-3"></div>
|
|
|
- <div class="right-page-bottom-video-max-big-box">
|
|
|
- <H5PlayerVideo class="for-video-box"
|
|
|
- :videoProps="videoProps"></H5PlayerVideo>
|
|
|
- </div>
|
|
|
+ <div class="right-page-bottom-video-max-big-box" id="videoData" ref="videoData"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import H5PlayerVideo from '@/components/H5PlayerVideo/H5PlayerVideo.vue'
|
|
|
+ import { iotIotdbSensorDailyStats,iotIotdbSensorRealDataCombined,iotCameraFindByCondition } from '@/api/index'
|
|
|
import titleComponent from './subcomponent/titleComponent.vue'
|
|
|
export default {
|
|
|
name: 'right',
|
|
|
components: {
|
|
|
- titleComponent,
|
|
|
- H5PlayerVideo
|
|
|
+ titleComponent
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
@@ -58,6 +54,28 @@
|
|
|
type:'right',
|
|
|
num:'7',
|
|
|
},
|
|
|
+ //定时拉取数据
|
|
|
+ getDataTimer:null,
|
|
|
+ // getDataSwitchTime:300000,
|
|
|
+ getDataSwitchTime:30000,
|
|
|
+ newData:{
|
|
|
+ subId: '',
|
|
|
+ deptName: "",
|
|
|
+ buildName: "",
|
|
|
+ subName: "",
|
|
|
+ temperature: {
|
|
|
+ min: 0,
|
|
|
+ last: 0,
|
|
|
+ max: 0
|
|
|
+ },
|
|
|
+ humidity: {
|
|
|
+ min: 0,
|
|
|
+ last: 0,
|
|
|
+ max: 0
|
|
|
+ },
|
|
|
+ floorName: "",
|
|
|
+ userName: ""
|
|
|
+ },
|
|
|
videoProps:{
|
|
|
fullShow:true,
|
|
|
width: 876, //(宽度:非必传-默认600)
|
|
|
@@ -71,17 +89,180 @@
|
|
|
|
|
|
},
|
|
|
mounted(){
|
|
|
- this.initialize();
|
|
|
+ this.getDataTimerFunction();
|
|
|
+ this.initH5Player(1);
|
|
|
},
|
|
|
methods:{
|
|
|
- initialize(){
|
|
|
- this.eCharts1();
|
|
|
- this.eCharts2();
|
|
|
- this.eCharts3();
|
|
|
+ getDataTimerFunction(){
|
|
|
+ clearInterval(this.getDataTimer)
|
|
|
+ this.iotIotdbSensorDailyStats();
|
|
|
+ this.iotIotdbSensorRealDataCombined();
|
|
|
+ this.getDataTimer = window.setInterval(() => {
|
|
|
+ this.iotIotdbSensorDailyStats();
|
|
|
+ this.iotIotdbSensorRealDataCombined();
|
|
|
+ }, this.getDataSwitchTime);
|
|
|
+ },
|
|
|
+ iotIotdbSensorDailyStats(){
|
|
|
+ iotIotdbSensorDailyStats().then(res => {
|
|
|
+ this.$set(this,'newData',res.data);
|
|
|
+ this.iotCameraFindByCondition(res.data);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ iotIotdbSensorRealDataCombined(){
|
|
|
+ iotIotdbSensorRealDataCombined().then(res => {
|
|
|
+ let wdData = [];
|
|
|
+ let wdTime = [];
|
|
|
+ let wdBzData = [];
|
|
|
+ let sdData = [];
|
|
|
+ let sdTime = [];
|
|
|
+ let sdBzData = [];
|
|
|
+ let glData = [];
|
|
|
+ let glTime = [];
|
|
|
+ let glBzData = [];
|
|
|
+ //温度
|
|
|
+ for(let i=0;i<res.data.temperature.length;i++){
|
|
|
+ wdData.push(res.data.temperature[i].temperature)
|
|
|
+ wdTime.push(res.data.temperature[i].time)
|
|
|
+ wdBzData.push(res.data.wdMin)
|
|
|
+ }
|
|
|
+ //湿度
|
|
|
+ for(let i=0;i<res.data.humidity.length;i++){
|
|
|
+ sdData.push(res.data.humidity[i].humidity)
|
|
|
+ sdTime.push(res.data.humidity[i].time)
|
|
|
+ sdBzData.push(res.data.sdMin)
|
|
|
+ }
|
|
|
+ //功率
|
|
|
+ for(let i=0;i<res.data.power.length;i++){
|
|
|
+ glData.push(res.data.power[i].power)
|
|
|
+ glTime.push(res.data.power[i].time)
|
|
|
+ glBzData.push(res.data.powerMin)
|
|
|
+ }
|
|
|
+ this.eCharts1(wdData,wdTime,wdBzData);
|
|
|
+ this.eCharts2(sdData,sdTime,sdBzData);
|
|
|
+ this.eCharts3(glData,glTime,glBzData);
|
|
|
+ })
|
|
|
},
|
|
|
- eCharts1(){
|
|
|
- let listA = ['00:00', '03:30', '07:00', '10:30', '14:00', '17:30', '21:00'];
|
|
|
- let listB = [105, 272, 239, 150, 147, 319, 284,];
|
|
|
+ iotCameraFindByCondition(obj){
|
|
|
+ let videoObj = {
|
|
|
+ page:'1',
|
|
|
+ pageSize:'10',
|
|
|
+ buildId:'',
|
|
|
+ floorId:'',
|
|
|
+ passageway:'',
|
|
|
+ subIds:[obj.subId],
|
|
|
+ protocol:window.location.href.indexOf('https') !== -1?'wss':'ws',
|
|
|
+ streamType:1,
|
|
|
+ source:1,
|
|
|
+ };
|
|
|
+ iotCameraFindByCondition(videoObj).then(res => {
|
|
|
+ if(res.data.records[0]){
|
|
|
+ this.$set(this, 'videoData', {
|
|
|
+ id: 'videoData',
|
|
|
+ width: 876,
|
|
|
+ height: 419,
|
|
|
+ url: res.data.records[0].streamUrl
|
|
|
+ })
|
|
|
+ this.videoOff();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //视频组件初始化
|
|
|
+ initH5Player(split) {
|
|
|
+ this.myPlugin = new window.JSPlugin({
|
|
|
+ szId: 'videoData', //需要英文字母开头,唯一性,必填
|
|
|
+ // szId: this.videoData.id, //需要英文字母开头,唯一性,必填
|
|
|
+ szBasePath: '/h5player/', // 必填,与h5player.min.js的引用目录一致 填写的是pulblic下的路径!!!
|
|
|
+ mseWorkerEnable:true,
|
|
|
+ bSupporDoubleClickFull: false,//是否支持双击全屏,默认true
|
|
|
+ // 当容器div#play_window有固定宽高时,可不传iWidth和iHeight,窗口大小将自适应容器宽高
|
|
|
+ iWidth: 876,
|
|
|
+ iHeight: 419,
|
|
|
+ // 分屏播放,默认最大分屏4*4
|
|
|
+ iMaxSplit: split,
|
|
|
+ iCurrentSplit: split,
|
|
|
+ openDebug: false,
|
|
|
+ oStyle: {
|
|
|
+ borderSelect: '#000'
|
|
|
+ },
|
|
|
+ })
|
|
|
+ let iWndNum = 1;
|
|
|
+ let InterruptTime = 5;
|
|
|
+ //设置断流时间回调
|
|
|
+ this.myPlugin.JS_SetInterruptTime(iWndNum, InterruptTime).then(
|
|
|
+ () => {
|
|
|
+ // console.info('JS_SetInterruptTime success');
|
|
|
+ // do you want...
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ // console.info('JS_SetInterruptTime failed');
|
|
|
+ // do you want...
|
|
|
+ }
|
|
|
+ );
|
|
|
+ // 事件回调绑定
|
|
|
+ this.myPlugin.JS_SetWindowControlCallback({
|
|
|
+ // windowEventSelect: function (iWndIndex) { //插件选中窗口回调
|
|
|
+ // // console.log('windowSelect callback: ', iWndIndex)
|
|
|
+ // },
|
|
|
+ // pluginErrorHandler: function (iWndIndex, iErrorCode, oError) { //插件错误回调
|
|
|
+ // // console.log('pluginError callback: ', iWndIndex, iErrorCode, oError)
|
|
|
+ // },
|
|
|
+ // windowEventOver: function (iWndIndex) { //鼠标移过回调
|
|
|
+ // //console.log(iWndIndex);
|
|
|
+ // },
|
|
|
+ // windowEventOut: function (iWndIndex) { //鼠标移出回调
|
|
|
+ // //console.log(iWndIndex);
|
|
|
+ // },
|
|
|
+ // windowEventUp: function (iWndIndex) { //鼠标mouseup事件回调
|
|
|
+ // //console.log(iWndIndex);
|
|
|
+ // },
|
|
|
+ // windowFullCcreenChange: function (bFull) { //全屏切换回调
|
|
|
+ // // console.log('fullScreen callback: ', bFull)
|
|
|
+ // },
|
|
|
+ // firstFrameDisplay: function (iWndIndex, iWidth, iHeight) { //首帧显示回调
|
|
|
+ // // console.log('firstFrame loaded callback: ', iWndIndex, iWidth, iHeight)
|
|
|
+ // },
|
|
|
+ performanceLack: function () { //性能不足回调
|
|
|
+ console.log('performanceLack callback: 性能不足')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //调用播放
|
|
|
+ initPlayer(url, index,type) {
|
|
|
+ this.myPlugin.JS_Play(url,
|
|
|
+ {
|
|
|
+ playURL: url, // 流媒体播放时必传
|
|
|
+ mode: type?type:0 // 解码类型:0=普通模式; 1=高级模式 默认为0
|
|
|
+ // ...
|
|
|
+ },
|
|
|
+ index //当前窗口下标
|
|
|
+ ).then(
|
|
|
+ () => {
|
|
|
+ // this.$set(this,'playType',true);
|
|
|
+ console.info('JS_Play success')
|
|
|
+ // do you want...
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ // this.$set(this,'playType',false);
|
|
|
+ console.info('JS_Play failed', err)
|
|
|
+ // do you want...
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ videoOff() {
|
|
|
+ this.myPlugin.JS_StopRealPlayAll().then(
|
|
|
+ () => {
|
|
|
+ console.info('JS_StopRealPlayAll success')
|
|
|
+ // do you want...
|
|
|
+ let type = this.videoData.url.indexOf('wss') !== -1?1:0;
|
|
|
+ this.initPlayer(this.videoData.url, 0,type)
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.info('JS_StopRealPlayAll failed')
|
|
|
+ // do you want...
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ eCharts1(Data,Time,BzData){
|
|
|
let option = {
|
|
|
tooltip: {
|
|
|
show: false,
|
|
|
@@ -102,7 +283,7 @@
|
|
|
selectedMode: false,
|
|
|
},
|
|
|
xAxis: {
|
|
|
- data: listA,
|
|
|
+ data: Time,
|
|
|
type: 'category',
|
|
|
boundaryGap: true,
|
|
|
itemStyle: {
|
|
|
@@ -169,7 +350,7 @@
|
|
|
containLabel: true
|
|
|
},
|
|
|
series: [{
|
|
|
- data: listB,
|
|
|
+ data: Data,
|
|
|
name: ' 24h温度走势图',
|
|
|
type: 'line',
|
|
|
symbol: 'circle',
|
|
|
@@ -206,15 +387,54 @@
|
|
|
),
|
|
|
}
|
|
|
}
|
|
|
+ },{
|
|
|
+ data: BzData,
|
|
|
+ name: '',
|
|
|
+ type: 'line',
|
|
|
+ symbol: 'circle',
|
|
|
+ smooth: true,
|
|
|
+ symbolSize: 0,//不需要点就设置0
|
|
|
+ lineStyle: {
|
|
|
+ width: 2,
|
|
|
+ type: 'solid'
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ borderWidth: 5,
|
|
|
+ borderColor: 'rgba(255,86,86,1)',
|
|
|
+ color: 'rgba(255,86,86,1)'
|
|
|
+ },
|
|
|
+ areaStyle: {
|
|
|
+ color: 'rgba(255,86,86,1)',
|
|
|
+ normal: {
|
|
|
+ //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);
|
|
|
+ color: this.$echarts.graphic.LinearGradient(
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 1,
|
|
|
+ [{
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(255,86,86,0.6)'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(255,86,86,.1)'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ false
|
|
|
+ ),
|
|
|
+ }
|
|
|
+ }
|
|
|
}]
|
|
|
}
|
|
|
+ if (this.$echarts.getInstanceByDom(document.getElementById('right-eCharts-1'))) {
|
|
|
+ this.$echarts.dispose(document.getElementById('right-eCharts-1'));
|
|
|
+ }
|
|
|
this.eChartsData1 = this.$echarts.init(document.getElementById('right-eCharts-1'))
|
|
|
this.eChartsData1.clear()
|
|
|
this.eChartsData1.setOption(option)
|
|
|
},
|
|
|
- eCharts2(){
|
|
|
- let listA = ['00:00', '03:30', '07:00', '10:30', '14:00', '17:30', '21:00'];
|
|
|
- let listB = [105, 272, 239, 150, 147, 319, 284,];
|
|
|
+ eCharts2(Data,Time,BzData){
|
|
|
let option = {
|
|
|
tooltip: {
|
|
|
show: false,
|
|
|
@@ -234,7 +454,7 @@
|
|
|
selectedMode: false,
|
|
|
},
|
|
|
xAxis: {
|
|
|
- data: listA,
|
|
|
+ data: Time,
|
|
|
type: 'category',
|
|
|
boundaryGap: true,
|
|
|
itemStyle: {
|
|
|
@@ -301,7 +521,7 @@
|
|
|
containLabel: true
|
|
|
},
|
|
|
series: [{
|
|
|
- data: listB,
|
|
|
+ data: Data,
|
|
|
name: ' 24h湿度走势图',
|
|
|
type: 'line',
|
|
|
symbol: 'circle',
|
|
|
@@ -338,15 +558,54 @@
|
|
|
),
|
|
|
}
|
|
|
}
|
|
|
+ },{
|
|
|
+ data: BzData,
|
|
|
+ name: '',
|
|
|
+ type: 'line',
|
|
|
+ symbol: 'circle',
|
|
|
+ smooth: true,
|
|
|
+ symbolSize: 0,//不需要点就设置0
|
|
|
+ lineStyle: {
|
|
|
+ width: 2,
|
|
|
+ type: 'solid'
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ borderWidth: 5,
|
|
|
+ borderColor: 'rgba(1,131,250,1)',
|
|
|
+ color: 'rgba(1,131,250,1)',
|
|
|
+ },
|
|
|
+ areaStyle: {
|
|
|
+ color: 'rgba(1,131,250,1)',
|
|
|
+ normal: {
|
|
|
+ //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);
|
|
|
+ color: this.$echarts.graphic.LinearGradient(
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 1,
|
|
|
+ [{
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(1,131,250,0.6)',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(1,131,250,0)',
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ false
|
|
|
+ ),
|
|
|
+ }
|
|
|
+ }
|
|
|
}]
|
|
|
}
|
|
|
- this.eChartsData1 = this.$echarts.init(document.getElementById('right-eCharts-2'))
|
|
|
- this.eChartsData1.clear()
|
|
|
- this.eChartsData1.setOption(option)
|
|
|
+ if (this.$echarts.getInstanceByDom(document.getElementById('right-eCharts-2'))) {
|
|
|
+ this.$echarts.dispose(document.getElementById('right-eCharts-2'));
|
|
|
+ }
|
|
|
+ this.eChartsData2 = this.$echarts.init(document.getElementById('right-eCharts-2'))
|
|
|
+ this.eChartsData2.clear()
|
|
|
+ this.eChartsData2.setOption(option)
|
|
|
},
|
|
|
- eCharts3(){
|
|
|
- let listA = ['00:00', '03:30', '07:00', '10:30', '14:00', '17:30', '21:00'];
|
|
|
- let listB = [105, 272, 239, 150, 147, 319, 284,];
|
|
|
+ eCharts3(Data,Time,BzData){
|
|
|
let option = {
|
|
|
tooltip: {
|
|
|
show: false,
|
|
|
@@ -367,7 +626,7 @@
|
|
|
selectedMode: false,
|
|
|
},
|
|
|
xAxis: {
|
|
|
- data: listA,
|
|
|
+ data: Time,
|
|
|
type: 'category',
|
|
|
boundaryGap: true,
|
|
|
itemStyle: {
|
|
|
@@ -434,7 +693,7 @@
|
|
|
containLabel: true
|
|
|
},
|
|
|
series: [{
|
|
|
- data: listB,
|
|
|
+ data: Data,
|
|
|
name: ' 用电功率(w)',
|
|
|
type: 'line',
|
|
|
symbol: 'circle',
|
|
|
@@ -471,13 +730,63 @@
|
|
|
),
|
|
|
}
|
|
|
}
|
|
|
+ },{
|
|
|
+ data: BzData,
|
|
|
+ name: '',
|
|
|
+ type: 'line',
|
|
|
+ symbol: 'circle',
|
|
|
+ smooth: true,
|
|
|
+ symbolSize: 0,//不需要点就设置0
|
|
|
+ lineStyle: {
|
|
|
+ width: 2,
|
|
|
+ type: 'solid'
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ borderWidth: 5,
|
|
|
+ borderColor: 'rgba(255,132,0,1)',
|
|
|
+ color: 'rgba(255,132,0,1)'
|
|
|
+ },
|
|
|
+ areaStyle: {
|
|
|
+ color: 'rgba(255,132,0,1)',
|
|
|
+ normal: {
|
|
|
+ //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);
|
|
|
+ color: this.$echarts.graphic.LinearGradient(
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 1,
|
|
|
+ [{
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(255,132,0,0.6)'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(255,132,0,0)'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ false
|
|
|
+ ),
|
|
|
+ }
|
|
|
+ }
|
|
|
}]
|
|
|
}
|
|
|
+ if (this.$echarts.getInstanceByDom(document.getElementById('right-eCharts-3'))) {
|
|
|
+ this.$echarts.dispose(document.getElementById('right-eCharts-3'));
|
|
|
+ }
|
|
|
this.eChartsData3 = this.$echarts.init(document.getElementById('right-eCharts-3'))
|
|
|
this.eChartsData3.clear()
|
|
|
this.eChartsData3.setOption(option)
|
|
|
},
|
|
|
},
|
|
|
+ beforeDestroy() {
|
|
|
+ //清除定时器
|
|
|
+ clearInterval(this.getDataTimer);
|
|
|
+ }
|
|
|
+ ,
|
|
|
+ destroyed() {
|
|
|
+ //清除定时器
|
|
|
+ clearInterval(this.getDataTimer);
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
@@ -554,6 +863,7 @@
|
|
|
}
|
|
|
.right-big-box{
|
|
|
p{
|
|
|
+ overflow: hidden;
|
|
|
width: 240px;
|
|
|
height: 64px;
|
|
|
font-family: Source Han Sans CN, Source Han Sans CN;
|