<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="5" :sm="5">
|
<a-form-item label="开始时间">
|
<a-date-picker show-time @change="startTimeParamChange" v-model="startTime" :allowClear="false"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="5" :sm="5">
|
<a-form-item label="结束时间">
|
<a-date-picker show-time @change="endTimeParamChange" v-model="endTime" :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="rowIndex" :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: 'EquipmentAlarmSortList',
|
components: {},
|
mixins: [JeecgListMixin],
|
data() {
|
return {
|
disableMixinCreated: true,
|
startTime: null,
|
endTime: null,
|
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: 'equipmentId',
|
width: 150
|
},
|
{
|
title: '设备名称',
|
align: 'center',
|
dataIndex: 'equipmentName',
|
width: 150
|
},
|
{
|
title: '日期',
|
align: 'center',
|
dataIndex: 'collecttime',
|
width: 150
|
},
|
{
|
title: '报警编号',
|
align: 'center',
|
dataIndex: 'alarmNo',
|
width: 150
|
},
|
{
|
title: '报警描述',
|
align: 'center',
|
dataIndex: 'alarmContent',
|
width: 500
|
}
|
],
|
dataList: [],
|
url: {
|
list: '/mdc/equipmentAlarm/list',
|
exportXlsUrl: '/mdc/equipmentAlarm/exportXls'
|
}
|
}
|
},
|
props: { node: {}, Type: '' },
|
created() {
|
this.startTime = moment().startOf('day')
|
this.endTime = moment()
|
this.queryParam.startTime = this.startTime.format('YYYY-MM-DD HH:mm:ss')
|
this.queryParam.endTime = this.endTime.format('YYYY-MM-DD HH:mm:ss')
|
this.queryParam.typeTree = '1'
|
this.loadData()
|
},
|
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: {
|
startTimeParamChange(v1, v2) {
|
this.queryParam.startTime = v2
|
},
|
endTimeParamChange(v1, v2) {
|
this.queryParam.endTime = v2
|
},
|
searchQuery() {
|
const dateDiff = this.endTime.diff(this.startTime, 'day')
|
if (dateDiff <= 7) {
|
this.loadData()
|
} else {
|
this.$notification.info({
|
message: '消息',
|
description: '最多只能选择7天'
|
})
|
}
|
},
|
searchReset() {
|
this.startTime = moment().startOf('day')
|
this.endTime = moment()
|
this.queryParam = {
|
startTime: this.startTime.format('YYYY-MM-DD HH:mm:ss'),
|
endTime: this.endTime.format('YYYY-MM-DD HH:mm:ss'),
|
sortFlag: true
|
}
|
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.startTime = this.queryParam.startTime
|
params.endTime = this.queryParam.endTime
|
params.parentId = this.queryParam.parentId
|
params.equipmentId = this.queryParam.equipmentId
|
params.orderByName = 'ascend'
|
params.sortFlag = true
|
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;
|
}
|
|
/deep/ .ant-col .ant-form-item-control-wrapper .ant-form-item-control .ant-form-item-children .ant-calendar-picker {
|
width: 100%;
|
min-width: 0 !important;
|
}
|
</style>
|