<template>
|
<TableLayout :permissions="['business:ywconditionermeter:query']">
|
<el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
|
<el-form-item label="设备信息" prop="keyword">
|
<el-input v-model="searchForm.keyword" placeholder="电表名称/地址" clearable @keypress.enter.native="search" />
|
</el-form-item>
|
<el-form-item label="网关MAC" prop="wgMacFilter">
|
<el-input v-model="searchForm.wgMacFilter" placeholder="网关MAC" clearable @keypress.enter.native="search" />
|
</el-form-item>
|
<section>
|
<el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
|
<el-button icon="el-icon-refresh" @click="reset">重置</el-button>
|
</section>
|
</el-form>
|
<template v-slot:table-wrap>
|
<ul class="toolbar">
|
<li>
|
<el-button
|
type="primary"
|
:loading="isSyncing"
|
v-permissions="['business:ywconditionermeter:sync']"
|
@click="handleSync"
|
>同步电表</el-button>
|
</li>
|
</ul>
|
<el-table v-loading="isWorking.search" :data="tableData.list" stripe>
|
<el-table-column prop="dbName" label="电表名称" min-width="130" align="center" show-overflow-tooltip />
|
<el-table-column prop="dbAdr" label="表地址" min-width="120" align="center" show-overflow-tooltip />
|
<el-table-column prop="wgMac" label="网关MAC" min-width="140" align="center" show-overflow-tooltip />
|
<el-table-column label="多联机MAC" min-width="180" align="center" show-overflow-tooltip>
|
<template slot-scope="{ row }">{{ formatNum(row.dljMac) }}</template>
|
</el-table-column>
|
<el-table-column label="波特率" min-width="80" align="center">
|
<template slot-scope="{ row }">{{ formatNum(row.btl) }}</template>
|
</el-table-column>
|
<el-table-column label="是否校验" min-width="100" align="center">
|
<template slot-scope="{ row }">{{ formatJy(row.jy) }}</template>
|
</el-table-column>
|
<el-table-column prop="dbBb" label="变比" min-width="80" align="center" />
|
<el-table-column prop="xyName" label="协议" min-width="100" align="center" show-overflow-tooltip />
|
<el-table-column prop="standbyShare" label="待机分摊" min-width="100" align="center" show-overflow-tooltip />
|
<el-table-column prop="outdoorLoop" label="外机回路" min-width="90" align="center" />
|
<el-table-column label="累计电能" min-width="110" align="center">
|
<template slot-scope="{ row }">{{ formatNum(row.totalDl) }}</template>
|
</el-table-column>
|
<el-table-column label="操作" min-width="160" align="center" fixed="right">
|
<template slot-scope="{ row }">
|
<el-button
|
type="text"
|
:loading="operatingId === row.id && operateType === 'energy'"
|
v-permissions="['business:ywconditionermeter:operate']"
|
@click="queryEnergy(row)"
|
>查电量</el-button>
|
<el-button
|
type="text"
|
:loading="operatingId === row.id && operateType === 'power'"
|
v-permissions="['business:ywconditionermeter:operate']"
|
@click="queryPower(row)"
|
>查功率</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<pagination
|
@size-change="handleSizeChange"
|
@current-change="handlePageChange"
|
:pagination="tableData.pagination"
|
/>
|
</template>
|
</TableLayout>
|
</template>
|
|
<script>
|
import BaseTable from '@/components/base/BaseTable'
|
import TableLayout from '@/layouts/TableLayout'
|
import Pagination from '@/components/common/Pagination'
|
import * as meterApi from '@/api/business/ywconditionermeter'
|
|
export default {
|
name: 'YwConditionerMeter',
|
extends: BaseTable,
|
components: { TableLayout, Pagination },
|
data () {
|
return {
|
searchForm: {
|
keyword: '',
|
wgMacFilter: ''
|
},
|
isSyncing: false,
|
operatingId: null,
|
operateType: ''
|
}
|
},
|
created () {
|
this.api = meterApi
|
this.module = '空调电表'
|
this.configData['field.id'] = 'id'
|
this.configData['field.main'] = 'dbName'
|
this.search()
|
},
|
methods: {
|
buildSearchModel () {
|
const model = {}
|
if (this.searchForm.keyword) model.keyword = this.searchForm.keyword
|
if (this.searchForm.wgMacFilter) model.wgMacFilter = this.searchForm.wgMacFilter
|
return model
|
},
|
handlePageChange (pageIndex) {
|
this.tableData.pagination.pageIndex = pageIndex || this.tableData.pagination.pageIndex
|
this.isWorking.search = true
|
meterApi.fetchList({
|
page: this.tableData.pagination.pageIndex,
|
capacity: this.tableData.pagination.pageSize,
|
model: this.buildSearchModel(),
|
sorts: this.tableData.sorts
|
})
|
.then(data => {
|
this.tableData.list = data.records || []
|
this.tableData.pagination.total = data.total || 0
|
})
|
.catch(() => {})
|
.finally(() => { this.isWorking.search = false })
|
},
|
reset () {
|
this.searchForm = { keyword: '', wgMacFilter: '' }
|
this.search()
|
},
|
formatNum (val) {
|
if (val === null || val === undefined || val === '') return '-'
|
return val
|
},
|
formatJy (val) {
|
if (val === null || val === undefined || val === '') return '-'
|
return Number(val) === 1 ? '1-校验' : '0-无校验'
|
},
|
handleSync () {
|
this.$dialog.actionConfirm('确认从智精灵平台同步全部电表吗?', '同步电表')
|
.then(() => {
|
this.isSyncing = true
|
meterApi.syncAll()
|
.then(res => {
|
this.$tip.apiSuccess(res || '同步成功')
|
this.search()
|
})
|
.catch(e => this.$tip.apiFailed(e))
|
.finally(() => { this.isSyncing = false })
|
})
|
.catch(() => {})
|
},
|
queryEnergy (row) {
|
this.operatingId = row.id
|
this.operateType = 'energy'
|
meterApi.queryEnergy(row.id)
|
.then(res => {
|
this.$tip.apiSuccess(res || '查电量成功')
|
this.search()
|
})
|
.catch(e => this.$tip.apiFailed(e))
|
.finally(() => {
|
this.operatingId = null
|
this.operateType = ''
|
})
|
},
|
queryPower (row) {
|
this.operatingId = row.id
|
this.operateType = 'power'
|
meterApi.queryPower(row.id)
|
.then(res => {
|
this.$tip.apiSuccess(res || '查功率成功')
|
this.search()
|
})
|
.catch(e => this.$tip.apiFailed(e))
|
.finally(() => {
|
this.operatingId = null
|
this.operateType = ''
|
})
|
}
|
}
|
}
|
</script>
|