<template>
  <div class="block">
    <el-timeline>
      <el-timeline-item v-for="(item,index) of timeline" :key="index" :timestamp="item.timestamp" placement="top">
        <el-card>
          <h4>{{ item.created_at }}</h4>
          <p>{{ item.name }}</p>
        </el-card>
      </el-timeline-item>
    </el-timeline>
  </div>
</template>

<script>
  import {
    listlog
  } from "../../../api/system/log.js";
  export default {
    data() {
      return {
        timeline: [],
        paginations: {
          page: 1,
          page_size: 15,
          total: 0
        },
        tableHeight: 0,
        //查询条件字段
        searchFields: {
          keyword: ""
        }
      }
    },
    created() {
      this.load();
    },
    methods: {
      load() {
        var that = this;
        listlog({
          page: that.paginations.page,
          ...this.searchFields
        }).then(response => {
          var data = response.data;
          this.paginations.total = response.total;
          that.timeline = data;
        }).catch(error => {
          console.log(error)
          //reject(error)
        })
      }
    }
  }
</script>
