diff --git a/src/views/enm_energy/day_base.vue b/src/views/enm_energy/day_base.vue
index 98b655cc..2a06f0aa 100644
--- a/src/views/enm_energy/day_base.vue
+++ b/src/views/enm_energy/day_base.vue
@@ -136,43 +136,13 @@ export default {
return {
year: "",
month: "",
- days: "",
myChart: null,
search_date: "",
headerLength: 33,
itemVisible: false,
xAxisData: [],
- tableDatas: [
- ["石灰石破碎", "破碎机", "kw.h"], //0
- ["石灰石破碎", "堆取料机", "kw.h"],
- ["石灰石破碎", "低压变压器柜", "kw.h"],
- ["石灰石破碎", "石灰石破碎合计", "kw.h"],
- ["原料磨", "循环风机", "kw.h"],
- ["原料磨", "辊压机", "kw.h"],
- ["原料磨", "调配变压器", "kw.h"],
- ["原料磨", "低压变压器柜器", "kw.h"],
- ["原料磨", "原料磨系统合计", "kw.h"],
- ["回转窑", "尾排风机", "kw.h"],
- ["回转窑", "高温风机", "kw.h"],
- ["回转窑", "头排风机", "kw.h"],
- ["回转窑", "低压变压器柜", "kw.h"],
- ["回转窑", "回转窑烧成系统合计", "kw.h"],
- ["煤磨", "煤磨主电机", "kw.h"],
- ["煤磨", "煤磨排风机", "kw.h"],
- ["煤磨", "低压变压器柜", "kw.h"],
- ["煤磨", "煤磨系统合计", "kw.h"],
- ["余热发电", "余热发电量", "kw.h"],
- ["余热发电", "余热发电自用电量", "kw.h"],
- ["余热发电", "余热供电量", "kw.h"],
- ["空压机", "1#空压机", "kw.h"],
- ["空压机", "2#空压机", "kw.h"],
- ["空压机", "3#空压机", "kw.h"],
- ["空压机", "4#空压机", "kw.h"],
- ["空压机", "空压机合计", "kw.h"],
- ["富氧燃烧系统", "富氧燃烧耗电设备", "kw.h"],
- ["生产总耗电量", "生产部分总耗电", "kw.h"],
- ["全厂进线", "全厂耗电量", "kw.h"],
- ],
+ mpointList: [],
+ tableDatas: [],
timeStamp: null,
tableWidth: "3300",
itemChartTitle: "",
@@ -275,26 +245,20 @@ export default {
mounted() {
let that = this;
var nowDate = new Date();
- that.year = nowDate.getFullYear();
- that.month = nowDate.getMonth() + 1;
- that.days = new Date(that.year, that.month, 0).getDate();
+ let year = nowDate.getFullYear();
+ let month = nowDate.getMonth() + 1;
+ month = month > 9 ? month : "0" + month;
+ that.search_date = year + "-" + month;
+ that.year = year;
+ that.month = month;
+ that.days = new Date(year, month, 0).getDate();
that.timeStamp = nowDate.getTime();
- let month0 = that.month > 9 ? that.month : "0" + that.month;
- that.search_date = that.year + "-" + month0;
that.headerLength = that.days + 4;
that.tableWidth = that.headerLength * 100 + "";
- let tableDatas = that.tableDatas;
- for (let i = 0; i < tableDatas.length; i++) {
- for (let j = 0; j < that.days; j++) {
- let k = 3 + j;
- that.tableDatas[i][k] = 0;
- this.$forceUpdate();
- }
- }
for (let n = 1; n <= that.days; n++) {
that.xAxisData.push(n + "日");
}
- this.getData();
+ this.getMPoints();
},
methods: {
dateChange(e) {
@@ -302,215 +266,263 @@ export default {
let arr = e.split("-");
that.year = Number(arr[0]);
that.month = Number(arr[1]);
- for (let i = 0; i < that.tableDatas.length; i++) {
- for (let j = 0; j < that.days + 1; j++) {
- let k = 3 + j;
- that.tableDatas[i][k] = 0;
- this.$forceUpdate();
- }
- }
let nowDate = new Date();
that.timeStamp = nowDate.getTime();
- this.getData();
+ this.dataLoop();
},
- getData() {
+ getMPoints() {
let that = this;
- function dataPush(name) {
- let index = 0;
- if (name == "破碎机") {
- index = 0;
- } else if (name == "堆取料机") {
- index = 1;
- } else if (name == "低压变压器柜") {
- index = 2;
- } else if (name == "循环风机") {
- index = 4;
- } else if (name == "调配变压器") {
- index = 6;
- } else if (name == "低压变压器柜器") {
- index = 7;
- } else if (name == "尾排风机") {
- index = 9;
- } else if (name == "高温风机") {
- index = 10;
- } else if (name == "头排风机") {
- index = 11;
- } else if (name == "煤磨主电机") {
- index = 14;
- } else if (name == "煤磨排风机") {
- index = 15;
- } else if (name == "低压变压器柜") {
- index = 16;
- } else if (name == "余热发电量") {
- index = 18;
- } else if (name == "余热发电自用电量") {
- index = 19;
- } else if (name == "1#空压机") {
- index = 21;
- } else if (name == "2#空压机") {
- index = 22;
- } else if (name == "3#空压机") {
- index = 23;
- } else if (name == "4#空压机") {
- index = 24;
- } else if (name == "富氧燃烧耗电设备") {
- index = 26;
- }
- return index;
- }
- function sumNum(a, b, c, d) {
- let sum = 0;
- if (typeof a !== "undefined" && a !== "NaN") {
- sum = sum + Number(a);
- }
- if (typeof b !== "undefined" && a !== "NaN") {
- sum = sum + Number(b);
- }
- if (typeof c !== "undefined" && a !== "NaN") {
- sum = sum + Number(c);
- }
- if (typeof d !== "undefined" && a !== "NaN") {
- sum = sum + Number(d);
- }
- return sum;
- }
- let obj = {};
- obj.type = "day_s";
- obj.year_s = that.year;
- obj.month_s = that.month;
- obj.page = 0;
- obj.mpoint__ep_monitored__power_kw__gte = 100;
- this.$API.enm.mpoint.stat
- .req(obj)
- .then((res) => {
- let wrapArr = [],
- innerArr = [];
- res.forEach((item) => {
- let day = item.day_s;
- if (wrapArr[day]) {
- wrapArr[day].push(item);
- } else {
- wrapArr[day] = [];
- wrapArr[day].push(item);
- }
- });
- wrapArr.forEach((inner, inde) => {
- inner.forEach((item) => {
- let i = dataPush(item.mpoint_name);
- let k = 0;
- if (
- i == 0 ||
- i == 4 ||
- i == 9 ||
- i == 14 ||
- i == 18 ||
- i == 21 ||
- i == 26 ||
- i == 27 ||
- i == 28
- ) {
- k = 3 + inde;
- } else {
- k = 2 + inde;
- }
- that.tableDatas[i][k] = item.val;
- });
- });
- for (let k = 0; k < that.headerLength; k++) {
- let m = k + 3;
- let n = k + 1;
- //石灰石破碎合计
-
- that.tableDatas[3][m] = sumNum(
- that.tableDatas[0][m],
- that.tableDatas[1][m],
- that.tableDatas[2][m]
- );
- //辊压机
- // that.tableDatas[5][m] = sumNum();
- //原料磨系统合计
- that.tableDatas[8][m] =
- sumNum(
- that.tableDatas[4][m],
- // that.tableDatas[5][m],
- that.tableDatas[6][m],
- that.tableDatas[7][m]
- ) -
- sumNum(
- that.tableDatas[1][m],
- that.tableDatas[2][m]
- );
- //低压变压器柜
- // that.tableDatas[12][m] = sumNum(
- // that.tableDatas[9][m],
- // that.tableDatas[10][m],
- // that.tableDatas[11][m]
- // );
- //回转窑烧成系统合计
- that.tableDatas[13][m] =
- typeof that.tableDatas[12][m] !== "undefined"
- ? sumNum(
- that.tableDatas[9][m],
- that.tableDatas[10][m],
- that.tableDatas[11][m],
- that.tableDatas[12][m]
- )
- : sumNum(
- that.tableDatas[9][m],
- that.tableDatas[10][m],
- that.tableDatas[11][m]
- );
- //煤磨系统合计
- let sum17 = sumNum(
- that.tableDatas[14][m],
- that.tableDatas[15][m],
- that.tableDatas[16][m]
- );
- that.tableDatas[17][m] =
- typeof that.tableDatas[21][m] !== "undefined"
- ? sum17 - that.tableDatas[21][m]
- : sum17;
- //余热供电量
- that.tableDatas[20][m] =
- typeof that.tableDatas[19][m] !== "undefined"
- ? that.tableDatas[18][m] -
- that.tableDatas[19][m]
- : that.tableDatas[18][m];
- //空压机合计
- that.tableDatas[25][m] = sumNum(
- that.tableDatas[21][m],
- that.tableDatas[22][m],
- that.tableDatas[23][m],
- that.tableDatas[24][m]
- );
- //生产部分总耗电
- that.tableDatas[27][m] = sumNum(
- that.tableDatas[3][m],
- that.tableDatas[8][m],
- that.tableDatas[13][m],
- that.tableDatas[17][m],
- that.tableDatas[18][m],
- that.tableDatas[25][m],
- that.tableDatas[26][m]
- );
- //全厂耗电量
- // that.tableDatas[28][m] = sumNum(
- // that.tableDatas[27][m],
- // that.tableDatas[26][m]
- // );
- }
- that.tableDatas.forEach((inner, inde) => {
- let sumlast = 0;
- inner.forEach((num, ind) => {
- if (ind > 2 && ind < that.headerLength) {
- sumlast = sumlast + Number(num);
- }
- });
- inner[that.headerLength] = sumlast;
- });
+ that.$API.enm.mpoint.list
+ .req({
+ page: 0,
+ enabled: true,
+ need_display: true,
+ ordering: "report_sortstr",
+ mpoint__material__code: "elec",
})
- .then(() => {});
+ .then((res) => {
+ let data = res.slice(3);
+ that.mpointList = data;
+ that.dataLoop();
+ });
},
+ dataLoop() {
+ let that = this;
+ that.tableDatas = [];
+ that.mpointList.forEach((item, index) => {
+ let arr = [];
+ arr[0] =
+ item.mgroup_name != null
+ ? item.mgroup_name
+ : item.nickname != null
+ ? item.nickname
+ : item.name;
+ arr[1] = item.nickname != null ? item.nickname : item.name;
+ arr[2] = item.unit;
+ for (let i = 0; i < that.days; i++) {
+ arr[i + 3] = 0;
+ }
+ that.tableDatas.push(arr);
+ that.getData(item.id, index);
+ });
+ },
+ getData(id, index) {
+ let that = this;
+ let obj = {};
+ obj.type = "day";
+ obj.year = that.year;
+ obj.month = that.month;
+ obj.mpoint__material__code = "elec";
+ obj.mpoint__need_display = 1;
+ obj.mpoint = id;
+ obj.page = 0;
+ this.$API.enm.mpoint.stat.req(obj).then((res) => {
+ console.log(res);
+ res.forEach((item) => {
+ let ind = item.day + 2;
+ that.tableDatas[index][ind] = item.val;
+ });
+ that.$forceUpdate();
+ });
+ },
+ // getData() {
+ // let that = this;
+ // function dataPush(name) {
+ // let index = 0;
+ // if (name == "破碎机") {
+ // index = 0;
+ // } else if (name == "堆取料机") {
+ // index = 1;
+ // } else if (name == "低压变压器柜") {
+ // index = 2;
+ // } else if (name == "循环风机") {
+ // index = 4;
+ // } else if (name == "调配变压器") {
+ // index = 6;
+ // } else if (name == "低压变压器柜器") {
+ // index = 7;
+ // } else if (name == "尾排风机") {
+ // index = 9;
+ // } else if (name == "高温风机") {
+ // index = 10;
+ // } else if (name == "头排风机") {
+ // index = 11;
+ // } else if (name == "煤磨主电机") {
+ // index = 14;
+ // } else if (name == "煤磨排风机") {
+ // index = 15;
+ // } else if (name == "低压变压器柜") {
+ // index = 16;
+ // } else if (name == "余热发电量") {
+ // index = 18;
+ // } else if (name == "余热发电自用电量") {
+ // index = 19;
+ // } else if (name == "1#空压机") {
+ // index = 21;
+ // } else if (name == "2#空压机") {
+ // index = 22;
+ // } else if (name == "3#空压机") {
+ // index = 23;
+ // } else if (name == "4#空压机") {
+ // index = 24;
+ // } else if (name == "富氧燃烧耗电设备") {
+ // index = 26;
+ // }
+ // return index;
+ // }
+ // function sumNum(a, b, c, d) {
+ // let sum = 0;
+ // if (typeof a !== "undefined" && a !== "NaN") {
+ // sum = sum + Number(a);
+ // }
+ // if (typeof b !== "undefined" && a !== "NaN") {
+ // sum = sum + Number(b);
+ // }
+ // if (typeof c !== "undefined" && a !== "NaN") {
+ // sum = sum + Number(c);
+ // }
+ // if (typeof d !== "undefined" && a !== "NaN") {
+ // sum = sum + Number(d);
+ // }
+ // return sum;
+ // }
+ // let obj = {};
+ // obj.type = "day_s";
+ // obj.year_s = that.year;
+ // obj.month_s = that.month;
+ // obj.page = 0;
+ // obj.mpoint__ep_monitored__power_kw__gte = 100;
+ // this.$API.enm.mpoint.stat
+ // .req(obj)
+ // .then((res) => {
+ // let wrapArr = [],
+ // innerArr = [];
+ // res.forEach((item) => {
+ // let day = item.day_s;
+ // if (wrapArr[day]) {
+ // wrapArr[day].push(item);
+ // } else {
+ // wrapArr[day] = [];
+ // wrapArr[day].push(item);
+ // }
+ // });
+ // wrapArr.forEach((inner, inde) => {
+ // inner.forEach((item) => {
+ // let i = dataPush(item.mpoint_name);
+ // let k = 0;
+ // if (
+ // i == 0 ||
+ // i == 4 ||
+ // i == 9 ||
+ // i == 14 ||
+ // i == 18 ||
+ // i == 21 ||
+ // i == 26 ||
+ // i == 27 ||
+ // i == 28
+ // ) {
+ // k = 3 + inde;
+ // } else {
+ // k = 2 + inde;
+ // }
+ // that.tableDatas[i][k] = item.val;
+ // });
+ // });
+ // for (let k = 0; k < that.headerLength; k++) {
+ // let m = k + 3;
+ // let n = k + 1;
+ // //石灰石破碎合计
+
+ // that.tableDatas[3][m] = sumNum(
+ // that.tableDatas[0][m],
+ // that.tableDatas[1][m],
+ // that.tableDatas[2][m]
+ // );
+ // //辊压机
+ // // that.tableDatas[5][m] = sumNum();
+ // //原料磨系统合计
+ // that.tableDatas[8][m] =
+ // sumNum(
+ // that.tableDatas[4][m],
+ // // that.tableDatas[5][m],
+ // that.tableDatas[6][m],
+ // that.tableDatas[7][m]
+ // ) -
+ // sumNum(
+ // that.tableDatas[1][m],
+ // that.tableDatas[2][m]
+ // );
+ // //低压变压器柜
+ // // that.tableDatas[12][m] = sumNum(
+ // // that.tableDatas[9][m],
+ // // that.tableDatas[10][m],
+ // // that.tableDatas[11][m]
+ // // );
+ // //回转窑烧成系统合计
+ // that.tableDatas[13][m] =
+ // typeof that.tableDatas[12][m] !== "undefined"
+ // ? sumNum(
+ // that.tableDatas[9][m],
+ // that.tableDatas[10][m],
+ // that.tableDatas[11][m],
+ // that.tableDatas[12][m]
+ // )
+ // : sumNum(
+ // that.tableDatas[9][m],
+ // that.tableDatas[10][m],
+ // that.tableDatas[11][m]
+ // );
+ // //煤磨系统合计
+ // let sum17 = sumNum(
+ // that.tableDatas[14][m],
+ // that.tableDatas[15][m],
+ // that.tableDatas[16][m]
+ // );
+ // that.tableDatas[17][m] =
+ // typeof that.tableDatas[21][m] !== "undefined"
+ // ? sum17 - that.tableDatas[21][m]
+ // : sum17;
+ // //余热供电量
+ // that.tableDatas[20][m] =
+ // typeof that.tableDatas[19][m] !== "undefined"
+ // ? that.tableDatas[18][m] -
+ // that.tableDatas[19][m]
+ // : that.tableDatas[18][m];
+ // //空压机合计
+ // that.tableDatas[25][m] = sumNum(
+ // that.tableDatas[21][m],
+ // that.tableDatas[22][m],
+ // that.tableDatas[23][m],
+ // that.tableDatas[24][m]
+ // );
+ // //生产部分总耗电
+ // that.tableDatas[27][m] = sumNum(
+ // that.tableDatas[3][m],
+ // that.tableDatas[8][m],
+ // that.tableDatas[13][m],
+ // that.tableDatas[17][m],
+ // that.tableDatas[18][m],
+ // that.tableDatas[25][m],
+ // that.tableDatas[26][m]
+ // );
+ // //全厂耗电量
+ // // that.tableDatas[28][m] = sumNum(
+ // // that.tableDatas[27][m],
+ // // that.tableDatas[26][m]
+ // // );
+ // }
+ // that.tableDatas.forEach((inner, inde) => {
+ // let sumlast = 0;
+ // inner.forEach((num, ind) => {
+ // if (ind > 2 && ind < that.headerLength) {
+ // sumlast = sumlast + Number(num);
+ // }
+ // });
+ // inner[that.headerLength] = sumlast;
+ // });
+ // })
+ // .then(() => {});
+ // },
itemClick(item, index) {
let that = this;
let lineData = that.tableDatas[index].slice(3, that.headerLength);
diff --git a/src/views/enm_energy/hour_base.vue b/src/views/enm_energy/hour_base.vue
index 5121180b..7c7a4fc3 100644
--- a/src/views/enm_energy/hour_base.vue
+++ b/src/views/enm_energy/hour_base.vue
@@ -46,7 +46,7 @@
设备 |
单位 |
- {{ item }}时
+ {{ item - 1 }}时
|
本日合计 |
@@ -135,11 +135,11 @@ export default {
},
data() {
return {
+ day: "",
year: "",
month: "",
- day: "",
search_date: "",
- tableDatas: [
+ tableDatas1: [
["石灰石破碎", "破碎机", "kw.h"], //0
["石灰石破碎", "堆取料机", "kw.h"],
["石灰石破碎", "低压变压器柜", "kw.h"],
@@ -170,10 +170,30 @@ export default {
["生产总耗电量", "生产部分总耗电", "kw.h"],
["全厂进线", "全厂耗电量", "kw.h"],
],
+ mpointList: [],
+ tableDatas: [],
hours: [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24,
],
+ mgroupList: [
+ "石灰石破碎",
+ "原料磨",
+ "回转窑",
+ "煤磨",
+ "余热发电",
+ "空压机",
+ "富氧燃烧系统",
+ "生产总耗电量",
+ "全厂进线",
+ ],
+ mgroup: "石灰石破碎",
+ itemChartTitle: "",
+ itemChartData: [],
+ itemChartXData: [],
+ itemChartYData: [],
+ itemChartLegend: [],
+ itemChartSeries: [],
timeStamp: null,
itemVisible: false,
exportLoading: false,
@@ -269,12 +289,16 @@ export default {
mounted() {
let that = this;
var nowDate = new Date();
- that.year = nowDate.getFullYear();
- that.month = nowDate.getMonth() + 1;
- that.day = nowDate.getDate();
+ let year = nowDate.getFullYear();
+ let month = nowDate.getMonth() + 1;
+ let day = nowDate.getDate();
that.timeStamp = nowDate.getTime();
- let month0 = that.month > 9 ? that.month : "0" + that.month;
- that.search_date = that.year + "-" + month0 + "-" + that.day;
+ month = month > 9 ? month : "0" + month;
+ day = day > 9 ? day : "0" + day;
+ that.day = day;
+ that.year = year;
+ that.month = month;
+ that.search_date = year + "-" + month + "-" + day;
for (let i = 0; i < that.tableDatas.length; i++) {
for (let j = 0; j < 24; j++) {
let k = 3 + j;
@@ -285,224 +309,292 @@ export default {
for (let n = 0; n < 24; n++) {
that.xAxisData.push(n + "时");
}
- this.getData();
+ this.getMPoints();
},
methods: {
dateChange(e) {
let that = this;
- let arr = e.split("-");
+ that.tableDatas = [];
+ let arr = that.search_date.split("-");
that.year = Number(arr[0]);
that.month = Number(arr[1]);
that.day = Number(arr[2]);
- for (let i = 0; i < that.tableDatas.length; i++) {
- for (let j = 0; j < 25; j++) {
- let k = 3 + j;
- that.tableDatas[i][k] = 0;
- this.$forceUpdate();
- }
- }
+ // for (let i = 0; i < that.tableDatas.length; i++) {
+ // for (let j = 0; j < 25; j++) {
+ // let k = 3 + j;
+ // that.tableDatas[i][k] = 0;
+ // this.$forceUpdate();
+ // }
+ // }
let nowDate = new Date();
that.timeStamp = nowDate.getTime();
- this.getData();
+ that.dataLoop();
},
- getData() {
+ getMPoints() {
let that = this;
- function dataPush(name) {
- let index = 0;
- if (name == "破碎机") {
- index = 0;
- } else if (name == "堆取料机") {
- index = 1;
- } else if (name == "低压变压器柜") {
- index = 2;
- } else if (name == "循环风机") {
- index = 4;
- } else if (name == "调配变压器") {
- index = 6;
- } else if (name == "低压变压器柜器") {
- index = 7;
- } else if (name == "尾排风机") {
- index = 9;
- } else if (name == "高温风机") {
- index = 10;
- } else if (name == "头排风机") {
- index = 11;
- } else if (name == "煤磨主电机") {
- index = 14;
- } else if (name == "煤磨排风机") {
- index = 15;
- } else if (name == "低压变压器柜") {
- index = 16;
- } else if (name == "余热发电量") {
- index = 18;
- } else if (name == "余热发电自用电量") {
- index = 19;
- } else if (name == "1#空压机") {
- index = 21;
- } else if (name == "2#空压机") {
- index = 22;
- } else if (name == "3#空压机") {
- index = 23;
- } else if (name == "4#空压机") {
- index = 24;
- } else if (name == "富氧燃烧耗电设备") {
- index = 26;
- }
- return index;
- }
- function sumNum(a, b, c, d) {
- let sum = 0;
- if (typeof a !== "undefined" && a !== "NaN") {
- sum = sum + Number(a);
- }
- if (typeof b !== "undefined" && a !== "NaN") {
- sum = sum + Number(b);
- }
- if (typeof c !== "undefined" && a !== "NaN") {
- sum = sum + Number(c);
- }
- if (typeof d !== "undefined" && a !== "NaN") {
- sum = sum + Number(d);
- }
- return sum;
- }
- let obj = {};
- obj.type = "hour_s";
- obj.year_s = that.year;
- obj.month_s = that.month;
- obj.day_s = that.day;
- obj.page = 0;
- obj.mpoint__ep_monitored__power_kw__gte = 100;
- this.$API.enm.mpoint.stat
- .req(obj)
- .then((res) => {
- let wrapArr = [],
- innerArr = [];
- res.forEach((item) => {
- let hour = item.hour;
- if (wrapArr[hour]) {
- wrapArr[hour].push(item);
- } else {
- wrapArr[hour] = [];
- wrapArr[hour].push(item);
- }
- });
- wrapArr.forEach((inner, inde) => {
- inner.forEach((item) => {
- let i = dataPush(item.mpoint_name);
- let k = 0;
- if (
- i == 0 ||
- i == 4 ||
- i == 9 ||
- i == 14 ||
- i == 18 ||
- i == 21 ||
- i == 26 ||
- i == 27 ||
- i == 28
- ) {
- k = 3 + inde;
- } else {
- k = 2 + inde;
- }
- that.tableDatas[i][k] = item.val;
- });
- });
- for (let k = 0; k < 24; k++) {
- let m = k + 3;
- let n = k + 1;
- //石灰石破碎合计
-
- that.tableDatas[3][m] = sumNum(
- that.tableDatas[0][m],
- that.tableDatas[1][m],
- that.tableDatas[2][m]
- );
- //辊压机
- // that.tableDatas[5][m] = sumNum();
- //原料磨系统合计
- that.tableDatas[8][m] =
- sumNum(
- that.tableDatas[4][m],
- // that.tableDatas[5][m],
- that.tableDatas[6][m],
- that.tableDatas[7][m]
- ) -
- sumNum(
- that.tableDatas[1][m],
- that.tableDatas[2][m]
- );
- //低压变压器柜
- // that.tableDatas[12][m] = sumNum(
- // that.tableDatas[9][m],
- // that.tableDatas[10][m],
- // that.tableDatas[11][m]
- // );
- //回转窑烧成系统合计
- that.tableDatas[13][m] =
- typeof that.tableDatas[12][m] !== "undefined"
- ? sumNum(
- that.tableDatas[9][m],
- that.tableDatas[10][m],
- that.tableDatas[11][m],
- that.tableDatas[12][m]
- )
- : sumNum(
- that.tableDatas[9][m],
- that.tableDatas[10][m],
- that.tableDatas[11][m]
- );
- //煤磨系统合计
- let sum17 = sumNum(
- that.tableDatas[14][m],
- that.tableDatas[15][m],
- that.tableDatas[16][m]
- );
- that.tableDatas[17][m] =
- typeof that.tableDatas[21][m] !== "undefined"
- ? sum17 - that.tableDatas[21][m]
- : sum17;
- //余热供电量
- that.tableDatas[20][m] =
- typeof that.tableDatas[19][m] !== "undefined"
- ? that.tableDatas[18][m] -
- that.tableDatas[19][m]
- : that.tableDatas[18][m];
- //空压机合计
- that.tableDatas[25][m] = sumNum(
- that.tableDatas[21][m],
- that.tableDatas[22][m],
- that.tableDatas[23][m],
- that.tableDatas[24][m]
- );
- //生产部分总耗电
- that.tableDatas[27][m] = sumNum(
- that.tableDatas[3][m],
- that.tableDatas[8][m],
- that.tableDatas[13][m],
- that.tableDatas[17][m],
- that.tableDatas[18][m],
- that.tableDatas[25][m],
- that.tableDatas[26][m]
- );
- //全厂耗电量
- // that.tableDatas[28][m] = sumNum(
- // that.tableDatas[27][m],
- // that.tableDatas[26][m]
- // );
- }
- that.tableDatas.forEach((inner, inde) => {
- let sum27 = 0;
- inner.forEach((num, ind) => {
- if (ind > 2 && ind < 27) {
- sum27 = sum27 + Number(num);
- }
- });
- inner[27] = sum27;
- });
+ that.$API.enm.mpoint.list
+ .req({
+ page: 0,
+ enabled: true,
+ need_display: true,
+ ordering: "report_sortstr",
+ mpoint__material__code: "elec",
})
- .then(() => {});
+ .then((res) => {
+ let data = res.slice(3);
+ that.mpointList = data;
+ that.dataLoop();
+ });
+ },
+ dataLoop() {
+ let that = this;
+ that.tableDatas = [];
+ that.mpointList.forEach((item, index) => {
+ let arr = [];
+ arr[0] =
+ item.mgroup_name != null
+ ? item.mgroup_name
+ : item.nickname != null
+ ? item.nickname
+ : item.name;
+ arr[1] = item.nickname != null ? item.nickname : item.name;
+ arr[2] = item.unit;
+ for (let i = 0; i < 24; i++) {
+ arr[i + 3] = 0;
+ }
+ that.tableDatas.push(arr);
+ that.getData(item.id, index);
+ });
+ },
+ getData(id, index) {
+ let that = this;
+ let obj = {};
+ obj.type = "hour";
+ obj.year = that.year;
+ obj.month = that.month;
+ obj.day = that.day;
+ obj.mpoint__material__code = "elec";
+ obj.mpoint__need_display = 1;
+ obj.mpoint = id;
+ obj.page = 0;
+ this.$API.enm.mpoint.stat.req(obj).then((res) => {
+ console.log(res);
+ res.forEach((item) => {
+ let ind = item.hour + 3;
+ that.tableDatas[index][ind] = item.val;
+ });
+ that.$forceUpdate();
+ });
+ },
+ // getData(id) {
+ // let that = this;
+ // function dataPush(name) {
+ // let index = 0;
+ // if (name == "破碎机") {
+ // index = 0;
+ // } else if (name == "堆取料机") {
+ // index = 1;
+ // } else if (name == "低压变压器柜") {
+ // index = 2;
+ // } else if (name == "循环风机") {
+ // index = 4;
+ // } else if (name == "调配变压器") {
+ // index = 6;
+ // } else if (name == "低压变压器柜器") {
+ // index = 7;
+ // } else if (name == "尾排风机") {
+ // index = 9;
+ // } else if (name == "高温风机") {
+ // index = 10;
+ // } else if (name == "头排风机") {
+ // index = 11;
+ // } else if (name == "煤磨主电机") {
+ // index = 14;
+ // } else if (name == "煤磨排风机") {
+ // index = 15;
+ // } else if (name == "低压变压器柜") {
+ // index = 16;
+ // } else if (name == "余热发电量") {
+ // index = 18;
+ // } else if (name == "余热发电自用电量") {
+ // index = 19;
+ // } else if (name == "1#空压机") {
+ // index = 21;
+ // } else if (name == "2#空压机") {
+ // index = 22;
+ // } else if (name == "3#空压机") {
+ // index = 23;
+ // } else if (name == "4#空压机") {
+ // index = 24;
+ // } else if (name == "富氧燃烧耗电设备") {
+ // index = 26;
+ // }
+ // return index;
+ // }
+ // function sumNum(a, b, c, d) {
+ // let sum = 0;
+ // if (typeof a !== "undefined" && a !== "NaN") {
+ // sum = sum + Number(a);
+ // }
+ // if (typeof b !== "undefined" && a !== "NaN") {
+ // sum = sum + Number(b);
+ // }
+ // if (typeof c !== "undefined" && a !== "NaN") {
+ // sum = sum + Number(c);
+ // }
+ // if (typeof d !== "undefined" && a !== "NaN") {
+ // sum = sum + Number(d);
+ // }
+ // return sum;
+ // }
+ // let obj = {};
+ // obj.type = "hour_s";
+ // obj.year_s = that.year;
+ // obj.month_s = that.month;
+ // obj.day_s = that.day;
+ // obj.page = 0;
+ // obj.mpoint__ep_monitored__power_kw__gte = 100;
+ // this.$API.enm.mpoint.stat
+ // .req(obj)
+ // .then((res) => {
+ // let wrapArr = [],
+ // innerArr = [];
+ // res.forEach((item) => {
+ // let hour = item.hour;
+ // if (wrapArr[hour]) {
+ // wrapArr[hour].push(item);
+ // } else {
+ // wrapArr[hour] = [];
+ // wrapArr[hour].push(item);
+ // }
+ // });
+ // wrapArr.forEach((inner, inde) => {
+ // inner.forEach((item) => {
+ // let i = dataPush(item.mpoint_name);
+ // let k = 0;
+ // if (
+ // i == 0 ||
+ // i == 4 ||
+ // i == 9 ||
+ // i == 14 ||
+ // i == 18 ||
+ // i == 21 ||
+ // i == 26 ||
+ // i == 27 ||
+ // i == 28
+ // ) {
+ // k = 3 + inde;
+ // } else {
+ // k = 2 + inde;
+ // }
+ // that.tableDatas[i][k] = item.val;
+ // });
+ // });
+ // for (let k = 0; k < 24; k++) {
+ // let m = k + 3;
+ // let n = k + 1;
+ // //石灰石破碎合计
+
+ // that.tableDatas[3][m] = sumNum(
+ // that.tableDatas[0][m],
+ // that.tableDatas[1][m],
+ // that.tableDatas[2][m]
+ // );
+ // //辊压机
+ // // that.tableDatas[5][m] = sumNum();
+ // //原料磨系统合计
+ // that.tableDatas[8][m] =
+ // sumNum(
+ // that.tableDatas[4][m],
+ // // that.tableDatas[5][m],
+ // that.tableDatas[6][m],
+ // that.tableDatas[7][m]
+ // ) -
+ // sumNum(
+ // that.tableDatas[1][m],
+ // that.tableDatas[2][m]
+ // );
+ // //低压变压器柜
+ // // that.tableDatas[12][m] = sumNum(
+ // // that.tableDatas[9][m],
+ // // that.tableDatas[10][m],
+ // // that.tableDatas[11][m]
+ // // );
+ // //回转窑烧成系统合计
+ // that.tableDatas[13][m] =
+ // typeof that.tableDatas[12][m] !== "undefined"
+ // ? sumNum(
+ // that.tableDatas[9][m],
+ // that.tableDatas[10][m],
+ // that.tableDatas[11][m],
+ // that.tableDatas[12][m]
+ // )
+ // : sumNum(
+ // that.tableDatas[9][m],
+ // that.tableDatas[10][m],
+ // that.tableDatas[11][m]
+ // );
+ // //煤磨系统合计
+ // let sum17 = sumNum(
+ // that.tableDatas[14][m],
+ // that.tableDatas[15][m],
+ // that.tableDatas[16][m]
+ // );
+ // that.tableDatas[17][m] =
+ // typeof that.tableDatas[21][m] !== "undefined"
+ // ? sum17 - that.tableDatas[21][m]
+ // : sum17;
+ // //余热供电量
+ // that.tableDatas[20][m] =
+ // typeof that.tableDatas[19][m] !== "undefined"
+ // ? that.tableDatas[18][m] -
+ // that.tableDatas[19][m]
+ // : that.tableDatas[18][m];
+ // //空压机合计
+ // that.tableDatas[25][m] = sumNum(
+ // that.tableDatas[21][m],
+ // that.tableDatas[22][m],
+ // that.tableDatas[23][m],
+ // that.tableDatas[24][m]
+ // );
+ // //生产部分总耗电
+ // that.tableDatas[27][m] = sumNum(
+ // that.tableDatas[3][m],
+ // that.tableDatas[8][m],
+ // that.tableDatas[13][m],
+ // that.tableDatas[17][m],
+ // that.tableDatas[18][m],
+ // that.tableDatas[25][m],
+ // that.tableDatas[26][m]
+ // );
+ // //全厂耗电量
+ // // that.tableDatas[28][m] = sumNum(
+ // // that.tableDatas[27][m],
+ // // that.tableDatas[26][m]
+ // // );
+ // }
+ // that.tableDatas.forEach((inner, inde) => {
+ // let sum27 = 0;
+ // inner.forEach((num, ind) => {
+ // if (ind > 2 && ind < 27) {
+ // sum27 = sum27 + Number(num);
+ // }
+ // });
+ // inner[27] = sum27;
+ // });
+ // })
+ // .then(() => {});
+ // },
+ getHourData() {
+ let that = this;
+ let m = 0;
+ let date = new Date();
+ let year = date.getFullYear();
+ let month = date.getMonth() + 1;
+ let day = date.getDate();
+ let hour = date.getHours();
+ let minute = date.getMinutes();
+ let second = date.getSeconds();
},
getTableData() {
for (let i = 0; i < this.tableDatas.length; i++) {
diff --git a/src/views/enm_energy/month_base.vue b/src/views/enm_energy/month_base.vue
index d7062bee..2e83a3dc 100644
--- a/src/views/enm_energy/month_base.vue
+++ b/src/views/enm_energy/month_base.vue
@@ -45,7 +45,7 @@
工段 |
设备 |
单位 |
-
+ |
{{ item }}月
|
本年合计 |
@@ -135,40 +135,9 @@ export default {
data() {
return {
year: "",
- month: "",
- day: "",
search_date: "",
- tableDatas: [
- ["石灰石破碎", "破碎机", "kw.h"], //0
- ["石灰石破碎", "堆取料机", "kw.h"],
- ["石灰石破碎", "低压变压器柜", "kw.h"],
- ["石灰石破碎", "石灰石破碎合计", "kw.h"],
- ["原料磨", "循环风机", "kw.h"],
- ["原料磨", "辊压机", "kw.h"],
- ["原料磨", "调配变压器", "kw.h"],
- ["原料磨", "低压变压器柜器", "kw.h"],
- ["原料磨", "原料磨系统合计", "kw.h"],
- ["回转窑", "尾排风机", "kw.h"],
- ["回转窑", "高温风机", "kw.h"],
- ["回转窑", "头排风机", "kw.h"],
- ["回转窑", "低压变压器柜", "kw.h"],
- ["回转窑", "回转窑烧成系统合计", "kw.h"],
- ["煤磨", "煤磨主电机", "kw.h"],
- ["煤磨", "煤磨排风机", "kw.h"],
- ["煤磨", "低压变压器柜", "kw.h"],
- ["煤磨", "煤磨系统合计", "kw.h"],
- ["余热发电", "余热发电量", "kw.h"],
- ["余热发电", "余热发电自用电量", "kw.h"],
- ["余热发电", "余热供电量", "kw.h"],
- ["空压机", "1#空压机", "kw.h"],
- ["空压机", "2#空压机", "kw.h"],
- ["空压机", "3#空压机", "kw.h"],
- ["空压机", "4#空压机", "kw.h"],
- ["空压机", "空压机合计", "kw.h"],
- ["富氧燃烧系统", "富氧燃烧耗电设备", "kw.h"],
- ["生产总耗电量", "生产部分总耗电", "kw.h"],
- ["全厂进线", "全厂耗电量", "kw.h"],
- ],
+ mpointList: [],
+ tableDatas: [],
timeStamp: null,
itemVisible: false,
months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
@@ -278,228 +247,72 @@ export default {
let that = this;
var nowDate = new Date();
that.year = nowDate.getFullYear();
- that.search_date = that.year + "";
+ that.search_date = that.year;
that.timeStamp = nowDate.getTime();
- let tableDatas = that.tableDatas;
- for (let i = 0; i < tableDatas.length; i++) {
- for (let j = 0; j < 12; j++) {
- let k = 3 + j;
- that.tableDatas[i][k] = 0;
- this.$forceUpdate();
- }
- }
- this.getData();
+ this.getMPoints();
},
methods: {
dateChange() {
let that = this;
- for (let i = 0; i < that.tableDatas.length; i++) {
- for (let j = 0; j < 13; j++) {
- let k = 3 + j;
- that.tableDatas[i][k] = 0;
- this.$forceUpdate();
- }
- }
+ that.tableDatas = [];
+ that.year = that.search_date;
let nowDate = new Date();
that.timeStamp = nowDate.getTime();
- this.getData();
+ that.dataLoop();
},
- getData() {
+ getMPoints() {
let that = this;
- function dataPush(name) {
- let index = 0;
- if (name == "破碎机") {
- index = 0;
- } else if (name == "堆取料机") {
- index = 1;
- } else if (name == "低压变压器柜") {
- index = 2;
- } else if (name == "循环风机") {
- index = 4;
- } else if (name == "调配变压器") {
- index = 6;
- } else if (name == "低压变压器柜器") {
- index = 7;
- } else if (name == "尾排风机") {
- index = 9;
- } else if (name == "高温风机") {
- index = 10;
- } else if (name == "头排风机") {
- index = 11;
- } else if (name == "煤磨主电机") {
- index = 14;
- } else if (name == "煤磨排风机") {
- index = 15;
- } else if (name == "低压变压器柜") {
- index = 16;
- } else if (name == "余热发电量") {
- index = 18;
- } else if (name == "余热发电自用电量") {
- index = 19;
- } else if (name == "1#空压机") {
- index = 21;
- } else if (name == "2#空压机") {
- index = 22;
- } else if (name == "3#空压机") {
- index = 23;
- } else if (name == "4#空压机") {
- index = 24;
- } else if (name == "富氧燃烧耗电设备") {
- index = 26;
- }
- return index;
- }
- function sumNum(a, b, c, d) {
- let sum = 0;
- if (typeof a !== "undefined" && a !== "NaN") {
- sum = sum + Number(a);
- }
- if (typeof b !== "undefined" && a !== "NaN") {
- sum = sum + Number(b);
- }
- if (typeof c !== "undefined" && a !== "NaN") {
- sum = sum + Number(c);
- }
- if (typeof d !== "undefined" && a !== "NaN") {
- sum = sum + Number(d);
- }
- return sum;
- }
- let obj = {};
-
- obj.type = "month_s";
- obj.year_s = that.year;
- obj.page = 0;
- obj.mpoint__ep_monitored__power_kw__gte = 100;
- this.$API.enm.mpoint.stat
- .req(obj)
- .then((res) => {
- let wrapArr = [],
- innerArr = [];
- res.forEach((item) => {
- let month = item.month;
- if (wrapArr[month]) {
- wrapArr[month].push(item);
- } else {
- wrapArr[month] = [];
- wrapArr[month].push(item);
- }
- });
- wrapArr.forEach((inner, inde) => {
- inner.forEach((item) => {
- let i = dataPush(item.mpoint_name);
- let k = 0;
- if (
- i == 0 ||
- i == 4 ||
- i == 9 ||
- i == 14 ||
- i == 18 ||
- i == 21 ||
- i == 26 ||
- i == 27 ||
- i == 28
- ) {
- k = 3 + inde;
- } else {
- k = 2 + inde;
- }
- that.tableDatas[i][k] = item.val;
- });
- });
- for (let k = 0; k < 24; k++) {
- let m = k + 3;
- let n = k + 1;
- //石灰石破碎合计
- that.tableDatas[3][m] = sumNum(
- that.tableDatas[0][m],
- that.tableDatas[1][m],
- that.tableDatas[2][m]
- );
- //辊压机
- // that.tableDatas[5][m] = sumNum();
- //原料磨系统合计
- that.tableDatas[8][m] =
- sumNum(
- that.tableDatas[4][m],
- // that.tableDatas[5][m],
- that.tableDatas[6][m],
- that.tableDatas[7][m]
- ) -
- sumNum(
- that.tableDatas[1][m],
- that.tableDatas[2][m]
- );
- //低压变压器柜
- // that.tableDatas[12][m] = sumNum(
- // that.tableDatas[9][m],
- // that.tableDatas[10][m],
- // that.tableDatas[11][m]
- // );
- //回转窑烧成系统合计
- that.tableDatas[13][m] =
- typeof that.tableDatas[12][m] !== "undefined"
- ? sumNum(
- that.tableDatas[9][m],
- that.tableDatas[10][m],
- that.tableDatas[11][m],
- that.tableDatas[12][m]
- )
- : sumNum(
- that.tableDatas[9][m],
- that.tableDatas[10][m],
- that.tableDatas[11][m]
- );
- //煤磨系统合计
- let sum17 = sumNum(
- that.tableDatas[14][m],
- that.tableDatas[15][m],
- that.tableDatas[16][m]
- );
- that.tableDatas[17][m] =
- typeof that.tableDatas[21][m] !== "undefined"
- ? sum17 - that.tableDatas[21][m]
- : sum17;
- //余热供电量
- that.tableDatas[20][m] =
- typeof that.tableDatas[19][m] !== "undefined"
- ? that.tableDatas[18][m] -
- that.tableDatas[19][m]
- : that.tableDatas[18][m];
- //空压机合计
- that.tableDatas[25][m] = sumNum(
- that.tableDatas[21][m],
- that.tableDatas[22][m],
- that.tableDatas[23][m],
- that.tableDatas[24][m]
- );
- //生产部分总耗电
- that.tableDatas[27][m] = sumNum(
- that.tableDatas[3][m],
- that.tableDatas[8][m],
- that.tableDatas[13][m],
- that.tableDatas[17][m],
- that.tableDatas[18][m],
- that.tableDatas[25][m],
- that.tableDatas[26][m]
- );
- //全厂耗电量
- // that.tableDatas[28][m] = sumNum(
- // that.tableDatas[27][m],
- // that.tableDatas[26][m]
- // );
- }
- that.tableDatas.forEach((inner, inde) => {
- let sum15 = 0;
- inner.forEach((num, ind) => {
- if (ind > 2 && ind < 15) {
- sum15 = sum15 + Number(num);
- }
- });
- inner[15] = sum15;
- });
+ that.$API.enm.mpoint.list
+ .req({
+ page: 0,
+ enabled: true,
+ need_display: true,
+ ordering: "report_sortstr",
+ mpoint__material__code: "elec",
})
- .then(() => {});
+ .then((res) => {
+ let data = res.slice(3);
+ that.mpointList = data;
+ that.dataLoop();
+ });
+ },
+ dataLoop() {
+ let that = this;
+ that.tableDatas = [];
+ that.mpointList.forEach((item, index) => {
+ let arr = [];
+ arr[0] =
+ item.mgroup_name != null
+ ? item.mgroup_name
+ : item.nickname != null
+ ? item.nickname
+ : item.name;
+ arr[1] = item.nickname != null ? item.nickname : item.name;
+ arr[2] = item.unit;
+ for (let i = 0; i < 12; i++) {
+ arr[i + 3] = 0;
+ }
+ that.tableDatas.push(arr);
+ that.getData(item.id, index);
+ });
+ },
+ getData(id, index) {
+ let that = this;
+ let obj = {};
+ obj.type = "month";
+ obj.year = that.year;
+ obj.mpoint__material__code = "elec";
+ obj.mpoint__need_display = 1;
+ obj.mpoint = id;
+ obj.page = 0;
+ this.$API.enm.mpoint.stat.req(obj).then((res) => {
+ console.log(res);
+ res.forEach((item) => {
+ let ind = item.month + 2;
+ that.tableDatas[index][ind] = item.val;
+ });
+ that.$forceUpdate();
+ });
},
itemClick(item, index) {
let that = this;