<template>
|
<TableLayout :permissions="['business:ywconditionerbilling:query']">
|
<el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
|
<el-form-item label="设备信息" prop="devKeyword">
|
<el-input v-model="searchForm.devKeyword" placeholder="设备名称/ID" clearable @keypress.enter.native="search" />
|
</el-form-item>
|
<el-form-item label="网关MAC" prop="wgMac">
|
<el-input v-model="searchForm.wgMac" 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:ywconditionerbilling:sync']"
|
@click="handleSync"
|
>同步计费系数</el-button>
|
</li>
|
</ul>
|
<el-table v-loading="isWorking.search" :data="tableData.list" stripe>
|
<el-table-column prop="platformDevId" label="平台设备ID" min-width="110" align="center" />
|
<el-table-column prop="devName" label="设备名称" min-width="140" align="center" show-overflow-tooltip />
|
<el-table-column prop="wgMac" label="网关MAC" min-width="140" align="center" show-overflow-tooltip />
|
<el-table-column label="计费类型" min-width="100" align="center">
|
<template slot-scope="{ row }">{{ formatKwType(row.kwType) }}</template>
|
</el-table-column>
|
<el-table-column prop="fanArg" label="风机系数" min-width="100" align="center" />
|
<el-table-column prop="fanKw" label="风机功率" min-width="100" align="center" />
|
<el-table-column prop="higKw" label="高档功率" min-width="100" align="center" />
|
<el-table-column prop="midKw" label="中档功率" min-width="100" align="center" />
|
<el-table-column prop="lowKw" label="低档功率" min-width="100" align="center" />
|
<el-table-column prop="lastSyncDate" label="最后同步" min-width="160" align="center" />
|
</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 billingApi from '@/api/business/ywconditionerbilling'
|
|
const KW_TYPE_MAP = {
|
0: '时长',
|
1: '能耗',
|
2: '电表'
|
}
|
|
export default {
|
name: 'YwConditionerBilling',
|
extends: BaseTable,
|
components: { TableLayout, Pagination },
|
data () {
|
return {
|
searchForm: {
|
devKeyword: '',
|
wgMac: ''
|
},
|
isSyncing: false
|
}
|
},
|
created () {
|
this.api = billingApi
|
this.module = '空调计费系数'
|
this.configData['field.id'] = 'id'
|
this.configData['field.main'] = 'devName'
|
this.search()
|
},
|
methods: {
|
buildSearchModel () {
|
const model = {}
|
if (this.searchForm.devKeyword) model.devKeyword = this.searchForm.devKeyword
|
if (this.searchForm.wgMac) model.wgMac = this.searchForm.wgMac
|
return model
|
},
|
handlePageChange (pageIndex) {
|
this.tableData.pagination.pageIndex = pageIndex || this.tableData.pagination.pageIndex
|
this.isWorking.search = true
|
billingApi.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 = { devKeyword: '', wgMac: '' }
|
this.search()
|
},
|
formatKwType (val) {
|
return KW_TYPE_MAP[val] != null ? KW_TYPE_MAP[val] : (val == null ? '-' : val)
|
},
|
handleSync () {
|
this.$dialog.actionConfirm('确认从智精灵平台同步全部计费系数吗?', '同步计费系数')
|
.then(() => {
|
this.isSyncing = true
|
billingApi.syncAll()
|
.then(res => {
|
this.$tip.apiSuccess(res || '同步成功')
|
this.search()
|
})
|
.catch(e => this.$tip.apiFailed(e))
|
.finally(() => { this.isSyncing = false })
|
})
|
.catch(() => {})
|
}
|
}
|
}
|
</script>
|