feat: 修改 report 报表

This commit is contained in:
zty 2025-01-14 16:28:14 +08:00
parent 5f116bed5f
commit bf736966b6
13 changed files with 914 additions and 294 deletions

View File

@ -307,12 +307,13 @@ export default {
this.option.series[0].name = that.cate;
console.log(that.mgroup)
if (that.mgroup) {
if (that.cate == "总产量t" || that.cate == "出厂水泥合计t") {
if (that.cate == "总产量t" || that.cate == "出厂水泥合计t" || that.cate == "电石渣干粉总产量t") {
that.cateName = "total_production";
} else if (
that.cate == "单位产品分布电耗kW·h/t" ||
that.cate == "生料分布电耗kW·h/t" ||
that.cate == "煤磨分布电耗kW·h/t"
that.cate == "煤磨分布电耗kW·h/t" ||
that.cate == "电石渣干粉分布电耗kW·h/t"
) {
that.cateName = "elec_consume_unit";
} else if (that.cate == "台时产量t/h") {
@ -338,7 +339,10 @@ export default {
that.cateName = "production_hour";
} else if (that.cate == "吨熟料发电量kW·h/t") {
that.cateName = "production_elec_unit";
} else if (that.cate == "总电耗kW·h"||that.cate =="总电量kW·h") {
} else if (that.cate == "总电耗kW·h"||
that.cate =="总电量kW·h" ||
that.cate == "电石渣工段总电量kW·h"
) {
that.cateName = "elec_consume";
}else if (that.cate == "消耗") {
that.cateName = "amount_consume";

View File

@ -38,7 +38,7 @@
>
<thead class="myTableHead">
<tr>
<th colspan="15">煤磨工序班组月度对比分析</th>
<th colspan="16">煤磨工序班组月度对比分析</th>
</tr>
<tr>
<th rowspan="2">月份</th>
@ -49,6 +49,7 @@
<th colspan="2">质量</th>
<th colspan="7">单位产品电耗</th>
<th rowspan="2">得分</th>
<th rowspan="2">排名</th>
</tr>
<tr>
<th>细度%</th>
@ -342,13 +343,35 @@ export default {
}
wrapArr.push(arr);
});
that.tableDatas = 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() {
this.tableDatas = [];

View File

@ -443,10 +443,8 @@ export default {
}
wrapArr.push(arr);
});
console.log(wrapArr),'------------------';
//
const sortArr = [...wrapArr];
// 4
const groupSize = 4;
const groupedArr = [];
@ -467,11 +465,11 @@ export default {
item.push(`${currentRank}`);
});
});
//
const flattenedArr = groupedArr.flat();
// tableDatas
that.tableDatas = flattenedArr;
}
//
const flattenedArr = groupedArr.flat();
// tableDatas
that.tableDatas = flattenedArr;
}
});
});

View File

@ -38,7 +38,7 @@
>
<thead class="myTableHead">
<tr>
<th colspan="19">水泥粉磨工序班组月度对比分析</th>
<th colspan="20">水泥粉磨工序班组月度对比分析</th>
</tr>
<tr>
<th rowspan="2">月份</th>
@ -49,6 +49,7 @@
<th colspan="3">质量</th>
<th colspan="9">单位产品电耗</th>
<th rowspan="2">得分</th>
<th rowspan="2">排名</th>
</tr>
<tr>
<th>总产量t</th>
@ -396,12 +397,35 @@ export default {
newArr.push(wrapArr[i]);
}
}
that.tableDatas = newArr;
} 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() {
this.tableDatas = [];

View File

@ -38,7 +38,7 @@
>
<thead class="myTableHead">
<tr>
<th colspan="11">
<th colspan="12">
水泥包装工序班组月度对比分析
</th>
</tr>
@ -48,6 +48,7 @@
<th rowspan="2">总产量t</th>
<th colspan="7">当期单位产品电耗</th>
<th rowspan="2">得分</th>
<th rowspan="2">排名</th>
</tr>
<tr>
<th>当期值kW·h/t</th>
@ -267,12 +268,35 @@ export default {
wrapArr.push(arr);
// console.log(wrapArr);
});
that.tableDatas = 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() {
this.tableDatas = [];

View File

@ -118,7 +118,7 @@ export default {
getMgroup() {
this.$API.mtm.mgroup.list.req({ page: 0, cate: 'section' }).then(res => {
res.forEach(item => {
if (item.name !== '煤磨' && item.name !== '水泥包装') {
if (item.name !== '煤磨' && item.name !== '水泥包装'&& item.name !== '原料磨') {
this.mgroupOptions.push(item);
}
})

View File

@ -42,9 +42,7 @@
<tr>
<th style="width:100px">序号</th>
<th colspan="2" style="width:280px">项目</th>
<th style="width:100px">月数据</th>
<th style="width:100px">环比增长</th>
<th style="width:100px">同比增长</th>
<th colspan="3" style="width:100px">月数据</th>
</tr>
</thead>
</table>
@ -53,14 +51,12 @@
<table border="1" cellspacing="0" :key="timeStamp" id="numTable" class="myTable">
<thead class="myTableHead">
<tr>
<th colspan="6">生产月报</th>
<th colspan="4">生产月报</th>
</tr>
<tr>
<th>序号</th>
<th colspan="2">项目</th>
<th >月数据</th>
<th>环比增长</th>
<th>同比增长</th>
<th colspan="3">月数据</th>
</tr>
</thead>
<tr v-for="(item,index) in tableDatas" :key="index">
@ -73,8 +69,8 @@
<td class="numCell" v-else-if="index>35">{{item[1]}}</td>
<td class="numCell" style="width: 180px !important;">{{item[2]}}</td>
<td class="numCell" >{{item[3]}}</td>
<td class="numCell">{{item[4]}}</td>
<td class="numCell">{{item[5]}}</td>
<td class="numCell" v-if="index>38">{{item[4]}}</td>
<td class="numCell" v-if="index>38">{{item[5]}}</td>
</tr>
</table>
</div>
@ -294,7 +290,7 @@
that.tableDatas[24][3] = res1[0].bag_cement_val;
}
}).then(res=>{
this.getHuanbiData();
// this.getHuanbiData();
})});
},
canCompute(a,b){
@ -310,172 +306,172 @@
return 0
}
},
getHuanbiData(){
let that = this;
let params = {};
params.page = 0;
params.year_s = that.year_h;
params.month_s = that.month_h;
let m_goal_val = "goal_val_" + that.month
params.type = 'month_s';
this.$API.enm.enstat.req(params).then((res) => {
let dataList = {};
res.forEach(item => {
let label = item.mgroup_name;
dataList[label] = item;
});
// getHuanbiData(){
// let that = this;
// let params = {};
// params.page = 0;
// params.year_s = that.year_h;
// params.month_s = that.month_h;
// let m_goal_val = "goal_val_" + that.month
// params.type = 'month_s';
// this.$API.enm.enstat.req(params).then((res) => {
// let dataList = {};
// res.forEach(item => {
// let label = item.mgroup_name;
// dataList[label] = item;
// });
//
that.tableDatas[0][4] = this.canCompute(that.nowData[0],dataList.原料磨.production_hour);
that.tableDatas[1][4] = this.canCompute(that.nowData[1],dataList.电石渣.production_hour);
that.tableDatas[2][4] = this.canCompute(that.nowData[2],dataList.煤磨.production_hour);
that.tableDatas[3][4] = this.canCompute(that.nowData[3],dataList.回转窑.production_hour);
that.tableDatas[4][4] = this.canCompute(that.nowData[4],dataList.水泥磨.production_hour);
//kW·h/t
that.tableDatas[5][4] = this.canCompute(that.nowData[5],dataList.回转窑.celec_consume_unit);
that.tableDatas[6][4] = this.canCompute(that.nowData[6],dataList.回转窑.coal_consume_unit);
that.tableDatas[7][4] = this.canCompute(that.nowData[7],dataList.回转窑.cen_consume_unit);
that.tableDatas[8][4] = this.canCompute(that.nowData[8],dataList.水泥磨.cen_consume_unit);
that.tableDatas[9][4] = this.canCompute(that.nowData[9],dataList.电石渣.elec_consume_unit);
that.tableDatas[10][4] = this.canCompute(that.nowData[10],dataList.原料磨.elec_consume_unit);
that.tableDatas[11][4] = this.canCompute(that.nowData[11],dataList.回转窑.elec_consume_unit);
that.tableDatas[12][4] = this.canCompute(that.nowData[12],dataList.水泥磨.elec_consume_unit);
that.tableDatas[13][4] = this.canCompute(that.nowData[13], dataList.水泥包装.elec_consume_unit);
//(t)
that.tableDatas[14][4] = this.canCompute(that.nowData[14],dataList.电石渣.total_production);
that.tableDatas[16][4] = this.canCompute(that.nowData[16],dataList.原料磨.total_production);
that.tableDatas[18][4] = this.canCompute(that.nowData[18],dataList.回转窑.total_production);
that.tableDatas[20][4] = this.canCompute(that.nowData[20],dataList.水泥磨.total_production);
//(/)
that.tableDatas[25][4] = this.canCompute(that.nowData[25],dataList.电石渣.production_cost_unit);
that.tableDatas[26][4] = this.canCompute(that.nowData[26],dataList.原料磨.production_cost_unit);
that.tableDatas[27][4] = this.canCompute(that.nowData[27],dataList.回转窑.production_cost_unit);
that.tableDatas[28][4] = this.canCompute(that.nowData[28],dataList.水泥磨.production_cost_unit);
that.tableDatas[29][4] = this.canCompute(that.nowData[29],dataList.水泥包装.production_cost_unit);
//kW·h
// that.tableDatas[30][4] = this.canCompute(that.nowData[30],dataList..elec_consume);
that.tableDatas[30][4] = this.canCompute(that.nowData[30],dataList.原料磨.elec_consume);
that.tableDatas[31][4] = this.canCompute(that.nowData[31],dataList.回转窑.elec_consume);
that.tableDatas[32][4] = this.canCompute(that.nowData[32],dataList.水泥磨.elec_consume);
that.tableDatas[33][4] = this.canCompute(that.nowData[33],dataList.水泥包装.elec_consume);
that.tableDatas[34][4] = this.canCompute(that.nowData[34],dataList.生活区.elec_consume);
// that.tableDatas[39][3] = dataList..elec_consume;
}).then(res=>{
//
let params1 = {};
params1.page = 0;
params1.goal_cate__code = 'total_production';
params1.year = that.year_h;
this.$API.mtm.goal.list.req(params1).then((res1) => {
let dataList1 = {};//
res1.forEach(item1 => {
let label = item1.mgroup_name;
dataList1[label] = item1;
});
that.tableDatas[15][4] = dataList1.电石渣&&dataList1.电石渣[m_goal_val]!==0&&dataList1.电石渣[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[14][4] /dataList1.电石渣[m_goal_val])*100).toFixed(2):'/';
that.tableDatas[17][4] = dataList1.原料磨&&dataList1.原料磨[m_goal_val]!==0&&dataList1.原料磨[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[16][4] /dataList1.原料磨[m_goal_val])*100).toFixed(5):'/';
that.tableDatas[19][4] = dataList1.回转窑&&dataList1.回转窑[m_goal_val]!==0&&dataList1.回转窑[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[18][4] /dataList1.回转窑[m_goal_val])*100).toFixed(2):'/';
that.tableDatas[21][4] = dataList1.水泥磨&&dataList1.水泥磨[m_goal_val]!==0&&dataList1.水泥磨[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[20][4] /dataList1.水泥磨[m_goal_val])*100).toFixed(2):'/';
})
}).then(res=>{
let obj1 = {};
obj1.page = 0;
obj1.year_s = this.year_h;
obj1.month_s = this.month_h;
obj1.type = 'month_s';
that.$API.enm.enstat2.req(obj1).then((res1) => {
if(res1.length>0){
that.tableDatas[22][4]= this.canCompute(that.nowData[22],res1[0].clinker_val);
that.tableDatas[23][4] = this.canCompute(that.nowData[23],res1[0].bulk_cement_val);
that.tableDatas[24][4] = this.canCompute(that.nowData[24],res1[0].bag_cement_val);
}
}).then(res=>{
this.getTongbiData();
})});
},
getTongbiData(){
let that = this;
let params = {};
params.page = 0;
params.year_s = that.year_t;
params.month_s = that.month_t;
let m_goal_val = "goal_val_" + that.month
params.type = 'month_s';
this.$API.enm.enstat.req(params).then((res) => {
if (res.length>0){
let dataList = {};
res.forEach(item => {
let label = item.mgroup_name;
dataList[label] = item;
});
//
that.tableDatas[0][5] = this.canCompute(that.nowData[0],dataList.原料磨.production_hour);
that.tableDatas[1][5] = this.canCompute(that.nowData[1],dataList.电石渣.production_hour);
that.tableDatas[2][5] = this.canCompute(that.nowData[2],dataList.煤磨.production_hour);
that.tableDatas[3][5] = this.canCompute(that.nowData[3],dataList.回转窑.production_hour);
that.tableDatas[4][5] = this.canCompute(that.nowData[4],dataList.水泥磨.production_hour);
//kW·h/t
that.tableDatas[5][5] = this.canCompute(that.nowData[5],dataList.回转窑.celec_consume_unit);
that.tableDatas[6][5] = this.canCompute(that.nowData[6],dataList.回转窑.coal_consume_unit);
that.tableDatas[7][5] = this.canCompute(that.nowData[7],dataList.回转窑.cen_consume_unit);
that.tableDatas[8][5] = this.canCompute(that.nowData[8],dataList.水泥磨.cen_consume_unit);
that.tableDatas[9][5] = this.canCompute(that.nowData[9],dataList.电石渣.elec_consume_unit);
that.tableDatas[10][5] = this.canCompute(that.nowData[10],dataList.原料磨.elec_consume_unit);
that.tableDatas[11][5] = this.canCompute(that.nowData[11],dataList.回转窑.elec_consume_unit);
that.tableDatas[12][5] = this.canCompute(that.nowData[12],dataList.水泥磨.elec_consume_unit);
that.tableDatas[13][5] = this.canCompute(that.nowData[13], dataList.水泥包装.elec_consume_unit);
//(t)
that.tableDatas[14][5] = this.canCompute(that.nowData[14],dataList.电石渣.total_production);
that.tableDatas[16][5] = this.canCompute(that.nowData[16],dataList.原料磨.total_production);
that.tableDatas[18][5] = this.canCompute(that.nowData[18],dataList.回转窑.total_production);
that.tableDatas[20][5] = this.canCompute(that.nowData[20],dataList.水泥磨.total_production);
//(/)
that.tableDatas[25][5] = this.canCompute(that.nowData[25],dataList.电石渣.production_cost_unit);
that.tableDatas[26][5] = this.canCompute(that.nowData[26],dataList.原料磨.production_cost_unit);
that.tableDatas[27][5] = this.canCompute(that.nowData[27],dataList.回转窑.production_cost_unit);
that.tableDatas[28][5] = this.canCompute(that.nowData[28],dataList.水泥磨.production_cost_unit);
that.tableDatas[29][5] = this.canCompute(that.nowData[29],dataList.水泥包装.production_cost_unit);
//kW·h
// that.tableDatas[30][5] = this.canCompute(that.nowData[30],dataList..elec_consume);
that.tableDatas[30][5] = this.canCompute(that.nowData[30],dataList.原料磨.elec_consume);
that.tableDatas[31][5] = this.canCompute(that.nowData[31],dataList.回转窑.elec_consume);
that.tableDatas[32][5] = this.canCompute(that.nowData[32],dataList.水泥磨.elec_consume);
that.tableDatas[33][5] = this.canCompute(that.nowData[33],dataList.水泥包装.elec_consume);
that.tableDatas[34][5] = this.canCompute(that.nowData[34],dataList.生活区.elec_consume);
}
// that.tableDatas[39][4] = dataList..elec_consume;
}).then(res=>{
//
let params1 = {};
params1.page = 0;
params1.goal_cate__code = 'total_production';
params1.year = that.year_h;
this.$API.mtm.goal.list.req(params1).then((res1) => {
let dataList1 = {};//
res1.forEach(item1 => {
let label = item1.mgroup_name;
dataList1[label] = item1;
});
that.tableDatas[15][5] = dataList1.电石渣&&dataList1.电石渣[m_goal_val]!==0&&dataList1.电石渣[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[14][5] /dataList1.电石渣[m_goal_val])*100:'';
that.tableDatas[17][5] = dataList1.原料磨&&dataList1.原料磨[m_goal_val]!==0&&dataList1.原料磨[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[16][5] /dataList1.原料磨[m_goal_val])*100:'';
that.tableDatas[19][5] = dataList1.回转窑&&dataList1.回转窑[m_goal_val]!==0&&dataList1.回转窑[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[18][5] /dataList1.回转窑[m_goal_val])*100:'';
that.tableDatas[21][5] = dataList1.水泥磨&&dataList1.水泥磨[m_goal_val]!==0&&dataList1.水泥磨[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[20][5] /dataList1.水泥磨[m_goal_val])*100:'';
})
}).then(res=>{
let obj1 = {};
obj1.page = 0;
obj1.year_s = this.year_t;
obj1.month_s = this.month_h;
obj1.type = 'month_s';
that.$API.enm.enstat2.req(obj1).then((res1) => {
if(res1.length>0){
that.tableDatas[22][5]= this.canCompute(that.nowData[22],res1[0].clinker_val);
that.tableDatas[23][5] = this.canCompute(that.nowData[23],res1[0].bulk_cement_val);
that.tableDatas[24][5] = this.canCompute(that.nowData[24],res1[0].bag_cement_val);
}
})
})
},
// //
// that.tableDatas[0][4] = this.canCompute(that.nowData[0],dataList..production_hour);
// that.tableDatas[1][4] = this.canCompute(that.nowData[1],dataList..production_hour);
// that.tableDatas[2][4] = this.canCompute(that.nowData[2],dataList..production_hour);
// that.tableDatas[3][4] = this.canCompute(that.nowData[3],dataList..production_hour);
// that.tableDatas[4][4] = this.canCompute(that.nowData[4],dataList..production_hour);
// //kW·h/t
// that.tableDatas[5][4] = this.canCompute(that.nowData[5],dataList..celec_consume_unit);
// that.tableDatas[6][4] = this.canCompute(that.nowData[6],dataList..coal_consume_unit);
// that.tableDatas[7][4] = this.canCompute(that.nowData[7],dataList..cen_consume_unit);
// that.tableDatas[8][4] = this.canCompute(that.nowData[8],dataList..cen_consume_unit);
// that.tableDatas[9][4] = this.canCompute(that.nowData[9],dataList..elec_consume_unit);
// that.tableDatas[10][4] = this.canCompute(that.nowData[10],dataList..elec_consume_unit);
// that.tableDatas[11][4] = this.canCompute(that.nowData[11],dataList..elec_consume_unit);
// that.tableDatas[12][4] = this.canCompute(that.nowData[12],dataList..elec_consume_unit);
// that.tableDatas[13][4] = this.canCompute(that.nowData[13], dataList..elec_consume_unit);
// //(t)
// that.tableDatas[14][4] = this.canCompute(that.nowData[14],dataList..total_production);
// that.tableDatas[16][4] = this.canCompute(that.nowData[16],dataList..total_production);
// that.tableDatas[18][4] = this.canCompute(that.nowData[18],dataList..total_production);
// that.tableDatas[20][4] = this.canCompute(that.nowData[20],dataList..total_production);
// //(/)
// that.tableDatas[25][4] = this.canCompute(that.nowData[25],dataList..production_cost_unit);
// that.tableDatas[26][4] = this.canCompute(that.nowData[26],dataList..production_cost_unit);
// that.tableDatas[27][4] = this.canCompute(that.nowData[27],dataList..production_cost_unit);
// that.tableDatas[28][4] = this.canCompute(that.nowData[28],dataList..production_cost_unit);
// that.tableDatas[29][4] = this.canCompute(that.nowData[29],dataList..production_cost_unit);
// //kW·h
// // that.tableDatas[30][4] = this.canCompute(that.nowData[30],dataList..elec_consume);
// that.tableDatas[30][4] = this.canCompute(that.nowData[30],dataList..elec_consume);
// that.tableDatas[31][4] = this.canCompute(that.nowData[31],dataList..elec_consume);
// that.tableDatas[32][4] = this.canCompute(that.nowData[32],dataList..elec_consume);
// that.tableDatas[33][4] = this.canCompute(that.nowData[33],dataList..elec_consume);
// that.tableDatas[34][4] = this.canCompute(that.nowData[34],dataList..elec_consume);
// // that.tableDatas[39][3] = dataList..elec_consume;
// }).then(res=>{
// //
// let params1 = {};
// params1.page = 0;
// params1.goal_cate__code = 'total_production';
// params1.year = that.year_h;
// this.$API.mtm.goal.list.req(params1).then((res1) => {
// let dataList1 = {};//
// res1.forEach(item1 => {
// let label = item1.mgroup_name;
// dataList1[label] = item1;
// });
// that.tableDatas[15][4] = dataList1.&&dataList1.[m_goal_val]!==0&&dataList1.[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[14][4] /dataList1.[m_goal_val])*100).toFixed(2):'/';
// that.tableDatas[17][4] = dataList1.&&dataList1.[m_goal_val]!==0&&dataList1.[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[16][4] /dataList1.[m_goal_val])*100).toFixed(5):'/';
// that.tableDatas[19][4] = dataList1.&&dataList1.[m_goal_val]!==0&&dataList1.[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[18][4] /dataList1.[m_goal_val])*100).toFixed(2):'/';
// that.tableDatas[21][4] = dataList1.&&dataList1.[m_goal_val]!==0&&dataList1.[m_goal_val]!==''&&that.tableDatas[14][4]!==''?((that.tableDatas[20][4] /dataList1.[m_goal_val])*100).toFixed(2):'/';
// })
// }).then(res=>{
// let obj1 = {};
// obj1.page = 0;
// obj1.year_s = this.year_h;
// obj1.month_s = this.month_h;
// obj1.type = 'month_s';
// that.$API.enm.enstat2.req(obj1).then((res1) => {
// if(res1.length>0){
// that.tableDatas[22][4]= this.canCompute(that.nowData[22],res1[0].clinker_val);
// that.tableDatas[23][4] = this.canCompute(that.nowData[23],res1[0].bulk_cement_val);
// that.tableDatas[24][4] = this.canCompute(that.nowData[24],res1[0].bag_cement_val);
// }
// }).then(res=>{
// this.getTongbiData();
// })});
// },
// getTongbiData(){
// let that = this;
// let params = {};
// params.page = 0;
// params.year_s = that.year_t;
// params.month_s = that.month_t;
// let m_goal_val = "goal_val_" + that.month
// params.type = 'month_s';
// this.$API.enm.enstat.req(params).then((res) => {
// if (res.length>0){
// let dataList = {};
// res.forEach(item => {
// let label = item.mgroup_name;
// dataList[label] = item;
// });
// //
// that.tableDatas[0][5] = this.canCompute(that.nowData[0],dataList..production_hour);
// that.tableDatas[1][5] = this.canCompute(that.nowData[1],dataList..production_hour);
// that.tableDatas[2][5] = this.canCompute(that.nowData[2],dataList..production_hour);
// that.tableDatas[3][5] = this.canCompute(that.nowData[3],dataList..production_hour);
// that.tableDatas[4][5] = this.canCompute(that.nowData[4],dataList..production_hour);
// //kW·h/t
// that.tableDatas[5][5] = this.canCompute(that.nowData[5],dataList..celec_consume_unit);
// that.tableDatas[6][5] = this.canCompute(that.nowData[6],dataList..coal_consume_unit);
// that.tableDatas[7][5] = this.canCompute(that.nowData[7],dataList..cen_consume_unit);
// that.tableDatas[8][5] = this.canCompute(that.nowData[8],dataList..cen_consume_unit);
// that.tableDatas[9][5] = this.canCompute(that.nowData[9],dataList..elec_consume_unit);
// that.tableDatas[10][5] = this.canCompute(that.nowData[10],dataList..elec_consume_unit);
// that.tableDatas[11][5] = this.canCompute(that.nowData[11],dataList..elec_consume_unit);
// that.tableDatas[12][5] = this.canCompute(that.nowData[12],dataList..elec_consume_unit);
// that.tableDatas[13][5] = this.canCompute(that.nowData[13], dataList..elec_consume_unit);
// //(t)
// that.tableDatas[14][5] = this.canCompute(that.nowData[14],dataList..total_production);
// that.tableDatas[16][5] = this.canCompute(that.nowData[16],dataList..total_production);
// that.tableDatas[18][5] = this.canCompute(that.nowData[18],dataList..total_production);
// that.tableDatas[20][5] = this.canCompute(that.nowData[20],dataList..total_production);
// //(/)
// that.tableDatas[25][5] = this.canCompute(that.nowData[25],dataList..production_cost_unit);
// that.tableDatas[26][5] = this.canCompute(that.nowData[26],dataList..production_cost_unit);
// that.tableDatas[27][5] = this.canCompute(that.nowData[27],dataList..production_cost_unit);
// that.tableDatas[28][5] = this.canCompute(that.nowData[28],dataList..production_cost_unit);
// that.tableDatas[29][5] = this.canCompute(that.nowData[29],dataList..production_cost_unit);
// //kW·h
// // that.tableDatas[30][5] = this.canCompute(that.nowData[30],dataList..elec_consume);
// that.tableDatas[30][5] = this.canCompute(that.nowData[30],dataList..elec_consume);
// that.tableDatas[31][5] = this.canCompute(that.nowData[31],dataList..elec_consume);
// that.tableDatas[32][5] = this.canCompute(that.nowData[32],dataList..elec_consume);
// that.tableDatas[33][5] = this.canCompute(that.nowData[33],dataList..elec_consume);
// that.tableDatas[34][5] = this.canCompute(that.nowData[34],dataList..elec_consume);
// }
// // that.tableDatas[39][4] = dataList..elec_consume;
// }).then(res=>{
// //
// let params1 = {};
// params1.page = 0;
// params1.goal_cate__code = 'total_production';
// params1.year = that.year_h;
// this.$API.mtm.goal.list.req(params1).then((res1) => {
// let dataList1 = {};//
// res1.forEach(item1 => {
// let label = item1.mgroup_name;
// dataList1[label] = item1;
// });
// that.tableDatas[15][5] = dataList1.&&dataList1.[m_goal_val]!==0&&dataList1.[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[14][5] /dataList1.[m_goal_val])*100:'';
// that.tableDatas[17][5] = dataList1.&&dataList1.[m_goal_val]!==0&&dataList1.[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[16][5] /dataList1.[m_goal_val])*100:'';
// that.tableDatas[19][5] = dataList1.&&dataList1.[m_goal_val]!==0&&dataList1.[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[18][5] /dataList1.[m_goal_val])*100:'';
// that.tableDatas[21][5] = dataList1.&&dataList1.[m_goal_val]!==0&&dataList1.[m_goal_val]!==''&&that.tableDatas[14][5]!==''&&that.tableDatas[14][5]!==undefined?(that.tableDatas[20][5] /dataList1.[m_goal_val])*100:'';
// })
// }).then(res=>{
// let obj1 = {};
// obj1.page = 0;
// obj1.year_s = this.year_t;
// obj1.month_s = this.month_h;
// obj1.type = 'month_s';
// that.$API.enm.enstat2.req(obj1).then((res1) => {
// if(res1.length>0){
// that.tableDatas[22][5]= this.canCompute(that.nowData[22],res1[0].clinker_val);
// that.tableDatas[23][5] = this.canCompute(that.nowData[23],res1[0].bulk_cement_val);
// that.tableDatas[24][5] = this.canCompute(that.nowData[24],res1[0].bag_cement_val);
// }
// })
// })
// },
getTableData(){
// for(let i=0;i<39;i++){
// this.tableDatas[i][3] = '';

View File

@ -2,6 +2,52 @@
<div class="app-container">
<el-header>
<div class="left-panel">
<el-select
v-model="query.type"
placeholder="查询类型"
clearable
class="headerSearch"
@change="typeCange"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
<el-date-picker
v-model="query.day"
type="date"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
placeholder="天"
v-if="query.type==0"
style="margin-right: 6px"
/>
<el-date-picker
v-model="query.month"
type="month"
value-format="YYYY-MM"
format="YYYY-MM"
placeholder="查询月份"
v-if="query.type==1"
class="headerSearch"
/>
<el-date-picker
v-model="query.year"
type="year"
value-format="YYYY"
format="YYYY"
placeholder="查询年份"
v-if="query.type==2"
class="headerSearch"
/>
<el-button
type="primary"
icon="el-icon-search"
@click="dateChange"
></el-button>
<el-button
type="primary"
@click="exportExcel()"
@ -91,7 +137,7 @@
</tr>
</tbody>
</table>
<div class="radioWrap">
<!-- <div class="radioWrap">
<el-radio-group
v-model="typeRadio"
@change="typeRadioChange"
@ -131,9 +177,9 @@
@change="dateChange"
></el-date-picker>
</div>
</div>
</div> -->
<!-- <div id="main" style="width:1200px;height:600px;"></div> -->
<div class="chartWrap" v-show="typeRadio == 'day'">
<div class="chartWrap" v-show="query.type == 0">
<div class="chartTitle">本日生产参数统计图</div>
<scEcharts
height="400px"
@ -141,7 +187,7 @@
:option="optionHour"
></scEcharts>
</div>
<div class="chartWrap" v-show="typeRadio == 'month'">
<div class="chartWrap" v-show="query.type == 1">
<div class="chartTitle">本月生产参数统计图</div>
<scEcharts
height="400px"
@ -149,7 +195,7 @@
:option="optionDay"
></scEcharts>
</div>
<div class="chartWrap" v-show="typeRadio == 'year'">
<div class="chartWrap" v-show="query.type == 2">
<div class="chartTitle">本年生产参数统计图</div>
<scEcharts
height="400px"
@ -160,7 +206,7 @@
</div>
</div>
<sc-dialog v-model="chartShow" draggable title="生料工序">
<!-- <sc-dialog v-model="chartShow" draggable title="生料工序">
<div class="searchHead" v-if="type == 'hours'">
<el-date-picker
v-model="query.start_time"
@ -263,7 +309,7 @@
:option="myOption"
v-if="chartShow"
></scEcharts>
</sc-dialog>
</sc-dialog> -->
<charts
v-if="asynDialog"
:type="type"
@ -532,8 +578,14 @@ export default {
month: 1,
days: 1,
hours: 1,
options: [
{id:0,name:'日统计'},
{id:1,name:'月统计'},
{id:2,name:'年统计'}
],
query: {
mgroup: "",
type: 0,
},
tableDatas: [
["产量", "立磨总产量t", 0, 0, 0, 0, 0, 0, 0, 0],
@ -978,7 +1030,6 @@ export default {
let data5 = res5;
data5.forEach((item5) => {
let str = "goal_val_" + that.month;
debugger;
console.log(str, item5[str]);
if (item5.goal_cate_name == "总产量t") {
@ -1136,31 +1187,215 @@ export default {
},
})
},
dateChange(val) {
dateChange() {
let that = this;
console.log(val);
if (val !== null) {
if (this.typeRadio == "day") {
let year = val.split("-")[0];
let month = val.split("-")[1];
let days = val.split("-")[2];
this.getHourData(year, month, days);
} else if (this.typeRadio == "month") {
let year = val.split("-")[0];
let month = val.split("-")[1];
this.getDayData(year, month);
} else {
this.getMonthData(val);
}
} else {
if (this.typeRadio == "day") {
that.getHourData(that.year, that.month, that.days);
} else if (this.typeRadio == "month") {
this.getDayData(that.year, that.month);
} else {
this.getMonthData(that.year);
}
let arr = [];
if(that.query.type==0) {
arr = that.query.day.split('-');
that.year = Number(arr[0]);
that.month = Number(arr[1]);
that.days = Number(arr[2]);
this.getHourData(that.year, that.month, that.days);
this.get_days(that.year, that.month, that.days);
}
else if(that.query.type==1) {
let year = that.query.month.split("-")[0];
let month = that.query.month.split("-")[1];
month = Number(month);
this.getDayData(year, month);
this.get_months(year, month);
this.get_month_year_goal(year, month);
}else if (that.query.type==2) {
let year = that.query.year;
this.getMonthData(year);
this.get_years(year);
this.get_month_year_goal(year , 1);
}
},
get_days(year_d, month_d, days){
let that = this;
let params4 = {};
params4.page = 0;
params4.year_s = year_d;
params4.month_s = month_d;
params4.day_s = days;
params4.type = "day_s";
params4.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params4).then((res4) => {
if (res4.length > 0) {
let data4 = res4[0];
that.tableDatas[0][2] = data4.total_production;
if (data4.total_production < 1) {
that.tableDatas[1][2] = 0;
that.tableDatas[2][2] = 0;
that.tableDatas[3][2] = 0;
}else{
that.tableDatas[1][2] = data4.elec_consume_unit;
that.tableDatas[2][2] = data4.elec_consume;
that.tableDatas[3][2] = data4.production_cost_unit;}
if (data4.imaterial_data.length > 0) {
data4.imaterial_data.forEach((item) => {
if (item.material_name == "湿电石渣消耗") {
that.tableDatas[4][2] = item.amount_consume;
}else if(item.material_name == "湿电石渣进厂"){
that.tableDatas[5][2] = item.amount_consume;
}
});
}
}
});
},
get_months(year, month){
let that = this;
let params2 = {};
params2.page = 0;
params2.year_s = year;
params2.month_s = month;
params2.type = "month_s";
params2.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params2).then((res2) => {
if (res2.length > 0) {
let data2 = res2[0];
that.tableDatas[0][4] = data2.total_production;
that.tableDatas[0][7] = precen(
that.tableDatas[0][4],
that.tableDatas[0][6]
);
that.tableDatas[1][4] = data2.elec_consume_unit;
that.tableDatas[1][7] = consume_precen(
that.tableDatas[1][4],
that.tableDatas[1][6]
);
that.tableDatas[2][4] = data2.elec_consume;
that.tableDatas[3][4] =
data2.production_cost_unit;
that.tableDatas[3][7] = consume_precen(
that.tableDatas[3][3],
that.tableDatas[3][6]
);
that.tableDatas[2][7] = consume_precen(
that.tableDatas[2][4],
that.tableDatas[2][6]
);
if (data2.imaterial_data.length > 0) {
data2.imaterial_data.forEach((item) => {
if (item.material_name == "湿电石渣消耗") {
that.tableDatas[4][4] = (item.amount_consume).toFixed(2);
that.tableDatas[4][7] = precen(
that.tableDatas[4][4],
that.tableDatas[4][6]
);
}else if(item.material_name == "湿电石渣进厂"){
that.tableDatas[5][4] = (item.amount_consume).toFixed(2);
that.tableDatas[5][7] = precen(
that.tableDatas[5][4],
that.tableDatas[5][6]
);
}
});
}
}
});
},
get_month_year_goal(year, month){
let that = this;
let params5 = {};
params5.page = 0;
params5.year = year;
params5.mgroup = that.query.mgroup;
this.$API.mtm.goal.list
.req(params5)
.then((res5) => {
if (res5.length > 0) {
let data5 = res5;
data5.forEach((item5) => {
let str = "goal_val_" + month;
if (item5.goal_cate_name == "总产量t") {
that.tableDatas[0][6] = item5[str];
that.tableDatas[0][8] = item5.goal_val;
} else if (
item5.goal_cate_name ==
"单位产品分布电耗kW·h/t"
) {
that.goal_list.push(item5);
that.tableDatas[1][6] = item5[str];
that.tableDatas[1][8] = item5.goal_val;
} else if (
item5.goal_cate_name ==
"单位产品成本(元/吨)"
) {
that.tableDatas[3][6] = item5[str];
that.tableDatas[3][8] = item5.goal_val;
}else if (item5.goal_cate_name ==
"总电量kW·h"){
that.tableDatas[2][6] = item5[str];
that.tableDatas[2][8] = item5.goal_val;
}else if (item5.goal_cate_name ==
"湿电石渣消耗t"){
that.tableDatas[4][6] = item5[str];
that.tableDatas[4][8] = item5.goal_val;
}
else if (item5.goal_cate_name ==
"湿电石渣进厂t"){
that.tableDatas[5][6] = item5[str];
that.tableDatas[5][8] = item5.goal_val;
}
});
}
})
},
get_years(year){
let that = this;
let params1 = {};
params1.page = 0;
params1.year_s = year;
params1.type = "year_s";
params1.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params1).then((res1) => {
if (res1.length > 0) {
let data1 = res1[0];
that.tableDatas[0][5] = data1.total_production;
that.tableDatas[0][9] = precen(
that.tableDatas[0][5],
that.tableDatas[0][8]
);
that.tableDatas[1][5] = data1.elec_consume_unit;
that.tableDatas[1][9] = consume_precen(
that.tableDatas[1][8]-that.tableDatas[1][5],
that.tableDatas[1][8]
);
that.tableDatas[2][5] = data1.elec_consume;
that.tableDatas[2][9] = consume_precen(
that.tableDatas[2][8]-that.tableDatas[2][5],
that.tableDatas[2][8]
);
that.tableDatas[3][5] =
data1.production_cost_unit;
that.tableDatas[3][9] = consume_precen(
that.tableDatas[3][8]-that.tableDatas[3][5],
that.tableDatas[3][8]
);
if (data1.imaterial_data.length > 0) {
data1.imaterial_data.forEach((item) => {
if (item.material_name == "湿电石渣消耗") {
that.tableDatas[4][5] = (item.amount_consume).toFixed(2);
that.tableDatas[4][9] = precen(
that.tableDatas[4][5],
that.tableDatas[4][8]
);
}else if(item.material_name == "湿电石渣进厂"){
that.tableDatas[5][5] = (item.amount_consume).toFixed(2);
that.tableDatas[5][9] = precen(
that.tableDatas[5][5],
that.tableDatas[5][8]
);
}
});
}
}
});
},
//
getHourData(year, month, days) {

View File

@ -38,7 +38,7 @@
>
<thead class="myTableHead">
<tr>
<th colspan="18">生料辅料工序班组月度对比分析</th>
<th colspan="19">生料辅料工序班组月度对比分析</th>
</tr>
<tr>
<th rowspan="2">月份</th>
@ -48,6 +48,7 @@
<th colspan="3">质量</th>
<th colspan="9">单位产品电耗</th>
<th rowspan="2">得分</th>
<th rowspan="2">排名</th>
</tr>
<tr>
<th>总产量t</th>
@ -365,11 +366,35 @@ export default {
}
wrapArr.push(arr);
});
that.tableDatas = 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() {

View File

@ -38,7 +38,7 @@
>
<thead class="myTableHead">
<tr>
<th colspan="18">生料工序班组月度对比分析</th>
<th colspan="19">生料工序班组月度对比分析</th>
</tr>
<tr>
<th rowspan="2">月份</th>
@ -49,6 +49,7 @@
<th colspan="4">质量</th>
<th colspan="7">单位产品电耗</th>
<th rowspan="2">得分</th>
<th rowspan="2">排名</th>
</tr>
<tr>
<th>总产量t</th>
@ -369,10 +370,35 @@ export default {
}
wrapArr.push(arr);
});
that.tableDatas = 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() {

View File

@ -54,20 +54,24 @@
class="numCell"
@click="itemClick('day_s', item)"
>
<el-tooltip effect="dark" placement="top">
{{ item1 }}
<div class="tooltip">
<p>设备电量({{item[6]}})/工段产量({{item[7]}})</p>
</div>
<template #content>
设备电量({{item[6]}})/工段产量({{item[7]}})
</template>
</el-tooltip>
</td>
<td
v-if="ind == 4"
class="numCell"
@click="itemClick('month_s', item)"
>
<el-tooltip effect="dark" placement="top">
{{ item1 }}
<div class="tooltip">
<p>设备电量({{item[8]}})/工段产量({{item[9]}})</p>
</div>
<template #content>
设备电量({{item[8]}})/工段产量({{item[9]}})
</template>
</el-tooltip>
</td>
</template>
</tr>
@ -534,8 +538,10 @@ export default {
border-radius: 5px;
display: none;
padding: 5px;
opacity: 0;
}
td:hover .tooltip {
display: block;
opacity: 1;
}
</style>

View File

@ -2,6 +2,52 @@
<div class="app-container">
<el-header>
<div class="left-panel">
<el-select
v-model="query.type"
placeholder="查询类型"
clearable
class="headerSearch"
@change="typeCange"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
<el-date-picker
v-model="query.day"
type="date"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
placeholder="天"
v-if="query.type==0"
style="margin-right: 6px"
/>
<el-date-picker
v-model="query.month"
type="month"
value-format="YYYY-MM"
format="YYYY-MM"
placeholder="查询月份"
v-if="query.type==1"
class="headerSearch"
/>
<el-date-picker
v-model="query.year"
type="year"
value-format="YYYY"
format="YYYY"
placeholder="查询年份"
v-if="query.type==2"
class="headerSearch"
/>
<el-button
type="primary"
icon="el-icon-search"
@click="dateChange"
></el-button>
<el-button
type="primary"
@click="exportExcel()"
@ -15,6 +61,7 @@
<el-card style="margin-top: 5px">
<div class="printWrap">
<div ref="print" id="myReport" class="printContainer">
<table
border="1"
width="1035"
@ -79,7 +126,7 @@
</tr>
</tbody>
</table>
<div class="radioWrap">
<!-- <div class="radioWrap">
<el-radio-group
v-model="typeRadio"
@change="typeRadioChange"
@ -119,8 +166,8 @@
@change="dateChange"
></el-date-picker>
</div>
</div>
<div class="chartWrap" v-show="typeRadio == 'days'">
</div> -->
<div class="chartWrap" v-show="query.type == 0">
<div class="chartTitle">本日生产参数统计图</div>
<scEcharts
height="400px"
@ -128,7 +175,7 @@
:option="optionHour"
></scEcharts>
</div>
<div class="chartWrap" v-show="typeRadio == 'month'">
<div class="chartWrap" v-show="query.type == 1">
<div class="chartTitle">本月生产参数统计图</div>
<scEcharts
height="400px"
@ -136,7 +183,7 @@
:option="optionDay"
></scEcharts>
</div>
<div class="chartWrap" v-show="typeRadio == 'year'">
<div class="chartWrap" v-show="query.type == 2">
<div class="chartTitle">本年生产参数统计图</div>
<scEcharts
height="400px"
@ -546,7 +593,6 @@ export default {
},
data() {
return {
typeRadio: "month",
searchDate: "",
timeStamp: null,
exportLoading: false,
@ -557,8 +603,14 @@ export default {
year: 2023,
month: 1,
days: 1,
options: [
{id:0,name:'日统计'},
{id:1,name:'月统计'},
{id:2,name:'年统计'}
],
query: {
mgroup: "3346491835287007232",
type: 0,
},
tableDatas: [
["产量", "电石渣干粉总产量t", 0, 0, 0, 0, 0, 0, 0, 0],
@ -944,7 +996,6 @@ export default {
}
});
}
} else {
}
});
//
@ -1015,34 +1066,216 @@ export default {
},
})
},
dateChange(val) {
get_days(year_d, month_d, days){
let that = this;
if (val !== null) {
if (this.typeRadio == "days") {
let year = val.split("-")[0];
let month = val.split("-")[1];
let days = val.split("-")[2];
this.getHourData(year, month, days);
}
else if (this.typeRadio == "month") {
let year = val.split("-")[0];
let month = val.split("-")[1];
month = Number(month);
this.getDayData(year, month);
} else if (this.typeRadio == "year") {
this.getMonthData(val);
}
} else {
if (this.typeRadio == "days") {
this.getHourData(that.year, that.month, that.days);
}
else if (this.typeRadio == "month") {
this.getDayData(that.year, that.month);
} else {
this.getMonthData(that.year);
}
let params4 = {};
params4.page = 0;
params4.year_s = year_d;
params4.month_s = month_d;
params4.day_s = days;
params4.type = "day_s";
params4.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params4).then((res4) => {
if (res4.length > 0) {
let data4 = res4[0];
that.tableDatas[0][2] = data4.total_production;
if (data4.total_production < 1) {
that.tableDatas[1][2] = 0;
that.tableDatas[2][2] = 0;
that.tableDatas[3][2] = 0;
}else{
that.tableDatas[1][2] = data4.elec_consume_unit;
that.tableDatas[2][2] = data4.elec_consume;
that.tableDatas[3][2] = data4.production_cost_unit;}
if (data4.imaterial_data.length > 0) {
data4.imaterial_data.forEach((item) => {
if (item.material_name == "湿电石渣消耗") {
that.tableDatas[4][2] = item.amount_consume;
}else if(item.material_name == "湿电石渣进厂"){
that.tableDatas[5][2] = item.amount_consume;
}
});
}
}
});
},
get_months(year, month){
let that = this;
let params2 = {};
params2.page = 0;
params2.year_s = year;
params2.month_s = month;
params2.type = "month_s";
params2.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params2).then((res2) => {
if (res2.length > 0) {
let data2 = res2[0];
that.tableDatas[0][4] = data2.total_production;
that.tableDatas[0][7] = precen(
that.tableDatas[0][4],
that.tableDatas[0][6]
);
that.tableDatas[1][4] = data2.elec_consume_unit;
that.tableDatas[1][7] = consume_precen(
that.tableDatas[1][4],
that.tableDatas[1][6]
);
that.tableDatas[2][4] = data2.elec_consume;
that.tableDatas[3][4] =
data2.production_cost_unit;
that.tableDatas[3][7] = consume_precen(
that.tableDatas[3][3],
that.tableDatas[3][6]
);
that.tableDatas[2][7] = consume_precen(
that.tableDatas[2][4],
that.tableDatas[2][6]
);
if (data2.imaterial_data.length > 0) {
data2.imaterial_data.forEach((item) => {
if (item.material_name == "湿电石渣消耗") {
that.tableDatas[4][4] = (item.amount_consume).toFixed(2);
that.tableDatas[4][7] = precen(
that.tableDatas[4][4],
that.tableDatas[4][6]
);
}else if(item.material_name == "湿电石渣进厂"){
that.tableDatas[5][4] = (item.amount_consume).toFixed(2);
that.tableDatas[5][7] = precen(
that.tableDatas[5][4],
that.tableDatas[5][6]
);
}
});
}
}
});
},
get_month_year_goal(year, month){
let that = this;
let params5 = {};
params5.page = 0;
params5.year = year;
params5.mgroup = that.query.mgroup;
this.$API.mtm.goal.list
.req(params5)
.then((res5) => {
if (res5.length > 0) {
let data5 = res5;
data5.forEach((item5) => {
let str = "goal_val_" + month;
if (item5.goal_cate_name == "总产量t") {
that.tableDatas[0][6] = item5[str];
that.tableDatas[0][8] = item5.goal_val;
} else if (
item5.goal_cate_name ==
"单位产品分布电耗kW·h/t"
) {
that.goal_list.push(item5);
that.tableDatas[1][6] = item5[str];
that.tableDatas[1][8] = item5.goal_val;
} else if (
item5.goal_cate_name ==
"单位产品成本(元/吨)"
) {
that.tableDatas[3][6] = item5[str];
that.tableDatas[3][8] = item5.goal_val;
}else if (item5.goal_cate_name ==
"总电量kW·h"){
that.tableDatas[2][6] = item5[str];
that.tableDatas[2][8] = item5.goal_val;
}else if (item5.goal_cate_name ==
"湿电石渣消耗t"){
that.tableDatas[4][6] = item5[str];
that.tableDatas[4][8] = item5.goal_val;
}
else if (item5.goal_cate_name ==
"湿电石渣进厂t"){
that.tableDatas[5][6] = item5[str];
that.tableDatas[5][8] = item5.goal_val;
}
});
}
})
},
get_years(year){
let that = this;
let params1 = {};
params1.page = 0;
params1.year_s = year;
params1.type = "year_s";
params1.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params1).then((res1) => {
if (res1.length > 0) {
let data1 = res1[0];
that.tableDatas[0][5] = data1.total_production;
that.tableDatas[0][9] = precen(
that.tableDatas[0][5],
that.tableDatas[0][8]
);
that.tableDatas[1][5] = data1.elec_consume_unit;
that.tableDatas[1][9] = consume_precen(
that.tableDatas[1][8]-that.tableDatas[1][5],
that.tableDatas[1][8]
);
that.tableDatas[2][5] = data1.elec_consume;
that.tableDatas[2][9] = consume_precen(
that.tableDatas[2][8]-that.tableDatas[2][5],
that.tableDatas[2][8]
);
that.tableDatas[3][5] =
data1.production_cost_unit;
that.tableDatas[3][9] = consume_precen(
that.tableDatas[3][8]-that.tableDatas[3][5],
that.tableDatas[3][8]
);
if (data1.imaterial_data.length > 0) {
data1.imaterial_data.forEach((item) => {
if (item.material_name == "湿电石渣消耗") {
that.tableDatas[4][5] = (item.amount_consume).toFixed(2);
that.tableDatas[4][9] = precen(
that.tableDatas[4][5],
that.tableDatas[4][8]
);
}else if(item.material_name == "湿电石渣进厂"){
that.tableDatas[5][5] = (item.amount_consume).toFixed(2);
that.tableDatas[5][9] = precen(
that.tableDatas[5][5],
that.tableDatas[5][8]
);
}
});
}
}
});
},
dateChange() {
let that = this;
let arr = [];
if(that.query.type==0) {
arr = that.query.day.split('-');
that.year = Number(arr[0]);
that.month = Number(arr[1]);
that.days = Number(arr[2]);
this.getHourData(that.year, that.month, that.days);
this.get_days(that.year, that.month, that.days);
}
else if(that.query.type==1) {
let year = that.query.month.split("-")[0];
let month = that.query.month.split("-")[1];
month = Number(month);
this.getDayData(year, month);
this.get_months(year, month);
this.get_month_year_goal(year, month);
} else if (that.query.type==2) {
let year = that.query.year;
this.getMonthData(year);
this.get_years(year);
this.get_month_year_goal(year , 1);
}
},
//
getHourData(year, month, days) {

View File

@ -38,7 +38,7 @@
>
<thead class="myTableHead">
<tr>
<th colspan="12">电石渣工序班组月度对比分析</th>
<th colspan="13">电石渣工序班组月度对比分析</th>
</tr>
<tr>
<th rowspan="2">月份</th>
@ -47,6 +47,7 @@
<th rowspan="2">单位产品成本/</th>
<th colspan="7">产品单位电耗</th>
<th rowspan="2">得分</th>
<th rowspan="2">排名</th>
</tr>
<tr>
<th>当期值kKW·h/t</th>
@ -258,10 +259,35 @@ export default {
}
wrapArr.push(arr);
});
that.tableDatas = 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() {