<template>
|
<el-dialog
|
:title="'上下线记录 - ' + (gateway.wgMac || '')"
|
:visible.sync="visible"
|
width="720px"
|
append-to-body
|
@open="load"
|
>
|
<el-table v-loading="loading" :data="list" stripe size="small" max-height="400">
|
<el-table-column prop="wgMac" label="网关MAC" min-width="140" align="center" show-overflow-tooltip />
|
<el-table-column prop="oldStatus" label="原状态" min-width="90" align="center" />
|
<el-table-column prop="newStatus" label="新状态" min-width="90" align="center">
|
<template slot-scope="{ row }">
|
<span :class="row.newStatus === '在线' ? 'green' : 'red'">{{ row.newStatus || '-' }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="logTime" label="记录时间" min-width="160" align="center" />
|
<el-table-column prop="source" label="来源" min-width="90" align="center" />
|
</el-table>
|
<pagination
|
class="mt10"
|
@size-change="onSizeChange"
|
@current-change="onPageChange"
|
:pagination="pagination"
|
/>
|
</el-dialog>
|
</template>
|
|
<script>
|
import Pagination from '@/components/common/Pagination'
|
import { gatewayLogPage } from '@/api/business/ywconditionergateway'
|
|
export default {
|
name: 'YwConditionerGatewayLogWindow',
|
components: { Pagination },
|
data () {
|
return {
|
visible: false,
|
loading: false,
|
gateway: {},
|
list: [],
|
pagination: {
|
pageIndex: 1,
|
pageSize: 10,
|
total: 0
|
}
|
}
|
},
|
methods: {
|
open (row) {
|
this.gateway = { ...row }
|
this.pagination.pageIndex = 1
|
this.visible = true
|
},
|
load () {
|
if (!this.gateway.id && !this.gateway.wgMac) return
|
this.loading = true
|
const model = {}
|
if (this.gateway.id) model.gatewayId = this.gateway.id
|
if (this.gateway.wgMac) model.wgMac = this.gateway.wgMac
|
gatewayLogPage({
|
page: this.pagination.pageIndex,
|
capacity: this.pagination.pageSize,
|
model,
|
sorts: []
|
})
|
.then(data => {
|
this.list = data.records || []
|
this.pagination.total = data.total || 0
|
})
|
.catch(() => {})
|
.finally(() => { this.loading = false })
|
},
|
onPageChange (page) {
|
this.pagination.pageIndex = page || 1
|
this.load()
|
},
|
onSizeChange (size) {
|
this.pagination.pageSize = size
|
this.pagination.pageIndex = 1
|
this.load()
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.mt10 { margin-top: 10px; }
|
.green { color: #67c23a; }
|
.red { color: #f56c6c; }
|
</style>
|