<template>
  <div class="app-container">
    <el-table
      v-loading="listLoading"
      ref="multipleTable"
      :data="varList"
      :row-key="getRowKey"
      :header-cell-style="{
        'font-weight': 'bold',
        'color': '#000'
      }"
      tooltip-effect="dark"
      border
      fit
      highlight-current-row
    >
      <el-table-column
        :reserve-selection="true"
        type="selection"
        width="55"
        align="center"/>
      <el-table-column type="index" label="序号" width="50" align="center" />
      <el-table-column prop="NAME" label="姓名"/>
      <el-table-column prop="PHONE" label="手机号"/>
      <el-table-column prop="cardNumber" label="证件号码"/>
      <el-table-column prop="channelName" label="口门名称"/>
      <el-table-column prop="departmentName" label="部门名称"/>
      <el-table-column prop="inOrOut" label="进出状态"/>
      <el-table-column prop="personCode" label="人员编号"/>
      <el-table-column prop="personType" label="人员身份"/>
      <el-table-column prop="personType" label="人员身份"/>
      <el-table-column prop="regionName" label="区域名称"/>
      <el-table-column prop="reportTime" label="上报时间"/>
    </el-table>
    <div class="page-btn-group">
      <div/><div/>
      <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
    </div>
    <div class="ui-foot">
      <el-button type="primary" @click="goBack">返 回</el-button>
    </div>
  </div>
</template>

<script>
import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包
import { requestFN } from '@/utils/request'
import waves from '@/directive/waves' // waves directive
export default{
  components: { Pagination },
  directives: { waves },
  data() {
    return {
      listQuery: {
        page: 1,
        limit: 10
      },
      areaList: [], // 省市县列表
      placeList: [],
      listLoading: true,
      varList: [],
      typeList: [
        { ID: '0', NAME: '监管端' },
        { ID: '1', NAME: '企业端' },
        { ID: '2', NAME: '相关方端' }
      ],
      total: 0,
      title: '',
      isShow: false,
      USER_ID: this.$parent.USER_ID,
      form: {
        USER_NAME: '',
        CORPINFO_NAME: '',
        DEPARTMENT_NAME: '',
        USER_TYPE: ''
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getRowKey(row) {
      return row.USER_ID
    },
    // 搜索
    getQuery() {
      this.$refs.multipleTable.clearSelection()
      this.getList()
    },
    // 重置
    reset() {
      this.form = {
        USER_NAME: '',
        PHONE: '',
        ID_CARD: '',
        CORPINFO_NAME: '',
        DEPARTMENT_NAME: '',
        VISIT_START_TIME: '',
        VISIT_END_TIME: '',
        DOOR_NAME: ''
      }
      this.getList()
    },
    // 获取列表
    getList() {
      this.listLoading = true
      requestFN(
        '/mkmjManagement/checkEntryAndExitRecords?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page,
        {
          USER_ID: this.USER_ID
        }

      ).then((data) => {
        console.log(data)
        this.listLoading = false
        this.varList = data.recordList
        this.total = data.page.totalResult
        this.hasButton()
      }).catch((e) => {
        this.listLoading = false
      })
    },
    goBack() {
      this.$parent.activeName = 'List'
    }
  }

}
</script>

