387 lines
11 KiB
Vue
387 lines
11 KiB
Vue
<template>
|
||
<div class="app-container">
|
||
<el-header>
|
||
<div class="left-panel">
|
||
<el-date-picker
|
||
v-model="query.year_s"
|
||
type="year"
|
||
value-format="YYYY"
|
||
format="YYYY"
|
||
placeholder="查询年份"
|
||
class="headerSearch"
|
||
/>
|
||
<el-button
|
||
type="primary"
|
||
icon="el-icon-search"
|
||
@click="handleQuery"
|
||
></el-button>
|
||
<el-button
|
||
type="primary"
|
||
@click="exportExcel()"
|
||
:loading="exportLoading"
|
||
>导出xlsx
|
||
</el-button>
|
||
<el-button type="primary" @click="handlePrint">打印 </el-button>
|
||
</div>
|
||
</el-header>
|
||
<el-card style="margin-top: 5px">
|
||
<div class="printWrap">
|
||
<div ref="print" id="myReport" class="printContainer">
|
||
<table
|
||
border="1"
|
||
width="3200"
|
||
cellspacing="0"
|
||
:key="timeStamp"
|
||
id="myTable"
|
||
class="myTable"
|
||
>
|
||
<thead class="myTableHead">
|
||
<tr>
|
||
<th colspan="32">回转窑工段班组月度对比分析</th>
|
||
</tr>
|
||
<tr>
|
||
<th rowspan="2">月份</th>
|
||
<th rowspan="2">班组</th>
|
||
<th colspan="2">产量</th>
|
||
<th>运转率</th>
|
||
<th>成本</th>
|
||
<th colspan="6">质量</th>
|
||
<th colspan="7">单位产品标煤耗</th>
|
||
<th colspan="12">产品单位电耗</th>
|
||
<th rowspan="2">得分</th>
|
||
</tr>
|
||
<tr>
|
||
<th>总产量(t)</th>
|
||
<th>台时产量(t/h)</th>
|
||
<th>运转率(%)</th>
|
||
<th>单位产品成本(元/吨)</th>
|
||
<th>CaO(%)</th>
|
||
<th>Fe₂O₃(%)</th>
|
||
<th>细度(%)</th>
|
||
<th>水分(%)</th>
|
||
<th>立升重(%)</th>
|
||
<th>f-CaO(%)</th>
|
||
|
||
<th>当期值(kgce/t))</th>
|
||
<th>目标值(kgce/t)</th>
|
||
<th>当期与目标差值(kgce/t)</th>
|
||
<th>环期值(kgce/t)</th>
|
||
<th>当期与环期差值(kgce/t)</th>
|
||
<th>环比增长率(%)</th>
|
||
<th>同比增长率(%)</th>
|
||
|
||
<th>高温风机(kW·h/t)</th>
|
||
<th>篦冷机一室风机(kW·h/t)</th>
|
||
<th>篦冷机三室风机(kW·h/t)</th>
|
||
<th>篦冷机二室风机(kW·h/t)</th>
|
||
<th>窑头排风机(kW·h/t)</th>
|
||
<th>当期值(kW·h/t)</th>
|
||
<th>目标值(kW·h/t)</th>
|
||
<th>当期与目标差值(kW·h/t)</th>
|
||
<th>环期值(kW·h/t)</th>
|
||
<th>当期与环期差值(kW·h/t)</th>
|
||
<th>环比增长率(%)</th>
|
||
<th>同比增长率(%)</th>
|
||
</tr>
|
||
</thead>
|
||
<tr v-for="(item, index) in tableDatas" :key="index">
|
||
<td
|
||
v-for="(item0, index0) in item"
|
||
:key="index0"
|
||
class="numCell"
|
||
>
|
||
{{ item0 }}
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</el-card>
|
||
</div>
|
||
</template>
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
timeStamp: 0,
|
||
query: {
|
||
year_s: "",
|
||
page: 0,
|
||
type: "month_st",
|
||
mgroup: "",
|
||
},
|
||
tableDatas: [],
|
||
exportLoading: false,
|
||
};
|
||
},
|
||
mounted() {
|
||
let that = this;
|
||
var myDate = new Date();
|
||
let year = myDate.getFullYear();
|
||
this.timeStamp = myDate.getTime();
|
||
that.query.year_s = year;
|
||
this.$API.mtm.mgroup.list
|
||
.req({ page: 0, search: "回转窑" })
|
||
.then((res) => {
|
||
console.log("回转窑", res);
|
||
that.query.mgroup = res[0].id;
|
||
that.getGoalData();
|
||
});
|
||
},
|
||
methods: {
|
||
getGoalData() {
|
||
let that = this;
|
||
let params = {};
|
||
params.page = 0;
|
||
params.year = that.query.year_s;
|
||
params.mgroup = that.query.mgroup;
|
||
this.$API.mtm.goal.list.req(params).then((res) => {
|
||
// let data = [];
|
||
// if (res.length > 0) {
|
||
// this.data = res;
|
||
// }
|
||
that.getData(res);
|
||
});
|
||
},
|
||
getData(goalData) {
|
||
let that = this;
|
||
let query0 = {};
|
||
query0.page = 0;
|
||
query0.type = "month_st";
|
||
query0.year_s = that.query.year_s - 1;
|
||
query0.mgroup = that.query.mgroup;
|
||
let wrapArr = [],
|
||
wrapArr0 = [],
|
||
wrapArrs = [],
|
||
comparEarr = [], //班组对比
|
||
compareArr0 = [];
|
||
this.$API.enm.enstat.req(query0).then((res0) => {
|
||
let data0 = res0;
|
||
debugger;
|
||
if (data0.length > 0) {
|
||
data0.forEach((item0) => {
|
||
//先按月份排序,再按班组排序
|
||
let n0 = item0.month_s;
|
||
let ind0 = 0;
|
||
let team_name0 = item0.team_name;
|
||
let arr0 = [];
|
||
arr0[0] = n0;
|
||
arr0[1] = team_name0;
|
||
arr0[2] = item0.total_output_unit;
|
||
arr0[3] = item0.total_output_unit;
|
||
arr0[4] = item0.run_rate_unit;
|
||
wrapArr0[ind0] = item0;
|
||
});
|
||
} else {
|
||
}
|
||
this.$API.enm.enstat.req(that.query).then((res) => {
|
||
let data = res;
|
||
if (data.length > 0) {
|
||
data.forEach((item) => {
|
||
//先按月份排序,再按班组排序
|
||
let compareArr = [];
|
||
let elecArr = [];
|
||
compareArr.push(item.month_s);
|
||
elecArr.push(item.month_s);
|
||
compareArr.push(item.team_name);
|
||
elecArr.push(item.team_name);
|
||
compareArr.push(item.coal_consume_unit);
|
||
elecArr.push(item.elec_consume_unit);
|
||
compareArr0.push(compareArr);
|
||
comparEarr.push(elecArr);
|
||
});
|
||
data.forEach((item) => {
|
||
//先按月份排序,再按班组排序
|
||
let n = item.month_s;
|
||
let ind = 0;
|
||
let arr = [];
|
||
let time = "" + item.year_s + "." + item.month_s;
|
||
arr.push(time);
|
||
arr.push(item.team_name);
|
||
arr.push(item.total_production);
|
||
arr.push(item.production_hour);
|
||
arr.push(item.run_rate);
|
||
arr.push(item.production_cost_unit);
|
||
//质量
|
||
arr[6] =
|
||
item.入窑生料_CaO_rate_pass != null
|
||
? item.入窑生料_CaO_rate_pass
|
||
: "/";
|
||
arr[7] =
|
||
item.入窑生料_Fe2O3_rate_pass != null
|
||
? item.入窑生料_Fe2O3_rate_pass
|
||
: "/";
|
||
arr[8] =
|
||
item.出磨煤粉_细度_rate_pass != null
|
||
? item.出磨煤粉_细度_rate_pass
|
||
: "/";
|
||
arr[9] =
|
||
item.出磨煤粉_水分_rate_pass != null
|
||
? item.出磨煤粉_水分_rate_pass
|
||
: "/";
|
||
arr[10] =
|
||
item.出窑熟料_立升重_rate_pass != null
|
||
? item.出窑熟料_立升重_rate_pass
|
||
: "/";
|
||
arr[11] =
|
||
item.出窑熟料_fCaO_rate_pass != null
|
||
? item.出窑熟料_fCaO_rate_pass
|
||
: "/";
|
||
|
||
//煤耗
|
||
arr[12] = item.coal_consume_unit; //当期值(KW·h/t)
|
||
let keyValue = "goal_val_" + n;
|
||
if (goalData.length > 0){
|
||
goalData.forEach((item) => {
|
||
if (item.id == "3638341891940192256") {
|
||
arr[13] = item[keyValue]; //目标值(KW·h/t)//需要接口获取
|
||
}else if (item.id == "3637651365016526848"){
|
||
arr[25] = item[keyValue]; //目标值(KW·h/t)//需要接口获取
|
||
}
|
||
});
|
||
};
|
||
let dq = 0
|
||
if (arr[13] !== null && arr[13] !== undefined){
|
||
dq = (arr[12] - arr[13]).toFixed(2); //当期与目标差值(KW·h/t)
|
||
}else{
|
||
dq == "/"
|
||
};
|
||
arr[14] = dq; //当期与目标差值
|
||
let ind_pre = 0,
|
||
huanbi = 0;
|
||
if (item.month_s == 1) {
|
||
ind_pre = 12;
|
||
huanbi = wrapArr0[ind_pre]
|
||
? wrapArr0[ind_pre].coal_consume_unit
|
||
: "/";
|
||
} else {
|
||
// 如果 wrapArr数组长度大于0,那么循环遍历wrapArr数组,找到与item.month_s相差1的元素 而 item.name相同,并赋值给huanbi
|
||
compareArr0.forEach((item0) => {
|
||
if (item0[0] == item.month_s - 1 && item0[1] == item.team_name) {
|
||
huanbi = item0[2];
|
||
}
|
||
})
|
||
}
|
||
arr[15] = huanbi; //环期值(KW·h/t)上个月的值
|
||
if(huanbi !=="/"){
|
||
arr[16] = (arr[12] - arr[15]).toFixed(2); //当期与环期差值(KW·h/t)
|
||
}else{
|
||
arr[16] = "/"
|
||
};
|
||
if (arr[15] !== "/"&& arr[15]!== 0 && arr[16]!=="/") {
|
||
arr[17] = ((arr[16] / arr[15]) * 100).toFixed(2); //环比增长率(%)
|
||
} else{
|
||
arr[17] = "/"
|
||
};
|
||
let sameRate = 0;
|
||
if (
|
||
wrapArr0[ind] &&
|
||
wrapArr0[ind].coal_consume_unit
|
||
) {
|
||
sameRate =
|
||
((arrs[1] -
|
||
wrapArr0[ind].coal_consume_unit) /
|
||
wrapArr0[ind].coal_consume_unit) *
|
||
100;
|
||
} else {
|
||
sameRate = "/";
|
||
}
|
||
arr[18] = sameRate; ///同比增长率(%)需要当前值/ 上一年同一个月的值即wrapArr0[ind].elec_consume_unit
|
||
//电耗
|
||
//设备
|
||
arr[19] =
|
||
item.高温风机_consume_unit != null
|
||
? item.高温风机_consume_unit
|
||
: "/";
|
||
arr[20] =
|
||
item.篦冷机一室风机电机_consume_unit != null
|
||
? item.篦冷机一室风机电机_consume_unit
|
||
: "/";
|
||
arr[21] =
|
||
item.篦冷机三室风机电机_consume_unit != null
|
||
? item.篦冷机三室风机电机_consume_unit
|
||
: "/";
|
||
arr[22] =
|
||
item.篦冷机二室风机电机_consume_unit != null
|
||
? item.篦冷机二室风机电机_consume_unit
|
||
: "/";
|
||
arr[23] =
|
||
item.窑头排风机主电机_consume_unit != null
|
||
? item.窑头排风机主电机_consume_unit
|
||
: "/";
|
||
arr[24] = item.elec_consume_unit; //当期值(KW·h/t)
|
||
// arr[25] = item.celec_consume_unit; //目标值(KW·h/t)//需要接口获取
|
||
if (item.elec_consume_unit != null &&item.elec_consume_unit !== "/"){
|
||
arr[26] = (arr[24]-arr[25]).toFixed(2); //当期与目标差值(KW·h/t)
|
||
}
|
||
let huanbiec = 0;
|
||
if (item.month_s == 1) {
|
||
ind_pre1 = 12;
|
||
huanbiec = wrapArr0[ind_pre]
|
||
? wrapArr0[ind_pre].elec_consume_unit
|
||
: "/";
|
||
} else {
|
||
// 如果 wrapArr数组长度大于0,那么循环遍历wrapArr数组,找到与item.month_s相差1的元素 而 item.name相同,并赋值给huanbi
|
||
comparEarr.forEach((item0) => {
|
||
if (item0[0] == item.month_s - 1 && item0[1] == item.team_name) {
|
||
huanbiec = item0[2];
|
||
}
|
||
})
|
||
}
|
||
arr[27] = huanbiec; //环期值(KW·h/t)上个月的值
|
||
if(arr[27]!=="/" && huanbiec!=="/"){
|
||
arr[28] = (arr[24] - huanbiec).toFixed(2); //当期与环期差值(KW·h/t)
|
||
}else{
|
||
arr[28] = "/"
|
||
}
|
||
if(arr[28]!=="/" && huanbiec!=="/"&&huanbiec!==0){
|
||
arr[29] = ((arr[28] / huanbiec) * 100).toFixed(2); //环比增长率(%)
|
||
}else{
|
||
arr[29] = 0}; //环比增长率(%)
|
||
arr[30] = item.celec_consume_unit; //同比增长率(%)
|
||
wrapArr.push(arr);
|
||
});
|
||
that.tableDatas = wrapArr;
|
||
} else {
|
||
}
|
||
});
|
||
});
|
||
},
|
||
handleQuery() {
|
||
this.tableDatas = [];
|
||
this.getGoalData();
|
||
},
|
||
itemClick(type, item) {
|
||
this.type = type;
|
||
this.asynDialog = true;
|
||
},
|
||
itemClick1(type, item) {
|
||
this.chartShow = false;
|
||
this.$API.bi.dataset.exec.req("3322567213885833216").then((res) => {
|
||
this.myOption = JSON.parse(res.echart_options);
|
||
debugger;
|
||
console.log(this.myOption);
|
||
this.chartShow = true;
|
||
});
|
||
},
|
||
handlePrint() {
|
||
this.$PRINT("#myReport");
|
||
},
|
||
exportExcel() {
|
||
this.exportLoading = true;
|
||
this.$XLSX("#myTable", this.tableName);
|
||
this.exportLoading = false;
|
||
},
|
||
},
|
||
};
|
||
</script>
|
||
<style scoped>
|
||
.printWrap {
|
||
width: 100%;
|
||
overflow-x: scroll;
|
||
}
|
||
.numCell {
|
||
width: 100px !important;
|
||
}
|
||
</style>
|