fix:enm单位产品电耗更改引用接口
This commit is contained in:
parent
32252eb850
commit
ca7a62fbbc
|
|
@ -238,6 +238,7 @@ export default {
|
|||
["煤磨排风机主电机", "", "KW·h/t", "", "", ""],
|
||||
["煤磨主电机", "", "KW·h/t", "", "", ""],
|
||||
],
|
||||
tableData: [],
|
||||
modelValue: true,
|
||||
type: "hour_s",
|
||||
title: "煤磨工段",
|
||||
|
|
@ -346,148 +347,42 @@ export default {
|
|||
},
|
||||
],
|
||||
},
|
||||
mpoints: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
let that = this;
|
||||
var myDate = new Date();
|
||||
let year = myDate.getFullYear();
|
||||
let month = myDate.getMonth() + 1;
|
||||
let days = myDate.getDate();
|
||||
let hours = myDate.getHours();
|
||||
let timeDate = myDate.getTime();
|
||||
let dayTime = 24 * 60 * 60 * 1000;
|
||||
//昨天的计算
|
||||
let year_d = year,
|
||||
month_d = month,
|
||||
days_d = days;
|
||||
if (hours < 21) {
|
||||
//21点前,查找昨日数据为前一天数据
|
||||
let newDate = timeDate - dayTime;
|
||||
let lastDate = new Date(newDate);
|
||||
year_d = lastDate.getFullYear();
|
||||
month_d = lastDate.getMonth() + 1;
|
||||
days_d = lastDate.getDate();
|
||||
}
|
||||
//上一小时的计算
|
||||
let hourTime = timeDate - 3600000;
|
||||
let hourDate = new Date(hourTime);
|
||||
let year_h = hourDate.getFullYear();
|
||||
let month_h = hourDate.getMonth() + 1;
|
||||
let days_h = hourDate.getDate();
|
||||
let hours_h = hourDate.getHours();
|
||||
this.$API.mtm.mgroup.list
|
||||
.req({ page: 0, search: "煤磨" })
|
||||
.then((res) => {
|
||||
console.log("煤磨", res);
|
||||
that.query.mgroup = res[0].id;
|
||||
//本月
|
||||
let params2 = {};
|
||||
params2.page = 0;
|
||||
params2.year_s = year;
|
||||
params2.month_s = month;
|
||||
params2.type = "month_s";
|
||||
params2.mgroup = that.query.mgroup;
|
||||
that.$API.enm.enstat
|
||||
.req(params2)
|
||||
.then((res2) => {
|
||||
if (res2.length > 0) {
|
||||
let hourProduct = (that.allValMonth =
|
||||
res2[0].total_production); //当前条件下的总产量
|
||||
params2.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
that.$API.enm.mpoint.stat
|
||||
.req(params2)
|
||||
.then((res) => {
|
||||
let data2 = res;
|
||||
for (let i = 0; i < data2.length; i++) {
|
||||
that.tableDatas[i] = [];
|
||||
that.tableDatas[i][0] =
|
||||
data2[i].ep_monitored_name;
|
||||
that.tableDatas[i][1] =
|
||||
data2[i].ep_monitored_number;
|
||||
that.tableDatas[i][2] = "KW·h/t";
|
||||
let val =
|
||||
hourProduct == 0
|
||||
? "/"
|
||||
: (
|
||||
data2[i].val /
|
||||
hourProduct
|
||||
).toFixed(2);
|
||||
that.tableDatas[i][5] = val;
|
||||
that.tableDatas[i][6] = data2[i].mpoint;
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.then((res2) => {
|
||||
//昨日
|
||||
let params3 = {};
|
||||
params3.page = 0;
|
||||
params3.year_s = year_d;
|
||||
params3.month_s = month_d;
|
||||
params3.day_s = days_d;
|
||||
params3.type = "day_s";
|
||||
params3.mgroup = that.query.mgroup;
|
||||
that.$API.enm.enstat.req(params3).then((res3) => {
|
||||
if (res3.length > 0) {
|
||||
let hourProduct = (that.allValDays =
|
||||
res3[0].total_production);
|
||||
params3.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
that.$API.enm.mpoint.stat
|
||||
.req(params3)
|
||||
.then((res) => {
|
||||
let data3 = res3;
|
||||
for (let j = 0; j < data3.length; j++) {
|
||||
let val =
|
||||
hourProduct == 0
|
||||
? "/"
|
||||
: (
|
||||
data3[j].val /
|
||||
hourProduct
|
||||
).toFixed(2);
|
||||
that.tableDatas[j][4] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
//上小时
|
||||
let params4 = {};
|
||||
params4.page = 0;
|
||||
params4.year = year_h;
|
||||
params4.month = month_h;
|
||||
params4.day = days_h;
|
||||
params4.hour = hours_h;
|
||||
params4.type = "hour_s";
|
||||
params4.mgroup = that.query.mgroup;
|
||||
that.$API.enm.enstat.req(params4).then((res4) => {
|
||||
if (res4.length > 0) {
|
||||
let hourProduct = (that.allValHour =
|
||||
res4[0].total_production);
|
||||
params4.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
that.$API.enm.mpoint.stat
|
||||
.req(params4)
|
||||
.then((res) => {
|
||||
let data4 = res4;
|
||||
for (let k = 0; k < data4.length; k++) {
|
||||
let val =
|
||||
hourProduct == 0
|
||||
? "/"
|
||||
: (
|
||||
data4[k].val /
|
||||
hourProduct
|
||||
).toFixed(2);
|
||||
that.tableDatas[k][3] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
that.getHourData();
|
||||
that.getDayData();
|
||||
that.getMonthData();
|
||||
});
|
||||
that.year = myDate.getFullYear();
|
||||
that.month = myDate.getMonth() + 1;
|
||||
that.days = myDate.getDate();
|
||||
that.hours = myDate.getHours();
|
||||
that.getMpoints();
|
||||
that.getTableHourData();
|
||||
that.getHourData(that.year, that.month, that.days);
|
||||
that.getDayData(that.year, that.month);
|
||||
that.getMonthData(that.year);
|
||||
},
|
||||
methods: {
|
||||
getMpoints() {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.mgroup__name = "煤磨";
|
||||
obj.page = 0;
|
||||
obj.enabled = 1;
|
||||
obj.need_display = 1;
|
||||
obj.ordering = "report_sortstr";
|
||||
obj.material__code__in = "elec,elec_0";
|
||||
this.$API.enm.mpoint.list.req(obj).then((res) => {
|
||||
console.log("mpoints", res);
|
||||
let arr = [];
|
||||
res.forEach((item) => {
|
||||
arr.push(item.nickname);
|
||||
});
|
||||
console.log("arr", arr);
|
||||
that.mpoints = arr;
|
||||
});
|
||||
},
|
||||
typeRadioChange() {
|
||||
this.searchDate = "";
|
||||
},
|
||||
|
|
@ -505,39 +400,154 @@ export default {
|
|||
} else {
|
||||
this.getMonthData(val);
|
||||
}
|
||||
this.searchDate;
|
||||
},
|
||||
//获取小时数据
|
||||
getHourData() {
|
||||
getTableHourData() {
|
||||
let that = this;
|
||||
let query = {};
|
||||
query.page = 0;
|
||||
query.year_s = that.year;
|
||||
query.month_s = that.month;
|
||||
query.day_s = that.days;
|
||||
query.type = "hour_s";
|
||||
query.mgroup = that.query.mgroup;
|
||||
query.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat.req(query).then((response) => {
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [];
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.hour;
|
||||
let val = 0;
|
||||
if (that.allValHour == 0) {
|
||||
val = "";
|
||||
that.tableDatas = [];
|
||||
let timeDate = new Date().getTime();
|
||||
let hourTime = timeDate - 3600000;
|
||||
let hourDate = new Date(hourTime);
|
||||
let year_h = hourDate.getFullYear();
|
||||
let month_h = hourDate.getMonth() + 1;
|
||||
let days_h = hourDate.getDate();
|
||||
let hours_h = hourDate.getHours();
|
||||
let minutes = hourDate.getMinutes();
|
||||
month_h = month_h > 9 ? month_h : "0" + month_h;
|
||||
days_h = days_h > 9 ? days_h : "0" + days_h;
|
||||
if (hours_h > 5) {
|
||||
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
|
||||
} else {
|
||||
val = (item.val / that.allValHour).toFixed(2);
|
||||
hours_h = hours_h - 1;
|
||||
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
|
||||
}
|
||||
if (item.equip_name == "煤磨排风机主电机") {
|
||||
seriesData0[ind] = val;
|
||||
} else if (item.equip_name == "煤磨主电机") {
|
||||
seriesData1[ind] = val;
|
||||
let obj = {};
|
||||
obj.type = "hour_s";
|
||||
obj.year = year_h;
|
||||
obj.month = month_h;
|
||||
obj.day = days_h;
|
||||
obj.hour = hours_h;
|
||||
obj.mgroup__name = "煤磨";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(obj)
|
||||
.then((res) => {
|
||||
that.tableData = res;
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname);
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[3] = item.elec_consume_unit;
|
||||
obj[4] = 0;
|
||||
obj[5] = 0;
|
||||
obj[6] = item.mpoint;
|
||||
that.tableDatas[index] = obj;
|
||||
});
|
||||
let yetTime = timeDate - 3600000 * 24;
|
||||
let ystDate = new Date(yetTime);
|
||||
let year_h = ystDate.getFullYear();
|
||||
let month_h = ystDate.getMonth() + 1;
|
||||
let days_h = ystDate.getDate();
|
||||
month_h = month_h > 9 ? month_h : "0" + month_h;
|
||||
days_h = days_h > 9 ? days_h : "0" + days_h;
|
||||
let obj_d = {};
|
||||
obj_d.type = "day_s";
|
||||
obj_d.year_s = year_h;
|
||||
obj_d.month_s = month_h;
|
||||
obj_d.day_s = days_h;
|
||||
obj_d.mgroup__name = "煤磨";
|
||||
obj_d.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_d.mpoint__need_display = 1;
|
||||
obj_d.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj_d).then((res) => {
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_d = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
);
|
||||
if (that.tableDatas[index_d]) {
|
||||
that.tableDatas[index_d][3] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[4] = item.elec_consume_unit;
|
||||
obj[6] = item.mpoint;
|
||||
that.tableDatas[index_d] = obj;
|
||||
}
|
||||
});
|
||||
let obj_m = {};
|
||||
obj_m.type = "month_s";
|
||||
obj_m.year_s = that.year;
|
||||
obj_m.month_s = that.month;
|
||||
obj_m.mgroup__name = "煤磨";
|
||||
obj_m.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_m.mpoint__need_display = 1;
|
||||
obj_m.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj_m).then((res) => {
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_m = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
);
|
||||
if (that.tableDatas[index_m]) {
|
||||
that.tableDatas[index_m][4] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[5] = item.elec_consume_unit;
|
||||
obj[6] = item.mpoint;
|
||||
that.tableDatas[index_m] = obj;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(() => {});
|
||||
},
|
||||
//获取小时数据
|
||||
getHourData(year, month, days) {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.type = "hour_s";
|
||||
obj.year_s = year;
|
||||
obj.month_s = month;
|
||||
obj.day_s = days;
|
||||
obj.mgroup__name = "煤磨";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let ind = item.hour; //xAxis
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option1 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let hourXAxis = [];
|
||||
for (let i = 0; i < 24; i++) {
|
||||
let item = i + "时";
|
||||
|
|
@ -548,39 +558,40 @@ export default {
|
|||
});
|
||||
},
|
||||
//获取天数据
|
||||
getDayData() {
|
||||
getDayData(year, month) {
|
||||
let that = this;
|
||||
let query1 = {};
|
||||
query1.page = 0;
|
||||
query1.year_s = that.year;
|
||||
query1.month_s = that.month;
|
||||
query1.type = "day_s";
|
||||
query1.mgroup = this.query.mgroup;
|
||||
query1.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.enstat.req(query1).then((response) => {
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [];
|
||||
let obj = {};
|
||||
obj.type = "day_s";
|
||||
obj.year_s = year;
|
||||
obj.month_s = month;
|
||||
obj.mgroup__name = "煤磨";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
// debugger;
|
||||
let ind = item.day_s;
|
||||
let val = 0;
|
||||
if (that.allValDays == 0) {
|
||||
val = "";
|
||||
} else {
|
||||
val = (item.val / that.allValDays).toFixed(2);
|
||||
}
|
||||
if (item.equip_name == "煤磨排风机主电机") {
|
||||
seriesData0[ind] = val;
|
||||
} else if (item.equip_name == "煤磨主电机") {
|
||||
seriesData1[ind] = val;
|
||||
}
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let ind = item.day_s - 1;
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option2 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let dayXAxis = [];
|
||||
for (let i = 1; i <= that.days; i++) {
|
||||
let dayss = new Date(year, month, 0).getDate();
|
||||
for (let i = 1; i <= dayss; i++) {
|
||||
let item = i + "日";
|
||||
dayXAxis.push(item);
|
||||
}
|
||||
|
|
@ -589,37 +600,38 @@ export default {
|
|||
});
|
||||
},
|
||||
//获取月数据
|
||||
getMonthData() {
|
||||
getMonthData(year) {
|
||||
let that = this;
|
||||
let query2 = {};
|
||||
query2.page = 0;
|
||||
query2.year_s = that.year;
|
||||
query2.type = "month_s";
|
||||
query2.mgroup = that.query.mgroup;
|
||||
query2.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.enstat.req(query2).then((response) => {
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [];
|
||||
let obj = {};
|
||||
obj.type = "month_s";
|
||||
obj.year_s = year;
|
||||
obj.mgroup__name = "煤磨";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.month_s;
|
||||
let val = 0;
|
||||
if (that.allValMonth == 0) {
|
||||
val = "";
|
||||
} else {
|
||||
val = (item.val / that.allValMonth).toFixed(2);
|
||||
}
|
||||
if (item.equip_name == "煤磨排风机主电机") {
|
||||
seriesData0[ind] = val;
|
||||
} else if (item.equip_name == "煤磨主电机") {
|
||||
seriesData1[ind] = val;
|
||||
}
|
||||
let ind = item.month_s - 1;
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option3 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let monthXAxis = [];
|
||||
for (let i = 1; i <= that.month; i++) {
|
||||
for (let i = 1; i < 13; i++) {
|
||||
let item = i + "月";
|
||||
monthXAxis.push(item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,6 +249,7 @@ export default {
|
|||
["高温风机", "", "KW·h/t", "", "", ""],
|
||||
["窑主电机", "", "KW·h/t", "", "", ""],
|
||||
],
|
||||
tableData: [],
|
||||
modelValue: true,
|
||||
type: "hour_s",
|
||||
title: "回转窑工段",
|
||||
|
|
@ -460,148 +461,43 @@ export default {
|
|||
},
|
||||
],
|
||||
},
|
||||
mpoints: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
//回转窑
|
||||
let that = this;
|
||||
var myDate = new Date();
|
||||
let year = myDate.getFullYear();
|
||||
let month = myDate.getMonth() + 1;
|
||||
let days = myDate.getDate();
|
||||
let hours = myDate.getHours();
|
||||
let timeDate = myDate.getTime();
|
||||
let dayTime = 24 * 60 * 60 * 1000;
|
||||
//昨天的计算
|
||||
let year_d = year,
|
||||
month_d = month,
|
||||
days_d = days;
|
||||
if (hours < 21) {
|
||||
//21点前,查找昨日数据为前一天数据
|
||||
let newDate = timeDate - dayTime;
|
||||
let lastDate = new Date(newDate);
|
||||
year_d = lastDate.getFullYear();
|
||||
month_d = lastDate.getMonth() + 1;
|
||||
days_d = lastDate.getDate();
|
||||
}
|
||||
//上一小时的计算
|
||||
let hourTime = timeDate - 3600000;
|
||||
let hourDate = new Date(hourTime);
|
||||
let year_h = hourDate.getFullYear();
|
||||
let month_h = hourDate.getMonth() + 1;
|
||||
let days_h = hourDate.getDate();
|
||||
let hours_h = hourDate.getHours();
|
||||
that.$API.mtm.mgroup.list
|
||||
.req({ page: 0, search: "回转窑" })
|
||||
.then((res) => {
|
||||
console.log("回转窑", res);
|
||||
that.query.mgroup = res[0].id;
|
||||
//本月
|
||||
let params2 = {};
|
||||
params2.page = 0;
|
||||
params2.year_s = year;
|
||||
params2.month_s = month;
|
||||
params2.type = "month_s";
|
||||
params2.mgroup = this.query.mgroup;
|
||||
this.$API.enm.enstat
|
||||
.req(params2)
|
||||
.then((res2) => {
|
||||
if (res2.length > 0) {
|
||||
let allValMonth = (that.allValMonth =
|
||||
res2[0].total_production); //当前条件下的总产量
|
||||
params2.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(params2)
|
||||
.then((res) => {
|
||||
let data2 = res;
|
||||
for (let i = 0; i < data2.length; i++) {
|
||||
that.tableDatas[i] = [];
|
||||
that.tableDatas[i][0] =
|
||||
data2[i].ep_monitored_name;
|
||||
that.tableDatas[i][1] =
|
||||
data2[i].ep_monitored_number;
|
||||
that.tableDatas[i][2] = "KW·h/t";
|
||||
let val =
|
||||
allValMonth == 0
|
||||
? "/"
|
||||
: (
|
||||
data2[i].val /
|
||||
allValMonth
|
||||
).toFixed(2);
|
||||
that.tableDatas[i][5] = val;
|
||||
that.tableDatas[i][6] = data2[i].mpoint;
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.then((res2) => {
|
||||
//昨日
|
||||
let params3 = {};
|
||||
params3.page = 0;
|
||||
params3.year_s = year_d;
|
||||
params3.month_s = month_d;
|
||||
params3.day_s = days_d;
|
||||
params3.type = "day_s";
|
||||
params3.mgroup = this.query.mgroup;
|
||||
this.$API.enm.enstat.req(params3).then((res3) => {
|
||||
if (res3.length > 0) {
|
||||
let allValDays = (that.allValDays =
|
||||
res3[0].total_production);
|
||||
params3.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(params3)
|
||||
.then((res) => {
|
||||
let data3 = res3;
|
||||
for (let j = 0; j < data3.length; j++) {
|
||||
let val =
|
||||
allValDays == 0
|
||||
? "/"
|
||||
: (
|
||||
data3[j].val /
|
||||
allValDays
|
||||
).toFixed(2);
|
||||
that.tableDatas[j][4] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
//上小时
|
||||
let params4 = {};
|
||||
params4.page = 0;
|
||||
params4.year = year_h;
|
||||
params4.month = month_h;
|
||||
params4.day = days_h;
|
||||
params4.hour = hours_h;
|
||||
params4.type = "hour_s";
|
||||
params4.mgroup = this.query.mgroup;
|
||||
this.$API.enm.enstat.req(params4).then((res4) => {
|
||||
if (res4.length > 0) {
|
||||
let hourProduct = (that.allValHour =
|
||||
res4[0].total_production);
|
||||
params4.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(params4)
|
||||
.then((res) => {
|
||||
let data4 = res4;
|
||||
for (let k = 0; k < data4.length; k++) {
|
||||
let val =
|
||||
hourProduct == 0
|
||||
? "/"
|
||||
: (
|
||||
data4[k].val /
|
||||
hourProduct
|
||||
).toFixed(2);
|
||||
that.tableDatas[k][3] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
that.getHourData();
|
||||
that.getDayData();
|
||||
that.getMonthData();
|
||||
});
|
||||
that.year = myDate.getFullYear();
|
||||
that.month = myDate.getMonth() + 1;
|
||||
that.days = myDate.getDate();
|
||||
that.hours = myDate.getHours();
|
||||
that.getMpoints();
|
||||
that.getTableHourData();
|
||||
that.getHourData(that.year, that.month, that.days);
|
||||
that.getDayData(that.year, that.month);
|
||||
that.getMonthData(that.year);
|
||||
},
|
||||
methods: {
|
||||
getMpoints() {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.mgroup__name = "回转窑";
|
||||
obj.page = 0;
|
||||
obj.enabled = 1;
|
||||
obj.need_display = 1;
|
||||
obj.ordering = "report_sortstr";
|
||||
obj.material__code__in = "elec,elec_0";
|
||||
this.$API.enm.mpoint.list.req(obj).then((res) => {
|
||||
console.log("mpoints", res);
|
||||
let arr = [];
|
||||
res.forEach((item) => {
|
||||
arr.push(item.nickname);
|
||||
});
|
||||
console.log("arr", arr);
|
||||
that.mpoints = arr;
|
||||
});
|
||||
},
|
||||
typeRadioChange() {
|
||||
this.searchDate = "";
|
||||
},
|
||||
|
|
@ -621,66 +517,152 @@ export default {
|
|||
}
|
||||
this.searchDate;
|
||||
},
|
||||
//获取小时数据
|
||||
getHourData() {
|
||||
getTableHourData() {
|
||||
let that = this;
|
||||
let query = {};
|
||||
query.page = 0;
|
||||
query.year_s = that.year;
|
||||
query.month_s = that.month;
|
||||
query.day_s = that.days;
|
||||
query.type = "hour_s";
|
||||
query.mgroup = that.query.mgroup;
|
||||
query.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat.req(query).then((response) => {
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [],
|
||||
seriesData2 = [],
|
||||
seriesData3 = [],
|
||||
seriesData4 = [],
|
||||
seriesData5 = [],
|
||||
seriesData6 = [],
|
||||
seriesData7 = [];
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.hour;
|
||||
let val = 0;
|
||||
if (that.allValHour == 0) {
|
||||
val = "";
|
||||
that.tableDatas = [];
|
||||
let timeDate = new Date().getTime();
|
||||
let hourTime = timeDate - 3600000;
|
||||
let hourDate = new Date(hourTime);
|
||||
let year_h = hourDate.getFullYear();
|
||||
let month_h = hourDate.getMonth() + 1;
|
||||
let days_h = hourDate.getDate();
|
||||
let hours_h = hourDate.getHours();
|
||||
let minutes = hourDate.getMinutes();
|
||||
month_h = month_h > 9 ? month_h : "0" + month_h;
|
||||
days_h = days_h > 9 ? days_h : "0" + days_h;
|
||||
if (hours_h > 5) {
|
||||
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
|
||||
} else {
|
||||
val = (item.val / that.allValHour).toFixed(2);
|
||||
hours_h = hours_h - 1;
|
||||
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
|
||||
}
|
||||
if (item.equip_name == "高温风机") {
|
||||
seriesData0[ind] = val;
|
||||
} else if (item.equip_name == "窑主电机") {
|
||||
seriesData1[ind] = val;
|
||||
} else if (item.equip_name == "篦冷机一室风机电机") {
|
||||
seriesData2[ind] = val;
|
||||
} else if (item.equip_name == "篦冷机二室风机电机") {
|
||||
seriesData3[ind] = val;
|
||||
} else if (item.equip_name == "篦冷机三室风机电机") {
|
||||
seriesData4[ind] = val;
|
||||
} else if (item.equip_name == "窑头排风机主电机") {
|
||||
seriesData5[ind] = val;
|
||||
} else if (
|
||||
item.equip_name == "篦冷机一室充气梁风机(左)电机"
|
||||
) {
|
||||
seriesData6[ind] = val;
|
||||
} else if (
|
||||
item.equip_name == "篦冷机一室充气梁风机(右)电机"
|
||||
) {
|
||||
seriesData7[ind] = val;
|
||||
let obj = {};
|
||||
obj.type = "hour_s";
|
||||
obj.year = year_h;
|
||||
obj.month = month_h;
|
||||
obj.day = days_h;
|
||||
obj.hour = hours_h;
|
||||
obj.mgroup__name = "回转窑";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(obj)
|
||||
.then((res) => {
|
||||
that.tableData = res;
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname);
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[3] = item.elec_consume_unit;
|
||||
obj[4] = 0;
|
||||
obj[5] = 0;
|
||||
obj[6] = item.mpoint;
|
||||
that.tableDatas[index] = obj;
|
||||
});
|
||||
let yetTime = timeDate - 3600000 * 24;
|
||||
let ystDate = new Date(yetTime);
|
||||
let year_h = ystDate.getFullYear();
|
||||
let month_h = ystDate.getMonth() + 1;
|
||||
let days_h = ystDate.getDate();
|
||||
month_h = month_h > 9 ? month_h : "0" + month_h;
|
||||
days_h = days_h > 9 ? days_h : "0" + days_h;
|
||||
let obj_d = {};
|
||||
obj_d.type = "day_s";
|
||||
obj_d.year_s = year_h;
|
||||
obj_d.month_s = month_h;
|
||||
obj_d.day_s = days_h;
|
||||
obj_d.mgroup__name = "回转窑";
|
||||
obj_d.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_d.mpoint__need_display = 1;
|
||||
obj_d.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj_d).then((res) => {
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_d = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
);
|
||||
if (that.tableDatas[index_d]) {
|
||||
that.tableDatas[index_d][3] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[4] = item.elec_consume_unit;
|
||||
obj[6] = item.mpoint;
|
||||
that.tableDatas[index_d] = obj;
|
||||
}
|
||||
});
|
||||
let obj_m = {};
|
||||
obj_m.type = "month_s";
|
||||
obj_m.year_s = that.year;
|
||||
obj_m.month_s = that.month;
|
||||
obj_m.mgroup__name = "回转窑";
|
||||
obj_m.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_m.mpoint__need_display = 1;
|
||||
obj_m.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj_m).then((res) => {
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_m = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
);
|
||||
if (that.tableDatas[index_m]) {
|
||||
that.tableDatas[index_m][4] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[5] = item.elec_consume_unit;
|
||||
obj[6] = item.mpoint;
|
||||
that.tableDatas[index_m] = obj;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(() => {});
|
||||
},
|
||||
//获取小时数据
|
||||
getHourData(year, month, days) {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.type = "hour_s";
|
||||
obj.year_s = year;
|
||||
obj.month_s = month;
|
||||
obj.day_s = days;
|
||||
obj.mgroup__name = "回转窑";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let ind = item.hour; //xAxis
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option1 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
options.series[2].data = seriesData2;
|
||||
options.series[3].data = seriesData3;
|
||||
options.series[4].data = seriesData4;
|
||||
options.series[5].data = seriesData4;
|
||||
options.series[6].data = seriesData4;
|
||||
options.series[7].data = seriesData4;
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let hourXAxis = [];
|
||||
for (let i = 0; i < 24; i++) {
|
||||
let item = i + "时";
|
||||
|
|
@ -691,67 +673,40 @@ export default {
|
|||
});
|
||||
},
|
||||
//获取天数据
|
||||
getDayData() {
|
||||
getDayData(year, month) {
|
||||
let that = this;
|
||||
let query1 = {};
|
||||
query1.page = 0;
|
||||
query1.year_s = that.year;
|
||||
query1.month_s = that.month;
|
||||
query1.type = "day_s";
|
||||
query1.mgroup = this.query.mgroup;
|
||||
query1.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.enstat.req(query1).then((response) => {
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [],
|
||||
seriesData2 = [],
|
||||
seriesData3 = [],
|
||||
seriesData4 = [],
|
||||
seriesData5 = [],
|
||||
seriesData6 = [],
|
||||
seriesData7 = [];
|
||||
let obj = {};
|
||||
obj.type = "day_s";
|
||||
obj.year_s = year;
|
||||
obj.month_s = month;
|
||||
obj.mgroup__name = "回转窑";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
// debugger;
|
||||
let ind = item.day_s;
|
||||
let val = 0;
|
||||
if (that.allValDays == 0) {
|
||||
val = "";
|
||||
} else {
|
||||
val = (item.val / that.allValDays).toFixed(2);
|
||||
}
|
||||
if (item.equip_name == "高温风机") {
|
||||
seriesData0[ind] = val;
|
||||
} else if (item.equip_name == "窑主电机") {
|
||||
seriesData1[ind] = val;
|
||||
} else if (item.equip_name == "篦冷机一室风机电机") {
|
||||
seriesData2[ind] = val;
|
||||
} else if (item.equip_name == "篦冷机二室风机电机") {
|
||||
seriesData3[ind] = val;
|
||||
} else if (item.equip_name == "篦冷机三室风机电机") {
|
||||
seriesData4[ind] = val;
|
||||
} else if (item.equip_name == "窑头排风机主电机") {
|
||||
seriesData5[ind] = val;
|
||||
} else if (
|
||||
item.equip_name == "篦冷机一室充气梁风机(左)电机"
|
||||
) {
|
||||
seriesData6[ind] = val;
|
||||
} else if (
|
||||
item.equip_name == "篦冷机一室充气梁风机(右)电机"
|
||||
) {
|
||||
seriesData7[ind] = val;
|
||||
}
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let ind = item.day_s - 1;
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option2 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
options.series[2].data = seriesData2;
|
||||
options.series[3].data = seriesData3;
|
||||
options.series[4].data = seriesData4;
|
||||
options.series[5].data = seriesData4;
|
||||
options.series[6].data = seriesData4;
|
||||
options.series[7].data = seriesData4;
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let dayXAxis = [];
|
||||
for (let i = 1; i <= that.days; i++) {
|
||||
let dayss = new Date(year, month, 0).getDate();
|
||||
for (let i = 1; i <= dayss; i++) {
|
||||
let item = i + "日";
|
||||
dayXAxis.push(item);
|
||||
}
|
||||
|
|
@ -760,65 +715,38 @@ export default {
|
|||
});
|
||||
},
|
||||
//获取月数据
|
||||
getMonthData() {
|
||||
getMonthData(year) {
|
||||
let that = this;
|
||||
let query2 = {};
|
||||
query2.page = 0;
|
||||
query2.year_s = that.year;
|
||||
query2.type = "month_s";
|
||||
query2.mgroup = that.query.mgroup;
|
||||
query2.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.enstat.req(query2).then((response) => {
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [],
|
||||
seriesData2 = [],
|
||||
seriesData3 = [],
|
||||
seriesData4 = [],
|
||||
seriesData5 = [],
|
||||
seriesData6 = [],
|
||||
seriesData7 = [];
|
||||
let obj = {};
|
||||
obj.type = "month_s";
|
||||
obj.year_s = year;
|
||||
obj.mgroup__name = "回转窑";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.month_s;
|
||||
let val = 0;
|
||||
if (that.allValMonth == 0) {
|
||||
val = "";
|
||||
} else {
|
||||
val = (item.val / that.allValMonth).toFixed(2);
|
||||
}
|
||||
if (item.equip_name == "高温风机") {
|
||||
seriesData0[ind] = val;
|
||||
} else if (item.equip_name == "窑主电机") {
|
||||
seriesData1[ind] = val;
|
||||
} else if (item.equip_name == "篦冷机一室风机电机") {
|
||||
seriesData2[ind] = val;
|
||||
} else if (item.equip_name == "篦冷机二室风机电机") {
|
||||
seriesData3[ind] = val;
|
||||
} else if (item.equip_name == "篦冷机三室风机电机") {
|
||||
seriesData4[ind] = val;
|
||||
} else if (item.equip_name == "窑头排风机主电机") {
|
||||
seriesData5[ind] = val;
|
||||
} else if (
|
||||
item.equip_name == "篦冷机一室充气梁风机(左)电机"
|
||||
) {
|
||||
seriesData6[ind] = val;
|
||||
} else if (
|
||||
item.equip_name == "篦冷机一室充气梁风机(右)电机"
|
||||
) {
|
||||
seriesData7[ind] = val;
|
||||
}
|
||||
let ind = item.month_s - 1;
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option3 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
options.series[2].data = seriesData2;
|
||||
options.series[3].data = seriesData3;
|
||||
options.series[4].data = seriesData4;
|
||||
options.series[5].data = seriesData4;
|
||||
options.series[6].data = seriesData4;
|
||||
options.series[7].data = seriesData4;
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let monthXAxis = [];
|
||||
for (let i = 1; i <= that.month; i++) {
|
||||
for (let i = 1; i < 13; i++) {
|
||||
let item = i + "月";
|
||||
monthXAxis.push(item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,6 +247,7 @@ export default {
|
|||
["循环风机1906", "", "KW·h/t", "", "", ""],
|
||||
["系统风机", "", "KW·h/t", "", "", ""],
|
||||
],
|
||||
tableData: [],
|
||||
modelValue: true,
|
||||
type: "hour_s",
|
||||
title: "水泥磨工段",
|
||||
|
|
@ -258,6 +259,7 @@ export default {
|
|||
allValHour: 0,
|
||||
allValDays: 0,
|
||||
allValMonth: 0,
|
||||
mpoints: [],
|
||||
option1: {
|
||||
color: colors,
|
||||
tooltip: tooltip,
|
||||
|
|
@ -420,148 +422,39 @@ export default {
|
|||
};
|
||||
},
|
||||
mounted() {
|
||||
//水泥磨
|
||||
let that = this;
|
||||
var myDate = new Date();
|
||||
let year = myDate.getFullYear();
|
||||
let month = myDate.getMonth() + 1;
|
||||
let days = myDate.getDate();
|
||||
let hours = myDate.getHours();
|
||||
let timeDate = myDate.getTime();
|
||||
that.timeStamp = timeDate;
|
||||
let dayTime = 24 * 60 * 60 * 1000;
|
||||
//昨天的计算
|
||||
let year_d = year,
|
||||
month_d = month,
|
||||
days_d = days;
|
||||
if (hours < 21) {
|
||||
//21点前,查找昨日数据为前一天数据
|
||||
let newDate = timeDate - dayTime;
|
||||
let lastDate = new Date(newDate);
|
||||
year_d = lastDate.getFullYear();
|
||||
month_d = lastDate.getMonth() + 1;
|
||||
days_d = lastDate.getDate();
|
||||
}
|
||||
//上一小时的计算
|
||||
let hourTime = timeDate - 3600000;
|
||||
let hourDate = new Date(hourTime);
|
||||
let year_h = hourDate.getFullYear();
|
||||
let month_h = hourDate.getMonth() + 1;
|
||||
let days_h = hourDate.getDate();
|
||||
let hours_h = hourDate.getHours();
|
||||
this.$API.mtm.mgroup.list
|
||||
.req({ page: 0, search: "水泥磨" })
|
||||
.then((res) => {
|
||||
console.log("水泥磨", res);
|
||||
that.query.mgroup = res[0].id;
|
||||
//本月
|
||||
let params2 = {};
|
||||
params2.page = 0;
|
||||
params2.year_s = year;
|
||||
params2.month_s = month;
|
||||
params2.type = "month_s";
|
||||
params2.mgroup = this.query.mgroup;
|
||||
this.$API.enm.enstat
|
||||
.req(params2)
|
||||
.then((res2) => {
|
||||
if (res2.length > 0) {
|
||||
let allValMonth = (that.allValMonth =
|
||||
res2[0].total_production); //当前条件下的总产量
|
||||
params2.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(params2)
|
||||
.then((res) => {
|
||||
let data2 = res;
|
||||
for (let i = 0; i < data2.length; i++) {
|
||||
that.tableDatas[i] = [];
|
||||
that.tableDatas[i][0] =
|
||||
data2[i].ep_monitored_name;
|
||||
that.tableDatas[i][1] =
|
||||
data2[i].ep_monitored_number;
|
||||
that.tableDatas[i][2] = "KW·h/t";
|
||||
let val =
|
||||
allValMonth == 0
|
||||
? "/"
|
||||
: (
|
||||
data2[i].val /
|
||||
allValMonth
|
||||
).toFixed(2);
|
||||
that.tableDatas[i][5] = val;
|
||||
that.tableDatas[i][6] = data2[i].mpoint;
|
||||
}
|
||||
debugger;
|
||||
console.log(that.tableDatas);
|
||||
});
|
||||
}
|
||||
})
|
||||
.then((res2) => {
|
||||
//昨日
|
||||
let params3 = {};
|
||||
params3.page = 0;
|
||||
params3.year_s = year_d;
|
||||
params3.month_s = month_d;
|
||||
params3.day_s = days_d;
|
||||
params3.type = "day_s";
|
||||
params3.mgroup = this.query.mgroup;
|
||||
this.$API.enm.enstat.req(params3).then((res3) => {
|
||||
if (res3.length > 0) {
|
||||
let allValDays = (that.allValDays =
|
||||
res3[0].total_production);
|
||||
params3.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(params3)
|
||||
.then((res) => {
|
||||
let data3 = res3;
|
||||
for (let j = 0; j < data3.length; j++) {
|
||||
let val =
|
||||
allValDays == 0
|
||||
? "/"
|
||||
: (
|
||||
data3[j].val /
|
||||
allValDays
|
||||
).toFixed(2);
|
||||
that.tableDatas[j][4] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
//上小时
|
||||
let params4 = {};
|
||||
params4.page = 0;
|
||||
params4.year = year_h;
|
||||
params4.month = month_h;
|
||||
params4.day = days_h;
|
||||
params4.hour = hours_h;
|
||||
params4.type = "hour_s";
|
||||
params4.mgroup = this.query.mgroup;
|
||||
this.$API.enm.enstat.req(params4).then((res4) => {
|
||||
if (res4.length > 0) {
|
||||
let hourProduct = (that.allValHour =
|
||||
res4[0].total_production);
|
||||
params4.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(params4)
|
||||
.then((res) => {
|
||||
let data4 = res4;
|
||||
for (let k = 0; k < data4.length; k++) {
|
||||
let val =
|
||||
hourProduct == 0
|
||||
? "/"
|
||||
: (
|
||||
data4[k].val /
|
||||
hourProduct
|
||||
).toFixed(2);
|
||||
that.tableDatas[k][3] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
that.getHourData();
|
||||
that.getDayData();
|
||||
that.getMonthData();
|
||||
});
|
||||
that.year = myDate.getFullYear();
|
||||
that.month = myDate.getMonth() + 1;
|
||||
that.days = myDate.getDate();
|
||||
that.hours = myDate.getHours();
|
||||
that.getMpoints();
|
||||
that.getTableHourData();
|
||||
that.getHourData(that.year, that.month, that.days);
|
||||
that.getDayData(that.year, that.month);
|
||||
that.getMonthData(that.year);
|
||||
},
|
||||
methods: {
|
||||
getMpoints() {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.mgroup__name = "水泥磨";
|
||||
obj.page = 0;
|
||||
obj.enabled = 1;
|
||||
obj.need_display = 1;
|
||||
obj.ordering = "report_sortstr";
|
||||
obj.material__code__in = "elec,elec_0";
|
||||
this.$API.enm.mpoint.list.req(obj).then((res) => {
|
||||
console.log("mpoints", res);
|
||||
let arr = [];
|
||||
res.forEach((item) => {
|
||||
arr.push(item.nickname);
|
||||
});
|
||||
console.log("arr", arr);
|
||||
that.mpoints = arr;
|
||||
});
|
||||
},
|
||||
typeRadioChange() {
|
||||
this.searchDate = "";
|
||||
},
|
||||
|
|
@ -581,58 +474,152 @@ export default {
|
|||
}
|
||||
this.searchDate;
|
||||
},
|
||||
//获取小时数据
|
||||
getHourData() {
|
||||
getTableHourData() {
|
||||
let that = this;
|
||||
let query = {};
|
||||
query.page = 0;
|
||||
query.year_s = that.year;
|
||||
query.month_s = that.month;
|
||||
query.day_s = that.days;
|
||||
query.type = "hour_s";
|
||||
query.mgroup = that.query.mgroup;
|
||||
query.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat.req(query).then((response) => {
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [],
|
||||
seriesData2 = [],
|
||||
seriesData3 = [],
|
||||
seriesData4 = [],
|
||||
seriesData5 = [],
|
||||
seriesData6 = [];
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.hour;
|
||||
let val = 0;
|
||||
if (that.allValHour == 0) {
|
||||
val = "";
|
||||
that.tableDatas = [];
|
||||
let timeDate = new Date().getTime();
|
||||
let hourTime = timeDate - 3600000;
|
||||
let hourDate = new Date(hourTime);
|
||||
let year_h = hourDate.getFullYear();
|
||||
let month_h = hourDate.getMonth() + 1;
|
||||
let days_h = hourDate.getDate();
|
||||
let hours_h = hourDate.getHours();
|
||||
let minutes = hourDate.getMinutes();
|
||||
month_h = month_h > 9 ? month_h : "0" + month_h;
|
||||
days_h = days_h > 9 ? days_h : "0" + days_h;
|
||||
if (hours_h > 5) {
|
||||
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
|
||||
} else {
|
||||
val = (item.val / that.allValHour).toFixed(2);
|
||||
hours_h = hours_h - 1;
|
||||
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
|
||||
}
|
||||
if (item.equip_name == "循环风机1906") {
|
||||
seriesData0[ind] = val;
|
||||
} else if (item.equip_name == "系统风机") {
|
||||
seriesData1[ind] = val;
|
||||
} else if (item.equip_name == "水平涡流选粉机") {
|
||||
seriesData2[ind] = val;
|
||||
} else if (item.equip_name == "水泥磨主电机") {
|
||||
seriesData3[ind] = val;
|
||||
} else if (item.equip_name == "辊压机动辊电机") {
|
||||
seriesData4[ind] = val;
|
||||
} else if (item.equip_name == "辊压机定辊电机") {
|
||||
seriesData5[ind] = val;
|
||||
} else if (item.equip_name == "新增磨尾风机") {
|
||||
seriesData6[ind] = val;
|
||||
let obj = {};
|
||||
obj.type = "hour_s";
|
||||
obj.year = year_h;
|
||||
obj.month = month_h;
|
||||
obj.day = days_h;
|
||||
obj.hour = hours_h;
|
||||
obj.mgroup__name = "水泥磨";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(obj)
|
||||
.then((res) => {
|
||||
that.tableData = res;
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname);
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[3] = item.elec_consume_unit;
|
||||
obj[4] = 0;
|
||||
obj[5] = 0;
|
||||
obj[6] = item.mpoint;
|
||||
that.tableDatas[index] = obj;
|
||||
});
|
||||
let yetTime = timeDate - 3600000 * 24;
|
||||
let ystDate = new Date(yetTime);
|
||||
let year_h = ystDate.getFullYear();
|
||||
let month_h = ystDate.getMonth() + 1;
|
||||
let days_h = ystDate.getDate();
|
||||
month_h = month_h > 9 ? month_h : "0" + month_h;
|
||||
days_h = days_h > 9 ? days_h : "0" + days_h;
|
||||
let obj_d = {};
|
||||
obj_d.type = "day_s";
|
||||
obj_d.year_s = year_h;
|
||||
obj_d.month_s = month_h;
|
||||
obj_d.day_s = days_h;
|
||||
obj_d.mgroup__name = "水泥磨";
|
||||
obj_d.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_d.mpoint__need_display = 1;
|
||||
obj_d.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj_d).then((res) => {
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_d = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
);
|
||||
if (that.tableDatas[index_d]) {
|
||||
that.tableDatas[index_d][3] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[4] = item.elec_consume_unit;
|
||||
obj[6] = item.mpoint;
|
||||
that.tableDatas[index_d] = obj;
|
||||
}
|
||||
});
|
||||
let obj_m = {};
|
||||
obj_m.type = "month_s";
|
||||
obj_m.year_s = that.year;
|
||||
obj_m.month_s = that.month;
|
||||
obj_m.mgroup__name = "水泥磨";
|
||||
obj_m.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_m.mpoint__need_display = 1;
|
||||
obj_m.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj_m).then((res) => {
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_m = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
);
|
||||
if (that.tableDatas[index_m]) {
|
||||
that.tableDatas[index_m][4] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[5] = item.elec_consume_unit;
|
||||
obj[6] = item.mpoint;
|
||||
that.tableDatas[index_m] = obj;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(() => {});
|
||||
},
|
||||
//获取小时数据
|
||||
getHourData(year, month, days) {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.type = "hour_s";
|
||||
obj.year_s = year;
|
||||
obj.month_s = month;
|
||||
obj.day_s = days;
|
||||
obj.mgroup__name = "水泥磨";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let ind = item.hour; //xAxis
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option1 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
options.series[2].data = seriesData2;
|
||||
options.series[3].data = seriesData3;
|
||||
options.series[4].data = seriesData4;
|
||||
options.series[5].data = seriesData4;
|
||||
options.series[6].data = seriesData4;
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let hourXAxis = [];
|
||||
for (let i = 0; i < 24; i++) {
|
||||
let item = i + "时";
|
||||
|
|
@ -643,59 +630,40 @@ export default {
|
|||
});
|
||||
},
|
||||
//获取天数据
|
||||
getDayData() {
|
||||
getDayData(year, month) {
|
||||
let that = this;
|
||||
let query1 = {};
|
||||
query1.page = 0;
|
||||
query1.year_s = that.year;
|
||||
query1.month_s = that.month;
|
||||
query1.type = "day_s";
|
||||
query1.mgroup = this.query.mgroup;
|
||||
query1.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.enstat.req(query1).then((response) => {
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [],
|
||||
seriesData2 = [],
|
||||
seriesData3 = [],
|
||||
seriesData4 = [],
|
||||
seriesData5 = [],
|
||||
seriesData6 = [];
|
||||
let obj = {};
|
||||
obj.type = "day_s";
|
||||
obj.year_s = year;
|
||||
obj.month_s = month;
|
||||
obj.mgroup__name = "水泥磨";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
// debugger;
|
||||
let ind = item.day_s;
|
||||
let val = 0;
|
||||
if (that.allValDays == 0) {
|
||||
val = "";
|
||||
} else {
|
||||
val = (item.val / that.allValDays).toFixed(2);
|
||||
}
|
||||
if (item.equip_name == "循环风机1906") {
|
||||
seriesData0[ind] = val;
|
||||
} else if (item.equip_name == "系统风机") {
|
||||
seriesData1[ind] = val;
|
||||
} else if (item.equip_name == "水平涡流选粉机") {
|
||||
seriesData2[ind] = val;
|
||||
} else if (item.equip_name == "水泥磨主电机") {
|
||||
seriesData3[ind] = val;
|
||||
} else if (item.equip_name == "辊压机动辊电机") {
|
||||
seriesData4[ind] = val;
|
||||
} else if (item.equip_name == "辊压机定辊电机") {
|
||||
seriesData5[ind] = val;
|
||||
} else if (item.equip_name == "新增磨尾风机") {
|
||||
seriesData6[ind] = val;
|
||||
}
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let ind = item.day_s - 1;
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option2 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
options.series[2].data = seriesData2;
|
||||
options.series[3].data = seriesData3;
|
||||
options.series[4].data = seriesData4;
|
||||
options.series[5].data = seriesData4;
|
||||
options.series[6].data = seriesData4;
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let dayXAxis = [];
|
||||
for (let i = 1; i <= that.days; i++) {
|
||||
let dayss = new Date(year, month, 0).getDate();
|
||||
for (let i = 1; i <= dayss; i++) {
|
||||
let item = i + "日";
|
||||
dayXAxis.push(item);
|
||||
}
|
||||
|
|
@ -704,57 +672,38 @@ export default {
|
|||
});
|
||||
},
|
||||
//获取月数据
|
||||
getMonthData() {
|
||||
getMonthData(year) {
|
||||
let that = this;
|
||||
let query2 = {};
|
||||
query2.page = 0;
|
||||
query2.year_s = that.year;
|
||||
query2.type = "month_s";
|
||||
query2.mgroup = that.query.mgroup;
|
||||
query2.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.enstat.req(query2).then((response) => {
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [],
|
||||
seriesData2 = [],
|
||||
seriesData3 = [],
|
||||
seriesData4 = [],
|
||||
seriesData5 = [],
|
||||
seriesData6 = [];
|
||||
let obj = {};
|
||||
obj.type = "month_s";
|
||||
obj.year_s = year;
|
||||
obj.mgroup__name = "水泥磨";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.month_s;
|
||||
let val = 0;
|
||||
if (that.allValMonth == 0) {
|
||||
val = "";
|
||||
} else {
|
||||
val = (item.val / that.allValMonth).toFixed(2);
|
||||
}
|
||||
if (item.equip_name == "循环风机1906") {
|
||||
seriesData0[ind] = val;
|
||||
} else if (item.equip_name == "系统风机") {
|
||||
seriesData1[ind] = val;
|
||||
} else if (item.equip_name == "水平涡流选粉机") {
|
||||
seriesData2[ind] = val;
|
||||
} else if (item.equip_name == "水泥磨主电机") {
|
||||
seriesData3[ind] = val;
|
||||
} else if (item.equip_name == "辊压机动辊电机") {
|
||||
seriesData4[ind] = val;
|
||||
} else if (item.equip_name == "辊压机定辊电机") {
|
||||
seriesData5[ind] = val;
|
||||
} else if (item.equip_name == "新增磨尾风机") {
|
||||
seriesData6[ind] = val;
|
||||
}
|
||||
let ind = item.month_s - 1;
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option3 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
options.series[2].data = seriesData2;
|
||||
options.series[3].data = seriesData3;
|
||||
options.series[4].data = seriesData4;
|
||||
options.series[5].data = seriesData4;
|
||||
options.series[6].data = seriesData4;
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let monthXAxis = [];
|
||||
for (let i = 1; i <= that.month; i++) {
|
||||
for (let i = 1; i < 13; i++) {
|
||||
let item = i + "月";
|
||||
monthXAxis.push(item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ export default {
|
|||
// ['废气风机','','KW·h/t','','',''],
|
||||
// ['尾排风机','','KW·h/t','','',''],
|
||||
],
|
||||
|
||||
tableData: [],
|
||||
modelValue: true,
|
||||
type: "hour_s",
|
||||
title: "原料磨工段",
|
||||
|
|
@ -395,148 +395,43 @@ export default {
|
|||
},
|
||||
],
|
||||
},
|
||||
mpoints: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// 原料磨
|
||||
let that = this;
|
||||
var myDate = new Date();
|
||||
let year = (that.year = myDate.getFullYear());
|
||||
let month = (that.month = myDate.getMonth() + 1);
|
||||
let days = (that.days = myDate.getDate());
|
||||
let hours = (that.hours = myDate.getHours());
|
||||
let timeDate = myDate.getTime();
|
||||
let dayTime = 24 * 60 * 60 * 1000;
|
||||
//昨天的计算
|
||||
let year_d = year,
|
||||
month_d = month,
|
||||
days_d = days;
|
||||
if (hours < 21) {
|
||||
//21点前,查找昨日数据为前一天数据
|
||||
let newDate = timeDate - dayTime;
|
||||
let lastDate = new Date(newDate);
|
||||
year_d = lastDate.getFullYear();
|
||||
month_d = lastDate.getMonth() + 1;
|
||||
days_d = lastDate.getDate();
|
||||
}
|
||||
//上一小时的计算
|
||||
let hourTime = timeDate - 3600000;
|
||||
let hourDate = new Date(hourTime);
|
||||
let year_h = hourDate.getFullYear();
|
||||
let month_h = hourDate.getMonth() + 1;
|
||||
let days_h = hourDate.getDate();
|
||||
let hours_h = hourDate.getHours();
|
||||
this.$API.mtm.mgroup.list
|
||||
.req({ page: 0, search: "原料磨" })
|
||||
.then((res) => {
|
||||
console.log("原料磨", res);
|
||||
that.query.mgroup = res[0].id;
|
||||
//本月
|
||||
let params2 = {};
|
||||
params2.page = 0;
|
||||
params2.year_s = year;
|
||||
params2.month_s = month;
|
||||
params2.type = "month_s";
|
||||
params2.mgroup = this.query.mgroup;
|
||||
this.$API.enm.enstat
|
||||
.req(params2)
|
||||
.then((res2) => {
|
||||
if (res2.length > 0) {
|
||||
let hourProduct = (that.allValMonth =
|
||||
res2[0].total_production); //当前条件下的总产量
|
||||
params2.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(params2)
|
||||
.then((res) => {
|
||||
let data2 = res;
|
||||
for (let i = 0; i < data2.length; i++) {
|
||||
that.tableDatas[i] = [];
|
||||
that.tableDatas[i][0] =
|
||||
data2[i].ep_monitored_name;
|
||||
that.tableDatas[i][1] =
|
||||
data2[i].ep_monitored_number;
|
||||
that.tableDatas[i][2] = "KW·h/t";
|
||||
let val =
|
||||
hourProduct == 0
|
||||
? "/"
|
||||
: (
|
||||
data2[i].val /
|
||||
hourProduct
|
||||
).toFixed(2);
|
||||
that.tableDatas[i][5] = val;
|
||||
that.tableDatas[i][6] = data2[i].mpoint;
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.then((res2) => {
|
||||
//昨日
|
||||
let params3 = {};
|
||||
params3.page = 0;
|
||||
params3.year_s = year_d;
|
||||
params3.month_s = month_d;
|
||||
params3.day_s = days_d;
|
||||
params3.type = "day_s";
|
||||
params3.mgroup = this.query.mgroup;
|
||||
this.$API.enm.enstat.req(params3).then((res3) => {
|
||||
if (res3.length > 0) {
|
||||
let hourProduct = (that.allValDays =
|
||||
res3[0].total_production);
|
||||
params3.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(params3)
|
||||
.then((res) => {
|
||||
let data3 = res3;
|
||||
for (let j = 0; j < data3.length; j++) {
|
||||
let val =
|
||||
hourProduct == 0
|
||||
? "/"
|
||||
: (
|
||||
data3[j].val /
|
||||
hourProduct
|
||||
).toFixed(2);
|
||||
that.tableDatas[j][4] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
//上小时
|
||||
let params4 = {};
|
||||
params4.page = 0;
|
||||
params4.year_s = year_h;
|
||||
params4.month_s = month_h;
|
||||
params4.day_s = days_h;
|
||||
params4.hour_s = hours_h;
|
||||
params4.type = "hour_s";
|
||||
params4.mgroup = this.query.mgroup;
|
||||
this.$API.enm.enstat.req(params4).then((res4) => {
|
||||
if (res4.length > 0) {
|
||||
let hourProduct = (that.allValHour =
|
||||
res4[0].total_production);
|
||||
params4.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(params4)
|
||||
.then((res) => {
|
||||
let data4 = res4;
|
||||
for (let k = 0; k < data4.length; k++) {
|
||||
let val =
|
||||
hourProduct == 0
|
||||
? "/"
|
||||
: (
|
||||
data4[k].val /
|
||||
hourProduct
|
||||
).toFixed(2);
|
||||
that.tableDatas[k][3] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
that.getHourData();
|
||||
that.getDayData();
|
||||
that.getMonthData();
|
||||
});
|
||||
that.year = myDate.getFullYear();
|
||||
that.month = myDate.getMonth() + 1;
|
||||
that.days = myDate.getDate();
|
||||
that.hours = myDate.getHours();
|
||||
that.getMpoints();
|
||||
that.getTableHourData();
|
||||
that.getHourData(that.year, that.month, that.days);
|
||||
that.getDayData(that.year, that.month);
|
||||
that.getMonthData(that.year);
|
||||
},
|
||||
methods: {
|
||||
getMpoints() {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.mgroup__name = "原料磨";
|
||||
obj.page = 0;
|
||||
obj.enabled = 1;
|
||||
obj.need_display = 1;
|
||||
obj.ordering = "report_sortstr";
|
||||
obj.material__code__in = "elec,elec_0";
|
||||
this.$API.enm.mpoint.list.req(obj).then((res) => {
|
||||
console.log("mpoints", res);
|
||||
let arr = [];
|
||||
res.forEach((item) => {
|
||||
arr.push(item.nickname);
|
||||
});
|
||||
console.log("arr", arr);
|
||||
that.mpoints = arr;
|
||||
});
|
||||
},
|
||||
typeRadioChange() {
|
||||
this.searchDate = "";
|
||||
},
|
||||
|
|
@ -554,51 +449,154 @@ export default {
|
|||
} else {
|
||||
this.getMonthData(val);
|
||||
}
|
||||
this.searchDate;
|
||||
},
|
||||
//获取小时数据
|
||||
getHourData() {
|
||||
getTableHourData() {
|
||||
let that = this;
|
||||
let query = {};
|
||||
query.page = 0;
|
||||
query.year_s = that.year;
|
||||
query.month_s = that.month;
|
||||
query.day_s = that.days;
|
||||
query.type = "hour_s";
|
||||
query.mgroup = that.query.mgroup;
|
||||
query.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat.req(query).then((response) => {
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [],
|
||||
seriesData2 = [],
|
||||
seriesData3 = [],
|
||||
seriesData4 = [];
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.hour;
|
||||
let val = 0;
|
||||
if (that.allValHour == 0) {
|
||||
val = "";
|
||||
that.tableDatas = [];
|
||||
let timeDate = new Date().getTime();
|
||||
let hourTime = timeDate - 3600000;
|
||||
let hourDate = new Date(hourTime);
|
||||
let year_h = hourDate.getFullYear();
|
||||
let month_h = hourDate.getMonth() + 1;
|
||||
let days_h = hourDate.getDate();
|
||||
let hours_h = hourDate.getHours();
|
||||
let minutes = hourDate.getMinutes();
|
||||
month_h = month_h > 9 ? month_h : "0" + month_h;
|
||||
days_h = days_h > 9 ? days_h : "0" + days_h;
|
||||
if (hours_h > 5) {
|
||||
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
|
||||
} else {
|
||||
val = (item.val / that.allValHour).toFixed(2);
|
||||
hours_h = hours_h - 1;
|
||||
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
|
||||
}
|
||||
if (item.equip_name == "立磨主电机") {
|
||||
seriesData0[ind] = val;
|
||||
} else if (item.equip_name == "循环风机") {
|
||||
seriesData1[ind] = val;
|
||||
} else if (item.equip_name == "烘干破主") {
|
||||
seriesData2[ind] = val;
|
||||
} else if (item.equip_name == "废气风机") {
|
||||
seriesData3[ind] = val;
|
||||
} else if (item.equip_name == "尾排风机") {
|
||||
seriesData4[ind] = val;
|
||||
let obj = {};
|
||||
obj.type = "hour_s";
|
||||
obj.year = year_h;
|
||||
obj.month = month_h;
|
||||
obj.day = days_h;
|
||||
obj.hour = hours_h;
|
||||
obj.mgroup__name = "原料磨";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(obj)
|
||||
.then((res) => {
|
||||
that.tableData = res;
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname);
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[3] = item.elec_consume_unit;
|
||||
obj[4] = 0;
|
||||
obj[5] = 0;
|
||||
obj[6] = item.mpoint;
|
||||
that.tableDatas[index] = obj;
|
||||
});
|
||||
let yetTime = timeDate - 3600000 * 24;
|
||||
let ystDate = new Date(yetTime);
|
||||
let year_h = ystDate.getFullYear();
|
||||
let month_h = ystDate.getMonth() + 1;
|
||||
let days_h = ystDate.getDate();
|
||||
month_h = month_h > 9 ? month_h : "0" + month_h;
|
||||
days_h = days_h > 9 ? days_h : "0" + days_h;
|
||||
let obj_d = {};
|
||||
obj_d.type = "day_s";
|
||||
obj_d.year_s = year_h;
|
||||
obj_d.month_s = month_h;
|
||||
obj_d.day_s = days_h;
|
||||
obj_d.mgroup__name = "原料磨";
|
||||
obj_d.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_d.mpoint__need_display = 1;
|
||||
obj_d.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj_d).then((res) => {
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_d = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
);
|
||||
if (that.tableDatas[index_d]) {
|
||||
that.tableDatas[index_d][3] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[4] = item.elec_consume_unit;
|
||||
obj[6] = item.mpoint;
|
||||
that.tableDatas[index_d] = obj;
|
||||
}
|
||||
});
|
||||
let obj_m = {};
|
||||
obj_m.type = "month_s";
|
||||
obj_m.year_s = that.year;
|
||||
obj_m.month_s = that.month;
|
||||
obj_m.mgroup__name = "原料磨";
|
||||
obj_m.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_m.mpoint__need_display = 1;
|
||||
obj_m.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj_m).then((res) => {
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_m = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
);
|
||||
if (that.tableDatas[index_m]) {
|
||||
that.tableDatas[index_m][4] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[5] = item.elec_consume_unit;
|
||||
obj[6] = item.mpoint;
|
||||
that.tableDatas[index_m] = obj;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(() => {});
|
||||
},
|
||||
//获取小时数据
|
||||
getHourData(year, month, days) {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.type = "hour_s";
|
||||
obj.year_s = year;
|
||||
obj.month_s = month;
|
||||
obj.day_s = days;
|
||||
obj.mgroup__name = "原料磨";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let ind = item.hour; //xAxis
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option1 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
options.series[2].data = seriesData2;
|
||||
options.series[3].data = seriesData3;
|
||||
options.series[4].data = seriesData4;
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let hourXAxis = [];
|
||||
for (let i = 0; i < 24; i++) {
|
||||
let item = i + "时";
|
||||
|
|
@ -609,50 +607,40 @@ export default {
|
|||
});
|
||||
},
|
||||
//获取天数据
|
||||
getDayData() {
|
||||
getDayData(year, month) {
|
||||
let that = this;
|
||||
let query1 = {};
|
||||
query1.page = 0;
|
||||
query1.year_s = that.year;
|
||||
query1.month_s = that.month;
|
||||
query1.type = "day_s";
|
||||
query1.mgroup = this.query.mgroup;
|
||||
query1.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.enstat.req(query1).then((response) => {
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [],
|
||||
seriesData2 = [],
|
||||
seriesData3 = [],
|
||||
seriesData4 = [];
|
||||
let obj = {};
|
||||
obj.type = "day_s";
|
||||
obj.year_s = year;
|
||||
obj.month_s = month;
|
||||
obj.mgroup__name = "原料磨";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.day_s;
|
||||
let val = 0;
|
||||
if (that.allValDays == 0) {
|
||||
val = "";
|
||||
} else {
|
||||
val = (item.val / that.allValDays).toFixed(2);
|
||||
}
|
||||
if (item.equip_name == "立磨主电机") {
|
||||
seriesData0[ind] = val;
|
||||
} else if (item.equip_name == "循环风机") {
|
||||
seriesData1[ind] = val;
|
||||
} else if (item.equip_name == "烘干破主") {
|
||||
seriesData2[ind] = val;
|
||||
} else if (item.equip_name == "废气风机") {
|
||||
seriesData3[ind] = val;
|
||||
} else if (item.equip_name == "尾排风机") {
|
||||
seriesData4[ind] = val;
|
||||
}
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let ind = item.day_s - 1;
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option2 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
options.series[2].data = seriesData2;
|
||||
options.series[3].data = seriesData3;
|
||||
options.series[4].data = seriesData4;
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let dayXAxis = [];
|
||||
for (let i = 1; i <= that.days; i++) {
|
||||
let dayss = new Date(year, month, 0).getDate();
|
||||
for (let i = 1; i <= dayss; i++) {
|
||||
let item = i + "日";
|
||||
dayXAxis.push(item);
|
||||
}
|
||||
|
|
@ -661,49 +649,38 @@ export default {
|
|||
});
|
||||
},
|
||||
//获取月数据
|
||||
getMonthData() {
|
||||
getMonthData(year) {
|
||||
let that = this;
|
||||
let query2 = {};
|
||||
query2.page = 0;
|
||||
query2.year_s = that.year;
|
||||
query2.type = "month_s";
|
||||
query2.mgroup = that.query.mgroup;
|
||||
query2.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.enstat.req(query2).then((response) => {
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [],
|
||||
seriesData2 = [],
|
||||
seriesData3 = [],
|
||||
seriesData4 = [];
|
||||
let obj = {};
|
||||
obj.type = "month_s";
|
||||
obj.year_s = year;
|
||||
obj.mgroup__name = "原料磨";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.month_s;
|
||||
let val = 0;
|
||||
if (that.allValMonth == 0) {
|
||||
val = "";
|
||||
} else {
|
||||
val = (item.val / that.allValMonth).toFixed(2);
|
||||
}
|
||||
if (item.equip_name == "立磨主电机") {
|
||||
seriesData0[ind] = val;
|
||||
} else if (item.equip_name == "循环风机") {
|
||||
seriesData1[ind] = val;
|
||||
} else if (item.equip_name == "烘干破主") {
|
||||
seriesData2[ind] = val;
|
||||
} else if (item.equip_name == "废气风机") {
|
||||
seriesData3[ind] = val;
|
||||
} else if (item.equip_name == "尾排风机") {
|
||||
seriesData4[ind] = val;
|
||||
}
|
||||
let ind = item.month_s - 1;
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option3 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
options.series[2].data = seriesData2;
|
||||
options.series[3].data = seriesData3;
|
||||
options.series[4].data = seriesData4;
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let monthXAxis = [];
|
||||
for (let i = 1; i <= that.month; i++) {
|
||||
for (let i = 1; i < 13; i++) {
|
||||
let item = i + "月";
|
||||
monthXAxis.push(item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,18 +189,21 @@ export default {
|
|||
exportLoading: false,
|
||||
chartShow: false,
|
||||
myOption: null,
|
||||
timeStamp: null,
|
||||
optionDay: {},
|
||||
optionMonth: {},
|
||||
year: 2023,
|
||||
month: 1,
|
||||
days: 1,
|
||||
query: {
|
||||
mgroup: "",
|
||||
},
|
||||
mpoint: "",
|
||||
tableName: "主要设备(100KW以上)单位产品电耗数据表",
|
||||
tableDatas: [["烘干破主电机", "", "kw.h/t", "", "", ""]],
|
||||
tableData: [],
|
||||
modelValue: true,
|
||||
type: "hour_s",
|
||||
type: "day_s",
|
||||
title: "电石渣工段",
|
||||
cate: "",
|
||||
apiObj: this.$API.enm.mpoint.stat,
|
||||
|
|
@ -209,7 +212,7 @@ export default {
|
|||
asynDialog: false,
|
||||
allValDays: 0,
|
||||
allValMonth: 0,
|
||||
option1: {
|
||||
option2: {
|
||||
color: colors,
|
||||
tooltip: tooltip,
|
||||
grid: grid,
|
||||
|
|
@ -230,7 +233,7 @@ export default {
|
|||
data: [],
|
||||
},
|
||||
},
|
||||
option2: {
|
||||
option3: {
|
||||
color: colors,
|
||||
tooltip: tooltip,
|
||||
grid: grid,
|
||||
|
|
@ -264,156 +267,176 @@ export default {
|
|||
data: [],
|
||||
},
|
||||
},
|
||||
mpoints: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
let that = this;
|
||||
var myDate = new Date();
|
||||
let year = myDate.getFullYear();
|
||||
let month = myDate.getMonth() + 1;
|
||||
let days = myDate.getDate();
|
||||
let hours = myDate.getHours();
|
||||
let timeDate = myDate.getTime();
|
||||
this.timeStamp = timeDate;
|
||||
this.year = year;
|
||||
this.month = month;
|
||||
this.days = days;
|
||||
|
||||
let dayTime = 24 * 60 * 60 * 1000;
|
||||
//昨天的计算
|
||||
let year_d = year,
|
||||
month_d = month,
|
||||
days_d = days;
|
||||
if (hours < 21) {
|
||||
//21点前,查找昨日数据为前一天数据
|
||||
let newDate = timeDate - dayTime;
|
||||
let lastDate = new Date(newDate);
|
||||
year_d = lastDate.getFullYear();
|
||||
month_d = lastDate.getMonth() + 1;
|
||||
days_d = lastDate.getDate();
|
||||
}
|
||||
this.$API.mtm.mgroup.list
|
||||
.req({ page: 0, search: "电石渣" })
|
||||
.then((res) => {
|
||||
console.log("电石渣", res);
|
||||
that.query.mgroup = res[0].id;
|
||||
//本月
|
||||
let params2 = {};
|
||||
params2.page = 0;
|
||||
params2.year_s = year;
|
||||
params2.month_s = month;
|
||||
params2.type = "month_s";
|
||||
params2.mgroup = this.query.mgroup;
|
||||
this.$API.enm.enstat
|
||||
.req(params2)
|
||||
.then((res2) => {
|
||||
if (res2.length > 0) {
|
||||
let allValMonth = (that.allValMonth =
|
||||
res2[0].total_production); //当前条件下的总产量
|
||||
params2.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(params2)
|
||||
.then((res) => {
|
||||
let data2 = res;
|
||||
for (let i = 0; i < data2.length; i++) {
|
||||
that.tableDatas[i] = [];
|
||||
that.tableDatas[i][0] =
|
||||
data2[i].ep_monitored_name;
|
||||
that.tableDatas[i][1] =
|
||||
data2[i].ep_monitored_number;
|
||||
that.tableDatas[i][2] = "KW·h/t";
|
||||
let val =
|
||||
allValMonth == 0
|
||||
? "/"
|
||||
: (
|
||||
data2[i].val /
|
||||
allValMonth
|
||||
).toFixed(2);
|
||||
that.tableDatas[i][4] = val;
|
||||
that.tableDatas[i][5] = data2[i].mpoint;
|
||||
}
|
||||
that.year = myDate.getFullYear();
|
||||
that.month = myDate.getMonth() + 1;
|
||||
that.days = myDate.getDate();
|
||||
that.getMpoints();
|
||||
that.getTableHourData();
|
||||
that.getDayData(that.year, that.month);
|
||||
that.getMonthData(that.year);
|
||||
let obj = {};
|
||||
obj.mgroup__name = "电石渣";
|
||||
obj.page = 0;
|
||||
obj.enabled = 1;
|
||||
obj.need_display = 1;
|
||||
obj.ordering = "report_sortstr";
|
||||
obj.material__code__in = "elec,elec_0";
|
||||
this.$API.enm.mpoint.list.req(obj).then((res) => {
|
||||
console.log("mpoints", res);
|
||||
let arr = [];
|
||||
res.forEach((item) => {
|
||||
arr.push(item.nickname);
|
||||
});
|
||||
}
|
||||
})
|
||||
.then((res2) => {
|
||||
//昨日
|
||||
let params3 = {};
|
||||
params3.page = 0;
|
||||
params3.year_s = year_d;
|
||||
params3.month_s = month_d;
|
||||
params3.day_s = days_d;
|
||||
params3.type = "day_s";
|
||||
params3.mgroup = this.query.mgroup;
|
||||
this.$API.enm.enstat.req(params3).then((res3) => {
|
||||
if (res3.length > 0) {
|
||||
let allValDays = (that.allValDays =
|
||||
res3[0].total_production);
|
||||
params3.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.mpoint.stat
|
||||
.req(params3)
|
||||
.then((res) => {
|
||||
let data3 = res3;
|
||||
for (let j = 0; j < data3.length; j++) {
|
||||
let val =
|
||||
allValDays == 0
|
||||
? "/"
|
||||
: (
|
||||
data3[j].val /
|
||||
allValDays
|
||||
).toFixed(2);
|
||||
that.tableDatas[j][3] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
that.getDayData();
|
||||
that.getMonthData();
|
||||
console.log("arr", arr);
|
||||
that.mpoints = arr;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getMpoints() {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.mgroup__name = "电石渣";
|
||||
obj.page = 0;
|
||||
obj.enabled = 1;
|
||||
obj.need_display = 1;
|
||||
obj.ordering = "report_sortstr";
|
||||
obj.material__code__in = "elec,elec_0";
|
||||
this.$API.enm.mpoint.list.req(obj).then((res) => {
|
||||
console.log("mpoints", res);
|
||||
let arr = [];
|
||||
res.forEach((item) => {
|
||||
arr.push(item.nickname);
|
||||
});
|
||||
console.log("arr", arr);
|
||||
that.mpoints = arr;
|
||||
});
|
||||
},
|
||||
typeRadioChange() {
|
||||
this.searchDate = "";
|
||||
},
|
||||
dateChange(val) {
|
||||
console.log(val);
|
||||
if (this.typeRadio == "month") {
|
||||
if (this.typeRadio == "day") {
|
||||
let year = val.split("-")[0];
|
||||
let month = val.split("-")[1];
|
||||
let days = val.split("-")[2];
|
||||
this.getHourData(year, month, days);
|
||||
} else if (this.typeRadio == "month") {
|
||||
let year = val.split("-")[0];
|
||||
let month = val.split("-")[1];
|
||||
this.getDayData(year, month);
|
||||
} else {
|
||||
this.getMonthData(val);
|
||||
}
|
||||
this.searchDate;
|
||||
},
|
||||
//获取天数据
|
||||
getDayData() {
|
||||
getTableHourData() {
|
||||
let that = this;
|
||||
let query1 = {};
|
||||
query1.page = 0;
|
||||
query1.year_s = that.year;
|
||||
query1.month_s = that.month;
|
||||
query1.type = "day_s";
|
||||
query1.mgroup = this.query.mgroup;
|
||||
query1.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.enstat.req(query1).then((response) => {
|
||||
let seriesData0 = [];
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.day_s;
|
||||
let val = 0;
|
||||
if (that.allValDays == 0) {
|
||||
val = "";
|
||||
that.tableDatas = [];
|
||||
let timeDate = new Date().getTime();
|
||||
let yetTime = timeDate - 3600000 * 24;
|
||||
let ystDate = new Date(yetTime);
|
||||
let year_h = ystDate.getFullYear();
|
||||
let month_h = ystDate.getMonth() + 1;
|
||||
let days_h = ystDate.getDate();
|
||||
month_h = month_h > 9 ? month_h : "0" + month_h;
|
||||
days_h = days_h > 9 ? days_h : "0" + days_h;
|
||||
let obj_d = {};
|
||||
obj_d.type = "day_s";
|
||||
obj_d.year_s = year_h;
|
||||
obj_d.month_s = month_h;
|
||||
obj_d.day_s = days_h;
|
||||
obj_d.mgroup__name = "电石渣";
|
||||
obj_d.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_d.mpoint__need_display = 1;
|
||||
obj_d.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj_d).then((res) => {
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_d = that.mpoints.indexOf(item.mpoint_nickname);
|
||||
if (that.tableDatas[index_d]) {
|
||||
that.tableDatas[index_d][3] = item.elec_consume_unit;
|
||||
} else {
|
||||
val = (item.val / that.allValDays).toFixed(2);
|
||||
}
|
||||
if (item.equip_name == "烘干破主电机") {
|
||||
seriesData0[ind] = val;
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[3] = item.elec_consume_unit;
|
||||
obj[5] = item.mpoint;
|
||||
that.tableDatas[index_d] = obj;
|
||||
}
|
||||
});
|
||||
let options = { ...that.option1 };
|
||||
options.series.data = seriesData0;
|
||||
let obj_m = {};
|
||||
obj_m.type = "month_s";
|
||||
obj_m.year_s = that.year;
|
||||
obj_m.month_s = that.month;
|
||||
obj_m.mgroup__name = "电石渣";
|
||||
obj_m.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_m.mpoint__need_display = 1;
|
||||
obj_m.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj_m).then((res) => {
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_m = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
);
|
||||
if (that.tableDatas[index_m]) {
|
||||
that.tableDatas[index_m][4] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[4] = item.elec_consume_unit;
|
||||
obj[5] = item.mpoint;
|
||||
that.tableDatas[index_m] = obj;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
//获取天数据
|
||||
getDayData(year, month) {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.type = "day_s";
|
||||
obj.year_s = year;
|
||||
obj.month_s = month;
|
||||
obj.mgroup__name = "电石渣";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let ind = item.day_s - 1;
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option2 };
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let dayXAxis = [];
|
||||
for (let i = 1; i <= that.days; i++) {
|
||||
let dayss = new Date(year, month, 0).getDate();
|
||||
for (let i = 1; i <= dayss; i++) {
|
||||
let item = i + "日";
|
||||
dayXAxis.push(item);
|
||||
}
|
||||
|
|
@ -422,31 +445,42 @@ export default {
|
|||
});
|
||||
},
|
||||
//获取月数据
|
||||
getMonthData() {
|
||||
getMonthData(year) {
|
||||
let that = this;
|
||||
let query2 = {};
|
||||
query2.page = 0;
|
||||
query2.year_s = that.year;
|
||||
query2.type = "month_s";
|
||||
query2.mgroup = that.query.mgroup;
|
||||
query2.mpoint__ep_monitored__power_kw__gte = 100;
|
||||
this.$API.enm.enstat.req(query2).then((response) => {
|
||||
let seriesData0 = [];
|
||||
let obj = {};
|
||||
obj.type = "month_s";
|
||||
obj.year_s = year;
|
||||
obj.mgroup__name = "电石渣";
|
||||
obj.mpoint__material__code__in = "elec,elec_0";
|
||||
obj.mpoint__ep_monitored__isnull = 0;
|
||||
obj.mpoint__need_display = 1;
|
||||
obj.page = 0;
|
||||
this.$API.enm.mpoint.stat.req(obj).then((response) => {
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < that.mpoints.length; i++) {
|
||||
seriesData.push([]);
|
||||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.month_s;
|
||||
let val = 0;
|
||||
if (that.allValMonth == 0) {
|
||||
val = "";
|
||||
} else {
|
||||
val = (item.val / that.allValMonth).toFixed(2);
|
||||
}
|
||||
if (item.equip_name == "烘干破主电机") {
|
||||
seriesData0[ind] = val;
|
||||
}
|
||||
let ind = item.month_s - 1;
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option2 };
|
||||
options.series.data = seriesData0;
|
||||
let options = { ...that.option3 };
|
||||
for (let j = 0; j < that.mpoints.length; j++) {
|
||||
let chartItem = {};
|
||||
chartItem.name = that.mpoints[j];
|
||||
chartItem.type = "bar";
|
||||
chartItem.data = seriesData[j];
|
||||
options.series.push(chartItem);
|
||||
}
|
||||
options.legend.data = that.mpoints;
|
||||
let monthXAxis = [];
|
||||
for (let i = 1; i < 13; i++) {
|
||||
let item = i + "月";
|
||||
monthXAxis.push(item);
|
||||
}
|
||||
options.xAxis.data = monthXAxis;
|
||||
that.optionMonth = options;
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue