fix:主要设备单位电耗变更(显示电耗报表里的所有设备)

This commit is contained in:
shijing 2024-05-21 17:02:32 +08:00
parent 7e50f935e3
commit 6a18cae3bb
3 changed files with 303 additions and 343 deletions

View File

@ -186,7 +186,7 @@ let toolbox = {
};
let legend = {
top: "2%",
data: ["煤磨排风机主电机", "煤磨主电机"],
data: [],
};
let yAxis = {
type: "value",
@ -227,7 +227,7 @@ export default {
mgroup: "",
},
searchDate: "",
tableName: "主要设备100KW以上单位产品电耗数据表",
tableName: "主要设备单位产品电耗数据表",
tableDatas: [
["煤磨排风机主电机", "", "KW·h/t", "", "", ""],
["煤磨主电机", "", "KW·h/t", "", "", ""],
@ -259,18 +259,7 @@ export default {
data: [],
},
yAxis: yAxis,
series: [
{
name: "煤磨排风机主电机",
type: "bar",
data: [],
},
{
name: "煤磨主电机",
type: "bar",
data: [],
},
],
series: [],
},
option2: {
color: colors,
@ -287,18 +276,7 @@ export default {
data: [],
},
yAxis: yAxis,
series: [
{
name: "煤磨排风机主电机",
type: "bar",
data: [],
},
{
name: "煤磨主电机",
type: "bar",
data: [],
},
],
series: [],
},
option3: {
color: colors,
@ -312,35 +290,12 @@ export default {
length: 5,
inside: true,
},
data: [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月",
],
data: [],
},
yAxis: yAxis,
series: [
{
name: "煤磨排风机主电机",
type: "bar",
data: [],
},
{
name: "煤磨主电机",
type: "bar",
data: [],
},
],
series: [],
},
mpoints: [],
};
},
mounted() {
@ -350,12 +305,32 @@ export default {
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 = "";
},
@ -402,7 +377,6 @@ export default {
obj.hour = hours_h;
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
@ -411,14 +385,15 @@ export default {
that.tableData = res;
console.log("getTableHourData", res);
res.forEach((item) => {
let index = that.mpoints.indexOf(item.mpoint_nickname);
let obj = [];
obj[0] = item.ep_monitored_name;
obj[0] = item.mpoint_nickname;
obj[1] = "KW·h/t";
obj[2] = item.elec_consume_unit;
obj[3] = 0;
obj[4] = 0;
obj[5] = item.mpoint;
that.tableDatas.push(obj);
that.tableDatas[index] = obj;
});
let yetTime = timeDate - 3600000 * 24;
let ystDate = new Date(yetTime);
@ -434,13 +409,25 @@ export default {
obj_d.day_s = days_h;
obj_d.mgroup__name = "煤磨";
obj_d.mpoint__material__code__in = "elec,elec_0";
obj_d.mpoint__ep_monitored__isnull = 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) => {
that.tableDatas[index][3] = item.elec_consume_unit;
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] = "KW·h/t";
obj[3] = item.elec_consume_unit;
obj[5] = item.mpoint;
that.tableDatas[index_d] = obj;
}
});
let obj_m = {};
obj_m.type = "month_s";
@ -448,14 +435,25 @@ export default {
obj_m.month_s = that.month;
obj_m.mgroup__name = "煤磨";
obj_m.mpoint__material__code__in = "elec,elec_0";
obj_m.mpoint__ep_monitored__isnull = 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) => {
that.tableDatas[index][4] =
item.elec_consume_unit;
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] = "KW·h/t";
obj[4] = item.elec_consume_unit;
obj[5] = item.mpoint;
that.tableDatas[index_m] = obj;
}
});
});
});
@ -465,28 +463,36 @@ export default {
//
getHourData(year, month, days) {
let that = this;
let query = {};
query.page = 0;
query.year_s = year;
query.month_s = month;
query.day_s = days;
query.type = "hour_s";
query.mgroup = that.query.mgroup;
this.$API.enm.mpoint.stat.req(query).then((response) => {
let seriesData0 = [],
seriesData1 = [];
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 ind = item.hour;
if (item.ep_monitored_name == "煤磨排风机主电机") {
seriesData0[ind] = item.elec_consume_unit;
} else if (item.ep_monitored_name == "煤磨主电机") {
seriesData1[ind] = item.elec_consume_unit;
}
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 + "时";
@ -499,27 +505,35 @@ export default {
//
getDayData(year, month) {
let that = this;
let query1 = {};
query1.page = 0;
query1.year_s = year;
query1.month_s = month;
query1.type = "day_s";
query1.mgroup = this.query.mgroup;
this.$API.enm.mpoint.stat.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) => {
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
let ind = item.day_s - 1;
if (item.ep_monitored_name == "煤磨排风机主电机") {
seriesData0[ind] = item.elec_consume_unit;
} else if (item.ep_monitored_name == "煤磨主电机") {
seriesData1[ind] = item.elec_consume_unit;
}
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 = [];
let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
@ -533,26 +547,34 @@ export default {
//
getMonthData(year) {
let that = this;
let query2 = {};
query2.page = 0;
query2.year_s = year;
query2.type = "month_s";
query2.mgroup = that.query.mgroup;
this.$API.enm.mpoint.stat.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 - 1;
if (item.ep_monitored_name == "煤磨排风机主电机") {
seriesData0[ind] = item.elec_consume_unit;
} else if (item.ep_monitored_name == "煤磨主电机") {
seriesData1[ind] = item.elec_consume_unit;
}
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 < 13; i++) {
let item = i + "月";

View File

@ -187,8 +187,7 @@ let toolbox = {
let legend = {
top: "2%",
left: "center",
// orient:'vertical',
data: ["尾排风机", "高温风机", "头排风机", "低压变压器柜"],
data: [],
};
let yAxis = {
type: "value",
@ -232,7 +231,7 @@ export default {
},
mpoint: "",
searchDate: "",
tableName: "主要设备100KW以上单位产品电耗数据表",
tableName: "主要设备单位产品电耗数据表",
tableDatas: [
["尾排风机", "KW·h/t", "", "", ""],
["高温风机", "KW·h/t", "", "", ""],
@ -264,28 +263,7 @@ export default {
data: [],
},
yAxis: yAxis,
series: [
{
name: "尾排风机",
type: "bar",
data: [],
},
{
name: "高温风机",
type: "bar",
data: [],
},
{
name: "头排风机",
type: "bar",
data: [],
},
{
name: "低压变压器柜",
type: "bar",
data: [],
},
],
series: [],
},
option2: {
color: colors,
@ -302,28 +280,7 @@ export default {
data: [],
},
yAxis: yAxis,
series: [
{
name: "尾排风机",
type: "bar",
data: [],
},
{
name: "高温风机",
type: "bar",
data: [],
},
{
name: "头排风机",
type: "bar",
data: [],
},
{
name: "低压变压器柜",
type: "bar",
data: [],
},
],
series: [],
},
option3: {
color: colors,
@ -337,45 +294,12 @@ export default {
length: 5,
inside: true,
},
data: [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月",
],
data: [],
},
yAxis: yAxis,
series: [
{
name: "尾排风机",
type: "bar",
data: [],
},
{
name: "高温风机",
type: "bar",
data: [],
},
{
name: "头排风机",
type: "bar",
data: [],
},
{
name: "低压变压器柜",
type: "bar",
data: [],
},
],
series: [],
},
mpoints: [],
};
},
mounted() {
@ -385,12 +309,32 @@ export default {
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 = "";
},
@ -437,19 +381,20 @@ export default {
obj.hour = hours_h;
obj.mgroup__name = "回转窑";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
// obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
res.forEach((item) => {
let index = that.mpoints.indexOf(item.mpoint_nickname);
let obj = [];
obj[0] = item.ep_monitored_name;
obj[0] = item.mpoint_nickname;
obj[1] = "KW·h/t";
obj[2] = item.elec_consume_unit;
obj[3] = 0;
obj[4] = 0;
obj[5] = item.mpoint;
that.tableDatas.push(obj);
that.tableDatas[index] = obj;
});
let yetTime = timeDate - 3600000 * 24;
let ystDate = new Date(yetTime);
@ -465,22 +410,23 @@ export default {
obj_d.day_s = days_d;
obj_d.mgroup__name = "回转窑";
obj_d.mpoint__material__code__in = "elec,elec_0";
obj_d.mpoint__ep_monitored__isnull = 0;
obj_d.mpoint__need_display = 1;
obj_d.page = 0;
this.$API.enm.mpoint.stat.req(obj_d).then((res) => {
res.forEach((item, index_d) => {
// that.tableDatas[index][3] = item.elec_consume_unit;
res.forEach((item) => {
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.ep_monitored_name;
obj[0] = item.mpoint_nickname;
obj[1] = "KW·h/t";
obj[3] = item.elec_consume_unit;
obj[5] = item.mpoint;
that.tableDatas.push(obj);
that.tableDatas[index_d] = obj;
}
});
let obj_m = {};
@ -489,24 +435,23 @@ export default {
obj_m.month_s = that.month;
obj_m.mgroup__name = "回转窑";
obj_m.mpoint__material__code__in = "elec,elec_0";
obj_m.mpoint__ep_monitored__isnull = 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_m) => {
// that.tableDatas[index_m][4] =
// item.elec_consume_unit;
res.forEach((item) => {
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.ep_monitored_name;
obj[0] = item.mpoint_nickname;
obj[1] = "KW·h/t";
obj[4] = item.elec_consume_unit;
obj[5] = item.mpoint;
that.tableDatas.push(obj);
that.tableDatas[index_m] = obj;
}
});
});
@ -527,24 +472,24 @@ export default {
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [];
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
response.forEach((item) => {
console.log(item.ep_monitored_name);
let ind = item.hour;
if (item.ep_monitored_name == "尾排风机") {
seriesData0[ind] = item.elec_consume_unit;
} else if (item.ep_monitored_name == "高温风机") {
seriesData1[ind] = item.elec_consume_unit;
} else if (item.ep_monitored_name == "头排风机") {
seriesData2[ind] = item.elec_consume_unit;
}
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;
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 + "时";
@ -567,24 +512,25 @@ export default {
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [];
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;
if (item.ep_monitored_name == "尾排风机") {
seriesData0[ind] = item.elec_consume_unit;
} else if (item.ep_monitored_name == "高温风机") {
seriesData1[ind] = item.elec_consume_unit;
} else if (item.ep_monitored_name == "头排风机") {
seriesData2[ind] = item.elec_consume_unit;
}
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;
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 = [];
let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
@ -607,24 +553,25 @@ export default {
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [];
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
let ind = item.month_s - 1;
if (item.ep_monitored_name == "尾排风机") {
seriesData0[ind] = item.elec_consume_unit;
} else if (item.ep_monitored_name == "高温风机") {
seriesData1[ind] = item.elec_consume_unit;
} else if (item.ep_monitored_name == "头排风机") {
seriesData2[ind] = item.elec_consume_unit;
}
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;
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 + "月";

View File

@ -179,7 +179,7 @@ let toolbox = {
};
let legend = {
top: "2%",
data: ["辊压机", "循环风机"],
data: [],
};
let yAxis = {
type: "value",
@ -223,7 +223,7 @@ export default {
},
mpoint: "",
searchDate: "",
tableName: "主要设备100KW以上单位产品电耗数据表",
tableName: "主要设备单位产品电耗数据表",
tableDatas: [
// ["", "KW·h/t", "", "", ""],
// ["", "KW·h/t", "", "", ""],
@ -254,18 +254,7 @@ export default {
data: [],
},
yAxis: yAxis,
series: [
{
name: "辊压机",
type: "bar",
data: [],
},
{
name: "循环风机",
type: "bar",
data: [],
},
],
series: [],
},
option2: {
color: colors,
@ -282,18 +271,7 @@ export default {
data: [],
},
yAxis: yAxis,
series: [
{
name: "辊压机",
type: "bar",
data: [],
},
{
name: "循环风机",
type: "bar",
data: [],
},
],
series: [],
},
option3: {
color: colors,
@ -307,36 +285,12 @@ export default {
length: 5,
inside: true,
},
data: [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月",
],
data: [],
},
yAxis: yAxis,
series: [
{
name: "辊压机",
type: "bar",
data: [],
},
{
name: "循环风机",
type: "bar",
data: [],
},
],
series: [],
},
mpointList: [],
mpoints: [],
};
},
mounted() {
@ -346,12 +300,32 @@ export default {
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 = "";
},
@ -397,19 +371,19 @@ export default {
obj.hour = hours_h;
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((res) => {
res.forEach((item) => {
let index = that.mpoints.indexOf(item.mpoint_nickname);
let obj = [];
obj[0] = item.ep_monitored_name;
obj[0] = item.mpoint_nickname;
obj[1] = "KW·h/t";
obj[2] = item.elec_consume_unit;
obj[3] = 0;
obj[4] = 0;
obj[5] = item.mpoint;
that.tableDatas.push(obj);
that.tableDatas[index] = obj;
});
let yetTime = timeDate - 3600000 * 24;
let ystDate = new Date(yetTime);
@ -425,22 +399,23 @@ export default {
obj_d.day_s = days_d;
obj_d.mgroup__name = "原料磨";
obj_d.mpoint__material__code__in = "elec,elec_0";
obj_d.mpoint__ep_monitored__isnull = 0;
obj_d.mpoint__need_display = 1;
obj_d.page = 0;
this.$API.enm.mpoint.stat.req(obj_d).then((res) => {
console.log("getTableDayData", res);
res.forEach((item, index_d) => {
res.forEach((item) => {
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.ep_monitored_name;
obj[0] = item.mpoint_nickname;
obj[1] = "KW·h/t";
obj[3] = item.elec_consume_unit;
obj[5] = item.mpoint;
that.tableDatas.push(obj);
that.tableDatas[index_d] = obj;
}
});
});
@ -450,22 +425,23 @@ export default {
obj_m.month_s = that.month;
obj_m.mgroup__name = "原料磨";
obj_m.mpoint__material__code__in = "elec,elec_0";
obj_m.mpoint__ep_monitored__isnull = 0;
obj_m.mpoint__need_display = 1;
obj_m.page = 0;
this.$API.enm.mpoint.stat.req(obj_m).then((res) => {
console.log("getTableMonthrData", res);
res.forEach((item, index_m) => {
res.forEach((item) => {
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.ep_monitored_name;
obj[0] = item.mpoint_nickname;
obj[1] = "KW·h/t";
obj[4] = item.elec_consume_unit;
obj[5] = item.mpoint;
that.tableDatas.push(obj);
that.tableDatas[index_m] = obj;
}
});
});
@ -485,26 +461,31 @@ export default {
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData0 = [],
seriesData1 = [];
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
response.forEach((item) => {
console.log(item.ep_monitored_name);
let ind = item.hour;
if (item.ep_monitored_name == "辊压机") {
seriesData0[ind] = item.elec_consume_unit;
} else if (item.ep_monitored_name == "循环风机") {
seriesData1[ind] = item.elec_consume_unit;
}
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 + "时";
hourXAxis.push(item);
}
options.xAxis.data = hourXAxis;
console.log("options", options);
that.optionHour = options;
});
},
@ -521,20 +502,25 @@ export default {
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData0 = [],
seriesData1 = [];
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;
if (item.ep_monitored_name == "辊压机") {
seriesData0[ind] = item.elec_consume_unit;
} else if (item.ep_monitored_name == "循环风机") {
seriesData1[ind] = item.elec_consume_unit;
}
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 = [];
let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
@ -557,20 +543,25 @@ export default {
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData0 = [],
seriesData1 = [];
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
let ind = item.month_s - 1;
if (item.ep_monitored_name == "辊压机") {
seriesData0[ind] = item.elec_consume_unit;
} else if (item.ep_monitored_name == "循环风机") {
seriesData1[ind] = item.elec_consume_unit;
}
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 < 13; i++) {
let item = i + "月";