<template>
  <section class="content">
    <div class="part-box-border">
      <el-table :data="auditInfoList">
        <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="auditInfoCurPage"
        :page-size="auditInfoPageSize"
        :page-sizes="[10, 20, 50, 100, 200, 300]"
        layout="total, sizes, prev, pager, next, jumper"
        :total="auditInfoTotal"
        @current-change="auditInfoCurChange"
        @size-change="handleAuditInfoSizeChange"
      ></el-pagination>
    </div>
  </section>
</template>
<script>
import { QUESTION_API } from "@/constants/constants.js";
import { mapState } from "vuex";

export default {
  props: {
    paperId: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      auditInfoLoading: false,
      auditInfoList: [],
      auditInfoCurPage: 1,
      auditInfoPageSize: 10,
      auditInfoTotal: 10,
    };
  },
  computed: {
    ...mapState({ user: (state) => state.user }),
  },
  //初始化查询
  created() {
    this.auditInfoSearch(1);
  },
  methods: {
    auditInfoSearch(curPage) {
      this.auditInfoLoading = true;
      var url =
        QUESTION_API +
        "/paper/audit/page/" +
        curPage +
        "/" +
        this.auditInfoPageSize +
        "?paperId=" +
        this.paperId;
      this.$httpWithMsg
        .get(url)
        .then((response) => {
          this.auditInfoList = response.data.content;
          this.auditInfoTotal = response.data.totalElements;
          this.auditInfoLoading = false;
        })
        .catch(function () {
          this.auditInfoLoading = false;
        });
    },
    auditInfoCurChange(val) {
      this.auditInfoCurPage = val;
      this.auditInfoSearch(val);
    },
    handleAuditInfoSizeChange(val) {
      this.auditInfoPageSize = val;
      this.auditInfoSearch(val);
    },
  },
};
</script>
