<template>
  <el-dialog
    title="审核记录"
    width="700px"
    :visible.sync="modalIsShow"
    :modal="false"
    append-to-body
    custom-class="side-dialog"
    @open="toPage(1)"
  >
    <div class="part-box-border">
      <el-table :data="tableData">
        <el-table-column
          prop="operateUserName"
          label="执行人"
        ></el-table-column>
        <el-table-column prop="operateTime" label="执行时间"></el-table-column>
        <el-table-column prop="operate" label="执行事项"></el-table-column>
        <el-table-column prop="auditRemark" label="审核意见"></el-table-column>
      </el-table>
    </div>
    <div class="part-page">
      <el-pagination
        :current-page="currentPage"
        :page-size="pageSize"
        :page-sizes="[10, 20, 50, 100, 200, 300]"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
        @current-change="toPage"
        @size-change="handleSizeChange"
      ></el-pagination>
    </div>
  </el-dialog>
</template>

<script>
import { paperAuditInfoApi } from "../api";

export default {
  name: "PaperAuditInfo",
  props: {
    paperId: {
      type: [String, Number],
      default: "",
    },
  },
  data() {
    return {
      modalIsShow: false,
      tableData: [],
      currentPage: 1,
      pageSize: 10,
      total: 0,
    };
  },
  methods: {
    cancel() {
      this.modalIsShow = false;
    },
    open() {
      this.modalIsShow = true;
    },
    async getList() {
      const res = await paperAuditInfoApi({
        paperId: this.paperId,
        curPage: this.currentPage,
        pageSize: this.pageSize,
      }).catch(() => {});
      if (!res) return;
      this.tableData = res.data.content;
      this.total = res.data.totalElements;
    },
    toPage(page) {
      this.currentPage = page;
      this.getList();
    },
    handleSizeChange(val) {
      this.pageSize = val;
      this.toPage(1);
    },
  },
};
</script>
