<template>
  <div class="app-container">

    <el-table
      v-loading="loading"
      :data="userList"
      style="width: 100%;"
    >
      <el-table-column label="序号" type="index" align="center">
        <template slot-scope="scope">
          <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
        </template>
      </el-table-column>
      <el-table-column label="标识符" align="center" prop="id" width="100"/>
      <el-table-column label="名称" align="center" prop="first"/>
    </el-table>

    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
                @pagination="getList"/>
  </div>
</template>

<script>
  import { listUser } from '@/api/activiti/user/index'

  export default {
    name: 'User',
    data() {
      return {
        // 遮罩层
        loading: true,
        // 总条数
        total: 0,
        // 表格数据
        userList: [],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10
        }
      }
    },
    created() {
      this.getList()
    },
    methods: {
      /** 查询登录日志列表 */
      getList() {
        this.loading = true
        listUser(this.queryParams).then(response => {
          this.userList = response.rows
          this.total = response.total
          this.loading = false
        })
      }
    }
  }
</script>
