factory_web/src/views/enm_slag/power.vue

211 lines
7.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container">
<el-header>
<div class="left-panel">
<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 ref="print" id="myReport" class="printContainer">
<h3 style="text-align: center;">主要设备100KW以上单位产品电耗数据表</h3>
<table border="1" width="1000" cellspacing="0" :key="timeStamp" id="myTable">
<thead style="background: #efefef;height: 40px;">
<tr>
<th>设备名称</th>
<th>设备编号</th>
<th>单位</th>
<th>上个小时</th>
<th>昨日</th>
<th>本月</th>
</tr>
</thead>
<tbody>
<tr v-for="(item) in tableDatas" :key="item">
<td class="numCell">{{item.name}}</td>
<td class="numCell">{{item.number}}</td>
<td class="numCell">{{item.unit}}</td>
<td class="numCell hoursItem" @click="itemClick('hours',item)" style="background: rgba(238, 179, 179, 0.8);">{{item.hours}}</td>
<td class="numCell monthItem" @click="itemClick('month',item)" style="background: rgba(238, 189, 124, 0.8);">{{item.days}}</td>
<td class="numCell yearItem" @click="itemClick1('year',item)" style="background: rgba(186, 236, 135, 0.8);">{{item.month}}</td>
</tr>
</tbody>
</table>
</div>
<sc-dialog v-model="chartShow" draggable title="创建/编辑人员证书">
<div class="searchHead" v-if="type=='hours'">
<el-date-picker
v-model="query.start_time"
type="date"
placeholder="选择时间"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
:picker-options="pickerOptions"
/>
<span class="middleText">至</span>
<el-date-picker
v-model="query.end_time"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
start-placeholder="结束日期"
:picker-options="pickerOptions"
/>
<el-button type="primary" class="searchBtn" @click="dataSearch">查询</el-button>
</div>
<div class="searchHead" v-if="type=='days'">
<el-date-picker
v-model="query.start_time"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
start-placeholder="开始日期"
:picker-options="pickerOptions"
/>
<el-date-picker
v-model="query.end_time"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
start-placeholder="结束日期"
:picker-options="pickerOptions"
/>
<el-button type="primary" class="searchBtn" @click="dataSearch">查询</el-button>
</div>
<div class="searchHead" v-if="type=='month'">
<el-date-picker
v-model="query.start_time"
type="month"
format="YYYY-MM"
value-format="YYYY-MM"
start-placeholder="开始月份"
:picker-options="pickerOptions"
/>
<el-date-picker
v-model="query.end_time"
type="month"
format="YYYY-MM"
value-format="YYYY-MM"
start-placeholder="结束月份"
:picker-options="pickerOptions"
/>
<el-button type="primary" class="searchBtn" @click="dataSearch">查询</el-button>
</div>
<scEcharts height="360px" :option="myOption" v-if="chartShow"></scEcharts>
</sc-dialog>
<charts
v-if="asynDialog"
:type="type"
:title="title"
:modelValue="modelValue"
:showClose="showClose"
:echartType='echartType'
@closed="asynDialog = false"
></charts>
</el-card>
</div>
</template>
<script>
import scEcharts from "@/components/scEcharts";
import { defineAsyncComponent } from 'vue'
export default {
components: {
scEcharts,
charts: defineAsyncComponent(() => import("@/components/scEnm/lineChartsdialog.vue")),
},
data() {
return {
chartShow: false,
myOption: null,
timeStamp:0,
listQuery:{
belong_dept:'',
task2__year:'',
page:0
},
query:{
time:''
},
tableName:'主要设备100KW以上单位产品电耗数据表',
tableDatas:[
{name:'烘干破主电机',number:'NM001',unit:'KW·h/t',hours:'120',days:'2000',month:'60000'},
],
modelValue:true,
type:'hours',
title:'title',
apiObj:'',
showClose:true,
echartType:'line',
asynDialog:false,
};
},
mounted() {
},
methods: {
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>
.printContainer{
width: 1075px;
}
#numTable{
margin-left: 37px;
}
#numTable td{
height: 32px;
padding-left: 5px;
}
.numCell{
width: 80px;
height: 35px;
}
.numCell.numCell_last{
width: 100px;
}
.searchHead{
display:flex
}
.middleText{
height: 32px;
line-height: 32px;
margin: 0 5px;
display: inline-block;
}
.searchBtn{
margin-left: 5px;
}
</style>