<template>
|
<el-dialog :visible.sync="editDialogVisible" :modal-append-to-body="false" :close-on-click-modal="false" :title="title+'历史记录'" center width="75%">
|
<div style="display: flex">
|
<div class="basic_search">
|
<span>按时间查询:</span>
|
<el-date-picker
|
value-format="yyyy-MM-dd HH:mm:ss"
|
v-model="validTime"
|
type="daterange"
|
:default-time="['00:00:00','23:59:59']"
|
range-separator="-"
|
start-placeholder="开始日期"
|
end-placeholder="结束日期"
|
>
|
</el-date-picker>
|
</div>
|
<div class="basic_search" style="margin: 0 10px">
|
<span>状态:</span>
|
<el-select v-model="listQuery.filter.deviceWarning" clearable filterable>
|
<el-option key="1" label="正常" :value="0"></el-option>
|
<el-option key="2" label="异常" :value="1"></el-option>
|
</el-select>
|
</div>
|
<div class="basic_search">
|
<el-button style="margin-left: 10px;" type="primary" @click="reset()">重置</el-button>
|
<el-button style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="search()">查询</el-button>
|
</div>
|
</div>
|
<br/>
|
<div class="table_content">
|
<el-table
|
:key="tableKey"
|
:data="dataList"
|
border
|
fit
|
highlight-current-row
|
style="width: 100%;"
|
>
|
<el-table-column label="浓度值" prop="realValue" align="center">
|
<template slot-scope="scope">
|
<span v-if="title == '温度'">{{scope.row.realValue}}℃</span>
|
<span v-else>{{scope.row.realValue}}%RH</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="状态" prop="deviceWarning" align="center">
|
<template slot-scope="scope">
|
<el-tag type="success" v-if="scope.row.deviceWarning == 0">正常</el-tag>
|
<el-tag type="danger" v-else>异常</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column label="时间" align="center">
|
<template slot-scope="scope">
|
{{scope.row.syncTime?scope.row.syncTime:scope.row.createDate }}
|
</template>
|
</el-table-column>
|
</el-table>
|
<br/>
|
<div style="display: flex;justify-content: right">
|
<el-pagination
|
v-show="recordTotal>0"
|
:current-page="currentPage"
|
:page-sizes="[10, 20, 30, 50]"
|
:page-size="listQuery.pageSize"
|
:total="recordTotal"
|
layout="total, sizes, prev, pager, next, jumper"
|
background
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
/>
|
</div>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button type="primary" @click="editDialogVisible = false">确 认</el-button>
|
</span>
|
</el-dialog>
|
</template>
|
|
<script>
|
import {updateStorehouseData} from "../../../../api/warehouse";
|
import {getHumidityPage, getOriginalPerson, getTemperaturePage} from "../../../../api/monitorAlert";
|
|
export default {
|
name: "thDialog",
|
data() {
|
return {
|
editDialogVisible: false,
|
title: '',
|
tableKey: '',
|
recordTotal: 0,
|
currentPage: 1,
|
dataList: [],
|
validTime: [],
|
listQuery: {
|
filter:{
|
deviceId: null,
|
deviceWarning: null,
|
createDateStart: '',
|
createDateEnd: ''
|
},
|
pageIndex:1,
|
pageSize:10
|
}
|
}
|
},
|
created() {
|
const t = this
|
},
|
methods: {
|
open(type,data){
|
this.editDialogVisible = true
|
this.dataList = []
|
this.listQuery.filter.deviceId = data.deviceId
|
this.title = type
|
this.getDataList()
|
},
|
async getDataList() {
|
this.listQuery.filter.createDateStart = this.validTime[0]?this.validTime[0]:''
|
this.listQuery.filter.createDateEnd = this.validTime[1]?this.validTime[1]:''
|
if(this.title == '温度'){
|
getTemperaturePage(this.listQuery).then((res)=>{
|
if(res.data.code == "200"){
|
const data = res.data.result
|
if(Array.isArray(data.records)){
|
this.dataList = data.records
|
this.recordTotal = data.total
|
this.currentPage = data.current
|
}else{
|
this.dataList = []
|
}
|
}else{
|
this.$message({
|
type: 'warning',
|
message: res.data.message
|
})
|
}
|
})
|
}else{
|
getHumidityPage(this.listQuery).then((res)=>{
|
if(res.data.code == "200"){
|
const data = res.data.result
|
if(Array.isArray(data.records)){
|
this.dataList = data.records
|
}else{
|
this.dataList = []
|
}
|
}else{
|
this.$message({
|
type: 'warning',
|
message: res.data.message
|
})
|
}
|
})
|
}
|
},
|
handleSizeChange: function(val) {
|
this.listQuery.pageSize = val
|
this.getDataList()
|
},
|
handleCurrentChange: function(val) {
|
this.listQuery.pageIndex = val
|
this.getDataList()
|
},
|
reset(){
|
this.listQuery.filter.deviceWarning = null
|
this.listQuery.filter.createDateStart = ''
|
this.listQuery.filter.createDateEnd = ''
|
this.validTime = []
|
this.listQuery.pageIndex = 1
|
this.listQuery.pageSize = 10
|
this.getDataList()
|
},
|
search(){
|
this.listQuery.pageIndex = 1
|
this.getDataList()
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.part-title{
|
font-size: 16px;
|
font-weight: bolder;
|
}
|
.selector{
|
/deep/ .el-form-item__content{
|
margin-left: 0 !important;
|
}
|
}
|
.form{
|
.el-form-item{
|
display: flex !important;
|
}
|
/deep/ .el-form-item__content{
|
width: 100%;
|
margin-left: 0 !important;
|
}
|
}
|
|
.numInput{
|
/deep/ .el-input__inner{
|
padding-right: 0;
|
}
|
}
|
</style>
|