feat:修改班组排名

This commit is contained in:
zty 2025-01-13 18:03:02 +08:00
parent b31ae9403c
commit 8d22019fd4
5 changed files with 37 additions and 29 deletions

View File

@ -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 => {

View File

@ -38,7 +38,7 @@
>
<thead class="myTableHead">
<tr>
<th colspan="30">烧成工序班组月度对比分析</th>
<th colspan="31">烧成工序班组月度对比分析</th>
</tr>
<tr>
<th rowspan="2">月份</th>
@ -50,6 +50,7 @@
<th colspan="7">单位产品标煤耗</th>
<th colspan="12">产品单位电耗</th>
<th rowspan="2">得分</th>
<th rowspan="2">排名</th>
</tr>
<tr>
<th>总产量t</th>
@ -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;
});
},

View File

@ -61,7 +61,7 @@
min-width="150"
></el-table-column>
<el-table-column
label="单价"
label="单价(元/吨)"
prop="price_unit"
min-width="150"
></el-table-column>

View File

@ -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;
//

View File

@ -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;