<template>

  <el-page-header content="系统日志" style="margin-bottom: 30px" @back="this.$router.push('/Login')"/>
  <el-card style="max-width: 1200px;margin:0 auto;background-color: #f9fafb">
    <!--表格展示-->
    <div style="margin-top: 20px">
      <el-table :data="list" border stripe v-loading="loading">
        <el-table-column align="center" prop="id" label="ID"/>
        <el-table-column align="center" prop="content" label="请求方法"/>
        <el-table-column align="center" prop="date" label="时间"/>
        <el-table-column align="center" prop="cost" label="耗时"/>
      </el-table>
    </div>
    <el-pagination
        @size-change="getLog"
        @current-change="getLog"
        v-model:current-page="pageNum"

        v-model:page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
    </el-pagination>
  </el-card>

</template>

<script>

let formData = new FormData;
export default {
  name: "Log",
  data() {
    return {
      loading: true,
      isEdit: false,

      pageSize: 30,
      pageNum: 1,
      total: 0,

      list: [],
      dialogVisibleForAdd: false,
    }
  },
  mounted() {
    this.getLog();
  },
  methods: {
    getLog() {
      this.loading = true;
      this.list = [];
      this.$http({
        method: 'get',
        url: '/log/' + this.pageNum + '/' + this.pageSize,
      }).then(({data}) => {
        this.list = data.list;
        this.total = data.total;
        this.loading = false;
      })
    },
  }
}
</script>

<style scoped>

</style>
