From ed9698aeea7645176bf771fd722187d08d60ebfa Mon Sep 17 00:00:00 2001 From: shijing Date: Thu, 14 Sep 2023 14:51:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=A4=A7=E5=B1=8F=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/bigScreen/index_enm.vue | 185 +++++++++++++++++++++--------- 1 file changed, 131 insertions(+), 54 deletions(-) diff --git a/src/views/bigScreen/index_enm.vue b/src/views/bigScreen/index_enm.vue index 28d82471..0a7fc4e1 100644 --- a/src/views/bigScreen/index_enm.vue +++ b/src/views/bigScreen/index_enm.vue @@ -145,6 +145,7 @@ export default { }, factoryData: {}, sectionData: {}, + nowDay:1, initialAlpha: -Math.PI / 0.89, initialBeta: Math.PI / 3.3, initialRadius: 18, @@ -230,45 +231,58 @@ export default { seriesData6:[0,0,0,0,0,0], path:"ws://49.232.14.174:2226/ws/my/?token=", ws:null, + mgroupValues:{ + 电石渣:{total:0,elec:0}, + 原料磨:{total:0,elec:0}, + 煤磨:{total:0,elec:0}, + 回转窑:{total:0,elec:0}, + 水泥磨:{total:0,elec:0}, + 水泥包装:{total:0,elec:0} + }, } }, mounted() { var that = this; + this.initCharts(); + this.addListener(); + let myDate = new Date(); + let year = myDate.getFullYear(); + let month = myDate.getMonth()+1; + let day = myDate.getDate(); + that.nowDay = day; + that.query.year_s = year; + that.query.month_s = month; this.initDomStyle(); this.$nextTick(() => { - this.initCharts(); - this.addListener(); - // this.$API.enm.enstat.req({mgroup_name:'电石渣',type:'month_s',month_s:'2023',year_s:'8',page:0}).then((res1) => { - // debugger; - // console.log(res1) - // }) - // this.$API.enm.enstat.req({mgroup_name:'原料磨',type:'month_s',month_s:'2023',year_s:'8',page:0}).then((res2) => { - // debugger; - // console.log(res2) - // }) - // this.$API.enm.enstat.req({mgroup_name:'回转窑',type:'month_s',month_s:'2023',year_s:'8',page:0}).then((res3) => { - // debugger; - // console.log(res3) - // }) - // this.$API.enm.enstat.req({mgroup_name:'煤磨',type:'month_s',month_s:'2023',year_s:'8',page:0}).then((res4) => { - // debugger; - // console.log(res4) - // }) - // this.$API.enm.enstat.req({mgroup_name:'水泥磨',type:'month_s',month_s:'2023',year_s:'8',page:0}).then((res5) => { - // debugger; - // console.log(res5) - // }) - // this.$API.enm.enstat.req({mgroup_name:'水泥包装',type:'month_s',month_s:'2023',year_s:'8',page:0}).then((res6) => { - // debugger; - // console.log(res6) - // }) + this.$API.enm.enstat.req({type:'month_s',month_s:month,year_s:year,page:0}).then((res1) => { + console.log('工段数据:',res1) + debugger + res1.forEach(item=>{ + if(item.mgroup_name=='电石渣'){ + that.mgroupValues.电石渣.total = item.total_production; + that.mgroupValues.电石渣.elec=item.elec_consume_unit; + }else if(item.mgroup_name=='原料磨'){ + that.mgroupValues.原料磨.total=item.total_production; + that.mgroupValues.原料磨.elec=item.elec_consume_unit; + }else if(item.mgroup_name=='煤磨'){ + that.mgroupValues.煤磨.total=item.total_production; + that.mgroupValues.煤磨.elec=item.elec_consume_unit; + }else if(item.mgroup_name=='回转窑'){ + that.mgroupValues.回转窑.total=item.total_production; + that.mgroupValues.回转窑.elec=item.elec_consume_unit; + }else if(item.mgroup_name=='水泥磨'){ + that.mgroupValues.水泥磨.total=item.total_production; + that.mgroupValues.水泥磨.elec=item.elec_consume_unit; + }else if(item.mgroup_name=='水泥包装'){ + that.mgroupValues.水泥包装.total=item.total_production; + that.mgroupValues.水泥包装.elec=item.elec_consume_unit; + } + }) + }) setTimeout(function () { that.initFactory(); }, 1000); }); - var myDate = new Date(); - let year = myDate.getFullYear(); - let month = myDate.getMonth()+1; let month1= month>9?month:'0'+month; let end_time = year+'-'+month1+'-01 10:00:00'; let year_s=year; @@ -276,12 +290,13 @@ export default { year_s = year-1; } let arr = [],xAxisData = []; + let monthItem = month; for (let i = 0; i < 6; i++) { - arr.push(month); - if(month === 1) { - month = 12; + arr.push(monthItem); + if(monthItem === 1) { + monthItem = 12; } else { - month--; + monthItem--; } } arr.reverse(); @@ -289,7 +304,6 @@ export default { let item = arr[i]+'月' xAxisData.push(item); } - let month0= arr[0]>9?arr[0]:'0'+arr[0]; let start_time = year_s+'-'+month0+'-01 10:00:00'; that.arrMonth = arr; @@ -297,10 +311,9 @@ export default { that.xAxisData = xAxisData; that.start_time = start_time; that.end_time = end_time; - that.query.year_s = year; - that.query.month_s = month; this.getFactoryData(); this.getSectionData(); + this.getDayData(); this.init(); }, beforeUnmount() { @@ -413,7 +426,7 @@ export default { obj.type = 'month_s'; obj.start_time = that.start_time; obj.end_time = that.end_time; - obj.mgroup='3346520558031773696'; + obj.mgroup__name=that.activeSectionName; obj.page=0; this.$API.enm.enstat.req(obj).then((res) => { let list0 = res.sort(this.compare('month_s')); @@ -433,6 +446,19 @@ export default { that.initCharts1(); }) }, + getDayData(){ + var that = this; + let obj = {}; + obj.type = 'day_s'; + obj.year_s = that.query.year_s; + obj.month_s = that.query.month_s; + obj.day_s = that.nowDay; + obj.mgroup__name=that.activeSectionName; + obj.page=0; + this.$API.enm.enstat.req(obj).then((res) => { + that.sectionData = res[0]; + }) + }, initCharts() { let that = this; function deepCopy(obj) { @@ -793,10 +819,10 @@ export default { BABYLON.Animation.CreateAndStartAnimation('at51', camera, 'target', 45, 200, camera.target, position, 0, ease); } let dataViewName = rect1.name.split('_')[0] + '_data_view'; + that.getMgroupChartData(dataViewName); let dataView = advancedTexture.getControlByName(dataViewName); if (dataView) { // // 在这里进行矩形的操作 - dataView.isVisible = true; } }); @@ -851,12 +877,12 @@ export default { rc.fontSize = '16px'; rc.text = "单位产品电耗:"; }else if(j==1&&i==0){ - rc.text = "456"; + rc.text = that.mgroupValues[value].total; rc.width = "80px"; rc.fontSize = '18px'; rc.color = "rgb(44,237,255)"; }else if(j==1&&i==1){ - rc.text = "123"; + rc.text = that.mgroupValues[value].elec; rc.width = "80px"; rc.fontSize = '18px'; rc.color = "rgb(44,237,255)"; @@ -974,6 +1000,7 @@ export default { }); }, handleSectionClick(val, index) { + let that = this; this.activeSectionName = val; this.activeSection = index; if (val == '回转窑') { @@ -981,22 +1008,72 @@ export default { } else { this.showKgcet = false; } - const element_main = document.querySelector('.right_main'); - element_main.classList.add('animate__animated', 'animate__fadeIn'); - element_main.addEventListener('animationend', () => { - // 移除属性 - element_main.classList.remove('animate__fadeIn'); - }); - const element = document.querySelector('.right_other'); - element.classList.add('animate__animated', 'animate__fadeIn'); - element.addEventListener('animationend', () => { - // 移除属性 - element.classList.remove('animate__fadeIn'); - }); - const sectionUI = this.myui.getControlByName(val+'_rect') - sectionUI.onPointerDownObservable.notifyObservers(); + let obj = {}; + obj.type = 'month_s'; + obj.start_time = that.start_time; + obj.end_time = that.end_time; + obj.mgroup__name=val; + obj.page=0; + this.$API.enm.enstat.req(obj).then((res) => { + let list0 = res.sort(this.compare('month_s')); + let list = list0.sort(this.compare('year_s')); + let seriesData4 = [0,0,0,0,0,0], + seriesData5 = [0,0,0,0,0,0], + seriesData6 = [0,0,0,0,0,0]; + list.forEach(item=>{ + let index = that.arrMonth.indexOf(item.month_s); + seriesData4[index] = Number(item.elec_consume_unit) + seriesData5[index] = Number(item.total_production) + seriesData6[index] = Number(item.run_rate) + }) + that.seriesData4=seriesData4; + that.seriesData5=seriesData5; + that.seriesData6=seriesData6; + that.initCharts1(); + const element_main = document.querySelector('.right_main'); + element_main.classList.add('animate__animated', 'animate__fadeIn'); + element_main.addEventListener('animationend', () => { + // 移除属性 + element_main.classList.remove('animate__fadeIn'); + }); + const element = document.querySelector('.right_other'); + element.classList.add('animate__animated', 'animate__fadeIn'); + element.addEventListener('animationend', () => { + // 移除属性 + element.classList.remove('animate__fadeIn'); + }); + const sectionUI = this.myui.getControlByName(val+'_rect') + sectionUI.onPointerDownObservable.notifyObservers(); + }) + }, + // getMgroupChartData(name){ + // var that = this; + // let obj = {}; + // obj.type = 'month_s'; + // obj.start_time = that.start_time; + // obj.end_time = that.end_time; + // obj.mgroup__name=val; + // obj.page=0; + // this.$API.enm.enstat.req(obj).then((res) => { + // let list0 = res.sort(this.compare('month_s')); + // let list = list0.sort(this.compare('year_s')); + // let seriesData4 = [0,0,0,0,0,0], + // seriesData5 = [0,0,0,0,0,0], + // seriesData6 = [0,0,0,0,0,0]; + // list.forEach(item=>{ + // let index = that.arrMonth.indexOf(item.month_s); + // seriesData4[index] = Number(item.elec_consume_unit) + // seriesData5[index] = Number(item.total_production) + // seriesData6[index] = Number(item.run_rate) + // }) + // that.seriesData4=seriesData4; + // that.seriesData5=seriesData5; + // that.seriesData6=seriesData6; + // that.initCharts1(); + // }) + // }, }, unmounted() { this.close();