From b73f62b4d232517e79c674a7c7a3788c7b9b8d68 Mon Sep 17 00:00:00 2001 From: shijing Date: Wed, 15 May 2024 09:51:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=8A=A5=E8=A1=A8=E5=90=88=E8=AE=A1?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/enm_energy/day_base.vue | 210 ++-------------------------- src/views/enm_energy/hour_base.vue | 205 +-------------------------- src/views/enm_energy/month_base.vue | 6 + 3 files changed, 23 insertions(+), 398 deletions(-) diff --git a/src/views/enm_energy/day_base.vue b/src/views/enm_energy/day_base.vue index 3fe73129..e14ca883 100644 --- a/src/views/enm_energy/day_base.vue +++ b/src/views/enm_energy/day_base.vue @@ -108,7 +108,9 @@ > {{ item[2 + day] }} - {{ item[headerLength] }} + + {{ item[headerLength - 1] }} + @@ -317,211 +319,21 @@ export default { obj.page = 0; this.$API.enm.mpoint.stat.req(obj).then((res) => { console.log(res); + let sum = 0; res.forEach((item) => { let ind = item.day + 2; that.tableDatas[index][ind] = item.val; + sum += Number(item.val); }); + sum = sum * 100; + sum = Math.round(sum); + sum = sum / 100; + let dayss = 0; + dayss = this.days + 3; + that.tableDatas[index][dayss] = sum.toFixed(2); 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 05d01804..37b3d2ee 100644 --- a/src/views/enm_energy/hour_base.vue +++ b/src/views/enm_energy/hour_base.vue @@ -384,212 +384,19 @@ export default { obj.page = 0; this.$API.enm.mpoint.stat.req(obj).then((res) => { console.log(res); + let sum = 0; res.forEach((item) => { let ind = item.hour + 3; that.tableDatas[index][ind] = item.val; + sum += Number(item.val); }); + sum = sum * 100; + sum = Math.round(sum); + sum = sum / 100; + that.tableDatas[index][27] = sum.toFixed(2); 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; diff --git a/src/views/enm_energy/month_base.vue b/src/views/enm_energy/month_base.vue index cd4592f0..790a996a 100644 --- a/src/views/enm_energy/month_base.vue +++ b/src/views/enm_energy/month_base.vue @@ -302,10 +302,16 @@ export default { obj.page = 0; this.$API.enm.mpoint.stat.req(obj).then((res) => { console.log(res); + let sum = 0; res.forEach((item) => { let ind = item.month + 2; that.tableDatas[index][ind] = item.val; + sum += Number(item.val); }); + sum = sum * 100; + sum = Math.round(sum); + sum = sum / 100; + that.tableDatas[index][15] = sum.toFixed(2); that.$forceUpdate(); }); },