<style>
  .ExamTest_Sysuser_Date .el-range-editor .el-range-input {
    background-color: transparent;
  }

  .ExamTest_Sysuser_Date .el-range-editor.el-input__inner {
    background-color: transparent;
  }

</style>
<!--考试管理-->
<template>
  <div class="page-body">
    <div class="page-search row items-center">
      <div class="col row wrap q-mr-lg q-col-gutter-md">
        <div class="col-3">
          <q-input @change="getList" clearable filled v-model="msg.PaperName" @clear="getList" maxlength="20"
            label="输入试卷名称" />
        </div>
        <div class="col-3 ExamTest_Sysuser_Date">
          <q-field filled>
             <template v-slot:control>
              <el-date-picker v-model="dateTimeList" @change="refreshPage" value-format="yyyy-MM-dd" type="daterange" style="border:none;" range-separator="至"
                 start-placeholder="开始时间"  end-placeholder="结束时间"></el-date-picker>       
            </template>
          </q-field>
        </div>
        <div class="col-3">
          <q-select @input="getList" clearable filled v-model="msg.QTestStatus" :options="StatusList" emit-value
            map-options label="状态" />
        </div>
      </div>
      <div class="page-option">

      </div>
    </div>
    <div class="page-content">
      <exampublishlist :dataList="dataList" :loading="loading" @close="closeExamPublishForm" @success="refreshPage">
      </exampublishlist>
      <q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount"
        :input="true" @input="changePage" />
    </div>
  </div>
</template>
<script>
  import {
    queryPublishExamPage,
  } from "../../api/teacher/index";
  import exampublishlist from "../../components/exam/exampublishlist"
  export default {
    components: {
      exampublishlist
    },
    meta: {
      title: "考试管理",
    },
    data() {
      return {
        data: [],
        msg: {
          pageIndex: 1,
          pageSize: 10,
          rowsPerPage: 10,
          PaperName: "", //试卷名称
          QTestStatus: "", //考试状态
          QStartTime: "", //开始时间
          QEndTime: "", //结束时间
        },
        StatusList: [{
            value: 1,
            label: "未开始"
          },
          {
            value: 2,
            label: "进行中"
          },
          {
            value: 3,
            label: "已结束"
          }
        ],
        dateTimeList: [],
        pageCount: 0,
        loading: false,
        dataList: [],
      };
    },
    created() {},
    mounted() {
      this.getList();
    },
    methods: {
      //翻页
      changePage(val) {
        this.msg.pageIndex = val;
        this.getList();
      },
      //获取菜单分页列表
      getList() {
        if (this.dateTimeList && this.dateTimeList.length > 0) {
          this.msg.QStartTime = this.dateTimeList[0];
          this.msg.QEndTime = this.dateTimeList[1];
        } else {
          this.msg.QStartTime = '';
          this.msg.QEndTime = '';
        }
        this.loading = true;
        this.dataList = [];
        queryPublishExamPage(this.msg)
          .then((res) => {
            this.loading = false;
            this.dataList = res.Data.PageData;
            this.pageCount = res.Data.PageCount;
          })
          .catch(() => {
            this.loading = false;
          });
      },
      //刷新页面
      refreshPage() {
        this.getList();
      },
      //关闭弹窗
      closeExamPublishForm() {

      },
    },
  };

</script>
<style lang="sass">
  @import url('~assets/css/table.sass')

</style>
