fix:小时数hour_s传参换成实际时间year、month、day、hour;表格数据通过测点的mpoint_name进行整合数据
This commit is contained in:
parent
909ba81ad4
commit
9ab7e759dd
|
|
@ -377,7 +377,7 @@ export default {
|
|||
console.log("mpoints", res);
|
||||
let arr = [];
|
||||
res.forEach((item) => {
|
||||
arr.push(item.nickname);
|
||||
arr.push(item.name);
|
||||
});
|
||||
console.log("arr", arr);
|
||||
that.mpoints = arr;
|
||||
|
|
@ -406,6 +406,7 @@ export default {
|
|||
getTableHourData() {
|
||||
let that = this;
|
||||
that.tableDatas = [];
|
||||
let nowDate = new Date();
|
||||
let timeDate = new Date().getTime();
|
||||
let hourTime = timeDate - 3600000;
|
||||
let hourDate = new Date(hourTime);
|
||||
|
|
@ -413,15 +414,6 @@ export default {
|
|||
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;
|
||||
|
|
@ -436,11 +428,10 @@ export default {
|
|||
.req(obj)
|
||||
.then((res) => {
|
||||
that.tableData = res;
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname);
|
||||
let index = that.mpoints.indexOf(item.mpoint_name);
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[3] = item.elec_consume_unit;
|
||||
|
|
@ -449,18 +440,21 @@ export default {
|
|||
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 ystDate = null;
|
||||
if(hours_h>21){//传入今天的日期
|
||||
ystDate = nowDate;
|
||||
}else{//传入昨天的日期
|
||||
let yetTime = timeDate - 3600000 * 24;
|
||||
ystDate = new Date(yetTime);
|
||||
}
|
||||
let year_d = ystDate.getFullYear();
|
||||
let month_d = ystDate.getMonth() + 1;
|
||||
let days_d = ystDate.getDate();
|
||||
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.year_s = year_d;
|
||||
obj_d.month_s = month_d;
|
||||
obj_d.day_s = days_d;
|
||||
obj_d.mgroup__name = "煤磨";
|
||||
obj_d.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_d.mpoint__need_display = 1;
|
||||
|
|
@ -469,14 +463,14 @@ export default {
|
|||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_d = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
item.mpoint_name
|
||||
);
|
||||
if (that.tableDatas[index_d]) {
|
||||
that.tableDatas[index_d][3] =
|
||||
that.tableDatas[index_d][4] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[4] = item.elec_consume_unit;
|
||||
|
|
@ -496,14 +490,14 @@ export default {
|
|||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_m = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
item.mpoint_name
|
||||
);
|
||||
if (that.tableDatas[index_m]) {
|
||||
that.tableDatas[index_m][4] =
|
||||
that.tableDatas[index_m][5] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[5] = item.elec_consume_unit;
|
||||
|
|
@ -514,7 +508,6 @@ export default {
|
|||
});
|
||||
});
|
||||
})
|
||||
.then(() => {});
|
||||
},
|
||||
//获取小时数据
|
||||
getHourData(year, month, days) {
|
||||
|
|
@ -536,7 +529,7 @@ export default {
|
|||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
let ind = item.hour; //xAxis
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
|
|
@ -577,7 +570,7 @@ export default {
|
|||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
let ind = item.day_s - 1;
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
|
|
@ -619,7 +612,7 @@ export default {
|
|||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.month_s - 1;
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option3 };
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ export default {
|
|||
console.log("mpoints", res);
|
||||
let arr = [];
|
||||
res.forEach((item) => {
|
||||
arr.push(item.nickname);
|
||||
arr.push(item.name);
|
||||
});
|
||||
console.log("arr", arr);
|
||||
that.mpoints = arr;
|
||||
|
|
@ -521,6 +521,7 @@ export default {
|
|||
getTableHourData() {
|
||||
let that = this;
|
||||
that.tableDatas = [];
|
||||
let nowDate = new Date();
|
||||
let timeDate = new Date().getTime();
|
||||
let hourTime = timeDate - 3600000;
|
||||
let hourDate = new Date(hourTime);
|
||||
|
|
@ -528,15 +529,6 @@ export default {
|
|||
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;
|
||||
|
|
@ -553,9 +545,9 @@ export default {
|
|||
that.tableData = res;
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname);
|
||||
let index = that.mpoints.indexOf(item.mpoint_name);
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[3] = item.elec_consume_unit;
|
||||
|
|
@ -564,18 +556,21 @@ export default {
|
|||
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 ystDate = null;
|
||||
if(hours_h>21){//传入今天的日期
|
||||
ystDate = nowDate;
|
||||
}else{//传入昨天的日期
|
||||
let yetTime = timeDate - 3600000 * 24;
|
||||
ystDate = new Date(yetTime);
|
||||
}
|
||||
let year_d = ystDate.getFullYear();
|
||||
let month_d = ystDate.getMonth() + 1;
|
||||
let days_d = ystDate.getDate();
|
||||
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.year_s = year_d;
|
||||
obj_d.month_s = month_d;
|
||||
obj_d.day_s = days_d;
|
||||
obj_d.mgroup__name = "回转窑";
|
||||
obj_d.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_d.mpoint__need_display = 1;
|
||||
|
|
@ -584,14 +579,14 @@ export default {
|
|||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_d = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
item.mpoint_name
|
||||
);
|
||||
if (that.tableDatas[index_d]) {
|
||||
that.tableDatas[index_d][3] =
|
||||
that.tableDatas[index_d][4] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[4] = item.elec_consume_unit;
|
||||
|
|
@ -611,14 +606,14 @@ export default {
|
|||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_m = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
item.mpoint_name
|
||||
);
|
||||
if (that.tableDatas[index_m]) {
|
||||
that.tableDatas[index_m][4] =
|
||||
that.tableDatas[index_m][5] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[5] = item.elec_consume_unit;
|
||||
|
|
@ -651,7 +646,7 @@ export default {
|
|||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
let ind = item.hour; //xAxis
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
|
|
@ -692,7 +687,7 @@ export default {
|
|||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
let ind = item.day_s - 1;
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
|
|
@ -734,7 +729,7 @@ export default {
|
|||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.month_s - 1;
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option3 };
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ export default {
|
|||
console.log("mpoints", res);
|
||||
let arr = [];
|
||||
res.forEach((item) => {
|
||||
arr.push(item.nickname);
|
||||
arr.push(item.name);
|
||||
});
|
||||
console.log("arr", arr);
|
||||
that.mpoints = arr;
|
||||
|
|
@ -478,6 +478,7 @@ export default {
|
|||
getTableHourData() {
|
||||
let that = this;
|
||||
that.tableDatas = [];
|
||||
let nowDate = new Date();
|
||||
let timeDate = new Date().getTime();
|
||||
let hourTime = timeDate - 3600000;
|
||||
let hourDate = new Date(hourTime);
|
||||
|
|
@ -485,15 +486,6 @@ export default {
|
|||
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;
|
||||
|
|
@ -510,29 +502,30 @@ export default {
|
|||
that.tableData = res;
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname);
|
||||
let index = that.mpoints.indexOf(item.mpoint_name);
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;
|
||||
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 ystDate = null;
|
||||
if(hours_h>21){//传入今天的日期
|
||||
ystDate = nowDate;
|
||||
}else{//传入昨天的日期
|
||||
let yetTime = timeDate - 3600000 * 24;
|
||||
ystDate = new Date(yetTime);
|
||||
}
|
||||
let year_d = ystDate.getFullYear();
|
||||
let month_d = ystDate.getMonth() + 1;
|
||||
let days_d = ystDate.getDate();
|
||||
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.year_s = year_d;
|
||||
obj_d.month_s = month_d;
|
||||
obj_d.day_s = days_d;
|
||||
obj_d.mgroup__name = "水泥磨";
|
||||
obj_d.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_d.mpoint__need_display = 1;
|
||||
|
|
@ -541,14 +534,14 @@ export default {
|
|||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_d = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
item.mpoint_name
|
||||
);
|
||||
if (that.tableDatas[index_d]) {
|
||||
that.tableDatas[index_d][3] =
|
||||
that.tableDatas[index_d][4] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[4] = item.elec_consume_unit;
|
||||
|
|
@ -568,14 +561,14 @@ export default {
|
|||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_m = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
item.mpoint_name
|
||||
);
|
||||
if (that.tableDatas[index_m]) {
|
||||
that.tableDatas[index_m][4] =
|
||||
that.tableDatas[index_m][5] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[5] = item.elec_consume_unit;
|
||||
|
|
@ -608,7 +601,7 @@ export default {
|
|||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
let ind = item.hour; //xAxis
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
|
|
@ -649,7 +642,7 @@ export default {
|
|||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
let ind = item.day_s - 1;
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
|
|
@ -691,7 +684,7 @@ export default {
|
|||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.month_s - 1;
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option3 };
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ export default {
|
|||
console.log("mpoints", res);
|
||||
let arr = [];
|
||||
res.forEach((item) => {
|
||||
arr.push(item.nickname);
|
||||
arr.push(item.name);
|
||||
});
|
||||
console.log("arr", arr);
|
||||
that.mpoints = arr;
|
||||
|
|
@ -455,6 +455,7 @@ export default {
|
|||
getTableHourData() {
|
||||
let that = this;
|
||||
that.tableDatas = [];
|
||||
let nowDate = new Date();
|
||||
let timeDate = new Date().getTime();
|
||||
let hourTime = timeDate - 3600000;
|
||||
let hourDate = new Date(hourTime);
|
||||
|
|
@ -462,15 +463,6 @@ export default {
|
|||
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;
|
||||
|
|
@ -487,9 +479,9 @@ export default {
|
|||
that.tableData = res;
|
||||
console.log("getTableHourData", res);
|
||||
res.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname);
|
||||
let index = that.mpoints.indexOf(item.mpoint_name);
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[3] = item.elec_consume_unit;
|
||||
|
|
@ -498,18 +490,21 @@ export default {
|
|||
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 ystDate = null;
|
||||
if(hours_h>21){//传入今天的日期
|
||||
ystDate = nowDate;
|
||||
}else{//传入昨天的日期
|
||||
let yetTime = timeDate - 3600000 * 24;
|
||||
ystDate = new Date(yetTime);
|
||||
}
|
||||
let year_d = ystDate.getFullYear();
|
||||
let month_d = ystDate.getMonth() + 1;
|
||||
let days_d = ystDate.getDate();
|
||||
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.year_s = year_d;
|
||||
obj_d.month_s = month_d;
|
||||
obj_d.day_s = days_d;
|
||||
obj_d.mgroup__name = "原料磨";
|
||||
obj_d.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_d.mpoint__need_display = 1;
|
||||
|
|
@ -518,14 +513,14 @@ export default {
|
|||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_d = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
item.mpoint_name
|
||||
);
|
||||
if (that.tableDatas[index_d]) {
|
||||
that.tableDatas[index_d][3] =
|
||||
that.tableDatas[index_d][4] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[4] = item.elec_consume_unit;
|
||||
|
|
@ -545,14 +540,14 @@ export default {
|
|||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_m = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
item.mpoint_name
|
||||
);
|
||||
if (that.tableDatas[index_m]) {
|
||||
that.tableDatas[index_m][4] =
|
||||
that.tableDatas[index_m][5] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[5] = item.elec_consume_unit;
|
||||
|
|
@ -585,7 +580,7 @@ export default {
|
|||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
let ind = item.hour; //xAxis
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
|
|
@ -626,7 +621,7 @@ export default {
|
|||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
let ind = item.day_s - 1;
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
|
|
@ -668,7 +663,7 @@ export default {
|
|||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.month_s - 1;
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option3 };
|
||||
|
|
|
|||
|
|
@ -280,22 +280,6 @@ export default {
|
|||
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);
|
||||
});
|
||||
console.log("arr", arr);
|
||||
that.mpoints = arr;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getMpoints() {
|
||||
|
|
@ -311,7 +295,7 @@ export default {
|
|||
console.log("mpoints", res);
|
||||
let arr = [];
|
||||
res.forEach((item) => {
|
||||
arr.push(item.nickname);
|
||||
arr.push(item.name);
|
||||
});
|
||||
console.log("arr", arr);
|
||||
that.mpoints = arr;
|
||||
|
|
@ -336,19 +320,24 @@ export default {
|
|||
getTableHourData() {
|
||||
let that = this;
|
||||
that.tableDatas = [];
|
||||
let nowDate = new Date();
|
||||
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 hours_h = nowDate.getHours();
|
||||
let ystDate = null;
|
||||
if(hours_h>21){//传入今天的日期
|
||||
ystDate = nowDate;
|
||||
}else{//传入昨天的日期
|
||||
let yetTime = timeDate - 3600000 * 24;
|
||||
ystDate = new Date(yetTime);
|
||||
}
|
||||
let year_d = ystDate.getFullYear();
|
||||
let month_d = ystDate.getMonth() + 1;
|
||||
let days_d = ystDate.getDate();
|
||||
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.year_s = year_d;
|
||||
obj_d.month_s = month_d;
|
||||
obj_d.day_s = days_d;
|
||||
obj_d.mgroup__name = "电石渣";
|
||||
obj_d.mpoint__material__code__in = "elec,elec_0";
|
||||
obj_d.mpoint__need_display = 1;
|
||||
|
|
@ -356,12 +345,12 @@ export default {
|
|||
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);
|
||||
let index_d = that.mpoints.indexOf(item.mpoint_name);
|
||||
if (that.tableDatas[index_d]) {
|
||||
that.tableDatas[index_d][3] = item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[3] = item.elec_consume_unit;
|
||||
|
|
@ -381,14 +370,14 @@ export default {
|
|||
console.log("getTableHourData", res);
|
||||
res.forEach((item, index) => {
|
||||
let index_m = that.mpoints.indexOf(
|
||||
item.mpoint_nickname
|
||||
item.mpoint_name
|
||||
);
|
||||
if (that.tableDatas[index_m]) {
|
||||
that.tableDatas[index_m][4] =
|
||||
item.elec_consume_unit;
|
||||
} else {
|
||||
let obj = [];
|
||||
obj[0] = item.mpoint_nickname;
|
||||
obj[0] = item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;;
|
||||
obj[1] = item.ep_monitored_number;
|
||||
obj[2] = "KW·h/t";
|
||||
obj[4] = item.elec_consume_unit;
|
||||
|
|
@ -418,7 +407,7 @@ export default {
|
|||
}
|
||||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
let ind = item.day_s - 1;
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
|
|
@ -460,7 +449,7 @@ export default {
|
|||
let data = response;
|
||||
data.forEach((item) => {
|
||||
let ind = item.month_s - 1;
|
||||
let index = that.mpoints.indexOf(item.mpoint_nickname); //第几个mpoint
|
||||
let index = that.mpoints.indexOf(item.mpoint_name); //第几个mpoint
|
||||
seriesData[index][ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = { ...that.option3 };
|
||||
|
|
|
|||
Loading…
Reference in New Issue