From 8d22019fd4d599b8b293d61347be417ce8ec7a11 Mon Sep 17 00:00:00 2001 From: zty Date: Mon, 13 Jan 2025 18:03:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BF=AE=E6=94=B9=E7=8F=AD=E7=BB=84?= =?UTF-8?q?=E6=8E=92=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/enm_energy/energyPicture.vue | 2 +- src/views/enm_kiln/teamAnalysis.vue | 57 +++++++++++++++----------- src/views/enm_monthSet/priceset.vue | 2 +- src/views/enm_report/quality.vue | 3 +- src/views/enm_rm/report.vue | 2 +- 5 files changed, 37 insertions(+), 29 deletions(-) diff --git a/src/views/enm_energy/energyPicture.vue b/src/views/enm_energy/energyPicture.vue index 98cfb890..32a15523 100644 --- a/src/views/enm_energy/energyPicture.vue +++ b/src/views/enm_energy/energyPicture.vue @@ -255,7 +255,7 @@ params.month_s = Number(arr[1]); params.type='month_s'; }else if (that.query.type==2){ - that.year = that.query.year; + params.year_s = that.query.year; params.type='year_s'; } this.$API.enm.mpoint.stat.req(params).then(res => { diff --git a/src/views/enm_kiln/teamAnalysis.vue b/src/views/enm_kiln/teamAnalysis.vue index b54cce26..eb986cec 100644 --- a/src/views/enm_kiln/teamAnalysis.vue +++ b/src/views/enm_kiln/teamAnalysis.vue @@ -38,7 +38,7 @@ > - 烧成工序班组月度对比分析 + 烧成工序班组月度对比分析 月份 @@ -50,6 +50,7 @@ 单位产品标煤耗 产品单位电耗 得分 + 排名 总产量(t) @@ -122,7 +123,6 @@ export default { this.$API.mtm.mgroup.list .req({ page: 0, search: "回转窑" }) .then((res) => { - console.log("回转窑", res); that.query.mgroup = res[0].id; that.getGoalData(); }); @@ -364,7 +364,6 @@ export default { 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]; const itemValue = item.elec_consume_unit; // 单位产品电耗的值 const sortedData = monthData.sort((a, b) => parseFloat(b.elec) - parseFloat(a.elec)); @@ -441,29 +440,40 @@ export default { } arr[29] += CaO_score; arr [29] += 60; - - // 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[29] += coal_score; } wrapArr.push(arr); }); - that.tableDatas = wrapArr; - } else { - } - }); - }); + console.log(wrapArr),'------------------'; + // 深拷贝数组,防止原始数据被修改 + const sortArr = [...wrapArr]; + + // 将数组按每4个元素进行分组 + const groupSize = 4; + const groupedArr = []; + for (let i = 0; i < sortArr.length; i += groupSize) { + groupedArr.push(sortArr.slice(i, i + groupSize)); + } + groupedArr.forEach(group => { + group.sort((a, b) => b[b.length - 1] - a[a.length - 1]); // 按最后一项值排序(忽略排名) + // 为每个分组内的元素计算排名 + let currentRank = 1; + let previousValue = null; + group.forEach((item, index) => { + if (previousValue !== item[item.length - 1]) { + currentRank = index + 1; + previousValue = item[item.length - 1]; // 保留上一个排名 + // 当前排名为索引加1 + } + item.push(`${currentRank}名`); + }); + }); + // 扁平化分组数组 + const flattenedArr = groupedArr.flat(); + // 将排序并添加排名后的数据赋值给 tableDatas + that.tableDatas = flattenedArr; + } + }); + }); }, handleQuery() { @@ -479,7 +489,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_monthSet/priceset.vue b/src/views/enm_monthSet/priceset.vue index c356df54..00bf7d52 100644 --- a/src/views/enm_monthSet/priceset.vue +++ b/src/views/enm_monthSet/priceset.vue @@ -61,7 +61,7 @@ min-width="150" > diff --git a/src/views/enm_report/quality.vue b/src/views/enm_report/quality.vue index b993f854..92a8e18e 100644 --- a/src/views/enm_report/quality.vue +++ b/src/views/enm_report/quality.vue @@ -221,7 +221,6 @@ let params = {page: 0}; let arr = []; if(that.query.type==0){//日 - console.log(that.query.month) arr = that.query.month.split('-'); params.year_s = arr[0]; params.month_s = arr[1]; @@ -272,7 +271,7 @@ let time =item1[0].day_s!=null? item1[0].year_s+'.'+item1[0].month_s+'.'+item1[0].day_s:item1[0].year_s+'.'+item1[0].month_s; itemArr.push(time) //遍历每个工段 - console.log(item1) + console.log(itemArr, 'itemArr--') item1.forEach(item2=>{ let data2 =item2.qua_data; //遍历一个工段的物料检验数据 diff --git a/src/views/enm_rm/report.vue b/src/views/enm_rm/report.vue index 79ae3767..7bd8f388 100644 --- a/src/views/enm_rm/report.vue +++ b/src/views/enm_rm/report.vue @@ -1106,7 +1106,7 @@ export default { that.tableDatas[4][4] = data2.elec_consume_unit; that.tableDatas[4][7] = consume_precen( - (that.tableDatas[4][4]-that.tableDatas[4][6]), + (that.tableDatas[4][6]-that.tableDatas[4][4]), that.tableDatas[4][6] ); that.tableDatas[5][4] = data2.elec_consume;