feat:修改班组排名
This commit is contained in:
parent
b31ae9403c
commit
8d22019fd4
|
@ -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 => {
|
||||||
|
|
|
@ -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;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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;
|
||||||
//遍历一个工段的物料检验数据
|
//遍历一个工段的物料检验数据
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue