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

// #region (constant)
const TABLE_KEY = 'xkkz_id'
const URL_CUT = '/xdjx/kcpzgl_kcsz'
// #endregion

// #region (type)
type TYPE_TABLE_FIELD = {
  [TABLE_KEY]: string;
  'xkkz_kcjsmc': string; // 考场教室名称
  'xkkz_kshs': string; // 考试行数
  'xkkz_ksls': string; // 考试列数
  'xkkz_zsrs': string; // 最适人数
}
// #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.xkkz_kcjsmc}}</div>
      </div>
      <div class="flex">
        <div>考试行数</div><div>{{detail_Data.xkkz_kshs}}</div>
      </div>
      <div class="flex">
        <div>考试列数</div><div>{{detail_Data.xkkz_ksls}}</div>
      </div>
      <div class="flex">
        <div>最适人数</div><div>{{detail_Data.xkkz_zsrs}}</div>
      </div>
    </template>      
  </div>

</template>
