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

    <el-table v-loading="loading" :data="alarmList">
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
      </el-table-column>
      <!-- <el-table-column label="接口" align="center" prop="interfaceName" /> -->
      <el-table-column label="状态" align="center" prop="status">
        <template slot-scope="scope">
          <span>{{ scope.row.status == 1 ? '成功' : scope.row.status == 2 ? '失败' : '' }}</span>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.current"
      :limit.sync="queryParams.size"
      @pagination="getList"
    />

  </div>
</template>

<script>
import { listTask } from "@/api/page/timedTask";

export default {
  name: "Alarm",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 报警事件表格数据
      alarmList: [],
      // 查询参数
      queryParams: {
        current: 1,
        size: 10,
        interfaceName: 3,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询报警事件列表 */
    getList() {
      this.loading = true;
      listTask(this.queryParams).then(response => {
        this.alarmList = response.data.records;
        this.total = response.data.total;
        this.loading = false;
      });
    },
  }
};
</script>
