This commit is contained in:
caoqianming 2024-12-06 15:14:04 +08:00
commit 1c47d546b7
2 changed files with 55 additions and 24 deletions

View File

@ -58,24 +58,6 @@
</div>
</el-header>
<el-card style="margin-top:5px">
<!-- <div ref="print" id="myReport" class="printContainer">
<h3 style="text-align: center;">{{ tableName }}</h3>
<el-table
:data="tableData"
style="width: 100%"
border
:height="tableHeight"
:span-method="objectSpanMethod">
<el-table-column
v-for="item in tableData[0]"
:key="item"
:prop="item"
:label="item"
width="100">
</el-table-column>
</el-table>
</div> -->
<div>
<table id="myTable" class="myTable" border="1" cellspacing="0" style="width: 100%; text-align: center;">
<thead class="myTableHead">
@ -86,7 +68,14 @@
</thead>
<tbody>
<tr v-for="(row, rowIndex) in tableData" :key="rowIndex">
<td v-for="(cell, cellIndex) in row" :key="cellIndex"
<td
v-if="rowIndex === 0 || rowIndex === 2 || rowIndex === 4"
:rowspan="rowIndex === 0 || rowIndex === 2 ? 2 : 1"
>
{{ row[0] }}
</td>
<td>{{ row[1] }}</td>
<td v-for="(cell, cellIndex) in row.slice(2)" :key="cellIndex"
>{{ cell }}</td>
</tr>
</tbody>

View File

@ -107,6 +107,7 @@
{id:1,name:'月统计'},
{id:2,name:'年统计'},
],
mgroups:['电石渣','原料磨','煤磨','回转窑','水泥磨','水泥包装'],
headers:['','时间','电石渣','原料磨','生料工段','煤磨','熟料工段','水泥粉磨','水泥包装'],
tableDatas:[
['产量(t)'],
@ -129,7 +130,9 @@
},
mounted() {
var myDate = new Date();
this.query.searchDay =this.currentDay = this.$TOOL.dateFormat2(myDate);
// this.query.searchDay =this.currentDay = this.$TOOL.dateFormat2(myDate);
this.query.searchDay =this.currentDay = '2024-10-04';
this.query.searchDay ='2024-10-04';
this.getData();
},
methods: {
@ -153,26 +156,65 @@
},
getData(){
let that = this;
let params = {};
let arr = [],type='',year_s = 2024,month_s = 1,day_s = 1;
let params = {page:0};
let arr = [],type='',year_s = 2024,month_s = 1,day_s = 1,search_time = '';
if(that.query.type==0){//
params.type='day_s';
search_time = that.query.searchDay;
let arr = that.query.searchDay.split('-');
params.year_s = Number(arr[0]);
params.month_s = Number(arr[1]);
params.day_s = Number(arr[2]);
}else if(that.query.type==1){//
params.type='month_s';
search_time = that.query.searchMonth;
let arr = that.query.searchMonth.split('-');
params.year_s = Number(arr[0]);
params.month_s = Number(arr[1]);
}else if (that.query.type==2){
params.type='year_s';
search_time = that.query.searchYear;
params.year_s = Number(that.query.searchYear);
}
//
that.tableDatas.forEach((item) => {
item[1] = search_time;
})
this.$API.enm.enstat.req(params).then((res) => {
let dataList = {};
if(res.length <= 0){
return;
}
res.forEach(item => {
let index = that.mgroups.indexOf(item.mgroup_name);
if(index>-1){
index = index+2;
that.tableDatas[0][index] = item.total_production;
that.tableDatas[1][index] = item.production_hour;
let str = '';
item.qua_data.forEach((item) => {
str = str+item.testitem_name+":"+(item.rate_pass).toFixed(2)+"%\n";
})
that.tableDatas[2][index] = str;//
that.tableDatas[3][index] = item.yield;//
that.tableDatas[4][index] = item.elec_consume;//
that.tableDatas[5][index] = item.imaterial_data_dict?item.imaterial_data_dict.柴油?(item.imaterial_data_dict.柴油.cost).toFixed(2):'':'';//
that.tableDatas[6][index] = item.yield;//绿
that.tableDatas[7][index] = item.yield;//
that.tableDatas[8][index] = item.imaterial_data_dict?item.imaterial_data_dict.工业水?(item.imaterial_data_dict.工业水.cost).toFixed(2) :'':''; //
that.tableDatas[12][index] = item.imaterial_data_dict?item.imaterial_data_dict.蒸汽?(item.imaterial_data_dict.蒸汽.cost).toFixed(2):'':'';//
that.tableDatas[13][index] = item.yield;//
}
if(item.mgroup_name=='原料压缩空气'){
that.tableDatas[9][3] = item.cair_consume;
}else if(item.mgroup_name=='水泥压缩空气'){
that.tableDatas[10][7] = item.cair_consume;
}else if(item.mgroup_name=='烧成压缩空气'){
that.tableDatas[11][6] = item.cair_consume;
}
});
})
},
getTableData(){
this.getData();
},