<template>
|
<TableLayout :permissions="['business:collectionDockDevice:query', 'business:collectionStation:query']">
|
<div ref="QueryFormRef" slot="search-form">
|
<el-form ref="searchForm" :model="searchForm" label-width="100px" inline>
|
<el-form-item label="采集站" prop="stationId">
|
<el-select v-model="searchForm.stationId" placeholder="全部" clearable filterable @change="search">
|
<el-option v-for="item in stationOptions" :key="item.id" :label="item.name" :value="item.id" />
|
</el-select>
|
</el-form-item>
|
<el-form-item label="设备名称" prop="deviceName">
|
<el-input v-model="searchForm.deviceName" placeholder="设备名称" @keypress.enter.native="search" />
|
</el-form-item>
|
<el-form-item label="序列号" prop="shortSerialNumber">
|
<el-input v-model="searchForm.shortSerialNumber" placeholder="短序列号" @keypress.enter.native="search" />
|
</el-form-item>
|
<section>
|
<el-button type="primary" @click="search">搜索</el-button>
|
<el-button @click="reset">重置</el-button>
|
</section>
|
</el-form>
|
</div>
|
|
<template v-slot:table-wrap>
|
<ul class="toolbar">
|
<li>
|
<el-button type="primary" v-permissions="['business:collectionStation:sync']" @click="handleSyncAll">同步全部采集站</el-button>
|
</li>
|
<li>
|
<el-button v-permissions="['business:collectionStation:sync']" :disabled="!searchForm.stationId" @click="handleSyncOne">同步当前采集站</el-button>
|
</li>
|
</ul>
|
<el-table :height="tableHeightNew" v-loading="isWorking.search" :data="tableData.list" stripe>
|
<el-table-column label="序号" width="55"><template slot-scope="scope">{{ scope.$index + 1 }}</template></el-table-column>
|
<el-table-column prop="stationName" label="采集站" min-width="120" />
|
<el-table-column prop="deviceName" label="设备名称" min-width="140" show-overflow-tooltip />
|
<el-table-column prop="deviceId" label="设备ID" min-width="120" show-overflow-tooltip />
|
<el-table-column prop="shortSerialNumber" label="短序列号" min-width="140" />
|
<el-table-column prop="accessDeviceId" label="平台注册ID" min-width="140" show-overflow-tooltip />
|
<el-table-column prop="networkedDevice" label="联网设备" width="90">
|
<template slot-scope="{row}">
|
<span v-if="row.networkedDevice === 1">是</span>
|
<span v-else-if="row.networkedDevice === 0">否</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="lastSyncTime" label="最近同步" min-width="160" />
|
<el-table-column prop="createDate" label="创建时间" min-width="160" />
|
</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 { list as fetchStationList, syncDevices, syncDevice } from '@/api/business/collectionStation'
|
|
export default {
|
name: 'CollectionDockDevice',
|
extends: BaseTable,
|
components: { TableLayout, Pagination },
|
data () {
|
return {
|
stationOptions: [],
|
searchForm: {
|
stationId: null,
|
deviceName: '',
|
shortSerialNumber: ''
|
}
|
}
|
},
|
created () {
|
const stationId = this.$route.query.stationId ? parseInt(this.$route.query.stationId) : null
|
if (stationId) {
|
this.searchForm.stationId = stationId
|
}
|
this.config({
|
module: '执法记录仪',
|
api: '/business/collectionDockDevice',
|
'field.id': 'id',
|
'field.main': 'deviceName'
|
})
|
this.loadStations()
|
this.search()
|
},
|
methods: {
|
loadStations () {
|
fetchStationList({ status: 1 }).then(res => {
|
this.stationOptions = res || []
|
})
|
},
|
handleSyncAll () {
|
syncDevices().then(res => {
|
this.$message.success(res.data || '同步完成')
|
this.search()
|
})
|
},
|
handleSyncOne () {
|
syncDevice(this.searchForm.stationId).then(res => {
|
this.$message.success(res.data || '同步成功')
|
this.search()
|
})
|
}
|
}
|
}
|
</script>
|