<template>
|
<GlobalWindow title="控制历史" :visible.sync="visible" width="900px" :show-confirm="false">
|
<p class="device-info" v-if="device.id">{{ device.name || device.code }} · {{ device.wgMac }}</p>
|
<el-table v-loading="loading" :data="list" stripe size="small" max-height="420">
|
<el-table-column prop="id" label="ID" width="70" align="center" />
|
<el-table-column label="操作类型" min-width="100" align="center">
|
<template slot-scope="{ row }">{{ formatActionType(row.actionType) }}</template>
|
</el-table-column>
|
<el-table-column prop="actionContent" label="操作描述" min-width="180" show-overflow-tooltip align="center" />
|
<el-table-column label="结果" width="80" align="center">
|
<template slot-scope="{ row }">
|
<span :class="row.resultStatus === 1 ? 'green' : 'red'">{{ row.resultStatus === 1 ? '成功' : '失败' }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="resultMsg" label="说明" min-width="120" show-overflow-tooltip align="center" />
|
<el-table-column prop="createDate" label="时间" min-width="150" align="center" />
|
</el-table>
|
<pagination
|
class="mt10"
|
@size-change="onSizeChange"
|
@current-change="onPageChange"
|
:pagination="pagination"
|
/>
|
</GlobalWindow>
|
</template>
|
|
<script>
|
import GlobalWindow from '@/components/common/GlobalWindow'
|
import Pagination from '@/components/common/Pagination'
|
import { historyPage } from '@/api/business/ywconditioner'
|
|
const ACTION_TYPE_MAP = {
|
1: '开关',
|
2: '模式',
|
3: '风速',
|
4: '温度',
|
5: '锁定',
|
6: '查电量',
|
7: '查功率'
|
}
|
|
export default {
|
name: 'YwConditionerHistoryWindow',
|
components: { GlobalWindow, Pagination },
|
data () {
|
return {
|
visible: false,
|
loading: false,
|
device: {},
|
list: [],
|
pagination: {
|
pageIndex: 1,
|
pageSize: 10,
|
total: 0
|
}
|
}
|
},
|
methods: {
|
open (row) {
|
this.device = { ...row }
|
this.pagination.pageIndex = 1
|
this.visible = true
|
this.load()
|
},
|
load () {
|
if (!this.device.id) return
|
this.loading = true
|
historyPage({
|
page: this.pagination.pageIndex,
|
capacity: this.pagination.pageSize,
|
model: { conditionerId: this.device.id },
|
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()
|
},
|
formatActionType (val) {
|
return ACTION_TYPE_MAP[val] || val || '-'
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.device-info { margin-bottom: 12px; color: #606266; }
|
.mt10 { margin-top: 10px; }
|
.green { color: #67c23a; }
|
.red { color: #f56c6c; }
|
</style>
|