<template>
  <div style="height: calc(100vh - 232px);">
    <Search :is-log-type="isLogType" />
    <el-table
      ref="table"
      :data="crud.data"
      style="width: 100%;"
      height="calc(100vh - 330px)"
    >
      <el-table-column type="index" label="序号" width="55" align="center" />
      <el-table-column prop="cdoorCode" label="安全门设备" />
      <el-table-column prop="inCount" label="进馆人次" />
      <el-table-column prop="outCount" label="出馆人次" />
      <el-table-column prop="LastTime" label="时间">
        <template slot-scope="scope">
          <div>{{ scope.row.LastTime | parseTime }}</div>
        </template>
      </el-table-column>
    </el-table>
    <pagination v-if="crud.data.length !== 0" />
  </div>
</template>

<script>
import CRUD, { presenter, crud, header } from '@crud/crud'
import pagination from '@crud/Pagination'
import Search from '../search.vue'
import { mapGetters } from 'vuex'

export default {
  name: 'LoginLog',
  components: { pagination, Search },
  mixins: [presenter(), crud(), header()],
  cruds() {
    return CRUD({
      url: 'api/accessLog/initSafetyDoorLog',
      sort: [],
      optShow: {
        add: false,
        edit: false,
        del: false,
        download: false,
        reset: false,
        group: false
      }
    })
  },

  data() {
    return {
      isLogType: 'visitor',
      selections: []
    }
  },
  computed: {
    ...mapGetters([
      'user'
    ])
  },
  methods: {
    [CRUD.HOOK.beforeRefresh]() {
      this.crud.query.libcode = this.user.fonds.fondsNo
    }
  }
}
</script>

<style lang="scss" scoped>
::v-deep .el-pagination{
  margin: 24px 0 10px 0 !important
}
</style>
