<template>
  <div class="table-container">
    <el-table ref="table" :data="list.slice((offset-1)*limit,offset*limit)" size="small" class="table" border>
      <el-table-column :index="indexMethod" align="center" label="排序" type="index" width="80"/>
      <el-table-column align="center" label="事件/部件" prop="eorc"/>
      <el-table-column align="center" label="大类/小类" prop="caseType"/>
      <el-table-column align="center" label="上报数" prop="caseNum"/>
    </el-table>
    <div class="pagination-container">
      <el-pagination
        :current-page="offset"
        :page-sizes="[10,20,30,50]"
        :page-size="limit"
        :total="list.length"
        align="center"
        layout="total, sizes, prev, pager, next"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"/>
    </div>
  </div>

</template>

<script>
export default {
  name: 'HighFreqList',
  props: {
    list: {
      type: Array,
      default() {
        return []
      }
    }
  },
  data() {
    return {
      offset: 1,
      limit: 10
    }
  },
  methods: {
    indexMethod(index) {
      return this.limit * (this.offset - 1) + index + 1
    },
    // 改变页容量
    handleSizeChange(val) {
      this.offset = 1
      this.limit = val
    },
    // 改变当前页
    handleCurrentChange(val) {
      this.offset = val
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .table{
    margin-bottom: 20px;
  }
  /*.pagination-container{*/
    /*padding-bottom: 50px;*/
  /*}*/
  .table-title{
    /*background-color:rgba(243, 243, 243, 1);*/
    background-color:#fff;
    .title-header{
      font-size: 15px;
      i{
        margin-left: 10px;
        margin-right: 5px;
      }
      i:focus{
        outline: none;
      }
    }
  }
  .edit_btns{
    padding-top:7px;
    padding-right:5px;
    text-align: right;
  }
  .popper-div{
    line-height: 1.5;
    .popper-btns{
      margin-top:10px;
    }
  }
  .table-container {
    border: 0 !important;
  }
</style>
