feat:凌源电量消耗报表

This commit is contained in:
shijing 2024-04-12 13:30:45 +08:00
parent ad3f90c293
commit 16bf29cd4f
3 changed files with 997 additions and 1634 deletions

View File

@ -1,354 +1,413 @@
<!-- 全厂电量统计 --> <!-- 全厂电量统计 -->
<template> <template>
<div class="app-container"> <div class="app-container">
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-date-picker <el-date-picker
v-model="search_date" v-model="search_date"
type="month" type="month"
value-format="YYYY-MM" value-format="YYYY-MM"
format="YYYY-MM" format="YYYY-MM"
placeholder="月" placeholder="月"
style="margin-right: 6px;" style="margin-right: 6px"
@change="dateChange" @change="dateChange"
/> />
<el-button <el-button
type="primary" type="primary"
icon="el-icon-search" icon="el-icon-search"
@click="getTableData" @click="getTableData"
></el-button> ></el-button>
<el-button <el-button
type="primary" type="primary"
@click="exportExcel()" @click="exportExcel()"
:loading = "exportLoading" :loading="exportLoading"
>导出xlsx >导出xlsx
</el-button> </el-button>
<el-button <el-button type="primary" @click="handlePrint">打印 </el-button>
type="primary" </div>
@click="handlePrint" </el-header>
>打印 <el-card style="margin-top: 5px">
</el-button> <div class="printWrap">
</div> <div ref="print" id="myReport" class="printContainer">
</el-header> <table
<el-card style="margin-top:5px"> border="1"
<div class="printWrap"> :width="tableWidth"
<div ref="print" id="myReport" class="printContainer"> cellspacing="0"
<table border="1" width="3300" cellspacing="0" :key="timeStamp" id="myTable" class="myTable"> :key="timeStamp"
<thead class="myTableHead"> id="myTable"
<tr> class="myTable"
<th :colspan="headerLength">全厂电量日统计</th> >
</tr> <thead class="myTableHead">
<tr> <tr>
<th>车间</th> <th :colspan="headerLength">电量消耗日报表</th>
<th>工段</th> </tr>
<th>设备</th> <tr>
<th v-for="item in days" :key="item">{{ item }}</th> <th>工段</th>
</tr> <th>设备</th>
</thead> <th>单位</th>
<tr v-for="(item,index) in tableDatas" :key="index"> <th v-for="item in this.days" :key="item">
<td class="numCell" v-if="index==0" rowspan="9">{{item[0]}}</td> {{ item }}
<td class="numCell" v-else-if="index==9" rowspan="18">{{item[0]}}</td> </th>
<td class="numCell" v-else-if="index==27" rowspan="12">{{item[0]}}</td> <th>本月合计</th>
<td class="numCell" v-else-if="index==39" rowspan="10" colspan="2">{{item[0]}}</td> </tr>
<td class="numCell" v-else-if="index==49" colspan="3">{{item[0]}}</td> </thead>
<td class="numCell" v-if="index==8||index==26||index==37||index==38" colspan="2">{{item[1]}}</td> <tr v-for="(item, index) in tableDatas" :key="index">
<td class="numCell" v-else-if="index==0" rowspan="2">{{item[1]}}</td> <td class="numCell" v-if="index == 0" rowspan="4">
<td class="numCell" v-else-if="index==2" rowspan="6">{{item[1]}}</td> {{ item[0] }}
<td class="numCell" v-else-if="index==9" rowspan="14">{{item[1]}}</td> </td>
<td class="numCell" v-else-if="index==23" rowspan="3">{{item[1]}}</td> <td
<td class="numCell" v-else-if="index==27" rowspan="10">{{item[1]}}</td> class="numCell"
<td class="numCell" v-else>{{item[1]}}</td> v-else-if="index == 4"
<td class="numCell">{{item[2]}}</td> rowspan="5"
<template v-for="day in days" :key="day"> >
<td class="numCell" v-if="item[day+2]!==null&&item[day+2]!==undefined">{{item[day+2]}}</td> {{ item[0] }}
</template> </td>
</tr> <td
</table> class="numCell"
</div> v-else-if="index == 9"
</div> rowspan="5"
</el-card> >
</div> {{ item[0] }}
</template> </td>
<td
class="numCell"
v-else-if="index == 14"
rowspan="4"
>
{{ item[0] }}
</td>
<td
class="numCell"
v-else-if="index == 18"
rowspan="3"
>
{{ item[0] }}
</td>
<td
class="numCell"
v-else-if="index == 21"
rowspan="5"
>
{{ item[0] }}
</td>
<td
class="numCell"
v-else-if="
index == 26 || index == 27 || index == 28
"
>
{{ item[0] }}
</td>
<td class="numCell">{{ item[1] }}</td>
<td class="numCell">{{ item[2] }}</td>
<td v-for="day in days" :key="day" class="numCell">
{{ item[2 + day] }}
</td>
<td class="numCell">{{ item[headerLength] }}</td>
</tr>
</table>
</div>
</div>
</el-card>
</div>
</template>
<script> <script>
export default { export default {
data() { data() {
return { return {
year:'', year: "",
month:'', month: "",
days:'', days: "",
search_date:'', search_date: "",
headerLength:33, headerLength: 33,
tableDatas:[ tableDatas: [
['原料车间','电石渣','烘干破主电机'],//0 ["石灰石破碎", "破碎机", "kw.h"], //0
['原料车间','电石渣合计'], ["石灰石破碎", "堆取料机", "kw.h"],
['原料车间','原料磨','反击式破碎机'],//2 ["石灰石破碎", "低压变压器柜", "kw.h"],
['原料车间','立磨主电机'], ["石灰石破碎", "石灰石破碎合计", "kw.h"],
['原料车间','循环风机'], ["原料磨", "循环风机", "kw.h"],
['原料车间','废气风机'],//5 ["原料磨", "辊压机", "kw.h"],
['原料车间','尾排风机'], ["原料磨", "调配变压器", "kw.h"],
['原料车间','原料磨合计'], ["原料磨", "低压变压器柜器", "kw.h"],
['原料车间','原料车间合计'],//8 ["原料磨", "原料磨系统合计", "kw.h"],
["回转窑", "尾排风机", "kw.h"],
["回转窑", "高温风机", "kw.h"],
["回转窑", "头排风机", "kw.h"],
["回转窑", "低压变压器柜", "kw.h"],
["回转窑", "回转窑烧成系统合计", "kw.h"],
["煤磨", "煤磨主电机", "kw.h"],
["煤磨", "煤磨排风机", "kw.h"],
["煤磨", "低压变压器柜", "kw.h"],
["煤磨", "煤磨系统合计", "kw.h"],
["余热发电", "余热发电量", "kw.h"],
["余热发电", "余热发电自用电量", "kw.h"],
["余热发电", "余热供电量", "kw.h"],
["空压机", "1#空压机", "kw.h"],
["空压机", "2#空压机", "kw.h"],
["空压机", "3#空压机", "kw.h"],
["空压机", "4#空压机", "kw.h"],
["空压机", "空压机合计", "kw.h"],
["富氧燃烧系统", "富氧燃烧耗电设备", "kw.h"],
["生产总耗电量", "生产部分总耗电", "kw.h"],
["全厂进线", "全厂耗电量", "kw.h"],
],
timeStamp: null,
tableWidth: "3300",
tableName: "全厂电量日统计",
sourceData: {},
};
},
mounted() {
let that = this;
var nowDate = new Date();
that.year = nowDate.getFullYear();
that.month = nowDate.getMonth() + 1;
that.days = new Date(that.year, that.month, 0).getDate();
that.timeStamp = nowDate.getTime();
let month0 = that.month > 9 ? that.month : "0" + that.month;
that.search_date = that.year + "-" + month0;
that.headerLength = that.days + 4;
that.tableWidth = that.headerLength * 100 + "";
let tableDatas = that.tableDatas;
for (let i = 0; i < tableDatas.length; i++) {
for (let j = 0; j < that.days; j++) {
let k = 3 + j;
that.tableDatas[i][k] = 0;
this.$forceUpdate();
}
}
this.getData();
},
methods: {
dateChange(e) {
let that = this;
let arr = e.split("-");
that.year = Number(arr[0]);
that.month = Number(arr[1]);
for (let i = 0; i < that.tableDatas.length; i++) {
for (let j = 0; j < that.days + 1; j++) {
let k = 3 + j;
that.tableDatas[i][k] = 0;
this.$forceUpdate();
}
}
let nowDate = new Date();
that.timeStamp = nowDate.getTime();
this.getData();
},
getData() {
let that = this;
function dataPush(name) {
let index = 0;
if (name == "破碎机") {
index = 0;
} else if (name == "堆取料机") {
index = 1;
} else if (name == "低压变压器柜") {
index = 2;
} else if (name == "循环风机") {
index = 4;
} else if (name == "调配变压器") {
index = 6;
} else if (name == "低压变压器柜器") {
index = 7;
} else if (name == "尾排风机") {
index = 9;
} else if (name == "高温风机") {
index = 10;
} else if (name == "头排风机") {
index = 11;
} else if (name == "煤磨主电机") {
index = 14;
} else if (name == "煤磨排风机") {
index = 15;
} else if (name == "低压变压器柜") {
index = 16;
} else if (name == "余热发电量") {
index = 18;
} else if (name == "余热发电自用电量") {
index = 19;
} else if (name == "1#空压机") {
index = 21;
} else if (name == "2#空压机") {
index = 22;
} else if (name == "3#空压机") {
index = 23;
} else if (name == "4#空压机") {
index = 24;
} else if (name == "富氧燃烧耗电设备") {
index = 26;
}
return index;
}
function sumNum(a, b, c, d) {
let sum = 0;
if (typeof a !== "undefined" && a !== "NaN") {
sum = sum + Number(a);
}
if (typeof b !== "undefined" && a !== "NaN") {
sum = sum + Number(b);
}
if (typeof c !== "undefined" && a !== "NaN") {
sum = sum + Number(c);
}
if (typeof d !== "undefined" && a !== "NaN") {
sum = sum + Number(d);
}
return sum;
}
let obj = {};
obj.type = "day_s";
obj.year_s = that.year;
obj.month_s = that.month;
obj.page = 0;
obj.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(obj)
.then((res) => {
let wrapArr = [],
innerArr = [];
res.forEach((item) => {
let day = item.day_s;
if (wrapArr[day]) {
wrapArr[day].push(item);
} else {
wrapArr[day] = [];
wrapArr[day].push(item);
}
});
wrapArr.forEach((inner, inde) => {
inner.forEach((item) => {
let i = dataPush(item.mpoint_name);
let k = 0;
if (
i == 0 ||
i == 4 ||
i == 9 ||
i == 14 ||
i == 18 ||
i == 21 ||
i == 26 ||
i == 27 ||
i == 28
) {
k = 3 + inde;
} else {
k = 2 + inde;
}
that.tableDatas[i][k] = item.val;
});
});
for (let k = 0; k < that.headerLength; k++) {
let m = k + 3;
let n = k + 1;
//
['烧成车间','回转窑','高温风机'],//9 that.tableDatas[3][m] = sumNum(
['烧成车间','窑主电机'],//10 that.tableDatas[0][m],
['烧成车间','篦冷机一室风机电机'], that.tableDatas[1][m],
['烧成车间','篦冷机三室风机电机'], that.tableDatas[2][m]
['烧成车间','篦冷机二室风机电机'], );
['烧成车间','篦冷机一室充气梁风机(左)'], //
['烧成车间','篦冷机一室充气梁风机(右)'],//15 // that.tableDatas[5][m] = sumNum();
['烧成车间','窑头排风机主电机'], //
['烧成车间','头煤粉罗茨电机(东、备用)'], that.tableDatas[8][m] =
['烧成车间','尾煤粉罗茨电机(西)'], sumNum(
['烧成车间','空压机3301'], that.tableDatas[4][m],
['烧成车间','空压机3308'],//20 // that.tableDatas[5][m],
['烧成车间','空压机3318'],//21 that.tableDatas[6][m],
['烧成车间','回转窑合计'], that.tableDatas[7][m]
['烧成车间','煤磨','煤磨主电机'], ) -
['烧成车间','煤磨排风机主电机'], sumNum(
['烧成车间','煤磨合计'],//25 that.tableDatas[1][m],
['烧成车间','烧成车间合计'],//26 that.tableDatas[2][m]
);
['水泥车间','水泥磨','循环风机1906'],//27 //
['水泥车间','系统风机'], // that.tableDatas[12][m] = sumNum(
['水泥车间','水平涡流选粉机1915'], // that.tableDatas[9][m],
['水泥车间','水泥磨主电机'],//30 // that.tableDatas[10][m],
['水泥车间','辊压机动辊电机'], // that.tableDatas[11][m]
['水泥车间','辊压机定辊电机'], // );
['水泥车间','新增磨尾风机'], //
['水泥车间','水泥1#空压机'], that.tableDatas[13][m] =
['水泥车间','水泥2#空压机'],//35 typeof that.tableDatas[12][m] !== "undefined"
['水泥车间','水泥磨合计计'], ? sumNum(
['水泥车间','水泥包装合计'],//37 that.tableDatas[9][m],
['水泥车间','水泥车间合计'],//38 that.tableDatas[10][m],
that.tableDatas[11][m],
['生活区','食堂'],//39 that.tableDatas[12][m]
['生活区','单元楼'],//40 )
['生活区','单身宿舍'], : sumNum(
['生活区','办公楼'], that.tableDatas[9][m],
['生活区','余热锅炉'], that.tableDatas[10][m],
['生活区','污水站'], that.tableDatas[11][m]
['生活区','南门办公区'],//45 );
['生活区','东门办公区'], //
['生活区','地磅'], let sum17 = sumNum(
['生活区','生活区合计'], that.tableDatas[14][m],
['全厂电量'] that.tableDatas[15][m],
], that.tableDatas[16][m]
tableName:'全厂电量日统计', );
sourceData:{} that.tableDatas[17][m] =
}; typeof that.tableDatas[21][m] !== "undefined"
}, ? sum17 - that.tableDatas[21][m]
mounted() { : sum17;
let that = this; //
var nowDate = new Date(); that.tableDatas[20][m] =
that.year = nowDate.getFullYear(); typeof that.tableDatas[19][m] !== "undefined"
that.month = nowDate.getMonth()+1; ? that.tableDatas[18][m] -
that.days = new Date(that.year,that.month,0).getDate(); that.tableDatas[19][m]
let month0 = that.month>9?that.month :'0'+that.month ; : that.tableDatas[18][m];
that.search_date = that.year+'-'+month0; //
that.headerLength = that.days+3; that.tableDatas[25][m] = sumNum(
let tableDatas = that.tableDatas; that.tableDatas[21][m],
this.$nextTick(()=>{ that.tableDatas[22][m],
for (let i = 0; i < tableDatas.length; i++) { that.tableDatas[23][m],
for (let j = 0; j < that.days; j++) { that.tableDatas[24][m]
let k = 0; );
if(i==0||i==2||i==9||i==23||i==27){ //
k = 3+j; that.tableDatas[27][m] = sumNum(
}else{ that.tableDatas[3][m],
k = 2+j; that.tableDatas[8][m],
} that.tableDatas[13][m],
that.tableDatas[i].push(0); that.tableDatas[17][m],
this.$forceUpdate(); that.tableDatas[18][m],
} that.tableDatas[25][m],
} that.tableDatas[26][m]
}) );
// that.$set(that.$data,'tableDatas',tableDatas); //
this.getData(); // that.tableDatas[28][m] = sumNum(
}, // that.tableDatas[27][m],
methods: { // that.tableDatas[26][m]
dateChange(e){ // );
let that = this; }
let arr = e.split('-') that.tableDatas.forEach((inner, inde) => {
that.year = Number(arr[0]); let sumlast = 0;
that.month = Number(arr[1]); inner.forEach((num, ind) => {
}, if (ind > 2 && ind < that.headerLength) {
getData(){ sumlast = sumlast + Number(num);
let that = this; }
function dataPush(name,value){ });
let index=0; inner[that.headerLength] = sumlast;
if(name=='烘干破主电机'){ });
index=0; })
that.tableDatas[0][3] = value; .then(() => {});
}else if(name=='电石渣合计'){ },
index=1; exportExcel() {
that.tableDatas[1][2] = value; this.exportLoading = true;
}else if(name=='反击式破碎机'){ this.$XLSX("#myTable", this.tableName);
index=2; this.exportLoading = false;
}else if(name=='立磨主电机'){ },
index=3; handlePrint() {
}else if(name=='循环风机'){ this.$PRINT("#myReport");
index=4; },
}else if(name=='废气风机'){ },
index=5; };
}else if(name=='尾排风机'){
index=6;
}else if(name=='原料磨合计'){
index=7;
}else if(name=='高温风机'){
index=9;
}else if(name=='窑主电机'){
index=10;
}else if(name=='篦冷机一室风机电机'){
index=11;
}else if(name=='篦冷机三室风机电机'){
index=12;
}else if(name=='篦冷机二室风机电机'){
index=13;
}else if(name=='篦冷机一室充气梁风机(左)'){
index=14;
}else if(name=='篦冷机一室充气梁风机(右)'){
index=15;
}else if(name=='窑头排风机主电机'){
index=16;
}else if(name=='头煤粉罗茨电机(东、备用)'){
index=17;
}else if(name=='尾煤粉罗茨电机(西)'){
index=18;
}else if(name=='空压机3301'){
index=19;
}else if(name=='空压机3308'){
index=20;
}else if(name=='空压机3318'){
index=21;
}else if(name=='回转窑合计'){
index=22;
}else if(name=='煤磨主电机'){
index=23;
}else if(name=='煤磨排风机主电机'){
index=24;
}else if(name=='煤磨合计'){
index=25;
}else if(name=='循环风机1906'){
index=27;
}else if(name=='系统风机'){
index=28;
}else if(name=='水平涡流选粉机1915'){
index=29;
}else if(name=='水泥磨主电机'){
index=30;
}else if(name=='辊压机动辊电机'){
index=31;
}else if(name=='辊压机定辊电机'){
index=32;
}else if(name=='新增磨尾风机'){
index=33;
}else if(name=='水泥1#空压机'){
index=34;
}else if(name=='水泥2#空压机'){
index=35;
}else if(name=='水泥磨合计计'){
index=36;
}else if(name=='水泥包装合计'){
index=37;
}else if(name=='食堂'){
index=39;
}else if(name=='单元楼'){
index=40;
}else if(name=='单身宿舍'){
index=41;
}else if(name=='办公楼'){
index=42;
}else if(name=='余热锅炉'){
index=43;
}else if(name=='污水站'){
index=44;
}else if(name=='南门办公区'){
index=45;
}else if(name=='东门办公区'){
index=46;
}else if(name=='生活区合计'){
index=47;
}else if(name=='地磅'){
index=48;
}
return index;
}
function sumNum(a,b,c,d){
let sum = 0;
if(a&&Number(a)){sum=sum+Number(a);}
if(b&&Number(b)){sum=sum+Number(b);}
if(c&&Number(c)){sum=sum+Number(c);}
if(d&&Number(d)){sum=sum+Number(d);}
return sum;
}
let obj = {};
obj.type='day_s';
obj.year_s = that.year;
obj.month_s = that.month;
obj.page = 0;
obj.mpoint__ep_monitored__power_kw__gte=100;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
let wrapArr = [],innerArr=[];
res.forEach(item=>{
let day = item.day_s;
if(wrapArr[day]){
wrapArr[day].push(day)
}else{
wrapArr[day]=[];
wrapArr[day].push(day);
}
})
wrapArr.forEach((inner,inde)=>{
inner.forEach(item=>{
let i = dataPush(item.mpoint_name);
let k = 0;
if(i==0||i==2||i==9||i==23||i==27){
k = 3+inde;
}else{
k = 2+inde;
}
that.tableDatas[i][k] = item.val;
})
})
for(let k = 0;k<that.days;k++){
let m = k+2;
let n = k+1;
that.tableDatas[8][m] = sumNum(that.tableDatas[1][m],that.tableDatas[7][m]);
that.tableDatas[26][m] = sumNum(that.tableDatas[22][m],that.tableDatas[25][m]);
that.tableDatas[38][m] = sumNum(that.tableDatas[36][m],that.tableDatas[37][m]);
that.tableDatas[49][n] = sumNum(that.tableDatas[8][m],that.tableDatas[26][m]+ that.tableDatas[38][m]+ that.tableDatas[48][m]);
}
})
},
getTableData(){
for(let i=0;i<this.tableDatas.length;i++){
let k = 0;
if(i==0||i==2||i==9||i==23||i==27){
k = 3;
}else if(i==49){
k = 1;
}else{
k = 2;
}
for (let j = k; j < this.tableDatas[i].length; j++) {
this.tableDatas[i][j]=0;
}
}
this.getData();
},
exportExcel() {
this.exportLoading = true;
this.$XLSX('#myTable', this.tableName)
this.exportLoading = false;
},
handlePrint() {
this.$PRINT('#myReport');
},
}
};
</script> </script>
<style scoped> <style scoped>
.printWrap{ .printWrap {
width: 100%; width: 100%;
overflow-x: scroll; overflow-x: scroll;
} }
</style> </style>

File diff suppressed because it is too large Load Diff

View File

@ -1,339 +1,406 @@
<!-- 全厂电量统计 --> <!-- 全厂电量统计 -->
<template> <template>
<div class="app-container"> <div class="app-container">
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-date-picker <el-date-picker
v-model="search_date" v-model="search_date"
type="year" type="year"
value-format="YYYY" value-format="YYYY"
format="YYYY" format="YYYY"
placeholder="年" placeholder="年"
style="margin-right: 6px;" style="margin-right: 6px"
@change="dateChange" @change="dateChange"
/> />
<el-button <el-button
type="primary" type="primary"
icon="el-icon-search" icon="el-icon-search"
@click="getTableData" @click="dateChange"
></el-button> ></el-button>
<el-button <el-button
type="primary" type="primary"
@click="exportExcel()" @click="exportExcel()"
:loading = "exportLoading" :loading="exportLoading"
>导出xlsx >导出xlsx
</el-button> </el-button>
<el-button <el-button type="primary" @click="handlePrint">打印 </el-button>
type="primary" </div>
@click="handlePrint" </el-header>
>打印 <el-card style="margin-top: 5px">
</el-button> <div class="printWrap">
</div> <div ref="print" id="myReport" class="printContainer">
</el-header> <table
<el-card style="margin-top:5px"> border="1"
<div class="printWrap"> width="1600"
<div ref="print" id="myReport" class="printContainer"> cellspacing="0"
<table border="1" width="1500" cellspacing="0" :key="timeStamp" id="myTable" class="myTable"> :key="timeStamp"
<thead class="myTableHead"> id="myTable"
<tr> class="myTable"
<th colspan="15">全厂电量月统计</th> >
</tr> <thead class="myTableHead">
<tr> <tr>
<th>车间</th> <th colspan="16">电量消耗月报表</th>
<th>工段</th> </tr>
<th>设备</th> <tr>
<th v-for="month in 12" :key="month">{{month}}</th> <th>工段</th>
</tr> <th>设备</th>
</thead> <th>单位</th>
<tr v-for="(item,index) in tableDatas" :key="index"> <th v-for="item in 12" :key="item">
<td class="numCell" v-if="index==0" rowspan="9">{{item[0]}}</td> {{ item }}
<td class="numCell" v-else-if="index==9" rowspan="18">{{item[0]}}</td> </th>
<td class="numCell" v-else-if="index==27" rowspan="12">{{item[0]}}</td> <th>本年合计</th>
<td class="numCell" v-else-if="index==39" rowspan="10" colspan="2">{{item[0]}}</td> </tr>
<td class="numCell" v-else-if="index==49" colspan="3">{{item[0]}}</td> </thead>
<td class="numCell" v-if="index==8||index==26||index==37||index==38" colspan="2">{{item[1]}}</td> <tr v-for="(item, index) in tableDatas" :key="index">
<td class="numCell" v-else-if="index==0" rowspan="2">{{item[1]}}</td> <td class="numCell" v-if="index == 0" rowspan="4">
<td class="numCell" v-else-if="index==2" rowspan="6">{{item[1]}}</td> {{ item[0] }}
<td class="numCell" v-else-if="index==9" rowspan="14">{{item[1]}}</td> </td>
<td class="numCell" v-else-if="index==23" rowspan="3">{{item[1]}}</td> <td
<td class="numCell" v-else-if="index==27" rowspan="10">{{item[1]}}</td> class="numCell"
<td class="numCell" v-else>{{item[1]}}</td> v-else-if="index == 4"
<td class="numCell">{{item[2]}}</td> rowspan="5"
<td class="numCell">{{item[3]}}</td> >
<td class="numCell">{{item[4]}}</td> {{ item[0] }}
<td class="numCell">{{item[5]}}</td> </td>
<td class="numCell">{{item[6]}}</td> <td
<td class="numCell">{{item[7]}}</td> class="numCell"
<td class="numCell">{{item[8]}}</td> v-else-if="index == 9"
<td class="numCell">{{item[9]}}</td> rowspan="5"
<td class="numCell">{{item[10]}}</td> >
<td class="numCell">{{item[11]}}</td> {{ item[0] }}
<td class="numCell">{{item[12]}}</td> </td>
<td class="numCell" v-if="item[13]!==null&&item[13]!==undefined">{{item[13]}}</td> <td
<td class="numCell" v-if="item[14]!==null&&item[14]!==undefined">{{item[14]}}</td> class="numCell"
</tr> v-else-if="index == 14"
</table> rowspan="4"
</div> >
</div> {{ item[0] }}
</el-card> </td>
</div> <td
</template> class="numCell"
v-else-if="index == 18"
rowspan="3"
>
{{ item[0] }}
</td>
<td
class="numCell"
v-else-if="index == 21"
rowspan="5"
>
{{ item[0] }}
</td>
<td
class="numCell"
v-else-if="
index == 26 || index == 27 || index == 28
"
>
{{ item[0] }}
</td>
<td class="numCell">{{ item[1] }}</td>
<td class="numCell">{{ item[2] }}</td>
<td
class="numCell"
v-for="month_item in months"
:key="month_item"
>
{{ item[2 + month_item] }}
</td>
<td class="numCell">{{ item[15] }}</td>
</tr>
</table>
</div>
</div>
</el-card>
</div>
</template>
<script> <script>
export default { export default {
data() { data() {
return { return {
year:'', year: "",
search_date:'', month: "",
tableDatas:[ day: "",
['原料车间','电石渣','烘干破主电机',0,0,0,0,0,0,0,0,0,0,0,0],//0 search_date: "",
['原料车间','电石渣合计',0,0,0,0,0,0,0,0,0,0,0,0], tableDatas: [
['原料车间','原料磨','反击式破碎机',0,0,0,0,0,0,0,0,0,0,0,0],//2 ["石灰石破碎", "破碎机", "kw.h"], //0
['原料车间','立磨主电机',0,0,0,0,0,0,0,0,0,0,0,0], ["石灰石破碎", "堆取料机", "kw.h"],
['原料车间','循环风机',0,0,0,0,0,0,0,0,0,0,0,0], ["石灰石破碎", "低压变压器柜", "kw.h"],
['原料车间','废气风机' ,0,0,0,0,0,0,0,0,0,0,0,0],//5 ["石灰石破碎", "石灰石破碎合计", "kw.h"],
['原料车间','尾排风机',0,0,0,0,0,0,0,0,0,0,0,0], ["原料磨", "循环风机", "kw.h"],
['原料车间','原料磨合计' ,0,0,0,0,0,0,0,0,0,0,0,0], ["原料磨", "辊压机", "kw.h"],
['原料车间','原料车间合计',0,0,0,0,0,0,0,0,0,0,0,0],//8 ["原料磨", "调配变压器", "kw.h"],
["原料磨", "低压变压器柜器", "kw.h"],
["原料磨", "原料磨系统合计", "kw.h"],
["回转窑", "尾排风机", "kw.h"],
["回转窑", "高温风机", "kw.h"],
["回转窑", "头排风机", "kw.h"],
["回转窑", "低压变压器柜", "kw.h"],
["回转窑", "回转窑烧成系统合计", "kw.h"],
["煤磨", "煤磨主电机", "kw.h"],
["煤磨", "煤磨排风机", "kw.h"],
["煤磨", "低压变压器柜", "kw.h"],
["煤磨", "煤磨系统合计", "kw.h"],
["余热发电", "余热发电量", "kw.h"],
["余热发电", "余热发电自用电量", "kw.h"],
["余热发电", "余热供电量", "kw.h"],
["空压机", "1#空压机", "kw.h"],
["空压机", "2#空压机", "kw.h"],
["空压机", "3#空压机", "kw.h"],
["空压机", "4#空压机", "kw.h"],
["空压机", "空压机合计", "kw.h"],
["富氧燃烧系统", "富氧燃烧耗电设备", "kw.h"],
["生产总耗电量", "生产部分总耗电", "kw.h"],
["全厂进线", "全厂耗电量", "kw.h"],
],
timeStamp: null,
months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
tableName: "全厂电量小时统计",
sourceData: {},
};
},
mounted() {
let that = this;
var nowDate = new Date();
that.year = nowDate.getFullYear();
that.search_date = that.year + "";
that.timeStamp = nowDate.getTime();
let tableDatas = that.tableDatas;
for (let i = 0; i < tableDatas.length; i++) {
for (let j = 0; j < 12; j++) {
let k = 3 + j;
that.tableDatas[i][k] = 0;
this.$forceUpdate();
}
}
this.getData();
},
methods: {
dateChange() {
let that = this;
for (let i = 0; i < that.tableDatas.length; i++) {
for (let j = 0; j < 13; j++) {
let k = 3 + j;
that.tableDatas[i][k] = 0;
this.$forceUpdate();
}
}
let nowDate = new Date();
that.timeStamp = nowDate.getTime();
this.getData();
},
getData() {
let that = this;
function dataPush(name) {
let index = 0;
if (name == "破碎机") {
index = 0;
} else if (name == "堆取料机") {
index = 1;
} else if (name == "低压变压器柜") {
index = 2;
} else if (name == "循环风机") {
index = 4;
} else if (name == "调配变压器") {
index = 6;
} else if (name == "低压变压器柜器") {
index = 7;
} else if (name == "尾排风机") {
index = 9;
} else if (name == "高温风机") {
index = 10;
} else if (name == "头排风机") {
index = 11;
} else if (name == "煤磨主电机") {
index = 14;
} else if (name == "煤磨排风机") {
index = 15;
} else if (name == "低压变压器柜") {
index = 16;
} else if (name == "余热发电量") {
index = 18;
} else if (name == "余热发电自用电量") {
index = 19;
} else if (name == "1#空压机") {
index = 21;
} else if (name == "2#空压机") {
index = 22;
} else if (name == "3#空压机") {
index = 23;
} else if (name == "4#空压机") {
index = 24;
} else if (name == "富氧燃烧耗电设备") {
index = 26;
}
return index;
}
function sumNum(a, b, c, d) {
let sum = 0;
if (typeof a !== "undefined" && a !== "NaN") {
sum = sum + Number(a);
}
if (typeof b !== "undefined" && a !== "NaN") {
sum = sum + Number(b);
}
if (typeof c !== "undefined" && a !== "NaN") {
sum = sum + Number(c);
}
if (typeof d !== "undefined" && a !== "NaN") {
sum = sum + Number(d);
}
return sum;
}
let obj = {};
['烧成车间','回转窑','高温风机',0,0,0,0,0,0,0,0,0,0,0,0],//9 obj.type = "month_s";
['烧成车间','窑主电机',0,0,0,0,0,0,0,0,0,0,0,0],//10 obj.year_s = that.year;
['烧成车间','篦冷机一室风机电机',0,0,0,0,0,0,0,0,0,0,0,0], obj.page = 0;
['烧成车间','篦冷机三室风机电机',0,0,0,0,0,0,0,0,0,0,0,0], obj.mpoint__ep_monitored__power_kw__gte = 100;
['烧成车间','篦冷机二室风机电机',0,0,0,0,0,0,0,0,0,0,0,0], this.$API.enm.mpoint.stat
['烧成车间','篦冷机一室充气梁风机(左)',0,0,0,0,0,0,0,0,0,0,0,0], .req(obj)
['烧成车间','篦冷机一室充气梁风机(右)',0,0,0,0,0,0,0,0,0,0,0,0],//15 .then((res) => {
['烧成车间','窑头排风机主电机',0,0,0,0,0,0,0,0,0,0,0,0], let wrapArr = [],
['烧成车间','头煤粉罗茨电机(东、备用)',0,0,0,0,0,0,0,0,0,0,0,0], innerArr = [];
['烧成车间','尾煤粉罗茨电机(西)',0,0,0,0,0,0,0,0,0,0,0,0], res.forEach((item) => {
['烧成车间','空压机3301',0,0,0,0,0,0,0,0,0,0,0,0], let month = item.month;
['烧成车间','空压机3308',0,0,0,0,0,0,0,0,0,0,0,0],//20 if (wrapArr[month]) {
['烧成车间','空压机3318',0,0,0,0,0,0,0,0,0,0,0,0],//21 wrapArr[month].push(item);
['烧成车间','回转窑合计',0,0,0,0,0,0,0,0,0,0,0,0], } else {
['烧成车间','煤磨','煤磨主电机',0,0,0,0,0,0,0,0,0,0,0,0], wrapArr[month] = [];
['烧成车间','煤磨排风机主电机',0,0,0,0,0,0,0,0,0,0,0,0], wrapArr[month].push(item);
['烧成车间','煤磨合计',0,0,0,0,0,0,0,0,0,0,0,0],//25 }
['烧成车间','烧成车间合计',0,0,0,0,0,0,0,0,0,0,0,0],//26 });
wrapArr.forEach((inner, inde) => {
['水泥车间','水泥磨','循环风机1906',0,0,0,0,0,0,0,0,0,0,0,0],//27 inner.forEach((item) => {
['水泥车间','系统风机',0,0,0,0,0,0,0,0,0,0,0,0], let i = dataPush(item.mpoint_name);
['水泥车间','水平涡流选粉机1915',0,0,0,0,0,0,0,0,0,0,0,0], let k = 0;
['水泥车间','水泥磨主电机',0,0,0,0,0,0,0,0,0,0,0,0],//30 if (
['水泥车间','辊压机动辊电机',0,0,0,0,0,0,0,0,0,0,0,0], i == 0 ||
['水泥车间','辊压机定辊电机',0,0,0,0,0,0,0,0,0,0,0,0], i == 4 ||
['水泥车间','新增磨尾风机',0,0,0,0,0,0,0,0,0,0,0,0], i == 9 ||
['水泥车间','水泥1#空压机',0,0,0,0,0,0,0,0,0,0,0,0], i == 14 ||
['水泥车间','水泥2#空压机',0,0,0,0,0,0,0,0,0,0,0,0],//35 i == 18 ||
['水泥车间','水泥磨合计计',0,0,0,0,0,0,0,0,0,0,0,0], i == 21 ||
['水泥车间','水泥包装合计',0,0,0,0,0,0,0,0,0,0,0,0],//37 i == 26 ||
['水泥车间','水泥车间合计',0,0,0,0,0,0,0,0,0,0,0,0],//38 i == 27 ||
i == 28
['生活区','食堂',0,0,0,0,0,0,0,0,0,0,0,0],//39 ) {
['生活区','单元楼',0,0,0,0,0,0,0,0,0,0,0,0],//40 k = 3 + inde;
['生活区','单身宿舍',0,0,0,0,0,0,0,0,0,0,0,0], } else {
['生活区','办公楼',0,0,0,0,0,0,0,0,0,0,0,0], k = 2 + inde;
['生活区','余热锅炉',0,0,0,0,0,0,0,0,0,0,0,0], }
['生活区','污水站',0,0,0,0,0,0,0,0,0,0,0,0], that.tableDatas[i][k] = item.val;
['生活区','南门办公区',0,0,0,0,0,0,0,0,0,0,0,0],//45 });
['生活区','东门办公区',0,0,0,0,0,0,0,0,0,0,0,0], });
['生活区','地磅',0,0,0,0,0,0,0,0,0,0,0,0], for (let k = 0; k < 24; k++) {
['生活区','生活区合计',0,0,0,0,0,0,0,0,0,0,0,0], let m = k + 3;
['全厂电量',0,0,0,0,0,0,0,0,0,0,0,0] let n = k + 1;
], //
tableName:'全厂电量月统计', that.tableDatas[3][m] = sumNum(
sourceData:{} that.tableDatas[0][m],
}; that.tableDatas[1][m],
}, that.tableDatas[2][m]
mounted() { );
let that = this; //
var nowDate = new Date(); // that.tableDatas[5][m] = sumNum();
that.year = nowDate.getFullYear(); //
that.search_date = that.year+''; that.tableDatas[8][m] =
this.getData(); sumNum(
}, that.tableDatas[4][m],
methods: { // that.tableDatas[5][m],
dateChange(e){ that.tableDatas[6][m],
let that = this; that.tableDatas[7][m]
that.year = Number(e); ) -
}, sumNum(
getData(){ that.tableDatas[1][m],
let that = this; that.tableDatas[2][m]
function dataPush(name,value){ );
let index=0; //
if(name=='烘干破主电机'){ // that.tableDatas[12][m] = sumNum(
index=0; // that.tableDatas[9][m],
that.tableDatas[0][3] = value; // that.tableDatas[10][m],
}else if(name=='电石渣合计'){ // that.tableDatas[11][m]
index=1; // );
that.tableDatas[1][2] = value; //
}else if(name=='反击式破碎机'){ that.tableDatas[13][m] =
index=2; typeof that.tableDatas[12][m] !== "undefined"
}else if(name=='立磨主电机'){ ? sumNum(
index=3; that.tableDatas[9][m],
}else if(name=='循环风机'){ that.tableDatas[10][m],
index=4; that.tableDatas[11][m],
}else if(name=='废气风机'){ that.tableDatas[12][m]
index=5; )
}else if(name=='尾排风机'){ : sumNum(
index=6; that.tableDatas[9][m],
}else if(name=='原料磨合计'){ that.tableDatas[10][m],
index=7; that.tableDatas[11][m]
}else if(name=='高温风机'){ );
index=9; //
}else if(name=='窑主电机'){ let sum17 = sumNum(
index=10; that.tableDatas[14][m],
}else if(name=='篦冷机一室风机电机'){ that.tableDatas[15][m],
index=11; that.tableDatas[16][m]
}else if(name=='篦冷机三室风机电机'){ );
index=12; that.tableDatas[17][m] =
}else if(name=='篦冷机二室风机电机'){ typeof that.tableDatas[21][m] !== "undefined"
index=13; ? sum17 - that.tableDatas[21][m]
}else if(name=='篦冷机一室充气梁风机(左)'){ : sum17;
index=14; //
}else if(name=='篦冷机一室充气梁风机(右)'){ that.tableDatas[20][m] =
index=15; typeof that.tableDatas[19][m] !== "undefined"
}else if(name=='窑头排风机主电机'){ ? that.tableDatas[18][m] -
index=16; that.tableDatas[19][m]
}else if(name=='头煤粉罗茨电机(东、备用)'){ : that.tableDatas[18][m];
index=17; //
}else if(name=='尾煤粉罗茨电机(西)'){ that.tableDatas[25][m] = sumNum(
index=18; that.tableDatas[21][m],
}else if(name=='空压机3301'){ that.tableDatas[22][m],
index=19; that.tableDatas[23][m],
}else if(name=='空压机3308'){ that.tableDatas[24][m]
index=20; );
}else if(name=='空压机3318'){ //
index=21; that.tableDatas[27][m] = sumNum(
}else if(name=='回转窑合计'){ that.tableDatas[3][m],
index=22; that.tableDatas[8][m],
}else if(name=='煤磨主电机'){ that.tableDatas[13][m],
index=23; that.tableDatas[17][m],
}else if(name=='煤磨排风机主电机'){ that.tableDatas[18][m],
index=24; that.tableDatas[25][m],
}else if(name=='煤磨合计'){ that.tableDatas[26][m]
index=25; );
}else if(name=='循环风机1906'){ //
index=27; // that.tableDatas[28][m] = sumNum(
}else if(name=='系统风机'){ // that.tableDatas[27][m],
index=28; // that.tableDatas[26][m]
}else if(name=='水平涡流选粉机1915'){ // );
index=29; }
}else if(name=='水泥磨主电机'){ that.tableDatas.forEach((inner, inde) => {
index=30; let sum15 = 0;
}else if(name=='辊压机动辊电机'){ inner.forEach((num, ind) => {
index=31; if (ind > 2 && ind < 15) {
}else if(name=='辊压机定辊电机'){ sum15 = sum15 + Number(num);
index=32; }
}else if(name=='新增磨尾风机'){ });
index=33; inner[15] = sum15;
}else if(name=='水泥1#空压机'){ });
index=34; })
}else if(name=='水泥2#空压机'){ .then(() => {});
index=35; },
}else if(name=='水泥磨合计计'){ exportExcel() {
index=36; this.exportLoading = true;
}else if(name=='水泥包装合计'){ this.$XLSX("#myTable", this.tableName);
index=37; this.exportLoading = false;
}else if(name=='食堂'){ },
index=39; handlePrint() {
}else if(name=='单元楼'){ this.$PRINT("#myReport");
index=40; },
}else if(name=='单身宿舍'){ },
index=41; };
}else if(name=='办公楼'){
index=42;
}else if(name=='余热锅炉'){
index=43;
}else if(name=='污水站'){
index=44;
}else if(name=='南门办公区'){
index=45;
}else if(name=='东门办公区'){
index=46;
}else if(name=='生活区合计'){
index=47;
}else if(name=='地磅'){
index=48;
}
return index;
}
function sumNum(a,b,c,d){
let sum = 0;
if(a&&Number(a)){sum=sum+Number(a);}
if(b&&Number(b)){sum=sum+Number(b);}
if(c&&Number(c)){sum=sum+Number(c);}
if(d&&Number(d)){sum=sum+Number(d);}
return sum;
}
let obj = {};
obj.type='month_s';
obj.year_s = that.year;
obj.page = 0;
obj.mpoint__ep_monitored__power_kw__gte=100;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
console.log(res)
let wrapArr = [],innerArr=[];
res.forEach(item=>{
let month = item.month_s;
if(wrapArr[month]){
wrapArr[month].push(item)
}else{
wrapArr[month]=[];
wrapArr[month].push(item);
}
})
console.log(wrapArr)//
wrapArr.forEach((inner,inde)=>{
inner.forEach(item=>{
let i = dataPush(item.mpoint_name);
let k = 0;
if(i==0||i==2||i==9||i==23||i==27){
k = 3+inde;
}else{
k = 2+inde;
}
that.tableDatas[i][k] = item.val;
})
})
for(let k = 0;k<12;k++){
let m = k+2;
let n = k+1;
that.tableDatas[8][m] = sumNum(that.tableDatas[1][m],that.tableDatas[7][m]);
that.tableDatas[26][m] = sumNum(that.tableDatas[22][m],that.tableDatas[25][m]);
that.tableDatas[38][m] = sumNum(that.tableDatas[36][m],that.tableDatas[37][m]);
that.tableDatas[49][n] = sumNum(that.tableDatas[8][m],that.tableDatas[26][m]+ that.tableDatas[38][m]+ that.tableDatas[48][m]);
}
})
},
getTableData(){
for(let i=0;i<this.tableDatas.length;i++){
let k = 0;
if(i==0||i==2||i==9||i==23||i==27){
k = 3;
}else if(i==49){
k = 1;
}else{
k = 2;
}
for (let j = k; j < this.tableDatas[i].length; j++) {
this.tableDatas[i][j]=0;
}
}
this.getData();
},
exportExcel() {
this.exportLoading = true;
this.$XLSX('#myTable', this.tableName)
this.exportLoading = false;
},
handlePrint() {
this.$PRINT('#myReport');
},
}
};
</script> </script>
<style scoped> <style scoped>
.printWrap{ .printWrap {
width: 100%; width: 100%;
overflow-x: scroll; overflow-x: scroll;
} }
</style> </style>