添加电量小时、日、月统计报表

This commit is contained in:
shijing 2023-08-24 16:31:35 +08:00
parent 67aa47adb8
commit 00e3fde1d4
5 changed files with 1157 additions and 32 deletions

View File

@ -544,6 +544,36 @@ const routes = [
"perms": ["enm"]
},
"component": "ungrouped/electric"
},
{
"name": "electricHour",
"path": "/ungrouped/electricHour",
"meta": {
"title": "全厂电量小时统计",
"icon": "el-icon-grid",
"perms": ["enm"]
},
"component": "ungrouped/electric_hour"
},
{
"name": "electricDay",
"path": "/ungrouped/electricDay",
"meta": {
"title": "全厂电量日统计",
"icon": "el-icon-grid",
"perms": ["enm"]
},
"component": "ungrouped/electric_day"
},
{
"name": "electricMonth",
"path": "/ungrouped/electricMonth",
"meta": {
"title": "全厂电量月统计",
"icon": "el-icon-grid",
"perms": ["enm"]
},
"component": "ungrouped/electric_month"
}
]
},

View File

@ -128,34 +128,75 @@
<el-button type="primary" :loading="isSaveing" @click="submit2">保存</el-button>
</el-footer>
</el-tab-pane>
<el-tab-pane label="能源" name="third">
其他能源输入
<el-tab-pane label="其他成本" name="third">
<div v-if="mgroupId=='3346491835287007232'||mgroupId=='3347217651339837440'||mgroupId=='3347217246321065984'">
<el-form
ref="thirdForms"
:model="thirdForm"
label-width="100px"
label-position="right"
>
<!-- 电石渣 -->
<el-row v-if="mgroupId=='3346491835287007232'">
<el-col :md="12" :sm="24">
<el-form-item label="湿电石渣">
<el-input-number v-model="thirdForm.num" controls-position="right" placeholder="湿电石渣" />
</el-form-item>
</el-col>
</el-row>
<!-- 回转窑 -->
<el-row v-if="mgroupId=='3347217246321065984'">
<el-col :md="12" :sm="24">
<el-form-item label="柴油">
<el-input-number v-model="thirdForm.num" controls-position="right" placeholder="柴油" />
</el-form-item>
</el-col>
</el-row>
<!-- 水泥磨 -->
<el-row v-if="mgroupId=='3347217651339837440'">
<el-col :md="12" :sm="24">
<el-form-item label="助剂">
<el-input-number v-model="thirdForm.num" controls-position="right" placeholder="助剂" />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="包装">
<el-input-number v-model="thirdForm.num" controls-position="right" placeholder="包装" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer style="text-align: center;">
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
</el-footer>
</div>
<div v-else style="width: 100%;height: 200px;line-height: 200px;text-align: center;">
无其他成本
</div>
</el-tab-pane>
<el-tab-pane label="异常" name="fourth">
<scTable
<el-table
ref="expTable"
:apiObj="apiObj"
:data="sflogexpList"
row-key="id"
stripe
highlightCurrentRow
hideDo
hidePagination
>
<el-table-column type="index" width="50"/>
<el-table-column label="发生时间" prop="happen_time"></el-table-column>
<el-table-column label="原因类别" prop="cate"></el-table-column>
<el-table-column label="异常名称" prop="title"></el-table-column>
<el-table-column label="事件原因" prop="reason"></el-table-column>
<el-table-column label="处置措施" prop="measure"></el-table-column>
<el-table-column label="停机时长" prop="duration"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="120">
<template #default="scope">
<el-button link size="small" @click="sflogexp_edit(scope.row)" type="primary">编辑</el-button>
<el-divider direction="vertical"></el-divider>
<el-button link size="small" @click="sflogexp_delete(scope.row)" type="danger">删除</el-button>
</template>
</el-table-column>
</scTable>
<el-table-column type="index" width="50"/>
<el-table-column label="发生时间" prop="happen_time"></el-table-column>
<el-table-column label="原因类别" prop="cate"></el-table-column>
<el-table-column label="异常名称" prop="title"></el-table-column>
<el-table-column label="事件原因" prop="reason"></el-table-column>
<el-table-column label="处置措施" prop="measure"></el-table-column>
<el-table-column label="停机时长" prop="duration"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="120">
<template #default="scope">
<el-button link size="small" @click="sflogexp_edit(scope.row)" type="primary">编辑</el-button>
<el-divider direction="vertical"></el-divider>
<el-button link size="small" @click="sflogexp_delete(scope.row)" type="danger">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog :title="expTitle" v-model="visible">
<el-form
ref="expForms"
@ -233,7 +274,6 @@
</el-tab-pane>
</el-tabs>
</el-card>
</el-main>
</el-container>
</template>
@ -261,6 +301,9 @@ import otherDialog from "./other_form.vue";
sflogItem:{},
form:{
},
thirdForm:{
num:''
},
expForm:{
happen_time:'',
@ -287,18 +330,13 @@ import otherDialog from "./other_form.vue";
apiObj:this.$API.wpm.sflogexp.list
};
},
created(){
let form = this.$TOOL.data.get("sflogItem")
this.form = JSON.parse(form);
query.stlog = this.form.id;
},
mounted(){
this.deptId = this.$route.query.deptId;
this.mgroupId = this.$route.query.mgroupId;
let form = this.$TOOL.data.get("sflogItem")
this.form = JSON.parse(form);
this.getTeam();
this.getSflogexp();
},
methods: {
handleClick(e){
@ -312,9 +350,9 @@ import otherDialog from "./other_form.vue";
let that = this;
let form ={};
form.page = 0;
form.belong_dept = this.deptId;
this.$API.mtm.team.list.req(form).then(res=>{
this.teamOptions = res;
form.belong_dept = that.deptId;
that.$API.mtm.team.list.req(form).then(res=>{
that.teamOptions = res;
})
},
teamChange(data){
@ -374,7 +412,7 @@ import otherDialog from "./other_form.vue";
getSflogexp(){
let obj = {};
obj.page = 0;
obj.stlog = this.form.id;
obj.sflog = this.form.id;
this.$API.wpm.sflogexp.list.req(obj).then(res=>{
this.sflogexpList = res;
})

View File

@ -0,0 +1,354 @@
<!-- 全厂电量统计 -->
<template>
<div class="app-container">
<el-header>
<div class="left-panel">
<el-date-picker
v-model="search_date"
type="month"
value-format="YYYY-MM"
format="YYYY-MM"
placeholder="月"
style="margin-right: 6px;"
@change="dateChange"
/>
<el-button
type="primary"
icon="el-icon-search"
@click="getTableData"
></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="3300" cellspacing="0" :key="timeStamp" id="myTable" class="myTable">
<thead class="myTableHead">
<tr>
<th :colspan="headerLength">全厂电量日统计</th>
</tr>
<tr>
<th>车间</th>
<th>工段</th>
<th>设备</th>
<th v-for="item in days" :key="item">{{ item }}</th>
</tr>
</thead>
<tr v-for="(item,index) in tableDatas" :key="index">
<td class="numCell" v-if="index==0" rowspan="9">{{item[0]}}</td>
<td class="numCell" v-else-if="index==9" rowspan="18">{{item[0]}}</td>
<td class="numCell" v-else-if="index==27" rowspan="12">{{item[0]}}</td>
<td class="numCell" v-else-if="index==39" rowspan="10" colspan="2">{{item[0]}}</td>
<td class="numCell" v-else-if="index==49" colspan="3">{{item[0]}}</td>
<td class="numCell" v-if="index==8||index==26||index==37||index==38" colspan="2">{{item[1]}}</td>
<td class="numCell" v-else-if="index==0" rowspan="2">{{item[1]}}</td>
<td class="numCell" v-else-if="index==2" rowspan="6">{{item[1]}}</td>
<td class="numCell" v-else-if="index==9" rowspan="14">{{item[1]}}</td>
<td class="numCell" v-else-if="index==23" rowspan="3">{{item[1]}}</td>
<td class="numCell" v-else-if="index==27" rowspan="10">{{item[1]}}</td>
<td class="numCell" v-else>{{item[1]}}</td>
<td class="numCell">{{item[2]}}</td>
<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>
</template>
</tr>
</table>
</div>
</div>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
year:'',
month:'',
days:'',
search_date:'',
headerLength:33,
tableDatas:[
['原料车间','电石渣','烘干破主电机'],//0
['原料车间','电石渣合计'],
['原料车间','原料磨','反击式破碎机'],//2
['原料车间','立磨主电机'],
['原料车间','循环风机'],
['原料车间','废气风机'],//5
['原料车间','尾排风机'],
['原料车间','原料磨合计'],
['原料车间','原料车间合计'],//8
['烧成车间','回转窑','高温风机'],//9
['烧成车间','窑主电机'],//10
['烧成车间','篦冷机一室风机电机'],
['烧成车间','篦冷机三室风机电机'],
['烧成车间','篦冷机二室风机电机'],
['烧成车间','篦冷机一室充气梁风机(左)'],
['烧成车间','篦冷机一室充气梁风机(右)'],//15
['烧成车间','窑头排风机主电机'],
['烧成车间','头煤粉罗茨电机(东、备用)'],
['烧成车间','尾煤粉罗茨电机(西)'],
['烧成车间','空压机3301'],
['烧成车间','空压机3308'],//20
['烧成车间','空压机3318'],//21
['烧成车间','回转窑合计'],
['烧成车间','煤磨','煤磨主电机'],
['烧成车间','煤磨排风机主电机'],
['烧成车间','煤磨合计'],//25
['烧成车间','烧成车间合计'],//26
['水泥车间','水泥磨','循环风机1906'],//27
['水泥车间','系统风机'],
['水泥车间','水平涡流选粉机1915'],
['水泥车间','水泥磨主电机'],//30
['水泥车间','辊压机动辊电机'],
['水泥车间','辊压机定辊电机'],
['水泥车间','新增磨尾风机'],
['水泥车间','水泥1#空压机'],
['水泥车间','水泥2#空压机'],//35
['水泥车间','水泥磨合计计'],
['水泥车间','水泥包装合计'],//37
['水泥车间','水泥车间合计'],//38
['生活区','食堂'],//39
['生活区','单元楼'],//40
['生活区','单身宿舍'],
['生活区','办公楼'],
['生活区','余热锅炉'],
['生活区','污水站'],
['生活区','南门办公区'],//45
['生活区','东门办公区'],
['生活区','地磅'],
['生活区','生活区合计'],
['全厂电量']
],
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();
let month0 = that.month>9?that.month :'0'+that.month ;
that.search_date = that.year+'-'+month0;
that.headerLength = that.days+3;
let tableDatas = that.tableDatas;
this.$nextTick(()=>{
for (let i = 0; i < tableDatas.length; i++) {
for (let j = 0; j < that.days; j++) {
let k = 0;
if(i==0||i==2||i==9||i==23||i==27){
k = 3+j;
}else{
k = 2+j;
}
that.tableDatas[i].push(0);
this.$forceUpdate();
}
}
})
// that.$set(that.$data,'tableDatas',tableDatas);
this.getData();
},
methods: {
dateChange(e){
let that = this;
let arr = e.split('-')
that.year = Number(arr[0]);
that.month = Number(arr[1]);
},
getData(){
let that = this;
function dataPush(name,value){
let index=0;
if(name=='烘干破主电机'){
index=0;
that.tableDatas[0][3] = value;
}else if(name=='电石渣合计'){
index=1;
that.tableDatas[1][2] = value;
}else if(name=='反击式破碎机'){
index=2;
}else if(name=='立磨主电机'){
index=3;
}else if(name=='循环风机'){
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>
<style scoped>
.printWrap{
width: 100%;
overflow-x: scroll;
}
</style>

View File

@ -0,0 +1,364 @@
<!-- 全厂电量统计 -->
<template>
<div class="app-container">
<el-header>
<div class="left-panel">
<el-date-picker
v-model="search_date"
type="date"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
placeholder="天"
style="margin-right: 6px;"
@change="dateChange"
/>
<el-button
type="primary"
icon="el-icon-search"
@click="getTableData"
></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="2700" cellspacing="0" :key="timeStamp" id="myTable" class="myTable">
<thead class="myTableHead">
<tr>
<th colspan="27">全厂电量小时统计</th>
</tr>
<tr>
<th>车间</th>
<th>工段</th>
<th>设备</th>
<th v-for="item in 24" :key="item">{{ item }}</th>
</tr>
</thead>
<tr v-for="(item,index) in tableDatas" :key="index">
<td class="numCell" v-if="index==0" rowspan="9">{{item[0]}}</td>
<td class="numCell" v-else-if="index==9" rowspan="18">{{item[0]}}</td>
<td class="numCell" v-else-if="index==27" rowspan="12">{{item[0]}}</td>
<td class="numCell" v-else-if="index==39" rowspan="10" colspan="2">{{item[0]}}</td>
<td class="numCell" v-else-if="index==49" colspan="3">{{item[0]}}</td>
<td class="numCell" v-if="index==8||index==26||index==37||index==38" colspan="2">{{item[1]}}</td>
<td class="numCell" v-else-if="index==0" rowspan="2">{{item[1]}}</td>
<td class="numCell" v-else-if="index==2" rowspan="6">{{item[1]}}</td>
<td class="numCell" v-else-if="index==9" rowspan="14">{{item[1]}}</td>
<td class="numCell" v-else-if="index==23" rowspan="3">{{item[1]}}</td>
<td class="numCell" v-else-if="index==27" rowspan="10">{{item[1]}}</td>
<td class="numCell" v-else>{{item[1]}}</td>
<td class="numCell">{{item[2]}}</td>
<td class="numCell">{{item[3]}}</td>
<td class="numCell">{{item[4]}}</td>
<td class="numCell">{{item[5]}}</td>
<td class="numCell">{{item[6]}}</td>
<td class="numCell">{{item[7]}}</td>
<td class="numCell">{{item[8]}}</td>
<td class="numCell">{{item[9]}}</td>
<td class="numCell">{{item[10]}}</td>
<td class="numCell">{{item[11]}}</td>
<td class="numCell">{{item[12]}}</td>
<td class="numCell">{{item[13]}}</td>
<td class="numCell">{{item[14]}}</td>
<td class="numCell">{{item[15]}}</td>
<td class="numCell">{{item[16]}}</td>
<td class="numCell">{{item[17]}}</td>
<td class="numCell">{{item[18]}}</td>
<td class="numCell">{{item[19]}}</td>
<td class="numCell">{{item[20]}}</td>
<td class="numCell">{{item[21]}}</td>
<td class="numCell">{{item[22]}}</td>
<td class="numCell">{{item[23]}}</td>
<td class="numCell">{{item[24]}}</td>
<td class="numCell" v-if="item[25]!==null&&item[25]!==undefined">{{item[25]}}</td>
<td class="numCell" v-if="item[26]!==null&&item[26]!==undefined">{{item[26]}}</td>
<td class="numCell" v-if="item[27]!==null&&item[27]!==undefined">{{item[27]}}</td>
</tr>
</table>
</div>
</div>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
year:'',
month:'',
day:'',
search_date:'',
tableDatas:[
['原料车间','电石渣','烘干破主电机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ],//0
['原料车间','电石渣合计',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ],
['原料车间','原料磨','反击式破碎机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//2
['原料车间','立磨主电机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['原料车间','循环风机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['原料车间','废气风机' ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//5
['原料车间','尾排风机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['原料车间','原料磨合计' ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['原料车间','原料车间合计',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//8
['烧成车间','回转窑','高温风机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//9
['烧成车间','窑主电机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//10
['烧成车间','篦冷机一室风机电机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','篦冷机三室风机电机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','篦冷机二室风机电机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','篦冷机一室充气梁风机(左)',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','篦冷机一室充气梁风机(右)',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//15
['烧成车间','窑头排风机主电机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','头煤粉罗茨电机(东、备用)',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','尾煤粉罗茨电机(西)',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','空压机3301',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','空压机3308',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//20
['烧成车间','空压机3318',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//21
['烧成车间','回转窑合计',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','煤磨','煤磨主电机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','煤磨排风机主电机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','煤磨合计',0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0],//26
['水泥车间','水泥磨','循环风机1906',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//27
['水泥车间','系统风机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','水平涡流选粉机1915',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','水泥磨主电机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//30
['水泥车间','辊压机动辊电机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','辊压机定辊电机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','新增磨尾风机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','水泥1#空压机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','水泥2#空压机',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//35
['水泥车间','水泥磨合计计',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','水泥包装合计',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//37
['水泥车间','水泥车间合计',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],//38
['生活区','食堂',0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0],//40
['生活区','单身宿舍',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['生活区','办公楼',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['生活区','余热锅炉',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['生活区','污水站',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['生活区','南门办公区',0,0,0,0,0,0,0,0,0,0,0,0,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],
['生活区','地磅',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['生活区','生活区合计',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
['全厂电量',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
],
tableName:'全厂电量小时统计',
sourceData:{}
};
},
mounted() {
let that = this;
var nowDate = new Date();
that.year = nowDate.getFullYear();
that.month = nowDate.getMonth()+1;
that.day = nowDate.getDate();
let month0 = that.month>9?that.month :'0'+that.month ;
that.search_date = that.year+'-'+month0+'-'+that.day;
this.getData();
},
methods: {
dateChange(e){
let that = this;
let arr = e.split('-')
that.year = Number(arr[0]);
that.month = Number(arr[1]);
that.day = Number(arr[2]);
},
getData(){
let that = this;
function dataPush(name,value){
let index=0;
if(name=='烘干破主电机'){
index=0;
that.tableDatas[0][3] = value;
}else if(name=='电石渣合计'){
index=1;
that.tableDatas[1][2] = value;
}else if(name=='反击式破碎机'){
index=2;
}else if(name=='立磨主电机'){
index=3;
}else if(name=='循环风机'){
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='hour_s';
obj.year_s = that.year;
obj.month_s = that.month;
obj.day_s = that.day;
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 hour = item.hour;
if(wrapArr[hour]){
wrapArr[hour].push(item)
}else{
wrapArr[hour]=[];
wrapArr[hour].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<24;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]);
}
}).then(()=>{ })
},
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>
<style scoped>
.printWrap{
width: 100%;
overflow-x: scroll;
}
</style>

View File

@ -0,0 +1,339 @@
<!-- 全厂电量统计 -->
<template>
<div class="app-container">
<el-header>
<div class="left-panel">
<el-date-picker
v-model="search_date"
type="year"
value-format="YYYY"
format="YYYY"
placeholder="年"
style="margin-right: 6px;"
@change="dateChange"
/>
<el-button
type="primary"
icon="el-icon-search"
@click="getTableData"
></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="1500" cellspacing="0" :key="timeStamp" id="myTable" class="myTable">
<thead class="myTableHead">
<tr>
<th colspan="15">全厂电量月统计</th>
</tr>
<tr>
<th>车间</th>
<th>工段</th>
<th>设备</th>
<th v-for="month in 12" :key="month">{{month}}</th>
</tr>
</thead>
<tr v-for="(item,index) in tableDatas" :key="index">
<td class="numCell" v-if="index==0" rowspan="9">{{item[0]}}</td>
<td class="numCell" v-else-if="index==9" rowspan="18">{{item[0]}}</td>
<td class="numCell" v-else-if="index==27" rowspan="12">{{item[0]}}</td>
<td class="numCell" v-else-if="index==39" rowspan="10" colspan="2">{{item[0]}}</td>
<td class="numCell" v-else-if="index==49" colspan="3">{{item[0]}}</td>
<td class="numCell" v-if="index==8||index==26||index==37||index==38" colspan="2">{{item[1]}}</td>
<td class="numCell" v-else-if="index==0" rowspan="2">{{item[1]}}</td>
<td class="numCell" v-else-if="index==2" rowspan="6">{{item[1]}}</td>
<td class="numCell" v-else-if="index==9" rowspan="14">{{item[1]}}</td>
<td class="numCell" v-else-if="index==23" rowspan="3">{{item[1]}}</td>
<td class="numCell" v-else-if="index==27" rowspan="10">{{item[1]}}</td>
<td class="numCell" v-else>{{item[1]}}</td>
<td class="numCell">{{item[2]}}</td>
<td class="numCell">{{item[3]}}</td>
<td class="numCell">{{item[4]}}</td>
<td class="numCell">{{item[5]}}</td>
<td class="numCell">{{item[6]}}</td>
<td class="numCell">{{item[7]}}</td>
<td class="numCell">{{item[8]}}</td>
<td class="numCell">{{item[9]}}</td>
<td class="numCell">{{item[10]}}</td>
<td class="numCell">{{item[11]}}</td>
<td class="numCell">{{item[12]}}</td>
<td class="numCell" v-if="item[13]!==null&&item[13]!==undefined">{{item[13]}}</td>
<td class="numCell" v-if="item[14]!==null&&item[14]!==undefined">{{item[14]}}</td>
</tr>
</table>
</div>
</div>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
year:'',
search_date:'',
tableDatas:[
['原料车间','电石渣','烘干破主电机',0,0,0,0,0,0,0,0,0,0,0,0],//0
['原料车间','电石渣合计',0,0,0,0,0,0,0,0,0,0,0,0],
['原料车间','原料磨','反击式破碎机',0,0,0,0,0,0,0,0,0,0,0,0],//2
['原料车间','立磨主电机',0,0,0,0,0,0,0,0,0,0,0,0],
['原料车间','循环风机',0,0,0,0,0,0,0,0,0,0,0,0],
['原料车间','废气风机' ,0,0,0,0,0,0,0,0,0,0,0,0],//5
['原料车间','尾排风机',0,0,0,0,0,0,0,0,0,0,0,0],
['原料车间','原料磨合计' ,0,0,0,0,0,0,0,0,0,0,0,0],
['原料车间','原料车间合计',0,0,0,0,0,0,0,0,0,0,0,0],//8
['烧成车间','回转窑','高温风机',0,0,0,0,0,0,0,0,0,0,0,0],//9
['烧成车间','窑主电机',0,0,0,0,0,0,0,0,0,0,0,0],//10
['烧成车间','篦冷机一室风机电机',0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','篦冷机三室风机电机',0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','篦冷机二室风机电机',0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','篦冷机一室充气梁风机(左)',0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','篦冷机一室充气梁风机(右)',0,0,0,0,0,0,0,0,0,0,0,0],//15
['烧成车间','窑头排风机主电机',0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','头煤粉罗茨电机(东、备用)',0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','尾煤粉罗茨电机(西)',0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','空压机3301',0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','空压机3308',0,0,0,0,0,0,0,0,0,0,0,0],//20
['烧成车间','空压机3318',0,0,0,0,0,0,0,0,0,0,0,0],//21
['烧成车间','回转窑合计',0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','煤磨','煤磨主电机',0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','煤磨排风机主电机',0,0,0,0,0,0,0,0,0,0,0,0],
['烧成车间','煤磨合计',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
['水泥车间','水泥磨','循环风机1906',0,0,0,0,0,0,0,0,0,0,0,0],//27
['水泥车间','系统风机',0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','水平涡流选粉机1915',0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','水泥磨主电机',0,0,0,0,0,0,0,0,0,0,0,0],//30
['水泥车间','辊压机动辊电机',0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','辊压机定辊电机',0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','新增磨尾风机',0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','水泥1#空压机',0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','水泥2#空压机',0,0,0,0,0,0,0,0,0,0,0,0],//35
['水泥车间','水泥磨合计计',0,0,0,0,0,0,0,0,0,0,0,0],
['水泥车间','水泥包装合计',0,0,0,0,0,0,0,0,0,0,0,0],//37
['水泥车间','水泥车间合计',0,0,0,0,0,0,0,0,0,0,0,0],//38
['生活区','食堂',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
['生活区','单身宿舍',0,0,0,0,0,0,0,0,0,0,0,0],
['生活区','办公楼',0,0,0,0,0,0,0,0,0,0,0,0],
['生活区','余热锅炉',0,0,0,0,0,0,0,0,0,0,0,0],
['生活区','污水站',0,0,0,0,0,0,0,0,0,0,0,0],
['生活区','南门办公区',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],
['生活区','生活区合计',0,0,0,0,0,0,0,0,0,0,0,0],
['全厂电量',0,0,0,0,0,0,0,0,0,0,0,0]
],
tableName:'全厂电量月统计',
sourceData:{}
};
},
mounted() {
let that = this;
var nowDate = new Date();
that.year = nowDate.getFullYear();
that.search_date = that.year+'';
this.getData();
},
methods: {
dateChange(e){
let that = this;
that.year = Number(e);
},
getData(){
let that = this;
function dataPush(name,value){
let index=0;
if(name=='烘干破主电机'){
index=0;
that.tableDatas[0][3] = value;
}else if(name=='电石渣合计'){
index=1;
that.tableDatas[1][2] = value;
}else if(name=='反击式破碎机'){
index=2;
}else if(name=='立磨主电机'){
index=3;
}else if(name=='循环风机'){
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='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>
<style scoped>
.printWrap{
width: 100%;
overflow-x: scroll;
}
</style>