<template>
  <div class="part-box is-filter">
    <el-form inline>
      <el-form-item label="确认类型">
        <el-select
          v-model="searchModel.confirmType"
          placeholder="手动更新"
          clearable
          style="width: 120px"
        >
          <el-option label="手动更新" :value="1" />
        </el-select>
      </el-form-item>
      <el-form-item label="科目">
        <select-subject v-model="searchModel.subject"></select-subject>
      </el-form-item>
      <el-form-item label="考点">
        <el-input
          v-model.trim="searchModel.examPoint"
          placeholder="请选择"
          clearable
          style="width: 120px"
        />
      </el-form-item>
    </el-form>
    <el-divider class="form-divider" />
    <div class="part-action">
      <el-space wrap>
        <el-button type="primary" @click="toPage(1)">查询</el-button>
        <el-button type="success" @click="startCheck">开始检查</el-button>
      </el-space>
    </div>
  </div>
  <div class="part-box">
    <el-table
      class="page-table"
      :data="dataList"
      :loading="loading"
      border
      stripe
    >
      <el-table-column type="index" label="序号" width="60" />
      <el-table-column prop="examCardNo" label="准考证号" width="120" />
      <el-table-column prop="name" label="姓名" min-width="100" />
      <el-table-column prop="studentNo" label="学号" width="120" />
      <el-table-column prop="subject" label="科目" min-width="100" />
      <el-table-column prop="examPoint" label="考点" width="120" />
      <el-table-column prop="scanBatch" label="扫描批次" width="120" />
      <el-table-column prop="uploadTime" label="上传时间" width="160" />
    </el-table>
    <el-pagination
      v-model:current-page="pagination.pageNumber"
      v-model:page-size="pagination.pageSize"
      :layout="pagination.layout"
      :total="pagination.total"
      @size-change="pageSizeChange"
      @current-change="toPage"
    />
  </div>
</template>

<script setup lang="ts">
  import { reactive } from 'vue';
  import { ElMessage } from 'element-plus';
  import { getManualConfirmDataList } from '@/api/check';
  import type {
    ManualConfirmDataListItem,
    ManualConfirmDataListFilter,
  } from '@/api/types/check';
  import useTable from '@/hooks/table';

  defineOptions({
    name: 'ManualConfirm',
  });

  const searchModel = reactive<ManualConfirmDataListFilter>({
    confirmType: null,
    subject: null,
    examPoint: '',
  });

  const { dataList, pagination, loading, toPage, pageSizeChange } =
    useTable<ManualConfirmDataListItem>(
      getManualConfirmDataList,
      searchModel,
      false
    );

  function startCheck() {
    ElMessage.info('开始检查功能待实现');
  }
</script>
