<template>
  <el-dialog
    class="class-mark-progress-dialog"
    :visible.sync="modalIsShow"
    :title="data.className"
    top="10vh"
    width="700px"
    :close-on-click-modal="false"
    :close-on-press-escape="false"
    append-to-body
    @opened="visibleChange"
    @close="closeHandle"
  >
    <el-table :data="dataList">
      <el-table-column
        prop="questionNumber"
        label="评阅题目"
        width="120"
      ></el-table-column>
      <el-table-column
        prop="taskCount"
        label="任务总数"
        width="100"
      ></el-table-column>
      <el-table-column
        prop="markedCount"
        label="完成总数"
        width="100"
      ></el-table-column>
      <el-table-column prop="markerUser" label="评卷员" min-width="100">
      </el-table-column>
    </el-table>
    <div slot="footer"></div>
  </el-dialog>
</template>

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

export default {
  name: "class-mark-progress-dialog",
  props: {
    data: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  data() {
    return {
      modalIsShow: false,
      dataList: [],
    };
  },
  methods: {
    visibleChange() {
      this.initData();
    },
    closeHandle() {
      this.dataList = [];
    },
    cancel() {
      this.modalIsShow = false;
    },
    open() {
      this.modalIsShow = true;
    },
    async initData() {
      const res = await markProgressClassQuestionListPage({
        examId: this.data.examId,
        paperNumber: this.data.paperNumber,
        className: this.data.className,
      });
      this.dataList = res || [];
    },
  },
};
</script>
