diff --git a/src/config/route.js b/src/config/route.js index ef8559c2..a756b652 100644 --- a/src/config/route.js +++ b/src/config/route.js @@ -449,26 +449,26 @@ const routes = [ // }, // component: "enm_rm_copy/power", // }, - // { - // name: "teamAnalysis_copy", - // path: "/enm_rm_copy/teamAnalysis", - // meta: { - // title: "班组月度对比", - // // icon: "el-icon-operation", - // perms: ["enm_rm_auxiliary"], - // }, - // component: "enm_rm_copy/teamAnalysis", - // }, - // { - // name: "workshopAnalysis_copy", - // path: "/enm_rm_copy/workshopAnalysis", - // meta: { - // title: "车间单耗分析", - // // icon: "el-icon-data-line", - // perms: ["enm_rm_auxiliary"], - // }, - // component: "enm_rm_copy/workshopAnalysis", - // }, + { + name: "teamAnalysis_copy", + path: "/enm_rm_copy/teamAnalysis", + meta: { + title: "班组月度对比", + // icon: "el-icon-operation", + perms: ["enm_rm_auxiliary"], + }, + component: "enm_rm_copy/teamAnalysis", + }, + { + name: "workshopAnalysis_copy", + path: "/enm_rm_copy/workshopAnalysis", + meta: { + title: "车间单耗分析", + // icon: "el-icon-data-line", + perms: ["enm_rm_auxiliary"], + }, + component: "enm_rm_copy/workshopAnalysis", + }, { name: "handoverLog_copy", path: "/enm_rm_copy/handoverLog", diff --git a/src/views/enm_coal/power.vue b/src/views/enm_coal/power.vue index 8e72d82f..c3e38329 100644 --- a/src/views/enm_coal/power.vue +++ b/src/views/enm_coal/power.vue @@ -371,6 +371,7 @@ export default { obj.mgroup__name = "煤磨"; obj.page = 0; obj.enabled = 1; + that.mpoints = []; // obj.need_display = 1; obj.ordering = "report_sortstr"; obj.material__code__in = "elec,elec_0"; @@ -461,7 +462,6 @@ export default { obj_d.mpoint__need_display = 1; obj_d.page = 0; this.$API.enm.mpoint.stat.req(obj_d).then((res) => { - console.log("getTableHourData", res); res.forEach((item, index) => { let index_d = that.mpoints.indexOf( item.mpoint_name @@ -479,7 +479,9 @@ export default { that.tableDatas[index_d] = obj; } }); - let obj_m = {}; + + }); + let obj_m = {}; obj_m.type = "month_s"; obj_m.year_s = that.year; obj_m.month_s = that.month; @@ -508,7 +510,6 @@ export default { } }); }); - }); }) }, //获取小时数据 @@ -516,15 +517,17 @@ export default { let that = this; let obj = {}; obj.type = "hour_s"; - obj.year = year; - obj.month = month; - obj.day = days; + obj.year_s = year; + obj.month_s = month; + obj.day_s = days; obj.mgroup__name = "煤磨"; obj.mpoint__material__code__in = "elec,elec_0"; // obj.mpoint__ep_monitored__isnull = 0; obj.mpoint__need_display = 1; obj.mpoint__ep_monitored__power_kw__gte = 100; obj.page = 0; + console.log(obj); + this.$API.enm.mpoint.stat.req(obj).then((response) => { let seriesData = []; for (let i = 0; i < that.mpoints.length; i++) { @@ -543,6 +546,8 @@ export default { seriesData[index][ind] = item.elec_consume_unit; }); let options = { ...that.option1 }; + options.legend.data = []; + options.series = []; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; chartItem.name = that.mpoints[j]; @@ -591,6 +596,8 @@ export default { seriesData[index][ind] = item.elec_consume_unit; }); let options = { ...that.option2 }; + options.legend.data = []; + options.series = []; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; chartItem.name = that.mpoints[j]; @@ -639,6 +646,8 @@ export default { seriesData[index][ind] = item.elec_consume_unit; }); let options = { ...that.option3 }; + options.legend.data = []; + options.series = []; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; chartItem.name = that.mpoints[j]; diff --git a/src/views/enm_coal/report.vue b/src/views/enm_coal/report.vue index 29947a18..47d21143 100644 --- a/src/views/enm_coal/report.vue +++ b/src/views/enm_coal/report.vue @@ -303,11 +303,11 @@ export default { }, tableDatas: [ ["产量", "煤磨总产量(t)", 0, 0, 0, 0, 0, 0, 0, 0], - ["产量", "煤磨台时产量(t/h)", "/", 0, 0, 0, 0, 0, 0, 0], - ["运转时间", "煤磨运转时间(h)", "/", 0, 0, "/", 0, 0, "/", "/"], - ["运转时间", "煤磨运转率(%)", "/", 0, 0, "/", 0, 0, "/","/"], + ["产量", "煤磨台时产量(t/h)", 0, 0, 0, 0, 0, 0, 0, 0], + ["运转时间", "煤磨运转时间(h)", 0, 0, 0, 0, 0, 0, 0, 0], + ["运转时间", "煤磨运转率(%)", 0, 0, 0, 0, 0, 0, 0, 0], ["能耗", "煤磨分布电耗(kW·h/t)", 0, 0, 0, 0, 0, 0, 0, 0], - ["能耗", "煤磨总电量(kW·h)", 0, 0, 0, 0, "/", "/", "/", "/"] + ["能耗", "煤磨总电量(kW·h)", 0, 0, 0, 0, 0, 0, 0, 0] ], tableName: "生产报告", modelValue: true, @@ -483,6 +483,14 @@ export default { return "/"; } } + function consume_precen(a, b) { + if (b !== 0 && b !== null && a !== null) { + let precen = ((a / b)+1)* 100; + return precen.toFixed(2) + "%"; + } else { + return "/"; + } + } let that = this; var myDate = new Date(); let year = (that.year = myDate.getFullYear()); @@ -571,6 +579,7 @@ export default { //月目标 let params5 = {}; params5.page = 0; + params5.year = year; params5.mgroup = that.query.mgroup; this.$API.mtm.goal.list .req(params5) @@ -591,18 +600,21 @@ export default { item5.goal_cate_name == "运转时间(h)" ) { that.tableDatas[2][6] = item5[str]; - // that.tableDatas[2][8] = item5.goal_val; + that.tableDatas[2][8] = item5.goal_val; } else if ( item5.goal_cate_name == "运转率(%)" ) { that.tableDatas[3][6] = item5[str]; - // that.tableDatas[3][8] = item5.goal_val; + that.tableDatas[3][8] = item5.goal_val; } else if ( item5.goal_cate_name == "单位产品分布电耗(kW·h/t)" ) { that.tableDatas[4][6] = item5[str]; that.tableDatas[4][8] = item5.goal_val; + }else if (item5.goal_cate_name == "总电量(kW·h)") { + that.tableDatas[5][6] = item5[str]; + that.tableDatas[5][8] = item5.goal_val; } }); } @@ -627,21 +639,25 @@ export default { that.tableDatas[1][5], that.tableDatas[1][8] ); - // that.tableDatas[2][5] = data1.run_hour; - // that.tableDatas[2][9] = precen( - // that.tableDatas[2][5], - // that.tableDatas[2][8] - // ); - // that.tableDatas[3][5] = data1.run_rate; - // that.tableDatas[3][9] = precen( - // that.tableDatas[3][5], - // that.tableDatas[3][8] - // ); + that.tableDatas[2][5] = data1.run_hour; + that.tableDatas[2][9] = precen( + that.tableDatas[2][5], + that.tableDatas[2][8] + ); + that.tableDatas[3][5] = data1.run_rate; + that.tableDatas[3][9] = precen( + that.tableDatas[3][5], + that.tableDatas[3][8] + ); that.tableDatas[4][5] = data1.elec_consume_unit; - that.tableDatas[5][5] = data1.elec_consume; - that.tableDatas[4][9] = precen( - (that.tableDatas[4][5]-that.tableDatas[4][8]), + that.tableDatas[4][9] = consume_precen( + that.tableDatas[4][8] - that.tableDatas[4][5], that.tableDatas[4][8] + ); + that.tableDatas[5][5] = data1.elec_consume; + that.tableDatas[5][9] = consume_precen( + (that.tableDatas[5][8]-that.tableDatas[5][5]), + that.tableDatas[5][8] ); } else { } @@ -677,11 +693,16 @@ export default { that.tableDatas[3][6] ); that.tableDatas[4][4] = data2.elec_consume_unit; - that.tableDatas[5][4] = data2.elec_consume; - that.tableDatas[4][7] = precen( - (that.tableDatas[4][4]-that.tableDatas[4][6]), + that.tableDatas[4][7] = consume_precen( + (that.tableDatas[4][6]-that.tableDatas[4][4]), that.tableDatas[4][6] ); + that.tableDatas[5][4] = data2.elec_consume; + that.tableDatas[5][7] = consume_precen( + (that.tableDatas[5][6]-that.tableDatas[5][4]), + that.tableDatas[5][6] + ); + } }); }); diff --git a/src/views/enm_coal/teamAnalysis.vue b/src/views/enm_coal/teamAnalysis.vue index 65fc8d66..9e775941 100644 --- a/src/views/enm_coal/teamAnalysis.vue +++ b/src/views/enm_coal/teamAnalysis.vue @@ -159,10 +159,14 @@ export default { if (data0.length > 0) { data0.forEach((item0) => { //先按月份排序,再按班组排序 - wrapArr0[ind0] = item0; + let month = item0.month_s; + if (!wrapArr0[month]) { + wrapArr0[month] = []; + } + wrapArr0[month].push(item0); }); - } else { - } + } else { console.log('No data received.');} + }).then(() => { this.$API.enm.enstat.req(that.query).then((res) => { //今年的值 let data = res; @@ -203,33 +207,36 @@ export default { arr[5] = item.出磨煤粉_细度_rate_pass !== undefined && item.出磨煤粉_细度_rate_pass !== null ? item.出磨煤粉_细度_rate_pass - : "/"; + : 0; arr[6] = item.出磨煤粉_水分_rate_pass !== undefined && item.出磨煤粉_水分_rate_pass !== null ? item.出磨煤粉_水分_rate_pass - : "/"; + : 0; //设备 arr[7] = item.煤磨排风机主电机_consume_unit !== undefined && item.煤磨排风机主电机_consume_unit !== null ? item.煤磨排风机主电机_consume_unit - : "/"; + : 0; let keyVale = "goal_val_" + n; arr[8] = item.elec_consume_unit; //当期值(kW·h/t) arr[9] = goalData[keyVale]; //目标值(kW·h/t)//需要接口获取 arr[10] = (arr[8] - arr[9]).toFixed(2); //当期与目标差值(kW·h/t) let ind_pre = 0, - huanqi = 0, - huanqicha = 0, - tongqi = 0, - tongqicha = 0; - if (n == 1) { - ind_pre = 12; - huanqi = wrapArr0[ind_pre] - ? wrapArr0[ind_pre].elec_consume_unit - : "/"; + huanqi = 0; + if (item.month_s == 1) { + ind_pre = 12; + // 循环遍历数组wrapArr0[ind_pre],找到item.name与 wrapArr0 数组中相同的名字 + if (wrapArr0[ind_pre]) { + wrapArr0[ind_pre].forEach((item0) => { + if (item0.team_name == item.team_name) { + huanqi = item0.elec_consume_unit; + } + }); + } + } else { // 如果 wrapArr数组长度大于0,那么循环遍历wrapArr数组,找到与item.month_s相差1的元素 而 item.name相同,并赋值给huanbi compareArr0.forEach((item0) => { @@ -239,6 +246,7 @@ export default { }) } arr[11] = huanqi; //环期值(kW·h/t)上个月的值 + let huanqicha = 0; if (huanqi !== "/") { huanqicha = (arr[8] - arr[11]).toFixed(2); } else { @@ -251,7 +259,7 @@ export default { }else{ arr[13] = "/"; //环比增长率(%)= 当期与环期差值(kW·h/t)/环期值(kW·h/t)*100% } - arr[14] = tongqi; //同比增长率(%) + arr[14] = 0; //同比增长率(%) // arr[15] = 0.0; //得分 arr[15] = 0; if (month_obj[n]) { @@ -338,6 +346,8 @@ export default { } }); }); + + }, handleQuery() { this.tableDatas = []; diff --git a/src/views/enm_coal/workshopAnalysis.vue b/src/views/enm_coal/workshopAnalysis.vue index 6ce7b76c..e4c94e45 100644 --- a/src/views/enm_coal/workshopAnalysis.vue +++ b/src/views/enm_coal/workshopAnalysis.vue @@ -140,12 +140,13 @@ export default { } //月目标 let paramsGoal = {}; + let monthGoal = []; paramsGoal.page = 0; paramsGoal.mgroup = that.query.mgroup; paramsGoal.goal_cate__code = "elec_consume_unit"; var ress = await that.$API.mtm.goal.list.req(paramsGoal); if (ress.length > 0) { - let monthGoal = []; + ress.forEach((goal) => { monthGoal[0] = goal.goal_val; monthGoal[1] = goal.goal_val_2; @@ -159,10 +160,9 @@ export default { monthGoal[9] = goal.goal_val_10; monthGoal[10] = goal.goal_val_11; monthGoal[11] = goal.goal_val_12; - monthGoal[12] = goal.goal_val_12; }); } - this.getData(); + this.getData(monthGoal); }, methods: { // 动态绑定Class @@ -190,7 +190,7 @@ export default { return "/"; } }, - getData() { + getData(monthGoal) { let that = this; let query0 = {}; query0.page = 0; @@ -219,14 +219,14 @@ export default { if (data.length > 0) { data.forEach((item) => { //先按月份排序,再按班组排序 - let ind = item.month_s; + let ind = item.month_s-1; let arr = []; let time = "" + item.year_s + "." + item.month_s; arr.push(time); arr.push(item.elec_consume_unit); //当期值(kW·h/t) arr[2] = - that.monthGoal[ind] !== undefined - ? that.monthGoal[ind] + monthGoal[ind] !== undefined + ? monthGoal[ind] : "/"; arr[3] = item.note; arr[4] = item.id; @@ -305,7 +305,6 @@ export default { wrapArrs.push(arrs); }); that.tableDatas = wrapArrs; - console.log(that.tableDatas); } else { } }); @@ -320,7 +319,6 @@ export default { this.$API.bi.dataset.exec.req("3322567213885833216").then((res) => { this.myOption = JSON.parse(res.echart_options); debugger; - console.log(this.myOption); this.chartShow = true; }); }, diff --git a/src/views/enm_kiln/power.vue b/src/views/enm_kiln/power.vue index 9c94cfbc..c2f42975 100644 --- a/src/views/enm_kiln/power.vue +++ b/src/views/enm_kiln/power.vue @@ -179,7 +179,7 @@ let tooltip = { let grid = { right: "3%", left: "7%", - top: "15%", + top: "30%", }; let toolbox = { right: "2%", @@ -187,11 +187,23 @@ let toolbox = { dataView: { show: true, readOnly: false }, saveAsImage: { show: true }, }, + orient: "vertical", }; let legend = { top: "2%", - left: "30", // orient:'vertical', + selector: [ + { + type: 'all', + title: '全选' + }, + { + type: 'inverse', + title: '反选' + } + ], + top: "2%", + width: "400px", data: [ "高温风机", "窑主电机", @@ -635,9 +647,9 @@ export default { let that = this; let obj = {}; obj.type = "hour_s"; - obj.year = year; - obj.month = month; - obj.day = days; + obj.year_s = year; + obj.month_s = month; + obj.day_s = days; obj.mgroup__name = "回转窑"; obj.mpoint__material__code__in = "elec,elec_0"; // obj.mpoint__ep_monitored__isnull = 0; @@ -656,6 +668,8 @@ export default { seriesData[index][ind] = item.elec_consume_unit; }); let options = { ...that.option1 }; + options.legend.data = []; + options.series = []; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; chartItem.name = that.mpoints[j]; @@ -698,6 +712,8 @@ export default { seriesData[index][ind] = item.elec_consume_unit; }); let options = { ...that.option2 }; + options.legend.data = []; + options.series = []; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; chartItem.name = that.mpoints[j]; @@ -743,6 +759,8 @@ export default { } seriesData[index][ind] = item.elec_consume_unit; }); + options.legend.data = []; + options.series = []; let options = { ...that.option3 }; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; diff --git a/src/views/enm_kiln/report.vue b/src/views/enm_kiln/report.vue index 6a7e8dcd..bbe60570 100644 --- a/src/views/enm_kiln/report.vue +++ b/src/views/enm_kiln/report.vue @@ -467,17 +467,17 @@ export default { }, tableDatas: [ ["产量", "回转窑总产量(t)", 0, 0, 0, 0, 0, 0, 0, 0], - ["产量", "回转窑台时产量(t/h)", "/", 0, 0, 0, 0, 0, 0, 0], - ["运转时间", "运转时间(h)", "/", 0, 0, "/", "/", 0, "/", "/"], - ["运转时间", "回转窑运转率(%)", "/", 0, 0, "/", "/", 0, "/", "/"], + ["产量", "回转窑台时产量(t/h)", 0, 0, 0, 0, 0, 0, 0, 0], + ["运转时间", "运转时间(h)", 0, 0, 0, 0, 0, 0, 0, 0], + ["运转时间", "回转窑运转率(%)", 0, 0, 0, 0, 0, 0, 0, 0], ["能耗", "熟料分布电耗(kW·h/t)", 0, 0, 0, 0, 0, 0, 0, 0], ["能耗", "熟料综合电耗(kW·h/t)", 0, 0, 0, 0, 0, 0, 0, 0], ["能耗", "熟料标煤耗(kgce/t)", 0, 0, 0, 0, 0, 0, 0, 0], ["能耗", "熟料综合能耗(kgce/t)", 0, 0, 0, 0, 0, 0, 0, 0], - ["能耗", "烧成工序总电量(kW·h)", 0, 0, 0, 0, "/", "/", "/", "/"], + ["能耗", "烧成工序总电量(kW·h)", 0, 0, 0, 0, 0, 0, 0, 0], ["成本", "熟料单位成本(元/吨)", 0, 0, 0, 0, 0, 0, 0, 0], - ["氨水", "氨水消耗量(t)", 0, 0, 0, 0, "/", "/", "/", "/"], - ["氨水", "熟料单位氨水消耗量(kg/t)", 0, 0, 0, 0, "/", "/", "/", "/"], + ["氨水", "氨水消耗量(t)", 0, 0, 0, 0, 0, 0, 0, 0], + ["氨水", "熟料单位氨水消耗量(kg/t)", 0, 0, 0, 0, 0, 0, 0, 0], ], tableName: "生产报告", modelValue: true, @@ -675,6 +675,14 @@ export default { return "/"; } } + function consume_precen(a, b) { + if (b !== 0 && b !== null && a !== null) { + let precen = ((a / b)+1)* 100; + return precen.toFixed(2) + "%"; + } else { + return "/"; + } + } let that = this; var myDate = new Date(); let year = (that.year = myDate.getFullYear()); @@ -769,6 +777,7 @@ export default { }); let params5 = {}; params5.page = 0; + params5.year = year; params5.mgroup = that.query.mgroup; that.$API.mtm.goal.list .req(params5) @@ -789,12 +798,12 @@ export default { item5.goal_cate_name == "运转时间(h)" ) { that.tableDatas[2][6] = item5[str]; - // that.tableDatas[2][8] = item5.goal_val; + that.tableDatas[2][8] = item5.goal_val; } else if ( item5.goal_cate_name == "运转率(%)" ) { that.tableDatas[3][6] = item5[str]; - // that.tableDatas[3][8] = item5.goal_val; + that.tableDatas[3][8] = item5.goal_val; } else if ( item5.goal_cate_name == "单位产品分布电耗(kW·h/t)" @@ -803,7 +812,7 @@ export default { that.tableDatas[4][8] = item5.goal_val; } else if ( item5.goal_cate_name == - "单位产品综合电耗(kW·h/t)" + "单位产品综合电耗(KW·h/t)" ) { that.tableDatas[5][6] = item5[str]; that.tableDatas[5][8] = item5.goal_val; @@ -825,6 +834,15 @@ export default { ) { that.tableDatas[9][6] = item5[str]; that.tableDatas[9][8] = item5.goal_val; + }else if(item5.goal_cate_name == "总电量(kW·h)"){ + that.tableDatas[8][6] = item5[str]; + that.tableDatas[8][8] = item5.goal_val; + }else if(item5.goal_cate_name == "氨水消耗量(t)"){ + that.tableDatas[10][6] = item5[str]; + that.tableDatas[10][8] = item5.goal_val; + }else if (item5.goal_cate_name == "熟料单位氨水消耗量(kg/t)"){ + that.tableDatas[11][6] = item5[str]; + that.tableDatas[11][8] = item5.goal_val; } }); } @@ -849,46 +867,58 @@ export default { that.tableDatas[1][5], that.tableDatas[1][8] ); - // that.tableDatas[2][5] = data1.run_hour; - // that.tableDatas[2][9] = precen( - // that.tableDatas[2][5], - // that.tableDatas[2][8] - // ); - // that.tableDatas[3][5] = data1.run_rate; - // that.tableDatas[3][9] = precen( - // that.tableDatas[3][5], - // that.tableDatas[3][8] - // ); + that.tableDatas[2][5] = data1.run_hour; + that.tableDatas[2][9] = precen( + that.tableDatas[2][5], + that.tableDatas[2][8] + ); + that.tableDatas[3][5] = data1.run_rate; + that.tableDatas[3][9] = precen( + that.tableDatas[3][5], + that.tableDatas[3][8] + ); that.tableDatas[4][5] = data1.elec_consume_unit; - that.tableDatas[4][9] = precen( - (that.tableDatas[4][5]-that.tableDatas[4][8]), + that.tableDatas[4][9] = consume_precen( + (that.tableDatas[4][8]-that.tableDatas[4][5]), that.tableDatas[4][8] ); that.tableDatas[5][5] = data1.celec_consume_unit; - that.tableDatas[5][9] = precen( - (that.tableDatas[5][5]-that.tableDatas[5][8]), + that.tableDatas[5][9] = consume_precen( + (that.tableDatas[5][8]-that.tableDatas[5][5]), that.tableDatas[5][8] ); that.tableDatas[6][5] = data1.coal_consume_unit; - that.tableDatas[6][9] = precen( - (that.tableDatas[6][5]-that.tableDatas[6][8]), + that.tableDatas[6][9] = consume_precen( + (that.tableDatas[6][8]-that.tableDatas[6][5]), that.tableDatas[6][8] ); that.tableDatas[7][5] = data1.cen_consume_unit; - that.tableDatas[7][9] = precen( - (that.tableDatas[7][5]-that.tableDatas[7][8]), + that.tableDatas[7][9] = consume_precen( + (that.tableDatas[7][8]-that.tableDatas[7][5]), that.tableDatas[7][8] ); that.tableDatas[8][5] = data1.elec_consume; + that.tableDatas[8][9] = consume_precen( + (that.tableDatas[8][8]-that.tableDatas[8][5]), + that.tableDatas[8][8] + ); that.tableDatas[9][5] = data1.production_cost_unit; - that.tableDatas[9][9] = precen( - (that.tableDatas[9][5]-that.tableDatas[9][8]), - that.tableDatas[9][9] + that.tableDatas[9][9] = consume_precen( + (that.tableDatas[9][8]-that.tableDatas[9][5]), + that.tableDatas[9][8] ); that.tableDatas[10][5] = data1.ammonia_consume; + that.tableDatas[10][9] = consume_precen( + that.tableDatas[10][8] - that.tableDatas[10][5], + that.tableDatas[10][8] + ); that.tableDatas[11][5] = (data1.ammonia_consume*1000/data1.total_production).toFixed(2); + that.tableDatas[11][9] = consume_precen( + that.tableDatas[11][8] - that.tableDatas[11][5], + that.tableDatas[11][8] + ); } else { } }); @@ -923,35 +953,47 @@ export default { that.tableDatas[3][6] ); that.tableDatas[4][4] = data2.elec_consume_unit; - that.tableDatas[4][7] = precen( - that.tableDatas[4][4]-that.tableDatas[4][6], + that.tableDatas[4][7] = consume_precen( + that.tableDatas[4][6] - that.tableDatas[4][4], that.tableDatas[4][6] ); that.tableDatas[5][4] = data2.celec_consume_unit; - that.tableDatas[5][7] = precen( - that.tableDatas[5][4]-that.tableDatas[5][6], + that.tableDatas[5][7] = consume_precen( + that.tableDatas[5][6] - that.tableDatas[5][4], that.tableDatas[5][6] ); that.tableDatas[6][4] = data2.coal_consume_unit; - that.tableDatas[6][7] = precen( - that.tableDatas[6][4]-that.tableDatas[6][6], + that.tableDatas[6][7] = consume_precen( + that.tableDatas[6][6]-that.tableDatas[6][4], that.tableDatas[6][6] ); that.tableDatas[7][4] = data2.cen_consume_unit; - that.tableDatas[7][7] = precen( - that.tableDatas[7][4]-that.tableDatas[7][6], + that.tableDatas[7][7] = consume_precen( + that.tableDatas[7][6]-that.tableDatas[7][4], that.tableDatas[7][6] ); that.tableDatas[8][4] = data2.elec_consume; + that.tableDatas[8][7] = consume_precen( + that.tableDatas[8][6]-that.tableDatas[8][4], + that.tableDatas[8][6] + ); that.tableDatas[9][4] = data2.production_cost_unit; - that.tableDatas[9][7] = precen( + that.tableDatas[9][7] = consume_precen( that.tableDatas[9][4]-that.tableDatas[9][6], that.tableDatas[9][6] ); that.tableDatas[10][4] = data2.ammonia_consume; + that.tableDatas[10][7] = consume_precen( + that.tableDatas[10][6] - that.tableDatas[10][4], + that.tableDatas[10][6] + ) that.tableDatas[11][4] = (data2.ammonia_consume*1000/data2.total_production).toFixed(2); + that.tableDatas[11][7] = consume_precen( + that.tableDatas[11][6] - that.tableDatas[11][4], + that.tableDatas[11][6] + ) } }); }); diff --git a/src/views/enm_kiln/teamAnalysis.vue b/src/views/enm_kiln/teamAnalysis.vue index 2c229585..8352bec5 100644 --- a/src/views/enm_kiln/teamAnalysis.vue +++ b/src/views/enm_kiln/teamAnalysis.vue @@ -38,7 +38,7 @@ > - 烧成工序班组月度对比分析 + 烧成工序班组月度对比分析 月份 @@ -46,7 +46,7 @@ 产量 运转率 成本 - 质量 + 质量 单位产品标煤耗 产品单位电耗 得分 @@ -56,8 +56,6 @@ 台时产量(t/h) 运转率(%) 单位产品成本(元/吨) - CaO(%) - Fe₂O₃(%) 细度(%) 水分(%) 立升重(%) @@ -159,23 +157,23 @@ export default { compareArr0 = []; this.$API.enm.enstat.req(query0).then((res0) => { let data0 = res0; - debugger; if (data0.length > 0) { data0.forEach((item0) => { //先按月份排序,再按班组排序 - let n0 = item0.month_s; - let ind0 = 0; - let team_name0 = item0.team_name; - let arr0 = []; - arr0[0] = n0; - arr0[1] = team_name0; - arr0[2] = item0.total_output_unit; - arr0[3] = item0.total_output_unit; - arr0[4] = item0.run_rate_unit; - wrapArr0[ind0] = item0; + let month = item0.month_s; + if (!wrapArr0[month]) { + wrapArr0[month] = []; + } + // let arr0 = []; + // arr0[0] = n0; + // arr0[1] = team_name0; + // arr0[2] = item0.total_output_unit; + // arr0[3] = item0.total_output_unit; + // arr0[4] = item0.run_rate_unit; + wrapArr0[month].push(item0); }); - } else { - } + } else {} + }).then(() => { this.$API.enm.enstat.req(that.query).then((res) => { let data = res; if (data.length > 0) { @@ -219,57 +217,61 @@ export default { arr.push(item.run_rate); arr.push(item.production_cost_unit); //质量 + // arr[6] = + // item.入窑生料_CaO_rate_pass != null + // ? item.入窑生料_CaO_rate_pass + // : "/"; + // arr[7] = + // item.入窑生料_Fe2O3_rate_pass != null + // ? item.入窑生料_Fe2O3_rate_pass + // : "/"; arr[6] = - item.入窑生料_CaO_rate_pass != null - ? item.入窑生料_CaO_rate_pass - : "/"; - arr[7] = - item.入窑生料_Fe2O3_rate_pass != null - ? item.入窑生料_Fe2O3_rate_pass - : "/"; - arr[8] = item.出磨煤粉_细度_rate_pass != null ? item.出磨煤粉_细度_rate_pass : "/"; - arr[9] = + arr[7] = item.出磨煤粉_水分_rate_pass != null ? item.出磨煤粉_水分_rate_pass : "/"; - arr[10] = + arr[8] = item.出窑熟料_立升重_rate_pass != null ? item.出窑熟料_立升重_rate_pass : "/"; - arr[11] = + arr[9] = item.出窑熟料_fCaO_rate_pass != null ? item.出窑熟料_fCaO_rate_pass : "/"; //煤耗 - arr[12] = item.coal_consume_unit; //当期值(kW·h/t) + arr[10] = item.coal_consume_unit; //当期值(kW·h/t) let keyValue = "goal_val_" + n; if (goalData.length > 0){ goalData.forEach((item) => { if (item.goal_cate_name == "单位产品标煤耗(kgce/t)") { - arr[13] = item[keyValue]; //目标值(kW·h/t)//需要接口获取 + arr[11] = item[keyValue]; //目标值(kW·h/t)//需要接口获取 }else if (item.goal_cate_name == "单位产品分布电耗(kW·h/t)"){ - arr[25] = item[keyValue]; //目标值(kW·h/t)//需要接口获取 + arr[23] = item[keyValue]; //目标值(kW·h/t)//需要接口获取 } }); }; let dq = 0 - if (arr[13] !== null && arr[13] !== undefined){ - dq = (arr[12] - arr[13]).toFixed(2); //当期与目标差值(kW·h/t) + if (arr[11] !== null && arr[11] !== undefined){ + dq = (arr[10] - arr[11]).toFixed(2); //当期与目标差值(kW·h/t) }else{ dq == "/" }; - arr[14] = dq; //当期与目标差值 + arr[12] = dq; //当期与目标差值 let ind_pre = 0, huanbi = 0; if (item.month_s == 1) { ind_pre = 12; - huanbi = wrapArr0[ind_pre] - ? wrapArr0[ind_pre].coal_consume_unit - : "/"; + if (wrapArr0[ind_pre]) { + wrapArr0[ind_pre].forEach((item0) => { + if (item0.team_name == item.team_name) { + huanbi = item0.coal_consume_unit; + } + }); + } } else { // 如果 wrapArr数组长度大于0,那么循环遍历wrapArr数组,找到与item.month_s相差1的元素 而 item.name相同,并赋值给huanbi compareArr0.forEach((item0) => { @@ -278,16 +280,16 @@ export default { } }) } - arr[15] = huanbi; //环期值(kW·h/t)上个月的值 + arr[13] = huanbi; //环期值(kW·h/t)上个月的值 if(huanbi !=="/"){ - arr[16] = (arr[12] - arr[15]).toFixed(2); //当期与环期差值(kW·h/t) + arr[14] = (arr[10] - arr[13]).toFixed(2); //当期与环期差值(kW·h/t) }else{ - arr[16] = "/" + arr[14] = 0 }; - if (arr[15] !== "/"&& arr[15]!== 0 && arr[16]!=="/") { - arr[17] = ((arr[16] / arr[15]) * 100).toFixed(2); //环比增长率(%) + if (arr[13] !== "/"&& arr[13]!== 0 && arr[14]!=="/") { + arr[15] = ((arr[14] / arr[13]) * 100).toFixed(2); //环比增长率(%) } else{ - arr[17] = "/" + arr[15] = "/" }; let sameRate = 0; if ( @@ -295,47 +297,51 @@ export default { wrapArr0[ind].coal_consume_unit ) { sameRate = - ((arrs[1] - + (( item.coal_consume_unit - wrapArr0[ind].coal_consume_unit) / wrapArr0[ind].coal_consume_unit) * 100; } else { sameRate = "/"; } - arr[18] = sameRate; ///同比增长率(%)需要当前值/ 上一年同一个月的值即wrapArr0[ind].elec_consume_unit + arr[16] = sameRate; ///同比增长率(%)需要当前值/ 上一年同一个月的值即wrapArr0[ind].elec_consume_unit //电耗 //设备 - arr[19] = + arr[17] = item.高温风机_consume_unit != null ? item.高温风机_consume_unit : "/"; - arr[20] = + arr[18] = item.篦冷机一室风机电机_consume_unit != null ? item.篦冷机一室风机电机_consume_unit : "/"; - arr[21] = + arr[19] = item.篦冷机三室风机电机_consume_unit != null ? item.篦冷机三室风机电机_consume_unit : "/"; - arr[22] = + arr[20] = item.篦冷机二室风机电机_consume_unit != null ? item.篦冷机二室风机电机_consume_unit : "/"; - arr[23] = + arr[21] = item.窑头排风机主电机_consume_unit != null ? item.窑头排风机主电机_consume_unit : "/"; - arr[24] = item.elec_consume_unit; //当期值(kW·h/t) + arr[22] = item.elec_consume_unit; //当期值(kW·h/t) // arr[25] = item.celec_consume_unit; //目标值(kW·h/t)//需要接口获取 if (item.elec_consume_unit != null &&item.elec_consume_unit !== "/"){ - arr[26] = (arr[24]-arr[25]).toFixed(2); //当期与目标差值(kW·h/t) + arr[24] = (arr[22]-arr[23]).toFixed(2); //当期与目标差值(kW·h/t) } let huanbiec = 0; if (item.month_s == 1) { - ind_pre1 = 12; - huanbiec = wrapArr0[ind_pre] - ? wrapArr0[ind_pre].elec_consume_unit - : "/"; + ind_pre = 12; + if (wrapArr0[ind_pre]) { + wrapArr0[ind_pre].forEach((item0) => { + if (item0.team_name == item.team_name) { + huanbiec = item0.elec_consume_unit; + } + }); + } } else { // 如果 wrapArr数组长度大于0,那么循环遍历wrapArr数组,找到与item.month_s相差1的元素 而 item.name相同,并赋值给huanbi comparEarr.forEach((item0) => { @@ -344,18 +350,18 @@ export default { } }) } - arr[27] = huanbiec; //环期值(kW·h/t)上个月的值 - if(arr[27]!=="/" && huanbiec!=="/"){ - arr[28] = (arr[24] - huanbiec).toFixed(2); //当期与环期差值(kW·h/t) + arr[25] = huanbiec; //环期值(kW·h/t)上个月的值 + if(arr[25]!=="/" && huanbiec!=="/"){ + arr[26] = (arr[22] - huanbiec).toFixed(2); //当期与环期差值(kW·h/t) }else{ - arr[28] = "/" + arr[26] = "/" } - if(arr[28]!=="/" && huanbiec!=="/"&&huanbiec!==0){ - arr[29] = ((arr[28] / huanbiec) * 100).toFixed(2); //环比增长率(%) + if(arr[26]!=="/" && huanbiec!=="/"&&huanbiec!==0){ + arr[27] = ((arr[26] / huanbiec) * 100).toFixed(2); //环比增长率(%) }else{ - arr[29] = 0}; //环比增长率(%) - arr[30] = item.celec_consume_unit; //同比增长率(%) - arr[31] = 0; + arr[27] = 0}; //环比增长率(%) + arr[28] = item.celec_consume_unit; //同比增长率(%) + arr[29] = 0; if (month_obj[n]) { console.log("month_obj[n]",month_obj[n]) const monthData = month_obj[n]; @@ -372,7 +378,7 @@ export default { } else if (index === 3) { elec_score= 0; } - arr[31] += elec_score; + arr[29] += elec_score; const run_rate_itemValue = item.run_rate; // 运转率的值 const run_rate_sortedData = monthData.sort((a, b) => parseFloat(b.run_rate) - parseFloat(a.run_rate)); @@ -387,7 +393,7 @@ export default { } else if (run_rate_index === 3) { run_rate_score= 0; } - arr[31] += run_rate_score; + arr[29] += run_rate_score; const production_hour_itemValue = item.production_hour; // 台时产量的值 const production_hour_sortedData = monthData.sort((a, b) => parseFloat(b.production_hour) - parseFloat(a.production_hour)); @@ -402,7 +408,7 @@ export default { } else if (production_hour_index === 3) { production_hour_score= 0; } - arr[31] += production_hour_score; + arr[29] += production_hour_score; const production_cost_unit_itemValue = item.production_cost_unit; // 单位产品成本的值 const production_cost_unit_sortedData = monthData.sort((a, b) => parseFloat(b.production_cost_unit) - parseFloat(a.production_cost_unit)); @@ -417,7 +423,7 @@ export default { } else if (production_cost_unit_index === 3) { production_cost_unit_score= 0; } - arr[31] += production_cost_unit_score; + arr[29] += production_cost_unit_score; const CaO_itemValue = item.出窑熟料_fCaO_rate_pass; // CaO的值 const CaO_sortedData = monthData.sort((a, b) => parseFloat(b.CaO) - parseFloat(a.CaO)); @@ -432,7 +438,7 @@ export default { } else if (CaO_index === 3) { CaO_score= 0; } - arr[31] += CaO_score; + arr[29] += CaO_score; const coal_itemValue = item.coal_consume_unit; // 当期单位产品标煤耗的值 const coal_sortedData = monthData.sort((a, b) => parseFloat(b.coal_consume_unit) - parseFloat(a.coal_consume_unit)); @@ -447,7 +453,7 @@ export default { } else if (coal_index === 3) { coal_score= 0; } - arr[31] += coal_score; + arr[29] += coal_score; } wrapArr.push(arr); }); @@ -456,6 +462,7 @@ export default { } }); }); + }, handleQuery() { this.tableDatas = []; diff --git a/src/views/enm_mill/power.vue b/src/views/enm_mill/power.vue index 8ad247bc..f20368b7 100644 --- a/src/views/enm_mill/power.vue +++ b/src/views/enm_mill/power.vue @@ -179,7 +179,7 @@ let tooltip = { let grid = { right: "3%", left: "7%", - top: "15%", + top: "20%", }; let toolbox = { right: "2%", @@ -187,10 +187,12 @@ let toolbox = { dataView: { show: true, readOnly: false }, saveAsImage: { show: true }, }, + orient: "vertical", }; let legend = { top: "2%", x: "center", + width: "400px", data: [ "循环风机1906", "系统风机", @@ -200,6 +202,16 @@ let legend = { "辊压机定辊电机", "新增磨尾风机", ], + selector: [ + { + type: 'all', + title: '全选' + }, + { + type: 'inverse', + title: '反选' + } + ], }; let yAxis = { type: "value", @@ -448,20 +460,18 @@ export default { obj.material__code__in = "elec,elec_0"; obj.ep_monitored__power_kw__gte = 100; this.$API.enm.mpoint.list.req(obj).then((res) => { - console.log("mpoints", res); let arr = []; res.forEach((item) => { arr.push(item.name); }); - console.log("arr", arr); that.mpoints = arr; }); }, + typeRadioChange() { this.searchDate = ""; }, dateChange(val) { - console.log(val); if (val !== null) { if (this.typeRadio == "day") { let year = val.split("-")[0]; @@ -503,7 +513,6 @@ export default { .req(obj) .then((res) => { that.tableData = res; - console.log("getTableHourData", res); res.forEach((item) => { let index = that.mpoints.indexOf(item.mpoint_name); let obj = []; @@ -535,7 +544,6 @@ export default { obj_d.mpoint__ep_monitored__power_kw__gte = 100; obj_d.page = 0; 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_name @@ -563,7 +571,6 @@ export default { obj_m.mpoint__ep_monitored__power_kw__gte = 100; obj_m.page = 0; this.$API.enm.mpoint.stat.req(obj_m).then((res) => { - console.log("getTableHourData", res); res.forEach((item, index) => { let index_m = that.mpoints.indexOf( item.mpoint_name @@ -591,9 +598,9 @@ export default { let that = this; let obj = {}; obj.type = "hour_s"; - obj.year = year; - obj.month = month; - obj.day = days; + obj.year_s = year; + obj.month_s = month; + obj.day_s = days; obj.mgroup__name = "水泥磨"; obj.mpoint__material__code__in = "elec,elec_0"; // obj.mpoint__ep_monitored__isnull = 0; @@ -615,6 +622,8 @@ export default { seriesData[index][ind] = item.elec_consume_unit; }); let options = { ...that.option1 }; + options.legend.data = []; + options.series = []; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; chartItem.name = that.mpoints[j]; @@ -660,6 +669,8 @@ export default { seriesData[index][ind] = item.elec_consume_unit; }); let options = { ...that.option2 }; + options.legend.data = []; + options.series = []; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; chartItem.name = that.mpoints[j]; @@ -705,6 +716,8 @@ export default { seriesData[index][ind] = item.elec_consume_unit; }); let options = { ...that.option3 }; + options.legend.data = []; + options.series = []; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; chartItem.name = that.mpoints[j]; diff --git a/src/views/enm_mill/report.vue b/src/views/enm_mill/report.vue index f770e6b3..225ebdb3 100644 --- a/src/views/enm_mill/report.vue +++ b/src/views/enm_mill/report.vue @@ -409,12 +409,12 @@ export default { }, tableDatas: [ ["产量", "水泥磨总产量(t)", 0, 0, 0, 0, 0, 0, 0, 0], - ["产量", "水泥磨台时产量(t/h)", "/", 0, 0, 0, 0, 0, 0, 0], - ["运转时间", "运转时间(h)", "/", 0, 0, "/", 0, 0, "/", "/"], - ["运转时间", "水泥磨运转率(%)", "/", 0, 0, "/", 0, 0, "/", "/"], + ["产量", "水泥磨台时产量(t/h)", 0, 0, 0, 0, 0, 0, 0, 0], + ["运转时间", "运转时间(h)", "/", 0, 0, 0, 0, 0, 0, 0, 0], + ["运转时间", "水泥磨运转率(%)", "/", 0, 0, 0, 0, 0, 0, 0, 0], ["能耗", "水泥粉磨工序分布电耗(kW·h/t)", 0, 0, 0, 0, 0, 0, 0, 0], ["能耗", "单位产品综合能耗(kgce/t)", 0, 0, 0, 0, 0, 0, 0, 0], - ["能耗", "水泥粉磨工序总电量(kW·h)", 0, 0, 0, 0, "/", "/", "/", "/"], + ["能耗", "水泥粉磨工序总电量(kW·h)", 0, 0, 0, 0, 0, 0, 0, 0], ["成本", "水泥单位成本(元/吨)", 0, 0, 0, 0, 0, 0, 0, 0], ], tableName: "生产报告", @@ -591,7 +591,15 @@ export default { let precen = (a / b) * 100; return precen.toFixed(2) + "%"; } else { - return "/"; + return 0; + } + } + function consume_precen(a, b) { + if (b !== 0 && b !== null && a !== null) { + let precen = ((a / b)+1)* 100; + return precen.toFixed(2) + "%"; + } else { + return 0; } } let that = this; @@ -688,6 +696,7 @@ export default { //月目标 let params5 = {}; params5.page = 0; + params5.year = year; params5.mgroup = that.query.mgroup; this.$API.mtm.goal.list .req(params5) @@ -708,12 +717,12 @@ export default { item5.goal_cate_name == "运转时间(h)" ) { that.tableDatas[2][6] = item5[str]; - // that.tableDatas[2][8] = item5.goal_val; + that.tableDatas[2][8] = item5.goal_val; } else if ( item5.goal_cate_name == "运转率(%)" ) { that.tableDatas[3][6] = item5[str]; - // that.tableDatas[3][8] = item5.goal_val; + that.tableDatas[3][8] = item5.goal_val; } else if ( item5.goal_cate_name == "单位产品分布电耗(kW·h/t)" @@ -732,6 +741,11 @@ export default { ) { that.tableDatas[7][6] = item5[str]; that.tableDatas[7][8] = item5.goal_val; + } else if( + item5.goal_cate_name == + "总电量(kW·h)"){ + that.tableDatas[6][6] = item5[str]; + that.tableDatas[6][8] = item5.goal_val; } }); } @@ -756,21 +770,35 @@ export default { that.tableDatas[1][5], that.tableDatas[1][8] ); + that.tableDatas[2][5] = data1.run_hour; + that.tableDatas[2][9] = precen( + that.tableDatas[2][5], + that.tableDatas[2][8] + ); + that.tableDatas[3][5] = data1.run_rate; + that.tableDatas[3][9] = precen( + that.tableDatas[3][5], + that.tableDatas[3][8] + ); that.tableDatas[4][5] = data1.elec_consume_unit; - that.tableDatas[4][9] = precen( - that.tableDatas[4][5]-that.tableDatas[4][8], + that.tableDatas[4][9] = consume_precen( + that.tableDatas[4][8]-that.tableDatas[4][5], that.tableDatas[4][8] ); that.tableDatas[5][5] = data1.cen_consume_unit; - that.tableDatas[5][9] = precen( - that.tableDatas[5][5]-that.tableDatas[5][8], + that.tableDatas[5][9] = consume_precen( + that.tableDatas[5][8]-that.tableDatas[5][5], that.tableDatas[5][8] ); that.tableDatas[6][5] = data1.elec_consume; + that.tableDatas[6][9] = consume_precen( + that.tableDatas[6][8]-that.tableDatas[6][5], + that.tableDatas[6][8] + ); that.tableDatas[7][5] = data1.production_cost_unit; - that.tableDatas[7][9] = precen( - that.tableDatas[7][5]-that.tableDatas[7][8], + that.tableDatas[7][9] = consume_precen( + that.tableDatas[7][8]-that.tableDatas[7][5], that.tableDatas[7][8] ); } else { @@ -807,20 +835,24 @@ export default { that.tableDatas[3][6] ); that.tableDatas[4][4] = data2.elec_consume_unit; - that.tableDatas[4][7] = precen( - that.tableDatas[4][4]-that.tableDatas[4][6], + that.tableDatas[4][7] = consume_precen( + that.tableDatas[4][6]-that.tableDatas[4][4], that.tableDatas[4][6] ); that.tableDatas[5][4] = data2.cen_consume_unit; - that.tableDatas[5][7] = precen( - that.tableDatas[5][4]-that.tableDatas[5][6], + that.tableDatas[5][7] = consume_precen( + that.tableDatas[5][6]-that.tableDatas[5][4], that.tableDatas[5][6] ); that.tableDatas[7][4] = data2.production_cost_unit; that.tableDatas[6][4] = data2.elec_consume; - that.tableDatas[7][7] = precen( - that.tableDatas[7][4]-that.tableDatas[7][6], + that.tableDatas[6][7] = consume_precen( + that.tableDatas[6][6]-that.tableDatas[6][4], + that.tableDatas[6][6] + ); + that.tableDatas[7][7] = consume_precen( + that.tableDatas[7][6]-that.tableDatas[7][4], that.tableDatas[7][6] ); } diff --git a/src/views/enm_mill/teamAnalysis.vue b/src/views/enm_mill/teamAnalysis.vue index c7866d76..56eb7e42 100644 --- a/src/views/enm_mill/teamAnalysis.vue +++ b/src/views/enm_mill/teamAnalysis.vue @@ -156,12 +156,14 @@ export default { if (data0.length > 0) { data0.forEach((item0) => { //先按月份排序,再按班组排序 - let ind0 = 0; - wrapArr0[ind0] = item0; + let month = item0.month_s; + if (!wrapArr0[month]) { + wrapArr0[month] = []; + } + wrapArr0[month].push(item0); }); - } else { - } - this.$API.enm.enstat.req(that.query).then((res) => { + } else { console.log('No data received.');} + }).then(() =>{this.$API.enm.enstat.req(that.query).then((res) => { //今年的值 let data = res; if (data.length > 0) { @@ -239,9 +241,13 @@ export default { tongqicha = 0; if (n == 1) { ind_pre = 12; - huanqi = wrapArr0[ind_pre] - ? wrapArr0[ind_pre].elec_consume_unit - : "/"; + if (wrapArr0[ind_pre]) { + wrapArr0[ind_pre].forEach((item0) => { + if (item0.team_name == item.team_name) { + huanqi = item0.elec_consume_unit; + } + }); + } } else { // 如果 wrapArr数组长度大于0,那么循环遍历wrapArr数组,找到与item.month_s相差1的元素 而 item.name相同,并赋值给huanbi compareArr0.forEach((item0) => { @@ -394,6 +400,7 @@ export default { } }); }); + }, handleQuery() { this.tableDatas = []; diff --git a/src/views/enm_monthSet/goalSetting.vue b/src/views/enm_monthSet/goalSetting.vue index 25a4b7bf..33794423 100644 --- a/src/views/enm_monthSet/goalSetting.vue +++ b/src/views/enm_monthSet/goalSetting.vue @@ -507,6 +507,7 @@ export default { //编辑目标 roleEdit(row) { this.type = "edit"; + this.form = {}; this.form = Object.assign(defaultForm, row); this.form.year = row.year + ""; this.limitedVisible = true; diff --git a/src/views/enm_rm/power.vue b/src/views/enm_rm/power.vue index 12d9c727..b30f8ec2 100644 --- a/src/views/enm_rm/power.vue +++ b/src/views/enm_rm/power.vue @@ -570,9 +570,9 @@ export default { let that = this; let obj = {}; obj.type = "hour_s"; - obj.year = year; - obj.month = month; - obj.day = days; + obj.year_s = year; + obj.month_s = month; + obj.day_s = days; obj.mgroup__name = "原料磨"; obj.mpoint__material__code__in = "elec,elec_0"; // obj.mpoint__ep_monitored__isnull = 0; @@ -597,6 +597,8 @@ export default { seriesData[index][ind] = item.elec_consume_unit; }); let options = { ...that.option1 }; + options.legend.data = []; + options.series = []; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; chartItem.name = that.mpoints[j]; @@ -645,6 +647,8 @@ export default { seriesData[index][ind] = item.elec_consume_unit; }); let options = { ...that.option2 }; + options.legend.data = []; + options.series = []; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; chartItem.name = that.mpoints[j]; @@ -695,6 +699,8 @@ export default { seriesData[index][ind] = item.elec_consume_unit; }); let options = { ...that.option3 }; + options.legend.data = []; + options.series = []; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; chartItem.name = that.mpoints[j]; diff --git a/src/views/enm_rm/report.vue b/src/views/enm_rm/report.vue index f3947859..260bd83a 100644 --- a/src/views/enm_rm/report.vue +++ b/src/views/enm_rm/report.vue @@ -413,10 +413,10 @@ export default { tableDatas: [ ["产量", "立磨总产量(t)", 0, 0, 0, 0, 0, 0, 0, 0], ["产量", "立磨台时产量(t/h)", 0, 0, 0, 0, 0, 0, 0, 0], - ["运转时间", "立磨运转时间(h)", 0, 0, 0, "/", 0, 0, "/", "/"], - ["运转时间", "立磨运转率(%)", 0, 0, 0, "/", 0, 0, "/", "/"], + ["运转时间", "立磨运转时间(h)", 0, 0, 0, 0,, 0, 0, 0,, 0,], + ["运转时间", "立磨运转率(%)", 0, 0, 0, 0, 0, 0, 0,0,], ["能耗", "立磨分布电耗(kW·h/t)", 0, 0, 0, 0, 0, 0, 0, 0], - ["能耗", "辅料工序总电耗(kW·h)", 0, 0, 0, 0, "/", "/", "/","/"], + ["能耗", "辅料工序总电耗(kW·h)", 0, 0, 0, 0, 0,, 0,0,0,], // ["成本", "生料成本(元/吨)", 0, 0, 0, 0, 0, 0, 0, 0], ], tableName: "生产报告", @@ -433,7 +433,7 @@ export default { tooltip: tooltip, grid: grid, toolbox: toolbox, - legend: Object.assign(legend, {data: ["立磨总产量", "分布电耗"]}), + legend: Object.assign(legend, {data: ["立磨总产量", "立磨台时产量", "立磨运转率", "分布电耗"]}), xAxis: { axisTick: { show: true, @@ -756,6 +756,14 @@ export default { return "/"; } } + function consume_precen(a, b) { + if (b !== 0 && b !== null && a !== null) { + let precen = ((a / b)+1)* 100; + return precen.toFixed(2) + "%"; + } else { + return "/"; + } + } let that = this; this.$nextTick(() => { var myDate = new Date(); @@ -841,6 +849,7 @@ export default { //月目标 let params5 = {}; params5.page = 0; + params5.year = year; params5.mgroup = that.query.mgroup; this.$API.mtm.goal.list .req(params5) @@ -865,12 +874,12 @@ export default { item5.goal_cate_name == "运转时间(h)" ) { that.tableDatas[2][6] = item5[str]; - // that.tableDatas[2][8] = item5.goal_val; + that.tableDatas[2][8] = item5.goal_val; } else if ( item5.goal_cate_name == "运转率(%)" ) { that.tableDatas[3][6] = item5[str]; - // that.tableDatas[3][8] = item5.goal_val; + that.tableDatas[3][8] = item5.goal_val; } else if ( item5.goal_cate_name == "单位产品分布电耗(kW·h/t)" @@ -882,6 +891,9 @@ export default { "单位产品成本(元/吨)" ) { + }else if (item5.goal_cate_name =="总电量(kW·h)"){ + that.tableDatas[5][6] = item5[str]; + that.tableDatas[5][8] = item5.goal_val; } }); } @@ -908,13 +920,27 @@ export default { that.tableDatas[1][5], that.tableDatas[1][8] ); + that.tableDatas[2][5] = data1.run_hour; + that.tableDatas[2][9] = precen( + that.tableDatas[2][5], + that.tableDatas[2][8] + ); + that.tableDatas[3][5] = data1.run_rate; + that.tableDatas[3][9] = precen( + that.tableDatas[3][5], + that.tableDatas[3][8] + ); that.tableDatas[4][5] = data1.elec_consume_unit; - that.tableDatas[4][9] = precen( - (that.tableDatas[4][5]-that.tableDatas[4][8]), + that.tableDatas[4][9] = consume_precen( + (that.tableDatas[4][8]-that.tableDatas[4][5]), that.tableDatas[4][8] ); that.tableDatas[5][5] = data1.elec_consume; + that.tableDatas[5][9] = consume_precen( + (that.tableDatas[5][8] - that.tableDatas[5][5]), + that.tableDatas[5][8] + ); } else { } @@ -959,11 +985,15 @@ export default { ); that.tableDatas[4][4] = data2.elec_consume_unit; - that.tableDatas[4][7] = precen( + that.tableDatas[4][7] = consume_precen( (that.tableDatas[4][4]-that.tableDatas[4][6]), that.tableDatas[4][6] ); that.tableDatas[5][4] = data2.elec_consume; + that.tableDatas[5][7] = consume_precen( + (that.tableDatas[5][6] - that.tableDatas[5][4]), + that.tableDatas[5][6] + ); } }); diff --git a/src/views/enm_rm/teamAnalysis.vue b/src/views/enm_rm/teamAnalysis.vue index de7c558a..1ef49ca6 100644 --- a/src/views/enm_rm/teamAnalysis.vue +++ b/src/views/enm_rm/teamAnalysis.vue @@ -38,14 +38,14 @@ > - 生料工序班组月度对比分析 + 生料辅料工序班组月度对比分析 月份 班组 产量 运转率 - 质量 + 质量 单位产品电耗 得分 @@ -56,10 +56,6 @@ 细度(%) Fe₂O₃(%) 水分(%) - 细度(%) - Fe₂O₃(%) - 水分(%) - CaO(%) 循环风机(kW·h/t) 立磨主电机(kW·h/t) @@ -157,7 +153,6 @@ export default { query0.mgroup = that.query.mgroup; let wrapArr = [], wrapArr0 = [], - wrapArrs = [], month_obj = {}, compareArr0 = []; this.$API.enm.enstat.req(query0).then((res0) => { @@ -165,10 +160,16 @@ export default { if (data0.length > 0) { data0.forEach((item0) => { //先按月份排序,再按班组排序 - wrapArr0[ind0] = item0; + let month = item0.month_s; + if (!wrapArr0[month]) { + wrapArr0[month] = []; + } + wrapArr0[month].push(item0); }); - } else { - }}); + } else { console.log('No data received.');} + + }).then(() => { + this.$API.enm.enstat.req(that.query).then((res) => { let data = res; if (data.length > 0) { @@ -197,7 +198,6 @@ export default { data.forEach((item) => { //先按月份排序,再按班组排序 let n = item.month_s; - let ind = 0; let arr = []; let time = "" + item.year_s + "." + item.month_s; arr.push(time); @@ -210,52 +210,42 @@ export default { arr[5] = item.辅料_细度_rate_pass != null ? item.辅料_细度_rate_pass - : "/"; + : 0; arr[6] = item.辅料_Fe2O3_rate_pass != null ? item.辅料_Fe2O3_rate_pass - : "/"; + : 0; arr[7] = item.辅料_水分_rate_pass != null ? item.辅料_水分_rate_pass - : "/"; - arr[8] = - item.干混生料_细度_rate_pass != null - ? item.干混生料_细度_rate_pass - : "/"; - arr[9] = - item.干混生料_Fe2O3_rate_pass != null - ? item.干混生料_Fe2O3_rate_pass - : "/"; - arr[10] = - item.干混生料_水分_rate_pass != null - ? item.干混生料_水分_rate_pass - : "/"; - arr[11] = - item.干混生料_CaO_rate_pass != null - ? item.干混生料_CaO_rate_pass - : "/"; + : 0; //设备 - arr[12] = - item.循环风机_consume_unit != null - ? item.循环风机_consume_unit - : "/"; - arr[13] = - item.立磨主电机_consume_unit != null - ? item.立磨主电机_consume_unit - : "/"; + arr[8] = + item.原料循环风机_consume_unit != null + ? item.原料循环风机_consume_unit + : 0; + arr[9] = + item.原料立磨主电机_consume_unit != null + ? item.原料立磨主电机_consume_unit + : 0; // - arr[14] = item.elec_consume_unit; //当期值(kW·h/t) + arr[10] = item.elec_consume_unit; //当期值(kW·h/t) let keyVale = "goal_val_" + n; - arr[15] = goalData[keyVale]?goalData[keyVale]:0; //目标值(kW·h/t)//需要接口获取 - arr[16] = (arr[14] - arr[15]).toFixed(2); //当期与目标差值(kW·h/t) + arr[11] = goalData[keyVale]?goalData[keyVale]:0; //目标值(kW·h/t)//需要接口获取 + arr[12] = (arr[10] - arr[11]).toFixed(2); //当期与目标差值(kW·h/t) let ind_pre = 0, huanbi = 0; if (item.month_s == 1) { ind_pre = 12; - huanbi = wrapArr0[ind_pre] - ? wrapArr0[ind_pre].elec_consume_unit - : "/"; + // 循环遍历数组wrapArr0[ind_pre],找到item.name与 wrapArr0 数组中相同的名字 + if (wrapArr0[ind_pre]) { + wrapArr0[ind_pre].forEach((item0) => { + if (item0.team_name == item.team_name) { + huanbi = item0.elec_consume_unit; + } + }); + } + } else { // 如果 wrapArr数组长度大于0,那么循环遍历wrapArr数组,找到与item.month_s相差1的元素 而 item.name相同,并赋值给huanbi compareArr0.forEach((item0) => { @@ -264,22 +254,22 @@ export default { } }) } - arr[17] = Number(huanbi) ; //环期值(kW·h/t)上个月的值 + arr[13] = Number(huanbi) ; //环期值(kW·h/t)上个月的值 //当期与环期差值(kW·h/t) - if (arr[18] !== "/"){ - arr[18] = (arr[14] - arr[17]).toFixed(2); //当期与环期差值(kW·h/t) + if (arr[14] !== "/"){ + arr[14] = (arr[10] - arr[13]).toFixed(2); //当期与环期差值(kW·h/t) }else{ - arr[18] = "/"; //当期与环期差值(kW·h/t) + arr[14] = "/"; //当期与环期差值(kW·h/t) } - arr[19] = 0; //环比增长率(%) - if (arr[17] !=="/" && arr[18] !==0 && arr[18] !== "undefined" && arr[17] !== 0){ - arr[19] = ((arr[18]/arr[17])*100).toFixed(2); + arr[15] = 0; //环比增长率(%) + if (arr[13] !=="/" && arr[14] !==0 && arr[14] !== "undefined" && arr[13] !== 0){ + arr[15] = ((arr[14]/arr[13])*100).toFixed(2); }else{ - arr[19] = "/"; //环比增长率(%)= 当期与环期差值(kW·h/t)/环期值(kW·h/t)*100% + arr[14] = "/"; //环比增长率(%)= 当期与环期差值(kW·h/t)/环期值(kW·h/t)*100% } - arr[20] = item.celec_consume_unit; //同比增长率(%) + arr[16] = item.celec_consume_unit; //同比增长率(%) - arr[21] = 0; + arr[17] = 0; if (month_obj[n]) { const monthData = month_obj[n]; const itemValue = item.elec_consume_unit; // 单位产品电耗的值 @@ -295,7 +285,7 @@ export default { } else if (index === 3) { elec_score= 0; } - arr[21] += elec_score; + arr[17] += elec_score; const run_rate_itemValue = item.run_rate; // 运转率的值 const run_rate_sortedData = monthData.sort((a, b) => parseFloat(b.run_rate) - parseFloat(a.run_rate)); @@ -310,7 +300,7 @@ export default { } else if (run_rate_index === 3) { run_rate_score= 0; } - arr[21] += run_rate_score; + arr[17] += run_rate_score; const production_hour_itemValue = item.production_hour; // 台时产量的值 const production_hour_sortedData = monthData.sort((a, b) => parseFloat(b.production_hour) - parseFloat(a.production_hour)); @@ -325,7 +315,7 @@ export default { } else if (production_hour_index === 3) { production_hour_score= 0; } - arr[21] += production_hour_score; + arr[17] += production_hour_score; const production_cost_unit_itemValue = item.production_cost_unit; // 单位产品成本的值 const production_cost_unit_sortedData = monthData.sort((a, b) => parseFloat(b.production_cost_unit) - parseFloat(a.production_cost_unit)); @@ -340,7 +330,7 @@ export default { } else if (production_cost_unit_index === 3) { production_cost_unit_score= 0; } - arr[21] += production_cost_unit_score; + arr[17] += production_cost_unit_score; const xidu_itemValue = item.辅料_细度_rate_pass; // 辅料细度的值 const xidu_sortedData = monthData.sort((a, b) => parseFloat(b.xidu) - parseFloat(a.xidu)); @@ -355,7 +345,7 @@ export default { } else if (xidu_index === 3) { xidu_score= 0; } - arr[21] += xidu_score; + arr[17] += xidu_score; const Fe203_itemValue = item.辅料_Fe2O3_rate_pass; // 辅料Fe203的值 const Fe203_sortedData = monthData.sort((a, b) => parseFloat(b.Fe203) - parseFloat(a.Fe203)); @@ -370,20 +360,22 @@ export default { } else if (Fe203_index === 3) { Fe203_score= 0; } - arr[21] += Fe203_score; + arr[17] += Fe203_score; } wrapArr.push(arr); }); that.tableDatas = wrapArr; } else { } - }); + });}); + + }, handleQuery() { this.tableDatas = []; this.getGoalData(); }, - itemClick(type, item) { + itemClick(type) { this.type = type; this.asynDialog = true; }, diff --git a/src/views/enm_rm/workshopAnalysis.vue b/src/views/enm_rm/workshopAnalysis.vue index 41515aa0..61093187 100644 --- a/src/views/enm_rm/workshopAnalysis.vue +++ b/src/views/enm_rm/workshopAnalysis.vue @@ -39,7 +39,7 @@ - 生料工序车间单位产品电耗月度分析表 + 生料辅料工序车间单位产品电耗月度分析表 diff --git a/src/views/enm_rm_copy/power.vue b/src/views/enm_rm_copy/power.vue index 6ccce9cc..1bb0194b 100644 --- a/src/views/enm_rm_copy/power.vue +++ b/src/views/enm_rm_copy/power.vue @@ -418,7 +418,7 @@ export default { getMpoints() { let that = this; let obj = {}; - obj.mgroup__name = "原料磨"; + obj.mgroup__name = "生料工序(二次配料)"; obj.page = 0; obj.enabled = 1; obj.need_display = 1; @@ -467,7 +467,7 @@ export default { obj.month = month_h; obj.day = days_h; obj.hour = hours_h; - obj.mgroup__name = "原料磨"; + obj.mgroup__name = "生料工序(二次配料)"; obj.mpoint__material__code__in = "elec,elec_0"; obj.mpoint__need_display = 1; obj.page = 0; @@ -506,7 +506,7 @@ export default { obj_d.year_s = year_d; obj_d.month_s = month_d; obj_d.day_s = days_d; - obj_d.mgroup__name = "原料磨"; + obj_d.mgroup__name = "生料工序(二次配料)"; obj_d.mpoint__material__code__in = "elec,elec_0"; obj_d.mpoint__need_display = 1; obj_d.page = 0; @@ -533,7 +533,7 @@ export default { obj_m.type = "month_s"; obj_m.year_s = that.year; obj_m.month_s = that.month; - obj_m.mgroup__name = "原料磨"; + obj_m.mgroup__name = "生料工序(二次配料)"; obj_m.mpoint__material__code__in = "elec,elec_0"; obj_m.mpoint__need_display = 1; obj_m.page = 0; @@ -572,7 +572,7 @@ export default { obj.year = year; obj.month = month; obj.day = days; - obj.mgroup__name = "原料磨"; + obj.mgroup__name = "生料工序(二次配料)"; obj.mpoint__material__code__in = "elec,elec_0"; // obj.mpoint__ep_monitored__isnull = 0; obj.mpoint__need_display = 1; @@ -619,7 +619,7 @@ export default { obj.type = "day_s"; obj.year_s = year; obj.month_s = month; - obj.mgroup__name = "原料磨"; + obj.mgroup__name = "生料工序(二次配料)"; obj.mpoint__material__code__in = "elec,elec_0"; // obj.mpoint__ep_monitored__isnull = 0; obj.mpoint__need_display = 1; @@ -668,7 +668,7 @@ export default { let obj = {}; obj.type = "month_s"; obj.year_s = year; - obj.mgroup__name = "原料磨"; + obj.mgroup__name = "生料工序(二次配料)"; obj.mpoint__material__code__in = "elec,elec_0"; // obj.mpoint__ep_monitored__isnull = 0; obj.mpoint__need_display = 1; diff --git a/src/views/enm_rm_copy/report.vue b/src/views/enm_rm_copy/report.vue index 20621336..6ef02f3b 100644 --- a/src/views/enm_rm_copy/report.vue +++ b/src/views/enm_rm_copy/report.vue @@ -419,11 +419,11 @@ export default { }, tableDatas: [ ["产量", "生料总产量(t)", 0, 0, 0, 0, 0, 0, 0, 0], - ["产量", "生料台时产量(t/h)", "/", 0, 0, 0, 0, 0, 0, 0], - ["运转时间", "生料运转时间(h)", "/", 0, 0, "/", 0, 0, "/", "/"], - ["运转时间", "生料运转率(%)", "/", 0, 0, "/", 0, 0, "/", "/"], + ["产量", "生料台时产量(t/h)", 0, 0, 0, 0, 0, 0, 0, 0], + ["运转时间", "生料运转时间(h)", 0, 0, 0, 0, 0, 0, 0, 0], + ["运转时间", "生料运转率(%)", 0, 0, 0, 0, 0, 0, 0, 0], ["能耗", "生料分布电耗(kW·h/t)", 0, 0, 0, 0, 0, 0, 0, 0], - ["能耗", "生料总电耗(kW·h)", 0, 0, 0, 0, "/", "/", "/","/"], + ["能耗", "生料总电耗(kW·h)", 0, 0, 0, 0, 0, 0, 0, 0], ["成本", "生料单位成本(元/吨)", 0, 0, 0, 0, 0, 0, 0, 0], ], tableName: "生产报告", @@ -801,6 +801,14 @@ export default { return "/"; } } + function consume_precen(a, b) { + if (b !== 0 && b !== null && a !== null) { + let precen = ((a / b)+1)* 100; + return precen.toFixed(2) + "%"; + } else { + return "/"; + } + } let that = this; this.$nextTick(() => { var myDate = new Date(); @@ -911,19 +919,24 @@ export default { item5.goal_cate_name == "运转时间(h)" ) { that.tableDatas[2][6] = item5[str]; - // that.tableDatas[2][8] = item5.goal_val; + that.tableDatas[2][8] = item5.goal_val; } else if ( item5.goal_cate_name == "运转率(%)" ) { that.tableDatas[3][6] = item5[str]; - // that.tableDatas[3][8] = item5.goal_val; + that.tableDatas[3][8] = item5.goal_val; } else if ( item5.goal_cate_name == "单位产品分布电耗(kW·h/t)" ) { that.tableDatas[4][6] = item5[str]; that.tableDatas[4][8] = item5.goal_val; - } else if ( + } else if (item5.goal_cate_name == + "总电量(kW·h)"){ + that.tableDatas[5][6] = item5[str]; + that.tableDatas[5][8] = item5.goal_val; + } + else if ( item5.goal_cate_name == "单位产品成本(元/吨)" ) { @@ -955,27 +968,31 @@ export default { that.tableDatas[1][5], that.tableDatas[1][8] ); - // that.tableDatas[2][5] = data1.run_hour; - // that.tableDatas[2][9] = precen( - // that.tableDatas[2][5], - // that.tableDatas[2][8] - // ); - // that.tableDatas[3][5] = data1.run_rate; - // that.tableDatas[3][9] = precen( - // that.tableDatas[3][5], - // that.tableDatas[3][8] - // ); + that.tableDatas[2][5] = data1.run_hour; + that.tableDatas[2][9] = precen( + that.tableDatas[2][5], + that.tableDatas[2][8] + ); + that.tableDatas[3][5] = data1.run_rate; + that.tableDatas[3][9] = precen( + that.tableDatas[3][5], + that.tableDatas[3][8] + ); that.tableDatas[4][5] = data1.elec_consume_unit; - that.tableDatas[4][9] = precen( - (that.tableDatas[4][5]-that.tableDatas[4][8]), + that.tableDatas[4][9] = consume_precen( + (that.tableDatas[4][8] - that.tableDatas[4][5]), that.tableDatas[4][8] ); that.tableDatas[5][5] = data1.elec_consume; + that.tableDatas[5][9] = consume_precen( + (that.tableDatas[5][8] - that.tableDatas[5][5]), + that.tableDatas[5][8] + ); that.tableDatas[6][5] = data1.production_cost_unit; that.tableDatas[6][9] = precen( - (that.tableDatas[6][5]-that.tableDatas[6][8]), + (that.tableDatas[6][8] - that.tableDatas[6][5]), that.tableDatas[6][8] ); } else { @@ -1021,15 +1038,19 @@ export default { ); that.tableDatas[4][4] = data2.elec_consume_unit; - that.tableDatas[4][7] = precen( - (that.tableDatas[4][4]-that.tableDatas[4][6]), + that.tableDatas[4][7] = consume_precen( + (that.tableDatas[4][6]-that.tableDatas[4][4]), that.tableDatas[4][6] ); that.tableDatas[5][4] = data2.elec_consume; + that.tableDatas[5][7] = consume_precen( + (that.tableDatas[5][6]-that.tableDatas[5][4]), + that.tableDatas[5][6] + ); that.tableDatas[6][4] = data2.production_cost_unit; - that.tableDatas[6][7] = precen( - (that.tableDatas[6][4]-that.tableDatas[6][6]), + that.tableDatas[6][7] = consume_precen( + (that.tableDatas[6][6] - that.tableDatas[6][4]), that.tableDatas[6][6] ); } diff --git a/src/views/enm_rm_copy/teamAnalysis.vue b/src/views/enm_rm_copy/teamAnalysis.vue index f8413427..9d053d4d 100644 --- a/src/views/enm_rm_copy/teamAnalysis.vue +++ b/src/views/enm_rm_copy/teamAnalysis.vue @@ -38,7 +38,7 @@ > - 生料工序班组月度对比分析 + 生料工序班组月度对比分析 月份 @@ -46,8 +46,8 @@ 产量 运转率 成本 - 质量 - 单位产品电耗 + 质量 + 单位产品电耗 得分 @@ -55,15 +55,11 @@ 台时产量(t/h) 运转率(%) 单位产品成本(元/吨) - 细度(%) - Fe₂O₃(%) - 水分(%) + 细度(%) Fe₂O₃(%) 水分(%) CaO(%) - 循环风机(kW·h/t) - 立磨主电机(kW·h/t) 当期值(kW·h/t) 目标值(kW·h/t) @@ -111,7 +107,7 @@ export default { let year = myDate.getFullYear(); that.query.year_s = year; this.$API.mtm.mgroup.list - .req({ page: 0, search: "原料磨" }) + .req({ page: 0, search: "生料工序(二次配料)" }) .then((res) => { that.query.mgroup = res[0].id; let params = {}; @@ -130,7 +126,6 @@ export default { }); }, methods: { - getGoalData() { const self = this; let params = {}; @@ -162,16 +157,19 @@ export default { wrapArrs = [], month_obj = {}, compareArr0 = []; - this.$API.enm.enstat.req(query0).then((res0) => { + this.$API.enm.enstat.req(query0).then((res0) => { let data0 = res0; if (data0.length > 0) { data0.forEach((item0) => { //先按月份排序,再按班组排序 - wrapArr0[ind0] = item0; + let month = item0.month_s; + if (!wrapArr0[month]) { + wrapArr0[month] = []; + } + wrapArr0[month].push(item0); }); - } else { - }}); - this.$API.enm.enstat.req(that.query).then((res) => { + } else { console.log('No data received.');} + }).then(() => {this.$API.enm.enstat.req(that.query).then((res) => { let data = res; if (data.length > 0) { data.forEach((item) => { @@ -190,8 +188,8 @@ export default { production_hour: item.production_hour, run_rate:item.run_rate, production_cost_unit:item.production_cost_unit, - xidu:item.辅料_细度_rate_pass, - Fe203:item.辅料_Fe2O3_rate_pass, + xidu:item.干混生料_细度_rate_pass , + Fe203:item.干混生料_Fe2O3_rate_pass , elec:item.elec_consume_unit, } ); @@ -210,54 +208,48 @@ export default { arr.push(item.production_cost_unit); //质量 arr[6] = - item.辅料_细度_rate_pass != null - ? item.辅料_细度_rate_pass - : "/"; - arr[7] = - item.辅料_Fe2O3_rate_pass != null - ? item.辅料_Fe2O3_rate_pass - : "/"; - arr[8] = - item.辅料_水分_rate_pass != null - ? item.辅料_水分_rate_pass - : "/"; - arr[9] = item.干混生料_细度_rate_pass != null ? item.干混生料_细度_rate_pass : "/"; - arr[10] = + arr[7] = item.干混生料_Fe2O3_rate_pass != null ? item.干混生料_Fe2O3_rate_pass : "/"; - arr[11] = + arr[8] = item.干混生料_水分_rate_pass != null ? item.干混生料_水分_rate_pass : "/"; - arr[12] = + arr[9] = item.干混生料_CaO_rate_pass != null ? item.干混生料_CaO_rate_pass : "/"; //设备 - arr[13] = - item.循环风机_consume_unit != null - ? item.循环风机_consume_unit - : "/"; - arr[14] = - item.立磨主电机_consume_unit != null - ? item.立磨主电机_consume_unit - : "/"; - // - arr[15] = item.elec_consume_unit; //当期值(kW·h/t) + // arr[10] = + // item.原料循环风机_consume_unit != null + // ? item.原料循环风机_consume_unit + // : "/"; + // arr[11] = + // item.立磨主电机_consume_unit != null + // ? item.立磨主电机_consume_unit + // : "/"; + // // + arr[10] = item.elec_consume_unit; //当期值(kW·h/t) let keyVale = "goal_val_" + n; - arr[16] = goalData[keyVale]?goalData[keyVale]:0; //目标值(kW·h/t)//需要接口获取 - arr[17] = (arr[15] - arr[16]).toFixed(2); //当期与目标差值(kW·h/t) + arr[11] = goalData[keyVale]?goalData[keyVale]:0; //目标值(kW·h/t)//需要接口获取 + arr[12] = (arr[10] - arr[11]).toFixed(2); //当期与目标差值(kW·h/t) let ind_pre = 0, huanbi = 0; - if (item.month_s == 1) { - ind_pre = 12; - huanbi = wrapArr0[ind_pre] - ? wrapArr0[ind_pre].elec_consume_unit - : "/"; + if (item.month_s == 1) { + ind_pre = 12; + // 循环遍历数组wrapArr0[ind_pre],找到item.name与 wrapArr0 数组中相同的名字 + if (wrapArr0[ind_pre]) { + wrapArr0[ind_pre].forEach((item0) => { + if (item0.team_name == item.team_name) { + huanbi = item0.elec_consume_unit; + } + }); + } + } else { // 如果 wrapArr数组长度大于0,那么循环遍历wrapArr数组,找到与item.month_s相差1的元素 而 item.name相同,并赋值给huanbi compareArr0.forEach((item0) => { @@ -266,22 +258,22 @@ export default { } }) } - arr[18] = huanbi; //环期值(kW·h/t)上个月的值 + arr[13] = huanbi; //环期值(kW·h/t)上个月的值 //当期与环期差值(kW·h/t) - if (arr[19] !== "/"){ - arr[19] = (arr[15] - arr[18]).toFixed(2); //当期与环期差值(kW·h/t) + if (arr[14] !== "/"){ + arr[14] = (arr[10] - arr[13]).toFixed(2); //当期与环期差值(kW·h/t) }else{ - arr[19] = "/"; //当期与环期差值(kW·h/t) + arr[14] = "/"; //当期与环期差值(kW·h/t) } - arr[20] = 0; //环比增长率(%) - if (arr[18] !=="/" && arr[19] !==0 && arr[19] !== "undefined" && arr[18] !== 0){ - arr[20] = ((arr[19]/arr[18])*100).toFixed(2); + arr[15] = 0; //环比增长率(%) + if (arr[13] !=="/" && arr[14] !==0 && arr[14] !== "undefined" && arr[13] !== 0){ + arr[15] = ((arr[14]/arr[13])*100).toFixed(2); }else{ - arr[20] = "/"; //环比增长率(%)= 当期与环期差值(kW·h/t)/环期值(kW·h/t)*100% + arr[15] = "/"; //环比增长率(%)= 当期与环期差值(kW·h/t)/环期值(kW·h/t)*100% } - arr[21] = item.celec_consume_unit; //同比增长率(%) + arr[16] = item.celec_consume_unit; //同比增长率(%) - arr[22] = 0; + arr[17] = 0; if (month_obj[n]) { const monthData = month_obj[n]; const itemValue = item.elec_consume_unit; // 单位产品电耗的值 @@ -297,7 +289,7 @@ export default { } else if (index === 3) { elec_score= 0; } - arr[22] += elec_score; + arr[17] += elec_score; const run_rate_itemValue = item.run_rate; // 运转率的值 const run_rate_sortedData = monthData.sort((a, b) => parseFloat(b.run_rate) - parseFloat(a.run_rate)); @@ -312,7 +304,7 @@ export default { } else if (run_rate_index === 3) { run_rate_score= 0; } - arr[22] += run_rate_score; + arr[17] += run_rate_score; const production_hour_itemValue = item.production_hour; // 台时产量的值 const production_hour_sortedData = monthData.sort((a, b) => parseFloat(b.production_hour) - parseFloat(a.production_hour)); @@ -327,7 +319,7 @@ export default { } else if (production_hour_index === 3) { production_hour_score= 0; } - arr[22] += production_hour_score; + arr[17] += production_hour_score; const production_cost_unit_itemValue = item.production_cost_unit; // 单位产品成本的值 const production_cost_unit_sortedData = monthData.sort((a, b) => parseFloat(b.production_cost_unit) - parseFloat(a.production_cost_unit)); @@ -342,7 +334,7 @@ export default { } else if (production_cost_unit_index === 3) { production_cost_unit_score= 0; } - arr[22] += production_cost_unit_score; + arr[17] += production_cost_unit_score; const xidu_itemValue = item.辅料_细度_rate_pass; // 辅料细度的值 const xidu_sortedData = monthData.sort((a, b) => parseFloat(b.xidu) - parseFloat(a.xidu)); @@ -357,7 +349,7 @@ export default { } else if (xidu_index === 3) { xidu_score= 0; } - arr[22] += xidu_score; + arr[17] += xidu_score; const Fe203_itemValue = item.辅料_Fe2O3_rate_pass; // 辅料Fe203的值 const Fe203_sortedData = monthData.sort((a, b) => parseFloat(b.Fe203) - parseFloat(a.Fe203)); @@ -372,14 +364,15 @@ export default { } else if (Fe203_index === 3) { Fe203_score= 0; } - arr[22] += Fe203_score; + arr[17] += Fe203_score; } wrapArr.push(arr); }); that.tableDatas = wrapArr; } else { } - }); + });}); + }, handleQuery() { this.tableDatas = []; diff --git a/src/views/enm_rm_copy/workshopAnalysis.vue b/src/views/enm_rm_copy/workshopAnalysis.vue index 090b361d..873d27b4 100644 --- a/src/views/enm_rm_copy/workshopAnalysis.vue +++ b/src/views/enm_rm_copy/workshopAnalysis.vue @@ -134,7 +134,7 @@ export default { that.query.year_s = year; that.timeStamp = myDate.getTime(); that.$API.mtm.mgroup.list - .req({ page: 0, name: "原料磨" }) + .req({ page: 0, name: "生料工序(二次配料)" }) .then((res) => { console.log("原料磨", res); that.query.mgroup = res[0].id; diff --git a/src/views/enm_slag/power.vue b/src/views/enm_slag/power.vue index 05eb72f4..002e96c5 100644 --- a/src/views/enm_slag/power.vue +++ b/src/views/enm_slag/power.vue @@ -423,6 +423,8 @@ export default { seriesData[index][ind] = item.elec_consume_unit; }); let options = { ...that.option2 }; + options.legend.data = []; + options.series = []; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; chartItem.name = that.mpoints[j]; @@ -466,6 +468,8 @@ export default { seriesData[index][ind] = item.elec_consume_unit; }); let options = { ...that.option3 }; + options.legend.data = []; + options.series = []; for (let j = 0; j < that.mpoints.length; j++) { let chartItem = {}; chartItem.name = that.mpoints[j]; diff --git a/src/views/enm_slag/report.vue b/src/views/enm_slag/report.vue index 38114d53..adc06a88 100644 --- a/src/views/enm_slag/report.vue +++ b/src/views/enm_slag/report.vue @@ -555,6 +555,14 @@ export default { return "/"; } } + function consume_precen(a, b) { + if (b !== 0 && b !== null && a !== null) { + let precen = ((a / b)+1)* 100; + return precen.toFixed(2) + "%"; + } else { + return "/"; + } + } let that = this; var myDate = new Date(); let year = (that.year = myDate.getFullYear()); @@ -620,14 +628,16 @@ export default { if (res4.length > 0) { let data4 = res4[0]; that.tableDatas[0][2] = data4.total_production; - if (data4.total_production == 0) { + if (data4.total_production < 1) { that.tableDatas[1][2] = 0; that.tableDatas[2][2] = 0; that.tableDatas[3][2] = 0; - } - that.tableDatas[1][2] = data4.elec_consume_unit; - that.tableDatas[2][2] = data4.elec_consume; - that.tableDatas[3][2] = data4.production_cost_unit; + + }else{ + that.tableDatas[1][2] = data4.elec_consume_unit; + that.tableDatas[2][2] = data4.elec_consume; + that.tableDatas[3][2] = data4.production_cost_unit;} + if (data4.imaterial_data.length > 0) { data4.imaterial_data.forEach((item) => { if (item.material_name == "湿电石渣消耗") { @@ -642,6 +652,7 @@ export default { //月目标 let params5 = {}; params5.page = 0; + params5.year = year; params5.mgroup = that.query.mgroup; this.$API.mtm.goal.list .req(params5) @@ -665,6 +676,19 @@ export default { ) { that.tableDatas[3][6] = item5[str]; that.tableDatas[3][8] = item5.goal_val; + }else if (item5.goal_cate_name == + "总电量(kW·h)"){ + that.tableDatas[2][6] = item5[str]; + that.tableDatas[2][8] = item5.goal_val; + }else if (item5.goal_cate_name == + "湿电石渣消耗(t)"){ + that.tableDatas[4][6] = item5[str]; + that.tableDatas[4][8] = item5.goal_val; + } + else if (item5.goal_cate_name == + "湿电石渣进厂(t)"){ + that.tableDatas[5][6] = item5[str]; + that.tableDatas[5][8] = item5.goal_val; } }); } @@ -682,26 +706,38 @@ export default { that.tableDatas[0][5] = data1.total_production; that.tableDatas[0][9] = precen( that.tableDatas[0][5], - that.tableDatas[0][6] + that.tableDatas[0][8] ); that.tableDatas[1][5] = data1.elec_consume_unit; - that.tableDatas[1][9] = precen( - (that.tableDatas[1][4]-that.tableDatas[1][7]), - that.tableDatas[1][7] + that.tableDatas[1][9] = consume_precen( + that.tableDatas[1][8]-that.tableDatas[1][5], + that.tableDatas[1][8] ); that.tableDatas[2][5] = data1.elec_consume; + that.tableDatas[2][9] = consume_precen( + that.tableDatas[2][8]-that.tableDatas[2][5], + that.tableDatas[2][8] + ); that.tableDatas[3][5] = data1.production_cost_unit; - that.tableDatas[3][9] = precen( - (that.tableDatas[3][5]-that.tableDatas[3][8]), + that.tableDatas[3][9] = consume_precen( + that.tableDatas[3][8]-that.tableDatas[3][5], that.tableDatas[3][8] ); if (data1.imaterial_data.length > 0) { data1.imaterial_data.forEach((item) => { if (item.material_name == "湿电石渣消耗") { that.tableDatas[4][5] = (item.amount_consume).toFixed(2); + that.tableDatas[4][9] = precen( + that.tableDatas[4][5], + that.tableDatas[4][8] + ); }else if(item.material_name == "湿电石渣进厂"){ that.tableDatas[5][5] = (item.amount_consume).toFixed(2); + that.tableDatas[5][9] = precen( + that.tableDatas[5][5], + that.tableDatas[5][8] + ); } }); } @@ -725,22 +761,34 @@ export default { ); that.tableDatas[1][4] = data2.elec_consume_unit; that.tableDatas[1][7] = precen( - (that.tableDatas[1][4]-that.tableDatas[1][6]), + that.tableDatas[1][4], that.tableDatas[1][6] ); + that.tableDatas[2][4] = data2.elec_consume; that.tableDatas[3][4] = data2.production_cost_unit; that.tableDatas[3][7] = precen( - (that.tableDatas[3][3]-that.tableDatas[3][6]), + that.tableDatas[3][3], that.tableDatas[3][6] ); - that.tableDatas[2][4] = data2.elec_consume; + that.tableDatas[2][7] = precen( + that.tableDatas[2][4], + that.tableDatas[2][6] + ); if (data2.imaterial_data.length > 0) { data2.imaterial_data.forEach((item) => { if (item.material_name == "湿电石渣消耗") { that.tableDatas[4][4] = (item.amount_consume).toFixed(2); + that.tableDatas[4][7] = precen( + that.tableDatas[4][4], + that.tableDatas[4][6] + ); }else if(item.material_name == "湿电石渣进厂"){ that.tableDatas[5][4] = (item.amount_consume).toFixed(2); + that.tableDatas[5][7] = precen( + that.tableDatas[5][4], + that.tableDatas[5][6] + ); } }); }