diff --git a/src/views/bigScreen/index_enm.vue b/src/views/bigScreen/index_enm.vue index 555e00f9..3bf13b93 100644 --- a/src/views/bigScreen/index_enm.vue +++ b/src/views/bigScreen/index_enm.vue @@ -144,8 +144,8 @@ export default { type:'month_s', page:0 }, - factoryData: { 'coal_consume': 100, 'elec_consume': 100, 'water_consume': 100, 'cair_consume': 100 }, - sectionData: { 'elec_consume_unit': 0, 'total_production': 0, 'run_rate': 100, 'coal_consume_unit': 0 }, + factoryData: {}, + sectionData: {}, initialAlpha: -Math.PI / 0.89, initialBeta: Math.PI / 3.3, initialRadius: 18, @@ -199,11 +199,11 @@ export default { ]) } }, - data: this.xAxisData + data: [] } ], grid: { // 让图表占满容器 - top: "5%", + top: "10%", left: "12%", right: "0px", bottom: "15%" @@ -212,7 +212,7 @@ export default { year_start:0, end_time:'', start_time:'', - xAxisData:[], + xAxisData:['一月', '二月', '三月', '四月', '五月', '六月'], arrMonth:[], legendData:['电石渣','原料磨','煤磨','回转窑','水泥磨','水泥包装'], chart1Option: {}, @@ -298,16 +298,23 @@ export default { //监听是否连接成功 this.ws.onopen = ()=> { // debugger; - console.log("socket连接成功"); - setTimeout(()=>{ - that.ws.send(JSON.stringify({'type': 'chat', 'msg': '你好admin', 'to': 'admin'})) - },5000) + // console.log("socket连接成功"); + // setTimeout(()=>{ + // that.ws.send(JSON.stringify({'type': 'chat', 'msg': '你好admin', 'to': 'admin'})) + // },5000) } //接听服务器发回的信息并处理展示 this.ws.onmessage = (msg)=>{ let data = JSON.parse(msg.data) console.log(data) + if(data.type=='event'){ + + }if(data.type=='ticket'){ + + }if(data.type=='chat'){ + + } }; @@ -370,6 +377,8 @@ export default { that.seriesData2=seriesData2; that.seriesData3=seriesData3; that.seriesData3_2=seriesData3_2; + debugger; + that.initCharts(); }) }, @@ -401,14 +410,15 @@ export default { }, initCharts() { let that = this; - + function deepCopy(obj) { + return JSON.parse(JSON.stringify(obj)); + } // 初始化所有表格 - let data11 = that.seriesData1; - that.chart1Option = Object.assign({}, that.basicOption) - that.chart1Option.xAxis.data = that.xAxisData; + that.basicOption.xAxis.data = that.xAxisData; + that.chart1Option = deepCopy(that.basicOption) that.chart1Option.series = [ { - name: 'Forest', + name: '电耗', type: 'bar', barWidth: 15, label: { @@ -421,16 +431,16 @@ export default { data: that.seriesData1 }] that.setChart('chart1',that.chart1Option); - this.chart2Option = Object.assign({}, this.basicOption) + this.chart2Option = deepCopy(that.basicOption) this.chart2Option.series[0].type = 'line'; this.chart2Option.series[0].data = that.seriesData2; this.setChart('chart2', this.chart2Option); - this.chart3Option = Object.assign({}, this.basicOption) - that.chart3Option.xAxis.data = that.xAxisData; + this.chart3Option =deepCopy(that.basicOption) this.chart3Option.series = [ { - name: 'Forest', + name: '工业水', type: 'bar', + barWidth: 15, label: { show: true, position: 'top' @@ -441,8 +451,9 @@ export default { data: that.seriesData3 }, { - name: 'Steppe', + name: '压缩空气', type: 'bar', + barWidth: 15, emphasis: { focus: 'series' }, @@ -452,19 +463,22 @@ export default { }, initCharts1() { let that = this; - this.chart4Option = Object.assign({}, this.basicOption) + function deepCopy(obj) { + return JSON.parse(JSON.stringify(obj)); + } + that.basicOption.xAxis.data = that.xAxisData; + this.chart4Option = deepCopy(that.basicOption) this.chart4Option.series[0].type = 'line'; this.chart4Option.series[0].data = that.seriesData4; this.setChart('chart4', this.chart4Option); - this.chart5Option = Object.assign({}, this.basicOption) + this.chart5Option = deepCopy(that.basicOption) this.chart5Option.series[0].type = 'line'; this.chart5Option.series[0].data = that.seriesData5; this.setChart('chart5', this.chart5Option); - this.chart6Option = Object.assign({}, this.basicOption) + this.chart6Option = deepCopy(that.basicOption) this.chart6Option.series[0].type = 'line'; this.chart6Option.series[0].data = that.seriesData6; this.setChart('chart6', this.chart6Option); - }, addListener() { var that = this;