<template>
|
<div class="deviceCalendar_list">
|
<!-- 查询区域 -->
|
<div>
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24" style="width: 100%">
|
<a-col :md="4" :sm="4">
|
<a-form-item label="日期">
|
<a-date-picker @change="dateParamChange" v-model="createDate" :disabledDate="disabledDate"
|
:allowClear="false"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="2" :sm="2" :xs="2">
|
<a-space>
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
<a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
|
<a-button type="primary" icon="download" @click="handleExportXls('设备负载报表')">导出</a-button>
|
</a-space>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
</div>
|
|
<div style="overflow: hidden;width: 100%;margin-top: 20px;flex: 1" id="DeviceList">
|
<a-table ref="table" bordered :scroll="{x:'max-content',y:scrollY}"
|
size="middle" rowKey="id" :columns="columns"
|
@change="handleTableChange" class="ant-table-striped"
|
:dataSource="dataSource" :pagination="ipagination"
|
:loading="loading" :row-class-name="(_record, index) => (index % 2 === 1 ? 'table-striped' : null)"/>
|
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import moment from 'moment'
|
import { putAction, getAction } from '@/api/manage'
|
import {
|
JeecgListMixin
|
} from '@/mixins/JeecgListMixin'
|
|
export default {
|
name: 'EquipmentLoadReportList',
|
components: {},
|
mixins: [JeecgListMixin],
|
data() {
|
return {
|
disableMixinCreated: true,
|
createDate: null,
|
axisList: [
|
{
|
'name': 1,
|
'value': 'X'
|
},
|
{
|
'name': 2,
|
'value': 'Y'
|
},
|
{
|
'name': 3,
|
'value': 'Z'
|
},
|
{
|
'name': 4,
|
'value': 'A'
|
},
|
{
|
'name': 5,
|
'value': 'B'
|
}
|
],
|
queryParam: {},
|
scrollY: 465,
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key: 'rowIndex',
|
width: 60,
|
align: 'center',
|
customRender: function(t, r, index) {
|
return parseInt(index) + 1
|
}
|
},
|
{
|
title: '设备名称',
|
align: 'center',
|
dataIndex: 'equipmentname',
|
width: 150
|
},
|
{
|
title: '设备编号',
|
align: 'center',
|
dataIndex: 'equipmentid',
|
width: 150
|
},
|
{
|
title: 'X坐标值',
|
align: 'center',
|
dataIndex: 'axisx',
|
width: 100
|
},
|
{
|
title: 'Y坐标值',
|
align: 'center',
|
dataIndex: 'axisy',
|
width: 100
|
},
|
{
|
title: 'Z坐标值',
|
align: 'center',
|
dataIndex: 'axisz',
|
width: 100
|
},
|
{
|
title: 'A坐标值',
|
align: 'center',
|
dataIndex: 'axisa',
|
width: 100
|
},
|
{
|
title: 'B坐标值',
|
align: 'center',
|
dataIndex: 'axisb',
|
width: 100
|
},
|
{
|
title: '最大负载',
|
align: 'center',
|
dataIndex: 'spindleload',
|
width: 150
|
},
|
{
|
title: '主轴转速',
|
align: 'center',
|
dataIndex: 'spindlespeed',
|
width: 150
|
},
|
{
|
title: '时间',
|
align: 'center',
|
dataIndex: 'createdate',
|
width: 150
|
},
|
],
|
dataList: [],
|
url: {
|
list: '/mdc/equipmentSpindleStatistical/list',
|
exportXlsUrl: '/mdc/equipmentSpindleStatistical/exportXls'
|
}
|
}
|
},
|
props: { node: {}, Type: '' },
|
created() {
|
this.searchReset()
|
},
|
mounted() {
|
window.addEventListener('resize', this.handleWindowResize)
|
this.handleWindowResize()
|
},
|
beforeDestroy() {
|
window.removeEventListener('resize', this.handleWindowResize)
|
},
|
watch: {
|
Type(valmath) {
|
this.dataList = []
|
this.queryParam.typeTree = valmath
|
// console.log(this.queryParams.typeTree)
|
},
|
node(val) { //监听currSelected 变化,将变化后的数值传递给 getCurrSelected 事件
|
if (JSON.stringify(val) != '{}') {
|
if (val.equipmentId != null) {
|
this.queryParam.equipmentId = val.equipmentId
|
this.queryParam.parentId = ' '
|
this.ipagination.current = 1
|
this.loadData()
|
} else {
|
this.queryParam.parentId = val.key
|
this.queryParam.equipmentId = null
|
this.ipagination.current = 1
|
this.loadData()
|
}
|
}
|
}
|
},
|
methods: {
|
dateParamChange(v1, v2) {
|
this.queryParam.createDate = v2
|
},
|
disabledDate(current) {
|
return current > moment().startOf('day')
|
},
|
searchQuery() {
|
this.loadData()
|
},
|
searchReset() {
|
this.createDate = moment().subtract('day', 1)
|
this.queryParam = {
|
createDate: this.createDate.format('YYYY-MM-DD')
|
}
|
this.loadData()
|
},
|
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
|
}
|
params.typeTree = '1'
|
params.parentId = this.queryParam.parentId
|
params.equipmentId = this.queryParam.equipmentId
|
params.orderByName = 'ascend'
|
this.loading = true
|
getAction(this.url.list, params).then((res) => {
|
if (res.success) {
|
// console.log(res)
|
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
|
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.$notification.warning({
|
message: '消息',
|
description:res.message
|
})
|
}
|
}).finally(() => {
|
this.loading = false
|
})
|
},
|
|
handleWindowResize() {
|
const boxHeight = +window.getComputedStyle(document.getElementById('DeviceList')).height.slice(0, -2)
|
const tableHeadHeight = +window.getComputedStyle(document.querySelector('.ant-table-thead th')).height.slice(0, -2)
|
this.scrollY = boxHeight - tableHeadHeight - 50
|
}
|
}
|
}
|
</script>
|
<style scoped>
|
.deviceCalendar_list {
|
overflow: hidden;
|
display: flex;
|
flex-direction: column;
|
}
|
|
@media screen and (min-width: 1920px) {
|
.deviceCalendar_list {
|
height: 812px !important;
|
}
|
}
|
|
@media screen and (min-width: 1680px) and (max-width: 1920px) {
|
.deviceCalendar_list {
|
height: 812px !important;
|
}
|
}
|
|
@media screen and (min-width: 1400px) and (max-width: 1680px) {
|
.deviceCalendar_list {
|
height: 664px !important;
|
}
|
}
|
|
@media screen and (min-width: 1280px) and (max-width: 1400px) {
|
.deviceCalendar_list {
|
height: 565px !important;
|
}
|
}
|
|
@media screen and (max-width: 1280px) {
|
.deviceCalendar_list {
|
height: 565px !important;
|
}
|
}
|
|
.ant-table-striped /deep/ .table-striped td {
|
background-color: #fafafa;
|
}
|
</style>
|