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

// #region (constant)
const TABLE_KEY = 'xxxddgl_id'
const URL_CUT = '/xdjx/xszhsz_cxddgl'
// #endregion

// #region (type)
type TYPE_TABLE_FIELD = {
  [TABLE_KEY]: string;
  'xxxddgl_mc': string; // 名称
  'xxx_id': string; // 所属成绩报告单
  'xxxfy_bzrmc': string; // 班主任名称
  'xxxfy_bzr_user_id': string; // 班主任用户编号
  'team_id': string; // 学期编号
  'team_name': string; // 学期名称
  'grade_name': string; // 年级名称
  'class_id': string; // 班级编号
  'class_name': string; // 班级名称
  'grade_id': string; // 年级编号
  'xxxddgl_zt': string; // 状态
  'xxxddgl_cpzb_json': string; // 测评指标JSON
  'cm_id': string; // 班级编号
}
// #endregion

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

// #region (props)
const props = defineProps<{
  aid: 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.aid)
  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.xxxddgl_mc}}</div>
      </div>
      <div class="flex">
        <div>所属成绩报告单</div><div>{{detail_Data.xxx_id}}</div>
      </div>
      <div class="flex">
        <div>班主任名称</div><div>{{detail_Data.xxxfy_bzrmc}}</div>
      </div>
      <div class="flex">
        <div>班主任用户编号</div><div>{{detail_Data.xxxfy_bzr_user_id}}</div>
      </div>
      <div class="flex">
        <div>学期编号</div><div>{{detail_Data.team_id}}</div>
      </div>
      <div class="flex">
        <div>学期名称</div><div>{{detail_Data.team_name}}</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.grade_id}}</div>
      </div>
      <div class="flex">
        <div>状态</div><div>{{detail_Data.xxxddgl_zt}}</div>
      </div>
      <div class="flex">
        <div>测评指标JSON</div><div>{{detail_Data.xxxddgl_cpzb_json}}</div>
      </div>
      <div class="flex">
        <div>班级编号</div><div>{{detail_Data.cm_id}}</div>
      </div>
    </template>      
  </div>

</template>
