<script setup lang="ts">
import { ref } from "vue";
import request, { download } from '~/utils/request';

// #region (constant)
const TABLE_KEY = 'xkks_id'
const URL_CUT = '/xdjx/kcpzgl_kslb'
// #endregion

// #region (type)
type TYPE_TABLE_FIELD = {
  [TABLE_KEY]: string;
  'xkks_xsxm': string; // 学生姓名
  'xkk_id': string; // 所属考试
  'grade_id': string; // 年级编号
  'grade_name': string; // 年级名称
  'class_id': string; // 班号
  'class_name': string; // 班级名称
  'cm_id': string; // 班级编号
  'xkks_kcmc': string; // 考场名称
  'xkks_kcmc_json': string; // 考场名称JSON
  'xkks_zkzh': string; // 准考证号
  'xkks_zc_x': string; // 坐次列X
  'xkks_zc_y': string; // 坐次行Y
}
// #endregion

// #region (variable)
const loading = ref(true)
// #endregion

// #region (props)
const props = defineProps<{
  aid: string,
  bid: string,
}>()
// #endregion

function detailApi(_id: string) {
  return request({
    url: URL_CUT + '/detail',
    data: {
      [TABLE_KEY]: _id,
    }
  })
}

const detail_Data = ref<TYPE_TABLE_FIELD>()

// #region (page init)
async function init() {
  const res = await detailApi(props.bid)
  detail_Data.value = (res.data.one_info)
  loading.value = false
}
init()
// #endregion

</script>

<template>
  <div :loading="loading">
    <template v-if="detail_Data">
      <div class="flex">
        <div>学生姓名</div><div>{{detail_Data.xkks_xsxm}}</div>
      </div>
      <div class="flex">
        <div>所属考试</div><div>{{detail_Data.xkk_id}}</div>
      </div>
      <div class="flex">
        <div>年级编号</div><div>{{detail_Data.grade_id}}</div>
      </div>
      <div class="flex">
        <div>年级名称</div><div>{{detail_Data.grade_name}}</div>
      </div>
      <div class="flex">
        <div>班号</div><div>{{detail_Data.class_id}}</div>
      </div>
      <div class="flex">
        <div>班级名称</div><div>{{detail_Data.class_name}}</div>
      </div>
      <div class="flex">
        <div>班级编号</div><div>{{detail_Data.cm_id}}</div>
      </div>
      <div class="flex">
        <div>考场名称</div><div>{{detail_Data.xkks_kcmc}}</div>
      </div>
      <div class="flex">
        <div>考场名称JSON</div><div>{{detail_Data.xkks_kcmc_json}}</div>
      </div>
      <div class="flex">
        <div>准考证号</div><div>{{detail_Data.xkks_zkzh}}</div>
      </div>
      <div class="flex">
        <div>坐次列X</div><div>{{detail_Data.xkks_zc_x}}</div>
      </div>
      <div class="flex">
        <div>坐次行Y</div><div>{{detail_Data.xkks_zc_y}}</div>
      </div>
    </template>      
  </div>

</template>
