fix:大屏数据更新
This commit is contained in:
parent
b61ff39468
commit
ed9698aeea
|
@ -145,6 +145,7 @@ export default {
|
||||||
},
|
},
|
||||||
factoryData: {},
|
factoryData: {},
|
||||||
sectionData: {},
|
sectionData: {},
|
||||||
|
nowDay:1,
|
||||||
initialAlpha: -Math.PI / 0.89,
|
initialAlpha: -Math.PI / 0.89,
|
||||||
initialBeta: Math.PI / 3.3,
|
initialBeta: Math.PI / 3.3,
|
||||||
initialRadius: 18,
|
initialRadius: 18,
|
||||||
|
@ -230,45 +231,58 @@ export default {
|
||||||
seriesData6:[0,0,0,0,0,0],
|
seriesData6:[0,0,0,0,0,0],
|
||||||
path:"ws://49.232.14.174:2226/ws/my/?token=",
|
path:"ws://49.232.14.174:2226/ws/my/?token=",
|
||||||
ws:null,
|
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() {
|
mounted() {
|
||||||
var that = this;
|
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.initDomStyle();
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.initCharts();
|
this.$API.enm.enstat.req({type:'month_s',month_s:month,year_s:year,page:0}).then((res1) => {
|
||||||
this.addListener();
|
console.log('工段数据:',res1)
|
||||||
// this.$API.enm.enstat.req({mgroup_name:'电石渣',type:'month_s',month_s:'2023',year_s:'8',page:0}).then((res1) => {
|
debugger
|
||||||
// debugger;
|
res1.forEach(item=>{
|
||||||
// console.log(res1)
|
if(item.mgroup_name=='电石渣'){
|
||||||
// })
|
that.mgroupValues.电石渣.total = item.total_production;
|
||||||
// this.$API.enm.enstat.req({mgroup_name:'原料磨',type:'month_s',month_s:'2023',year_s:'8',page:0}).then((res2) => {
|
that.mgroupValues.电石渣.elec=item.elec_consume_unit;
|
||||||
// debugger;
|
}else if(item.mgroup_name=='原料磨'){
|
||||||
// console.log(res2)
|
that.mgroupValues.原料磨.total=item.total_production;
|
||||||
// })
|
that.mgroupValues.原料磨.elec=item.elec_consume_unit;
|
||||||
// this.$API.enm.enstat.req({mgroup_name:'回转窑',type:'month_s',month_s:'2023',year_s:'8',page:0}).then((res3) => {
|
}else if(item.mgroup_name=='煤磨'){
|
||||||
// debugger;
|
that.mgroupValues.煤磨.total=item.total_production;
|
||||||
// console.log(res3)
|
that.mgroupValues.煤磨.elec=item.elec_consume_unit;
|
||||||
// })
|
}else if(item.mgroup_name=='回转窑'){
|
||||||
// this.$API.enm.enstat.req({mgroup_name:'煤磨',type:'month_s',month_s:'2023',year_s:'8',page:0}).then((res4) => {
|
that.mgroupValues.回转窑.total=item.total_production;
|
||||||
// debugger;
|
that.mgroupValues.回转窑.elec=item.elec_consume_unit;
|
||||||
// console.log(res4)
|
}else if(item.mgroup_name=='水泥磨'){
|
||||||
// })
|
that.mgroupValues.水泥磨.total=item.total_production;
|
||||||
// this.$API.enm.enstat.req({mgroup_name:'水泥磨',type:'month_s',month_s:'2023',year_s:'8',page:0}).then((res5) => {
|
that.mgroupValues.水泥磨.elec=item.elec_consume_unit;
|
||||||
// debugger;
|
}else if(item.mgroup_name=='水泥包装'){
|
||||||
// console.log(res5)
|
that.mgroupValues.水泥包装.total=item.total_production;
|
||||||
// })
|
that.mgroupValues.水泥包装.elec=item.elec_consume_unit;
|
||||||
// this.$API.enm.enstat.req({mgroup_name:'水泥包装',type:'month_s',month_s:'2023',year_s:'8',page:0}).then((res6) => {
|
}
|
||||||
// debugger;
|
})
|
||||||
// console.log(res6)
|
})
|
||||||
// })
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
that.initFactory();
|
that.initFactory();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
var myDate = new Date();
|
|
||||||
let year = myDate.getFullYear();
|
|
||||||
let month = myDate.getMonth()+1;
|
|
||||||
let month1= month>9?month:'0'+month;
|
let month1= month>9?month:'0'+month;
|
||||||
let end_time = year+'-'+month1+'-01 10:00:00';
|
let end_time = year+'-'+month1+'-01 10:00:00';
|
||||||
let year_s=year;
|
let year_s=year;
|
||||||
|
@ -276,12 +290,13 @@ export default {
|
||||||
year_s = year-1;
|
year_s = year-1;
|
||||||
}
|
}
|
||||||
let arr = [],xAxisData = [];
|
let arr = [],xAxisData = [];
|
||||||
|
let monthItem = month;
|
||||||
for (let i = 0; i < 6; i++) {
|
for (let i = 0; i < 6; i++) {
|
||||||
arr.push(month);
|
arr.push(monthItem);
|
||||||
if(month === 1) {
|
if(monthItem === 1) {
|
||||||
month = 12;
|
monthItem = 12;
|
||||||
} else {
|
} else {
|
||||||
month--;
|
monthItem--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
arr.reverse();
|
arr.reverse();
|
||||||
|
@ -289,7 +304,6 @@ export default {
|
||||||
let item = arr[i]+'月'
|
let item = arr[i]+'月'
|
||||||
xAxisData.push(item);
|
xAxisData.push(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
let month0= arr[0]>9?arr[0]:'0'+arr[0];
|
let month0= arr[0]>9?arr[0]:'0'+arr[0];
|
||||||
let start_time = year_s+'-'+month0+'-01 10:00:00';
|
let start_time = year_s+'-'+month0+'-01 10:00:00';
|
||||||
that.arrMonth = arr;
|
that.arrMonth = arr;
|
||||||
|
@ -297,10 +311,9 @@ export default {
|
||||||
that.xAxisData = xAxisData;
|
that.xAxisData = xAxisData;
|
||||||
that.start_time = start_time;
|
that.start_time = start_time;
|
||||||
that.end_time = end_time;
|
that.end_time = end_time;
|
||||||
that.query.year_s = year;
|
|
||||||
that.query.month_s = month;
|
|
||||||
this.getFactoryData();
|
this.getFactoryData();
|
||||||
this.getSectionData();
|
this.getSectionData();
|
||||||
|
this.getDayData();
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
|
@ -413,7 +426,7 @@ export default {
|
||||||
obj.type = 'month_s';
|
obj.type = 'month_s';
|
||||||
obj.start_time = that.start_time;
|
obj.start_time = that.start_time;
|
||||||
obj.end_time = that.end_time;
|
obj.end_time = that.end_time;
|
||||||
obj.mgroup='3346520558031773696';
|
obj.mgroup__name=that.activeSectionName;
|
||||||
obj.page=0;
|
obj.page=0;
|
||||||
this.$API.enm.enstat.req(obj).then((res) => {
|
this.$API.enm.enstat.req(obj).then((res) => {
|
||||||
let list0 = res.sort(this.compare('month_s'));
|
let list0 = res.sort(this.compare('month_s'));
|
||||||
|
@ -433,6 +446,19 @@ export default {
|
||||||
that.initCharts1();
|
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() {
|
initCharts() {
|
||||||
let that = this;
|
let that = this;
|
||||||
function deepCopy(obj) {
|
function deepCopy(obj) {
|
||||||
|
@ -793,10 +819,10 @@ export default {
|
||||||
BABYLON.Animation.CreateAndStartAnimation('at51', camera, 'target', 45, 200, camera.target, position, 0, ease);
|
BABYLON.Animation.CreateAndStartAnimation('at51', camera, 'target', 45, 200, camera.target, position, 0, ease);
|
||||||
}
|
}
|
||||||
let dataViewName = rect1.name.split('_')[0] + '_data_view';
|
let dataViewName = rect1.name.split('_')[0] + '_data_view';
|
||||||
|
that.getMgroupChartData(dataViewName);
|
||||||
let dataView = advancedTexture.getControlByName(dataViewName);
|
let dataView = advancedTexture.getControlByName(dataViewName);
|
||||||
if (dataView) {
|
if (dataView) {
|
||||||
// // 在这里进行矩形的操作
|
// // 在这里进行矩形的操作
|
||||||
|
|
||||||
dataView.isVisible = true;
|
dataView.isVisible = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -851,12 +877,12 @@ export default {
|
||||||
rc.fontSize = '16px';
|
rc.fontSize = '16px';
|
||||||
rc.text = "单位产品电耗:";
|
rc.text = "单位产品电耗:";
|
||||||
}else if(j==1&&i==0){
|
}else if(j==1&&i==0){
|
||||||
rc.text = "456";
|
rc.text = that.mgroupValues[value].total;
|
||||||
rc.width = "80px";
|
rc.width = "80px";
|
||||||
rc.fontSize = '18px';
|
rc.fontSize = '18px';
|
||||||
rc.color = "rgb(44,237,255)";
|
rc.color = "rgb(44,237,255)";
|
||||||
}else if(j==1&&i==1){
|
}else if(j==1&&i==1){
|
||||||
rc.text = "123";
|
rc.text = that.mgroupValues[value].elec;
|
||||||
rc.width = "80px";
|
rc.width = "80px";
|
||||||
rc.fontSize = '18px';
|
rc.fontSize = '18px';
|
||||||
rc.color = "rgb(44,237,255)";
|
rc.color = "rgb(44,237,255)";
|
||||||
|
@ -974,6 +1000,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSectionClick(val, index) {
|
handleSectionClick(val, index) {
|
||||||
|
let that = this;
|
||||||
this.activeSectionName = val;
|
this.activeSectionName = val;
|
||||||
this.activeSection = index;
|
this.activeSection = index;
|
||||||
if (val == '回转窑') {
|
if (val == '回转窑') {
|
||||||
|
@ -981,22 +1008,72 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.showKgcet = false;
|
this.showKgcet = false;
|
||||||
}
|
}
|
||||||
const element_main = document.querySelector('.right_main');
|
let obj = {};
|
||||||
element_main.classList.add('animate__animated', 'animate__fadeIn');
|
obj.type = 'month_s';
|
||||||
element_main.addEventListener('animationend', () => {
|
obj.start_time = that.start_time;
|
||||||
// 移除属性
|
obj.end_time = that.end_time;
|
||||||
element_main.classList.remove('animate__fadeIn');
|
obj.mgroup__name=val;
|
||||||
});
|
obj.page=0;
|
||||||
const element = document.querySelector('.right_other');
|
this.$API.enm.enstat.req(obj).then((res) => {
|
||||||
element.classList.add('animate__animated', 'animate__fadeIn');
|
let list0 = res.sort(this.compare('month_s'));
|
||||||
element.addEventListener('animationend', () => {
|
let list = list0.sort(this.compare('year_s'));
|
||||||
// 移除属性
|
let seriesData4 = [0,0,0,0,0,0],
|
||||||
element.classList.remove('animate__fadeIn');
|
seriesData5 = [0,0,0,0,0,0],
|
||||||
});
|
seriesData6 = [0,0,0,0,0,0];
|
||||||
const sectionUI = this.myui.getControlByName(val+'_rect')
|
list.forEach(item=>{
|
||||||
sectionUI.onPointerDownObservable.notifyObservers();
|
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() {
|
unmounted() {
|
||||||
this.close();
|
this.close();
|
||||||
|
|
Loading…
Reference in New Issue