diff --git a/.env.development b/.env.development index fccc0642..1eca0332 100644 --- a/.env.development +++ b/.env.development @@ -3,8 +3,8 @@ NODE_ENV = development # 标题 # VUE_APP_TITLE = '曲阳金隅安全智能管控平台' -VUE_APP_TITLE = '托克逊能源管理平台' -# VUE_APP_TITLE = '中建材光子科技有限公司' +# VUE_APP_TITLE = '托克逊能源管理平台' +VUE_APP_TITLE = '中建材光子科技有限公司' # VUE_APP_TITLE = '超低排放系统' VUE_APP_PJ = '' @@ -13,21 +13,21 @@ VUE_APP_PJ = '' #VUE_APP_WS_API = 'ws://localhost:8000' # VUE_APP_API_BASEURL = http://222.222.144.147:6013/api #VUE_APP_API_BASEURL = http://10.99.5.79:20309/api -# VUE_APP_API_BASEURL = http://127.0.0.1:2226/api +# VUE_APP_API_BASEURL = http://127.0.0.1:8887/api #测试环境 -# VUE_APP_API_BASEURL = http://10.50.211.228:2250/api + VUE_APP_API_BASEURL = http://10.50.211.228:2250/api #VUE_APP_API_BASEURL = http://127.0.0.1:2226/api VUE_APP_BASEURL = http://10.50.211.228:2250/ -# VUE_APP_BASEURL = http://10.50.211.228:2250 +# VUE_APP_BASEURL = http://127.0.0.1:8887 #VUE_APP_BASEURL = http://127.0.0.1:2226 # #光子 -VUE_APP_API_BASEURL = http://49.232.14.174:2226/api -VUE_APP_BASEURL = http://49.232.14.174:2226 - +# VUE_APP_API_BASEURL = http://49.232.14.174:2226/api +# VUE_APP_BASEURL = http://49.232.14.174:2226 +# # 本地端口 VUE_APP_PORT = 2800 diff --git a/src/views/enm_coal/teamAnalysis.vue b/src/views/enm_coal/teamAnalysis.vue index 7529f30e..9bd3eba7 100644 --- a/src/views/enm_coal/teamAnalysis.vue +++ b/src/views/enm_coal/teamAnalysis.vue @@ -128,6 +128,7 @@ export default { let wrapArr = [], wrapArr0 = [], compareArr0 = [], + month_obj = {}, wrapArrs = []; this.$API.enm.enstat.req(query0).then((res0) => { let data0 = res0; @@ -149,6 +150,20 @@ export default { compareArr.push(item.team_name); compareArr.push(item.elec_consume_unit); compareArr0.push(compareArr); + if (!month_obj[item.month_s]) { + month_obj[item.month_s] = []; + } + month_obj[item.month_s].push( + { + team:item.team_name, + production_hour: item.production_hour, + run_rate:item.run_rate, + xidu:item.出磨煤粉_细度_rate_pass, + coal_powder:item.出磨煤粉_水分_rate_pass, + elec:item.elec_consume_unit, + } + ); + }); data.forEach((item) => { //先按月份排序,再按班组排序 @@ -205,13 +220,92 @@ export default { } arr[12] = huanqicha; //当期与环期差值(KW·h/t) // arr[13] = - if (arr[11] !=="/" && arr[11]!==0 && arr[11] !==0 && arr[12] !== "undefined"){ + if (arr[11] !=="/" && arr[11]!==0 && arr[12] !==0 && arr[12] !== "undefined"){ arr[13] = ((arr[11]/arr[12])*100).toFixed(2); }else{ arr[13] = "/"; //环比增长率(%)= 当期与环期差值(KW·h/t)/环期值(KW·h/t)*100% } arr[14] = tongqi; //同比增长率(%) - arr[15] = 0.0; //得分 + // arr[15] = 0.0; //得分 + arr[15] = 0; + if (month_obj[n]) { + console.log("month_obj[n]",month_obj[n]) + const monthData = month_obj[n]; + const itemValue = item.elec_consume_unit; // 单位产品电耗的值 + const sortedData = monthData.sort((a, b) => parseFloat(b.elec) - parseFloat(a.elec)); + const index = sortedData.findIndex(obj => parseFloat(obj.elec) === parseFloat(itemValue)); + let elec_score = 0; + if (index === 0){ + elec_score= 20; + } else if (index === 1) { + elec_score= 15; + } else if (index === 2) { + elec_score= 5; + } else if (index === 3) { + elec_score= 0; + } + arr[15] += 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)); + const run_rate_index = run_rate_sortedData.findIndex(obj => parseFloat(obj.run_rate) === parseFloat(run_rate_itemValue)); + let run_rate_score = 0; + if (run_rate_index === 0){ + run_rate_score= 20; + } else if (run_rate_index === 1) { + run_rate_score= 15; + } else if (run_rate_index === 2) { + run_rate_score= 5; + } else if (run_rate_index === 3) { + run_rate_score= 0; + } + arr[15] += 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)); + const production_hour_index = production_hour_sortedData.findIndex(obj => parseFloat(obj.production_hour) === parseFloat(production_hour_itemValue)); + let production_hour_score = 0; + if (production_hour_index === 0){ + production_hour_score= 20; + } else if (production_hour_index === 1) { + production_hour_score= 15; + } else if (production_hour_index === 2) { + production_hour_score= 5; + } else if (production_hour_index === 3) { + production_hour_score= 0; + } + arr[15] += production_hour_score; + + const xidu_itemValue = item.出磨煤粉_细度_rate_pass; // 出磨煤粉细度的值 + const xidu_sortedData = monthData.sort((a, b) => parseFloat(b.xidu) - parseFloat(a.xidu)); + const xidu_index = xidu_sortedData.findIndex(obj => parseFloat(obj.xidu) === parseFloat(xidu_itemValue)); + let xidu_score = 0; + if (xidu_index === 0){ + xidu_score= 20; + } else if (xidu_index === 1) { + xidu_score= 15; + } else if (xidu_index === 2) { + xidu_score= 5; + } else if (xidu_index === 3) { + xidu_score= 0; + } + arr[15] += xidu_score; + + const coal_powder_itemValue = item.出磨煤粉_水分_rate_pass; // 出磨煤粉水分的值 + const coal_powder_sortedData = monthData.sort((a, b) => parseFloat(b.coal_powder) - parseFloat(a.coal_powder)); + const coal_powder_index = coal_powder_sortedData.findIndex(obj => parseFloat(obj.coal_powder) === parseFloat(coal_powder_itemValue)); + let coal_powder_score = 0; + if (coal_powder_index === 0){ + coal_powder_score= 20; + } else if (coal_powder_index === 1) { + coal_powder_score= 15; + } else if (coal_powder_index === 2) { + coal_powder_score= 5; + } else if (coal_powder_index === 3) { + coal_powder_score= 0; + } + arr[15] += coal_powder_score; + } wrapArr.push(arr); }); that.tableDatas = wrapArr; diff --git a/src/views/enm_kiln/teamAnalysis.vue b/src/views/enm_kiln/teamAnalysis.vue index 2a801ce9..215c4578 100644 --- a/src/views/enm_kiln/teamAnalysis.vue +++ b/src/views/enm_kiln/teamAnalysis.vue @@ -154,6 +154,7 @@ export default { wrapArr0 = [], wrapArrs = [], comparEarr = [], //班组对比 + month_obj = {}, compareArr0 = []; this.$API.enm.enstat.req(query0).then((res0) => { let data0 = res0; @@ -189,6 +190,20 @@ export default { elecArr.push(item.elec_consume_unit); compareArr0.push(compareArr); comparEarr.push(elecArr); + if (!month_obj[item.month_s]) { + month_obj[item.month_s] = []; + }; + month_obj[item.month_s].push( + { + team:item.team_name, + production_hour: item.production_hour, + run_rate:item.run_rate, + production_cost_unit:item.production_cost_unit, + CaO:item.出窑熟料_fCaO_rate_pass, + coal_consume_unit:item.coal_consume_unit, + elec:item.elec_consume_unit, + } + ); }); data.forEach((item) => { //先按月份排序,再按班组排序 @@ -339,6 +354,100 @@ export default { }else{ arr[29] = 0}; //环比增长率(%) arr[30] = item.celec_consume_unit; //同比增长率(%) + arr[31] = 0; + if (month_obj[n]) { + console.log("month_obj[n]",month_obj[n]) + const monthData = month_obj[n]; + const itemValue = item.elec_consume_unit; // 单位产品电耗的值 + const sortedData = monthData.sort((a, b) => parseFloat(b.elec) - parseFloat(a.elec)); + const index = sortedData.findIndex(obj => parseFloat(obj.elec) === parseFloat(itemValue)); + let elec_score = 0; + if (index === 0){ + elec_score= 20; + } else if (index === 1) { + elec_score= 15; + } else if (index === 2) { + elec_score= 5; + } else if (index === 3) { + elec_score= 0; + } + arr[31] += 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)); + const run_rate_index = run_rate_sortedData.findIndex(obj => parseFloat(obj.run_rate) === parseFloat(run_rate_itemValue)); + let run_rate_score = 0; + if (run_rate_index === 0){ + run_rate_score= 10; + } else if (run_rate_index === 1) { + run_rate_score= 7; + } else if (run_rate_index === 2) { + run_rate_score= 3; + } else if (run_rate_index === 3) { + run_rate_score= 0; + } + arr[31] += 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)); + const production_hour_index = production_hour_sortedData.findIndex(obj => parseFloat(obj.production_hour) === parseFloat(production_hour_itemValue)); + let production_hour_score = 0; + if (production_hour_index === 0){ + production_hour_score= 20; + } else if (production_hour_index === 1) { + production_hour_score= 15; + } else if (production_hour_index === 2) { + production_hour_score= 5; + } else if (production_hour_index === 3) { + production_hour_score= 0; + } + arr[31] += 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)); + const production_cost_unit_index = production_cost_unit_sortedData.findIndex(obj => parseFloat(obj.production_cost_unit) === parseFloat(production_cost_unit_itemValue)); + let production_cost_unit_score = 0; + if (production_cost_unit_index === 0){ + production_cost_unit_score= 10; + } else if (production_cost_unit_index === 1) { + production_cost_unit_score= 7; + } else if (production_cost_unit_index === 2) { + production_cost_unit_score= 3; + } else if (production_cost_unit_index === 3) { + production_cost_unit_score= 0; + } + arr[31] += 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)); + const CaO_index = CaO_sortedData.findIndex(obj => parseFloat(obj.CaO) === parseFloat(CaO_itemValue)); + let CaO_score = 0; + if (CaO_index === 0){ + CaO_score= 20; + } else if (CaO_index === 1) { + CaO_score= 15; + } else if (CaO_index === 2) { + CaO_score= 5; + } else if (CaO_index === 3) { + CaO_score= 0; + } + arr[31] += 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)); + const coal_index = coal_sortedData.findIndex(obj => parseFloat(obj.coal_consume_unit) === parseFloat(coal_itemValue)); + let coal_score = 0; + if (coal_index === 0){ + coal_score= 20; + } else if (coal_index === 1) { + coal_score= 15; + } else if (coal_index === 2) { + coal_score= 5; + } else if (coal_index === 3) { + coal_score= 0; + } + arr[31] += coal_score; + } wrapArr.push(arr); }); that.tableDatas = wrapArr; diff --git a/src/views/enm_mill/teamAnalysis.vue b/src/views/enm_mill/teamAnalysis.vue index 606c7122..adf47af7 100644 --- a/src/views/enm_mill/teamAnalysis.vue +++ b/src/views/enm_mill/teamAnalysis.vue @@ -144,6 +144,7 @@ export default { let wrapArr = [], wrapArr0 = [], compareArr0 = [], + month_obj = {}, wrapArrs = []; this.$API.enm.enstat.req(query0).then((res0) => { let data0 = []; //去年的值 @@ -167,6 +168,21 @@ export default { compareArr.push(item.team_name); compareArr.push(item.elec_consume_unit); compareArr0.push(compareArr); + if (!month_obj[item.month_s]) { + month_obj[item.month_s] = []; + }; + month_obj[item.month_s].push( + { + team:item.team_name, + production_hour: item.production_hour, + run_rate:item.run_rate, + production_cost_unit:item.production_cost_unit, + surface_area :item.出磨水泥_比表面积_rate_pass, + SO3:item.出磨水泥_SO3_rate_pass, + chanliang:item.出磨水泥_掺量_rate_pass, + elec:item.elec_consume_unit, + } + ); }); data.forEach((item) => { //先按月份排序,再按班组排序 @@ -250,7 +266,116 @@ export default { } arr[17] = tongqi; //同比增长率(%):本月-去年本月/去年 - arr[18] = 0.0; //同比增长率(%) + // arr[18] = 0.0; //同比增长率(%) + arr[18] = 0; + if (month_obj[n]) { + console.log("month_obj[n]",month_obj[n]) + const monthData = month_obj[n]; + const itemValue = item.elec_consume_unit; // 单位产品电耗的值 + const sortedData = monthData.sort((a, b) => parseFloat(b.elec) - parseFloat(a.elec)); + const index = sortedData.findIndex(obj => parseFloat(obj.elec) === parseFloat(itemValue)); + let elec_score = 0; + if (index === 0){ + elec_score= 10; + } else if (index === 1) { + elec_score= 7; + } else if (index === 2) { + elec_score= 3; + } else if (index === 3) { + elec_score= 0; + } + arr[18] += 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)); + const run_rate_index = run_rate_sortedData.findIndex(obj => parseFloat(obj.run_rate) === parseFloat(run_rate_itemValue)); + let run_rate_score = 0; + if (run_rate_index === 0){ + run_rate_score= 10; + } else if (run_rate_index === 1) { + run_rate_score= 7; + } else if (run_rate_index === 2) { + run_rate_score= 3; + } else if (run_rate_index === 3) { + run_rate_score= 0; + } + arr[18] += 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)); + const production_hour_index = production_hour_sortedData.findIndex(obj => parseFloat(obj.production_hour) === parseFloat(production_hour_itemValue)); + let production_hour_score = 0; + if (production_hour_index === 0){ + production_hour_score= 20; + } else if (production_hour_index === 1) { + production_hour_score= 15; + } else if (production_hour_index === 2) { + production_hour_score= 5; + } else if (production_hour_index === 3) { + production_hour_score= 0; + } + arr[18] += 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)); + const production_cost_unit_index = production_cost_unit_sortedData.findIndex(obj => parseFloat(obj.production_cost_unit) === parseFloat(production_cost_unit_itemValue)); + let production_cost_unit_score = 0; + if (production_cost_unit_index === 0){ + production_cost_unit_score= 10; + } else if (production_cost_unit_index === 1) { + production_cost_unit_score= 7; + } else if (production_cost_unit_index === 2) { + production_cost_unit_score= 3; + } else if (production_cost_unit_index === 3) { + production_cost_unit_score= 0; + } + arr[18] += production_cost_unit_score; + + const surface_area_itemValue = item.出磨水泥_比表面积_rate_pass; // 比表面积的值 + const surface_area_sortedData = monthData.sort((a, b) => parseFloat(b.surface_area) - parseFloat(a.surface_area)); + const surface_area_index = surface_area_sortedData.findIndex(obj => parseFloat(obj.surface_area) === parseFloat(surface_area_itemValue)); + let surface_area_score = 0; + if (surface_area_index === 0){ + surface_area_score= 20; + } else if (surface_area_index === 1) { + surface_area_score= 15; + } else if (surface_area_index === 2) { + surface_area_score= 5; + } else if (surface_area_index === 3) { + surface_area_score= 0; + } + arr[18] += surface_area_score; + + const SO3_itemValue = item.出磨水泥_SO3_rate_pass; // SO3的值 + const SO3_sortedData = monthData.sort((a, b) => parseFloat(b.SO3) - parseFloat(a.SO3)); + const SO3_index = SO3_sortedData.findIndex(obj => parseFloat(obj.SO3) === parseFloat(SO3_itemValue)); + let SO3_score = 0; + if (SO3_index === 0){ + SO3_score= 20; + } else if (SO3_index === 1) { + SO3_score= 15; + } else if (SO3_index === 2) { + SO3_score= 5; + } else if (SO3_index === 3) { + SO3_score= 0; + } + arr[18] += SO3_score; + + const CLitemValue = item.出磨水泥_掺量_rate_pass; // SO3的值 + const CL_sortedData = monthData.sort((a, b) => parseFloat(b.chanliang) - parseFloat(a.chanliang)); + const CL_index = CL_sortedData.findIndex(obj => parseFloat(obj.chanliang) === parseFloat(CLitemValue)); + let CL_score = 0; + if (CL_index === 0){ + CL_score= 10; + } else if (CL_index === 1) { + CL_score= 7; + } else if (SO3_inCL_indexdex === 2) { + CL_score= 3; + } else if (CL_index === 3) { + CL_score= 0; + } + arr[18] += CL_score; + } wrapArr.push(arr); }); let newArr = []; diff --git a/src/views/enm_monthSet/feeset.vue b/src/views/enm_monthSet/feeset.vue index 42be3615..b52911e1 100644 --- a/src/views/enm_monthSet/feeset.vue +++ b/src/views/enm_monthSet/feeset.vue @@ -167,13 +167,27 @@ export default { //获取集合列表 getMgroup() { this.$API.mtm.mgroup.list.req({ page: 0, cate:"section"}).then((res) => { - this.options = res; + //如果res.name=煤磨、原料磨、水泥包装,则不放入options中 + res.forEach(element => { + // console.log(element.name); + if(['煤磨','原料磨','水泥包装'].includes(element.name)){ + return; + } + this.options.push(element); + }); + console.log(this.options); }); }, //获取类型列表 getFee() { this.$API.fim.fee.req({ page: 0 }).then((res) => { - this.feeOptions = res; + res.forEach(element => { + // console.log(element.name); + if(['煤磨','原料磨','水泥包装'].includes(element.name)){ + return; + } + this.feeOptions.push(element); + }); }); }, //添加 diff --git a/src/views/enm_monthSet/goalSetting.vue b/src/views/enm_monthSet/goalSetting.vue index aa025d89..a834ba27 100644 --- a/src/views/enm_monthSet/goalSetting.vue +++ b/src/views/enm_monthSet/goalSetting.vue @@ -175,6 +175,7 @@ { let data0 = res0; @@ -151,6 +152,10 @@ export default { compareArr.push(item.team_name); compareArr.push(item.elec_consume_unit); compareArr0.push(compareArr); + if (!month_obj[item.month_s]) { + month_obj[item.month_s] = []; + } + month_obj[item.month_s].push({team:item.team_name, value: item.elec_consume_unit}); }); data.forEach((item) => { @@ -211,6 +216,21 @@ export default { } arr[9] = sameRate; ///同比增长率(%)需要当前值/ 上一年同一个月的值即wrapArr0[ind].elec_consume_unit // arr[10] = item.celec_consume_unit; //同比增长率(%)需要当前值-上一年同一个月的值即wrapArr0[ind].elec_consume_unit + if (month_obj[n]) { + const monthData = month_obj[n]; + const itemValue = item.elec_consume_unit; // 当前项的值 + const sortedData = monthData.sort((a, b) => parseFloat(b.value) - parseFloat(a.value)); + const index = sortedData.findIndex(obj => parseFloat(obj.value) === parseFloat(itemValue)); + if (index === 0){ + arr[10] = 100; + } else if (index === 1) { + arr[10] = 80; + } else if (index === 2) { + arr[10] = 70; + } else if (index === 3) { + arr[10] = 0; + } + } wrapArr.push(arr); // console.log(wrapArr); }); diff --git a/src/views/enm_rm/logDetail.vue b/src/views/enm_rm/logDetail.vue index b9d66ffe..410ef50a 100644 --- a/src/views/enm_rm/logDetail.vue +++ b/src/views/enm_rm/logDetail.vue @@ -616,6 +616,7 @@ export default { return { deptId: "", mgroupId: "", + sflogId: "", hideAdd: true, visible: false, hideDelete: true, @@ -661,7 +662,7 @@ export default { mpoint__type: 30, has_create_by: 1, }, - querystlog: { mgroup: "" }, + querystlog: { mgroup: "", sflogs: ""}, stlogVisiable: false, cateOptions: ["工艺", "机械", "电气", "其他"], checkList: [], @@ -679,12 +680,16 @@ export default { mounted() { this.deptId = this.$route.query.deptId; this.mgroupId = this.$route.query.mgroupId; + this.sflogId = this.$route.query.sflogId; this.querymplogX.mgroup = this.mgroupId; - this.querystlog.mgroup = this.mgroupId; + this.apiObj = this.$API.enm.mpoint.stat; - this.apiObjStlog = this.$API.wpm.stlog.list; + let form = this.$TOOL.data.get("sflogItem"); this.form = JSON.parse(form); + this.querystlog.mgroup = this.mgroupId; + this.querystlog.sflogs = this.form.id; + this.apiObjStlog = this.$API.wpm.stlog.list; this.getMpoint(); this.getTeam(); let height = document.getElementById("elMain").clientHeight; diff --git a/src/views/enm_rm/teamAnalysis.vue b/src/views/enm_rm/teamAnalysis.vue index 8d88ef81..65851c71 100644 --- a/src/views/enm_rm/teamAnalysis.vue +++ b/src/views/enm_rm/teamAnalysis.vue @@ -138,6 +138,7 @@ export default { let wrapArr = [], wrapArr0 = [], wrapArrs = [], + month_obj = {}, compareArr0 = []; this.$API.enm.enstat.req(query0).then((res0) => { let data0 = res0; @@ -147,7 +148,7 @@ export default { wrapArr0[ind0] = item0; }); } else { - } + }}); this.$API.enm.enstat.req(that.query).then((res) => { let data = res; if (data.length > 0) { @@ -158,6 +159,20 @@ export default { compareArr.push(item.team_name); compareArr.push(item.elec_consume_unit); compareArr0.push(compareArr); + if (!month_obj[item.month_s]) { + month_obj[item.month_s] = []; + } + month_obj[item.month_s].push( + { + team:item.team_name, + 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, + elec:item.elec_consume_unit, + } + ); }); data.forEach((item) => { //先按月份排序,再按班组排序 @@ -247,14 +262,107 @@ export default { arr[21] = "/"; //环比增长率(%)= 当期与环期差值(KW·h/t)/环期值(KW·h/t)*100% } arr[22] = item.celec_consume_unit; //同比增长率(%) - arr[23] = item.celec_consume_unit; //同比增长率(%) + + arr[23] = 0; + if (month_obj[n]) { + console.log("month_obj[n]",month_obj[n]) + const monthData = month_obj[n]; + const itemValue = item.elec_consume_unit; // 单位产品电耗的值 + const sortedData = monthData.sort((a, b) => parseFloat(b.elec) - parseFloat(a.elec)); + const index = sortedData.findIndex(obj => parseFloat(obj.elec) === parseFloat(itemValue)); + let elec_score = 0; + if (index === 0){ + elec_score= 20; + } else if (index === 1) { + elec_score= 15; + } else if (index === 2) { + elec_score= 5; + } else if (index === 3) { + elec_score= 0; + } + arr[23] += 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)); + const run_rate_index = run_rate_sortedData.findIndex(obj => parseFloat(obj.run_rate) === parseFloat(run_rate_itemValue)); + let run_rate_score = 0; + if (run_rate_index === 0){ + run_rate_score= 10; + } else if (run_rate_index === 1) { + run_rate_score= 7; + } else if (run_rate_index === 2) { + run_rate_score= 3; + } else if (run_rate_index === 3) { + run_rate_score= 0; + } + arr[23] += 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)); + const production_hour_index = production_hour_sortedData.findIndex(obj => parseFloat(obj.production_hour) === parseFloat(production_hour_itemValue)); + let production_hour_score = 0; + if (production_hour_index === 0){ + production_hour_score= 20; + } else if (production_hour_index === 1) { + production_hour_score= 15; + } else if (production_hour_index === 2) { + production_hour_score= 5; + } else if (production_hour_index === 3) { + production_hour_score= 0; + } + arr[23] += 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)); + const production_cost_unit_index = production_cost_unit_sortedData.findIndex(obj => parseFloat(obj.production_cost_unit) === parseFloat(production_cost_unit_itemValue)); + let production_cost_unit_score = 0; + if (production_cost_unit_index === 0){ + production_cost_unit_score= 10; + } else if (production_cost_unit_index === 1) { + production_cost_unit_score= 7; + } else if (production_cost_unit_index === 2) { + production_cost_unit_score= 3; + } else if (production_cost_unit_index === 3) { + production_cost_unit_score= 0; + } + arr[23] += production_cost_unit_score; + + const xidu_itemValue = item.辅料_细度_rate_pass; // 辅料细度的值 + const xidu_sortedData = monthData.sort((a, b) => parseFloat(b.xidu) - parseFloat(a.xidu)); + const xidu_index = xidu_sortedData.findIndex(obj => parseFloat(obj.xidu) === parseFloat(xidu_itemValue)); + let xidu_score = 0; + if (xidu_index === 0){ + xidu_score= 20; + } else if (xidu_index === 1) { + xidu_score= 15; + } else if (xidu_index === 2) { + xidu_score= 5; + } else if (xidu_index === 3) { + xidu_score= 0; + } + arr[23] += xidu_score; + + const Fe203_itemValue = item.辅料_Fe2O3_rate_pass; // 辅料Fe203的值 + const Fe203_sortedData = monthData.sort((a, b) => parseFloat(b.Fe203) - parseFloat(a.Fe203)); + const Fe203_index = Fe203_sortedData.findIndex(obj => parseFloat(obj.Fe203) === parseFloat(Fe203_itemValue)); + let Fe203_score = 0; + if (Fe203_index === 0){ + Fe203_score= 20; + } else if (Fe203_index === 1) { + Fe203_score= 15; + } else if (Fe203_index === 2) { + Fe203_score= 5; + } else if (Fe203_index === 3) { + Fe203_score= 0; + } + arr[23] += Fe203_score; + } wrapArr.push(arr); }); that.tableDatas = wrapArr; } else { } }); - }); }, handleQuery() { this.tableDatas = []; diff --git a/src/views/enm_slag/teamAnalysis.vue b/src/views/enm_slag/teamAnalysis.vue index eb6fcf6e..4537c3ba 100644 --- a/src/views/enm_slag/teamAnalysis.vue +++ b/src/views/enm_slag/teamAnalysis.vue @@ -122,8 +122,8 @@ export default { query0.mgroup = that.query.mgroup; let wrapArr = [], wrapArr0 = [], - compareArr0 = [], - wrapArrs = []; + month_obj = {}, + compareArr0 = []; this.$API.enm.enstat.req(query0).then((res0) => { let data0 = res0; if (data0.length > 0) { @@ -132,17 +132,24 @@ export default { wrapArr0[ind0] = item0; }); } else { - } + } + }); this.$API.enm.enstat.req(that.query).then((res) => { let data = res; + console.log("data", data); if (data.length > 0) { - data.forEach((item) => { + data.forEach((item, index) => { //先按月份排序,再按班组排序 - let compareArr = []; + let compareArr = []; compareArr.push(item.month_s); compareArr.push(item.team_name); compareArr.push(item.elec_consume_unit); - compareArr0.push(compareArr); + compareArr0[index]=compareArr; + if (!month_obj[item.month_s]) { + month_obj[item.month_s] = []; + } + month_obj[item.month_s].push({team:item.team_name, value: item.elec_consume_unit}); + // month_list.push(month_obj) }); data.forEach((item) => { //先按月份排序,再按班组排序 @@ -194,16 +201,29 @@ export default { tongqi = 0; } arr[10] = tongqi; //同比增长率(%) - arr[11] = 0; //得分 + //如果n = month_list的key值,则遍历里面的对象按照value排序, 如果 index==0,则arr[11] = 100,如果 index==1,则arr[11] = 80,如果 index==2,则arr[11] = 70,如果 index==3,则arr[11] = 0 + if (month_obj[n]) { + const monthData = month_obj[n]; + const itemValue = item.elec_consume_unit; // 当前项的值 + const sortedData = monthData.sort((a, b) => parseFloat(b.value) - parseFloat(a.value)); + const index = sortedData.findIndex(obj => parseFloat(obj.value) === parseFloat(itemValue)); + if (index === 0){ + arr[11] = 100; + } else if (index === 1) { + arr[11] = 80; + } else if (index === 2) { + arr[11] = 70; + } else if (index === 3) { + arr[11] = 0; + } + } wrapArr.push(arr); - }); - console.log(wrapArr); + // console.log(wrapArr); that.tableDatas = wrapArr; } else { } }); - }); }, handleQuery() { this.tableDatas = [];