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.month_s = Number(arr[1]);
params.type='month_s'; params.type='month_s';
}else if (that.query.type==2){ }else if (that.query.type==2){
that.year = that.query.year; params.year_s = that.query.year;
params.type='year_s'; params.type='year_s';
} }
this.$API.enm.mpoint.stat.req(params).then(res => { this.$API.enm.mpoint.stat.req(params).then(res => {

View File

@ -38,7 +38,7 @@
> >
<thead class="myTableHead"> <thead class="myTableHead">
<tr> <tr>
<th colspan="30">烧成工序班组月度对比分析</th> <th colspan="31">烧成工序班组月度对比分析</th>
</tr> </tr>
<tr> <tr>
<th rowspan="2">月份</th> <th rowspan="2">月份</th>
@ -50,6 +50,7 @@
<th colspan="7">单位产品标煤耗</th> <th colspan="7">单位产品标煤耗</th>
<th colspan="12">产品单位电耗</th> <th colspan="12">产品单位电耗</th>
<th rowspan="2">得分</th> <th rowspan="2">得分</th>
<th rowspan="2">排名</th>
</tr> </tr>
<tr> <tr>
<th>总产量t</th> <th>总产量t</th>
@ -122,7 +123,6 @@ export default {
this.$API.mtm.mgroup.list this.$API.mtm.mgroup.list
.req({ page: 0, search: "回转窑" }) .req({ page: 0, search: "回转窑" })
.then((res) => { .then((res) => {
console.log("回转窑", res);
that.query.mgroup = res[0].id; that.query.mgroup = res[0].id;
that.getGoalData(); that.getGoalData();
}); });
@ -364,7 +364,6 @@ export default {
arr[28] = item.celec_consume_unit; //% arr[28] = item.celec_consume_unit; //%
arr[29] = 0; arr[29] = 0;
if (month_obj[n]) { if (month_obj[n]) {
console.log("month_obj[n]",month_obj[n])
const monthData = month_obj[n]; const monthData = month_obj[n];
const itemValue = item.elec_consume_unit; // const itemValue = item.elec_consume_unit; //
const sortedData = monthData.sort((a, b) => parseFloat(b.elec) - parseFloat(a.elec)); const sortedData = monthData.sort((a, b) => parseFloat(b.elec) - parseFloat(a.elec));
@ -441,29 +440,40 @@ export default {
} }
arr[29] += CaO_score; arr[29] += CaO_score;
arr [29] += 60; 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); wrapArr.push(arr);
}); });
that.tableDatas = wrapArr; console.log(wrapArr),'------------------';
} else { //
} 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() { handleQuery() {
@ -479,7 +489,6 @@ export default {
this.$API.bi.dataset.exec.req("3322567213885833216").then((res) => { this.$API.bi.dataset.exec.req("3322567213885833216").then((res) => {
this.myOption = JSON.parse(res.echart_options); this.myOption = JSON.parse(res.echart_options);
debugger; debugger;
console.log(this.myOption);
this.chartShow = true; this.chartShow = true;
}); });
}, },

View File

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

View File

@ -221,7 +221,6 @@
let params = {page: 0}; let params = {page: 0};
let arr = []; let arr = [];
if(that.query.type==0){// if(that.query.type==0){//
console.log(that.query.month)
arr = that.query.month.split('-'); arr = that.query.month.split('-');
params.year_s = arr[0]; params.year_s = arr[0];
params.month_s = arr[1]; 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; 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) itemArr.push(time)
// //
console.log(item1) console.log(itemArr, 'itemArr--')
item1.forEach(item2=>{ item1.forEach(item2=>{
let data2 =item2.qua_data; let data2 =item2.qua_data;
// //

View File

@ -1106,7 +1106,7 @@ export default {
that.tableDatas[4][4] = that.tableDatas[4][4] =
data2.elec_consume_unit; data2.elec_consume_unit;
that.tableDatas[4][7] = consume_precen( 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[4][6]
); );
that.tableDatas[5][4] = data2.elec_consume; that.tableDatas[5][4] = data2.elec_consume;