<template> 
 | 
    <TableLayout :permissions="['business:device:query']"> 
 | 
        <!-- 搜索表单 --> 
 | 
        <el-form ref="searchForm"  slot="search-form" :model="searchForm" label-width="100px" inline> 
 | 
            <el-form-item title="名称" prop="name"> 
 | 
                <el-input v-model="searchForm.name" placeholder="请输入名称" @keypress.enter.native="search"></el-input> 
 | 
            </el-form-item> 
 | 
            <section> 
 | 
                <el-button type="primary" @click="search">搜索</el-button> 
 | 
                <el-button @click="reset">重置</el-button> 
 | 
            </section> 
 | 
        </el-form> 
 | 
        <!-- 表格和分页 --> 
 | 
        <template v-slot:table-wrap> 
 | 
            <ul class="toolbar"> 
 | 
                <li><el-button type="primary" @click="synchronousData">同步</el-button></li> 
 | 
            </ul> 
 | 
            <el-table 
 | 
                :height="tableHeightNew" 
 | 
                v-loading="isWorking.search" 
 | 
                :data="tableData.list" 
 | 
                stripe 
 | 
            > 
 | 
              <el-table-column label="序号"  width="55" fixed><template slot-scope="scope" >{{scope.$index+1}}</template></el-table-column> 
 | 
                <el-table-column prop="name" label="名称"></el-table-column> 
 | 
                <el-table-column prop="hkId" label="广播点唯一标识" min-width="200"></el-table-column> 
 | 
                <el-table-column prop="channelInfo" label="广播点类型"></el-table-column> 
 | 
                <el-table-column prop="channelNo" label="通道号"></el-table-column> 
 | 
                <el-table-column prop="regionName" label="区域名称"></el-table-column> 
 | 
                <el-table-column prop="hkDate" label="同步时间"></el-table-column> 
 | 
            </el-table> 
 | 
            <pagination 
 | 
                @size-change="handleSizeChange" 
 | 
                @current-change="handlePageChange" 
 | 
                :pagination="tableData.pagination" 
 | 
            > 
 | 
            </pagination> 
 | 
        </template> 
 | 
        <!-- 新建/修改 --> 
 | 
<!--        <OperaDeviceWindow ref="operaDeviceWindow" @success="handlePageChange"/>--> 
 | 
    </TableLayout> 
 | 
</template> 
 | 
  
 | 
<script> 
 | 
import BaseTable from '@/components/base/BaseTable' 
 | 
import TableLayout from '@/layouts/TableLayout' 
 | 
import Pagination from '@/components/common/Pagination' 
 | 
import OperaDeviceWindow from '@/components/business/OperaDeviceWindow' 
 | 
import { syncDevices, updateEntranceById } from '@/api/business/device' 
 | 
export default { 
 | 
  name: 'Device', 
 | 
  extends: BaseTable, 
 | 
  components: { TableLayout, Pagination, OperaDeviceWindow }, 
 | 
  data () { 
 | 
    return { 
 | 
      // 搜索 
 | 
      searchForm: { 
 | 
        doorName: '', 
 | 
        regionPathName: '', 
 | 
        isEntrance: '', 
 | 
        online: '', 
 | 
        type: 3 
 | 
      }, 
 | 
      options: [] 
 | 
    } 
 | 
  }, 
 | 
  created () { 
 | 
    this.config({ 
 | 
      module: '设备信息表', 
 | 
      api: '/business/device', 
 | 
      'field.id': 'id', 
 | 
      'field.main': 'id' 
 | 
    }) 
 | 
    this.search() 
 | 
  }, 
 | 
  methods: { 
 | 
    changeManufature(e, row) { 
 | 
      updateEntranceById({ 
 | 
        id: row.id, 
 | 
        isEntrance: e 
 | 
      }) 
 | 
    }, 
 | 
    synchronousData () { 
 | 
      this.$dialog.actionConfirm('操作确认提醒', '您确认同步全部信息吗?') 
 | 
        .then(() => { 
 | 
          this.isWorking.delete = true 
 | 
          syncDevices({type: 3}) 
 | 
            .then(res => { 
 | 
              this.$tip.apiSuccess(res || '同步成功') 
 | 
              this.search() 
 | 
            }) 
 | 
            .catch(e => { 
 | 
             //  this.$tip.apiFailed(e) 
 | 
            }) 
 | 
            .finally(() => { 
 | 
              this.isWorking.delete = false 
 | 
            }) 
 | 
        }) 
 | 
        .catch(() => {}) 
 | 
    } 
 | 
  } 
 | 
} 
 | 
</script> 
 |