<template>
  <div class="business-data-detail">
    <div class="part-box part-box-filter part-box-flex">
      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
        <el-form-item label="印刷计划：">
          <print-plan-select
            v-model.trim="filter.printPlanId"
            placeholder="请选择"
            clearable
          ></print-plan-select>
        </el-form-item>
        <el-form-item label="课程（代码）：" label-width="110px">
          <course-select
            v-model.trim="filter.courseCode"
            placeholder="请选择"
            clearable
          ></course-select>
        </el-form-item>
        <el-form-item label="试卷编号：">
          <paper-number-select
            ref="PaperNumberSelect"
            v-model="filter.paperNumber"
            placeholder="请选择"
            clearable
          ></paper-number-select>
        </el-form-item>
        <el-form-item label="考点：" label-width="55px">
          <place-select
            v-model.trim="filter.examPlace"
            placeholder="请选择"
            clearable
          ></place-select>
        </el-form-item>
        <el-form-item label="考场：" label-width="55px">
          <room-select
            v-model.trim="filter.examRoom"
            placeholder="请选择"
            clearable
          ></room-select>
        </el-form-item>
        <el-form-item label="考生：" label-width="70px">
          <el-input
            v-model="filter.studentParams"
            placeholder="请输入"
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item label-width="0px">
          <el-button type="primary" icon="el-icon-search" @click="search"
            >查询</el-button
          >
        </el-form-item>
      </el-form>
    </div>

    <div class="part-box">
      <el-table ref="TableList" :data="dataList" border stripe>
        <el-table-column
          type="index"
          label="序号"
          width="70"
          align="center"
          :index="indexMethod"
        ></el-table-column>
        <el-table-column
          prop="printPlanName"
          label="印刷计划"
        ></el-table-column>
        <el-table-column prop="courseNameCode" label="课程（代码）">
        </el-table-column>
        <el-table-column prop="specialty" label="适用专业（方向）">
        </el-table-column>
        <el-table-column prop="paperNumber" label="试卷编码"></el-table-column>
        <el-table-column prop="examPlace" label="考点"> </el-table-column>
        <el-table-column prop="examRoom" label="考场"> </el-table-column>
        <el-table-column prop="ticketNumber" label="考号" width="120">
        </el-table-column>
        <el-table-column prop="studentCode" label="学号" width="120">
        </el-table-column>
        <el-table-column prop="studentName" label="姓名" width="120">
        </el-table-column>
      </el-table>
      <div class="part-page">
        <el-pagination
          background
          layout="total,prev, pager, next"
          :current-page="current"
          :total="total"
          :page-size="size"
          @current-change="toPage"
        >
        </el-pagination>
      </div>
    </div>
  </div>
</template>

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

export default {
  name: "business-data-detail",
  data() {
    return {
      filter: {
        printPlanId: "",
        courseCode: "",
        paperNumber: "",
        examPlace: "",
        examRoom: "",
        studentParams: ""
      },
      current: 1,
      size: this.GLOBAL.pageSize,
      total: 0,
      dataList: [],
      curBusiness: null
    };
  },
  created() {
    this.search();
  },
  methods: {
    async getList() {
      const datas = {
        ...this.filter,
        pageNumber: this.current,
        pageSize: this.size
      };
      const data = await businessDataDetailListPage(datas);
      this.dataList = data.records;
      this.total = data.total;
    },
    toPage(page) {
      this.current = page;
      this.getList();
    },
    search() {
      this.toPage(1);
    }
  },
  beforeDestroy() {
    this.$ls.remove("curBusiness");
  }
};
</script>
