fix:单位产品电耗数据更新

This commit is contained in:
shijing 2024-05-13 17:21:15 +08:00
parent c55f516019
commit 85eb08dfb1
3 changed files with 433 additions and 663 deletions

View File

@ -24,13 +24,12 @@
>
<thead class="myTableHead">
<tr>
<th colspan="6">
<th colspan="5">
煤磨工段主要设备100KW以上单位产品电耗数据表
</th>
</tr>
<tr>
<th>设备名称</th>
<th>设备编号</th>
<th>单位</th>
<th>上个小时</th>
<th>昨日</th>
@ -44,27 +43,27 @@
:key="item1"
>
<td
v-if="ind == 0 || ind == 1 || ind == 2"
v-if="ind == 0 || ind == 1"
class="numCell"
>
{{ item1 }}
</td>
<td
v-if="ind == 3"
v-if="ind == 2"
class="numCell hoursItem"
@click="itemClick('hour_s', item1)"
>
{{ item1 }}
</td>
<td
v-if="ind == 4"
v-if="ind == 3"
class="numCell monthItem"
@click="itemClick('day_s', item1)"
>
{{ item1 }}
</td>
<td
v-if="ind == 5"
v-if="ind == 4"
class="numCell yearItem"
@click="itemClick('month_s', item1)"
>
@ -307,142 +306,103 @@ 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();
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;
}
});
}
})
.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.getTableHourData();
that.getHourData();
that.getDayData();
that.getMonthData();
},
methods: {
getTableHourData() {
let that = this;
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 {
hours_h = hours_h - 1;
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
}
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__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat
.req(obj)
.then((res) => {
console.log("getTableHourData", res);
res.forEach((item) => {
let obj = [];
obj[0] = item.ep_monitored_name;
obj[1] = "KW·h/t";
obj[2] = item.elec_consume_unit;
obj[3] = 0;
obj[4] = 0;
that.tableDatas.push(obj);
});
})
.then(() => {
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 = {};
obj.type = "day_s";
obj.year_s = year_h;
obj.month_s = month_h;
obj.day_s = days_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) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
that.tableDatas[index][3] = item.elec_consume_unit;
});
});
})
.then(() => {
let obj = {};
obj.type = "month_s";
obj.year_s = that.year;
obj.month_s = that.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((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
that.tableDatas[index][4] = item.elec_consume_unit;
});
});
});
},
//
getHourData() {
let that = this;
@ -459,17 +419,11 @@ export default {
seriesData1 = [];
let data = response;
data.forEach((item) => {
let ind = item.hour;
let val = 0;
if (that.allValHour == 0) {
val = "";
} else {
val = (item.val / that.allValHour).toFixed(2);
}
if (item.equip_name == "煤磨排风机主电机") {
seriesData0[ind] = val;
} else if (item.equip_name == "煤磨主电机") {
seriesData1[ind] = val;
let ind = item.hour - 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 options = { ...that.option1 };
@ -499,18 +453,11 @@ export default {
seriesData1 = [];
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 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;
}
});
let options = { ...that.option2 };
@ -539,17 +486,11 @@ export default {
seriesData1 = [];
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;
if (item.ep_monitored_name == "煤磨排风机主电机") {
seriesData0[ind] = item.elec_consume_unit;
} else if (item.ep_monitored_name == "煤磨主电机") {
seriesData1[ind] = item.elec_consume_unit;
}
});
let options = { ...that.option3 };

View File

@ -24,13 +24,12 @@
>
<thead class="myTableHead">
<tr>
<th colspan="6">
<th colspan="5">
回转窑工段主要设备100KW以上单位产品电耗数据表
</th>
</tr>
<tr>
<th>设备名称</th>
<th>设备编号</th>
<th>单位</th>
<th>上个小时</th>
<th>昨日</th>
@ -44,27 +43,27 @@
:key="item1"
>
<td
v-if="ind == 0 || ind == 1 || ind == 2"
v-if="ind == 0 || ind == 1"
class="numCell"
>
{{ item1 }}
</td>
<td
v-if="ind == 3"
v-if="ind == 2"
class="numCell"
@click="itemClick('hour_s', item)"
>
{{ item1 }}
</td>
<td
v-if="ind == 4"
v-if="ind == 3"
class="numCell"
@click="itemClick('day_s', item)"
>
{{ item1 }}
</td>
<td
v-if="ind == 5"
v-if="ind == 4"
class="numCell"
@click="itemClick('month_s', item)"
>
@ -193,9 +192,9 @@ export default {
},
tableName: "主要设备100KW以上单位产品电耗数据表",
tableDatas: [
["尾排风机", "", "KW·h/t", "", "", ""],
["高温风机", "", "KW·h/t", "", "", ""],
["头排风机", "", "KW·h/t", "", "", ""],
["尾排风机", "KW·h/t", "", "", ""],
["高温风机", "KW·h/t", "", "", ""],
["头排风机", "KW·h/t", "", "", ""],
],
modelValue: true,
type: "hour_s",
@ -340,184 +339,137 @@ 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();
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;
}
});
}
})
.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.getTableHourData();
that.getHourData();
that.getDayData();
that.getMonthData();
},
methods: {
getTableHourData() {
let that = this;
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 {
hours_h = hours_h - 1;
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
}
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__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat
.req(obj)
.then((res) => {
console.log("getTableHourData", res);
res.forEach((item) => {
let obj = [];
obj[0] = item.ep_monitored_name;
obj[1] = "KW·h/t";
obj[2] = item.elec_consume_unit;
obj[3] = 0;
obj[4] = 0;
that.tableDatas.push(obj);
});
})
.then(() => {
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 = {};
obj.type = "day_s";
obj.year_s = year_h;
obj.month_s = month_h;
obj.day_s = days_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) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
that.tableDatas[index][3] = item.elec_consume_unit;
});
});
})
.then(() => {
let obj = {};
obj.type = "month_s";
obj.year_s = that.year;
obj.month_s = that.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((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
that.tableDatas[index][4] = item.elec_consume_unit;
});
});
});
},
//
getHourData() {
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 obj = {};
obj.type = "hour_s";
obj.year_s = that.year;
obj.month_s = that.month;
obj.day_s = that.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 seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [];
let data = response;
data.forEach((item) => {
let ind = item.hour;
let val = 0;
if (that.allValHour == 0) {
val = "";
} else {
val = (item.val / that.allValHour).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;
seriesData2 = [];
response.forEach((item) => {
console.log(item.ep_monitored_name);
let ind = item.hour - 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 options = { ...that.option1 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
let hourXAxis = [];
for (let i = 1; i <= that.hours; i++) {
for (let i = 1; i < that.hours + 1; i++) {
let item = i + "时";
hourXAxis.push(item);
}
@ -528,43 +480,34 @@ export default {
//
getDayData() {
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 obj = {};
obj.type = "day_s";
obj.year_s = that.year;
obj.month_s = that.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 seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [];
seriesData2 = [];
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;
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;
}
});
let options = { ...that.option2 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
let dayXAxis = [];
for (let i = 1; i <= that.days; i++) {
let item = i + "日";
@ -577,41 +520,33 @@ export default {
//
getMonthData() {
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 obj = {};
obj.type = "month_s";
obj.year_s = that.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 seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [];
seriesData2 = [];
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;
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 options = { ...that.option3 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
let monthXAxis = [];
for (let i = 1; i <= that.month; i++) {
let item = i + "月";

View File

@ -24,13 +24,12 @@
>
<thead class="myTableHead">
<tr>
<th colspan="6">
<th colspan="5">
原料磨工段主要设备100KW以上单位产品电耗数据表
</th>
</tr>
<tr>
<th>设备名称</th>
<th>设备编号</th>
<th>单位</th>
<th>上个小时</th>
<th>昨日</th>
@ -44,27 +43,27 @@
:key="item1"
>
<td
v-if="ind == 0 || ind == 1 || ind == 2"
v-if="ind == 0 || ind == 1"
class="numCell"
>
{{ item1 }}
</td>
<td
v-if="ind == 3"
v-if="ind == 2"
class="numCell"
@click="itemClick('hour_s', item)"
>
{{ item1 }}
</td>
<td
v-if="ind == 4"
v-if="ind == 3"
class="numCell"
@click="itemClick('day_s', item)"
>
{{ item1 }}
</td>
<td
v-if="ind == 5"
v-if="ind == 4"
class="numCell"
@click="itemClick('month_s', item)"
>
@ -141,7 +140,7 @@ let toolbox = {
};
let legend = {
top: "2%",
data: ["辊压机", "循环风机", "调配变压器", "低压变压器柜器"],
data: ["辊压机", "循环风机"],
};
let yAxis = {
type: "value",
@ -175,17 +174,17 @@ export default {
optionHour: {},
optionDay: {},
optionMonth: {},
year: 2023,
month: 1,
days: 1,
year: 2024,
month: 5,
days: 13,
hours: 1,
query: {
mgroup: "",
},
tableName: "主要设备100KW以上单位产品电耗数据表",
tableDatas: [
["辊压机", "", "KW·h/t", "", "", ""],
["循环风机", "", "KW·h/t", "", "", ""],
// ["", "KW·h/t", "", "", ""],
// ["", "KW·h/t", "", "", ""],
],
modelValue: true,
type: "hour_s",
@ -224,16 +223,6 @@ export default {
type: "bar",
data: [],
},
{
name: "调配变压器",
type: "bar",
data: [],
},
{
name: "低压变压器柜器",
type: "bar",
data: [],
},
],
},
option2: {
@ -262,16 +251,6 @@ export default {
type: "bar",
data: [],
},
{
name: "调配变压器",
type: "bar",
data: [],
},
{
name: "低压变压器柜器",
type: "bar",
data: [],
},
],
},
option3: {
@ -313,202 +292,141 @@ export default {
type: "bar",
data: [],
},
{
name: "调配变压器",
type: "bar",
data: [],
},
{
name: "低压变压器柜器",
type: "bar",
data: [],
},
],
},
mpointList: [],
};
},
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();
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 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;
}
});
}
})
.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 = 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.getTableHourData();
that.getHourData();
that.getDayData();
that.getMonthData();
},
methods: {
getTableHourData() {
let that = this;
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 {
hours_h = hours_h - 1;
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
}
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__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat
.req(obj)
.then((res) => {
console.log("getTableHourData", res);
res.forEach((item) => {
let obj = [];
obj[0] = item.ep_monitored_name;
obj[1] = "KW·h/t";
obj[2] = item.elec_consume_unit;
obj[3] = 0;
obj[4] = 0;
that.tableDatas.push(obj);
});
})
.then(() => {
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 = {};
obj.type = "day_s";
obj.year_s = year_h;
obj.month_s = month_h;
obj.day_s = days_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) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
that.tableDatas[index][3] = item.elec_consume_unit;
});
});
})
.then(() => {
let obj = {};
obj.type = "month_s";
obj.year_s = that.year;
obj.month_s = that.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((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
that.tableDatas[index][4] = item.elec_consume_unit;
});
});
});
},
//
getHourData() {
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 obj = {};
obj.type = "hour_s";
obj.year_s = that.year;
obj.month_s = that.month;
obj.day_s = that.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 seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [];
let data = response;
data.forEach((item) => {
let ind = item.hour;
let val = 0;
if (that.allValHour == 0) {
val = "";
} else {
val = (item.val / that.allValHour).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;
seriesData1 = [];
response.forEach((item) => {
console.log(item.ep_monitored_name);
let ind = item.hour - 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 options = { ...that.option1 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
let hourXAxis = [];
for (let i = 1; i <= that.hours; i++) {
for (let i = 1; i < that.hours + 1; i++) {
let item = i + "时";
hourXAxis.push(item);
}
@ -519,42 +437,30 @@ export default {
//
getDayData() {
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 obj = {};
obj.type = "day_s";
obj.year_s = that.year;
obj.month_s = that.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 seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [];
seriesData1 = [];
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;
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;
}
});
let options = { ...that.option2 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
let dayXAxis = [];
for (let i = 1; i <= that.days; i++) {
let item = i + "日";
@ -567,41 +473,29 @@ export default {
//
getMonthData() {
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 obj = {};
obj.type = "month_s";
obj.year_s = that.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 seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [];
seriesData1 = [];
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;
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 options = { ...that.option3 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
let monthXAxis = [];
for (let i = 1; i <= that.month; i++) {
let item = i + "月";