<template>
  <div>
    <div style="margin-bottom: 12px">
      <el-button type="primary" @click="refresh">刷新</el-button>
    </div>
    <div class="list" v-loading="loading">
      <el-table
        :data="tableData"
        style="width: 100%"
        :header-cell-style="{ background: '#EAF1FE', color: '#666666' }"
      >
        <el-table-column type="index" label="序号" align="center" />
        <el-table-column prop="equipCode" label="设备编号" align="center" />
        <el-table-column prop="addResult" label="操作回执" align="center" />
        <el-table-column prop="addLog" label="操作日志" align="center" />
        <el-table-column prop="addTime" label="添加时间" align="center" />
      </el-table>
      <Pagination
        :limit="params.size"
        :page="params.current"
        :total="total"
        class="pagination"
        @pagination="handlePageChange"
      />
    </div>
  </div>
</template>

<script>
import { autoList } from "../api.js";
export default {
  data() {
    return {
      tableData: [],
      params: {
        current: 1,
        size: 10,
      },
      total: 10,
      loading: false,
    };
  },
  mounted() {
    this.handleAutoList();
  },
  methods: {
    refresh() {
      this.params.current = 1;
      this.handleAutoList();
    },
    async handleAutoList() {
      this.loading = true;
      let res = await autoList(this.params);
      this.tableData = res.records;
      this.total = res.total;
      this.loading = false;
    },
    handlePageChange(pageData) {
      this.params.size = pageData.size;
      this.params.current = pageData.page;
      this.handleAutoList();
    },
  },
};
</script>

<style lang="scss" scoped>
</style>