<template>
|
<a-card :bordered="false" class="device_list">
|
<!-- 查询区域 -->
|
<div style="width: 100%; background-color: #fff" class="table-page-search-wrapper">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24">
|
<a-col :md="6" :sm="6">
|
<a-form-item label="时间">
|
<a-range-picker @change="dateParamChange" :disabledDate="disabledDate" format="YYYY-MM-DD" v-model="dates"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="2" :sm="3" :xs="3">
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
</a-col>
|
<a-col :md="2" :sm="2" :xs="2">
|
<a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
|
</a-col>
|
<a-col :md="5" :sm="5" :xs="5">
|
<a-button type="primary" icon="download" @click="handleExportXls('设备实时监控统计表')">导出</a-button>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
|
<!--table区域-->
|
<div>
|
<a-table ref="table" bordered size="middle" :rowKey="(record,index) => {return index}" :columns="columns"
|
:scroll="{y: 600}" :dataSource="dataSource" :pagination="false" :loading="loading"
|
@change="handleTableChange">
|
</a-table>
|
</div>
|
<!-- table区域-end -->
|
</a-card>
|
</template>
|
|
<script>
|
import moment from 'moment'
|
import { filterObj } from '@/utils/util'
|
import {
|
requestPut,
|
deleteAction,
|
getAction,
|
postAction,
|
putAction,
|
downFile,
|
downFileExcl
|
} from '@/api/manage'
|
import '@/components/table2excel/table2excel'
|
import {
|
JeecgListMixin
|
} from '@/mixins/JeecgListMixin'
|
export default {
|
name: 'RealTimeMonitoringEquipment',
|
mixins: [JeecgListMixin],
|
components: {
|
|
},
|
data() {
|
return {
|
dates: [],
|
queryParams:{},
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key: 'rowIndex',
|
width: 60,
|
align: "center",
|
customRender: function (t, r, index) {
|
return parseInt(index) + 1;
|
}
|
},
|
{
|
title: '部门',
|
align: 'center',
|
dataIndex: 'sectionName'
|
},
|
{
|
title: '设备数量',
|
align: 'center',
|
dataIndex: 'equipmentNumber'
|
},
|
{
|
title: '利用率(%)',
|
align: 'center',
|
dataIndex: 'useRate',
|
|
},
|
{
|
title: '白班利用率(%)',
|
align: 'center',
|
dataIndex: 'useRateDayShift'
|
},
|
{
|
title: '其他班利用率(%)',
|
align: 'center',
|
dataIndex: 'useRateotherShift'
|
},
|
{
|
title: '班次工时(h)',
|
align: 'center',
|
dataIndex: 'totalTime'
|
},
|
{
|
title: '运行时长(h)',
|
align: 'center',
|
dataIndex: 'processingTime'
|
},
|
{
|
title: '待机时长(h)',
|
align: 'center',
|
dataIndex: 'idleTime'
|
},
|
{
|
title: '报警时长(h)',
|
align: 'center',
|
dataIndex: 'faultTime'
|
},
|
],
|
url: {
|
list: '/mdc/mdcRate/rateShiftDates',
|
exportXlsUrl:'/mdc/mdcRate/rateShiftExportXls'
|
}
|
}
|
},
|
methods: {
|
getQueryParams() {
|
//获取查询条件
|
let sqp = {}
|
if(this.superQueryParams){
|
sqp['superQueryParams']=encodeURI(this.superQueryParams)
|
sqp['superQueryMatchType'] = this.superQueryMatchType
|
}
|
var param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters);
|
param.field = this.getQueryField();
|
param.pageNo = this.ipagination.current;
|
param.pageSize = this.ipagination.pageSize;
|
param.startTime = this.queryParams.startTime
|
param.endTime = this.queryParams.endTime
|
|
return filterObj(param);
|
},
|
loadData(arg) {
|
this.dataSource = []
|
if(!this.url.list){
|
this.$message.error("请设置url.list属性!")
|
return
|
}
|
//加载数据 若传入参数1则加载第一页的内容
|
if (arg === 1) {
|
this.ipagination.current = 1;
|
}
|
var params = this.getQueryParams();//查询条件
|
if(!params){
|
return false;
|
}
|
this.loading = true;
|
postAction(this.url.list, params).then((res) => {
|
if (res.success) {
|
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
for (var i = 0; i < res.result.length;i++){
|
res.result[i].useRateDayShift = this.numFilter(res.result[i].useRateDayShift)
|
res.result[i].useRateotherShift = this.numFilter(res.result[i].useRateotherShift)
|
res.result[i].useRate = this.numFilter(res.result[i].useRate)
|
}
|
this.dataSource = res.result.records||res.result;
|
if(res.result.total)
|
{
|
this.ipagination.total = res.result.total;
|
}else{
|
this.ipagination.total = 0;
|
}
|
//update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
}else{
|
this.$message.warning(res.message)
|
}
|
}).finally(() => {
|
this.loading = false
|
})
|
},
|
disabledDate(current){
|
//Can not slect days after today and today
|
return current && current > moment().subtract('days', 1);
|
},
|
numFilter(value) {
|
if (value) {
|
return parseFloat((value * 100).toFixed(2))
|
} else {
|
return '0'
|
}
|
},
|
searchReset() {
|
this.dates = [];
|
this.queryParams = {}
|
this.loadData();
|
},
|
dateParamChange(v1, v2) {
|
this.queryParams.startTime = v2[0]
|
this.queryParams.endTime = v2[1]
|
},
|
searchQuery() {
|
this.dataSource = []
|
this.loadData(1);
|
},
|
handleExportXls(fileName){
|
if(!fileName || typeof fileName != "string"){
|
fileName = "导出文件"
|
}
|
/*let param = this.getQueryParams2();*/
|
// if(this.selectedRowKeys && this.selectedRowKeys.length>0){
|
// param['selections'] = this.selectedRowKeys.join(",")
|
// }
|
let params = {};
|
params.startTime = this.queryParams.startTime
|
params.endTime = this.queryParams.endTime
|
// console.log("导出参数",params)
|
downFile(this.url.exportXlsUrl,params).then((data)=>{
|
if (!data) {
|
this.$message.warning("文件下载失败")
|
return
|
}
|
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls')
|
}else{
|
let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
|
let link = document.createElement('a')
|
link.style.display = 'none'
|
link.href = url
|
link.setAttribute('download', fileName+'.xls')
|
document.body.appendChild(link)
|
link.click()
|
document.body.removeChild(link); //下载完成移除元素
|
window.URL.revokeObjectURL(url); //释放掉blob对象
|
}
|
})
|
},
|
},
|
created() {
|
this.dates = [moment().subtract('days', 3), moment().subtract('days', 1)]
|
this.queryParams.startTime = moment(this.dates[0]).format('YYYY-MM-DD')
|
this.queryParams.endTime = moment(this.dates[1]).format('YYYY-MM-DD')
|
this.loadData()
|
}
|
}
|
</script>
|
|
<style lang="less" scoped>
|
@import '~@assets/less/common.less';
|
|
|
</style>
|