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

// #region (constant)
const TABLE_KEY = 'xxxfy_id'
const URL_CUT = '/xdjx/xszhsz_xqfygl'
// #endregion

// #region (type)
type TYPE_TABLE_FIELD = {
  [TABLE_KEY]: string;
  'xxx_id': string; // 所属成绩报告单
  'xxxfy_jsmc': string; // 教师名称
  'xxxfy_js_user_id': string; // 教师用户编号
  'team_id': string; // 学期编号
  'xxxfy_fymc': string; // 附言名称
  'team_name': string; // 学期名称
  'subject_id': string; // 科目编号
  'subject_name': string; // 科目名称
  'grade_name': string; // 年级名称
  'class_id': string; // 班级编号
  'class_name': string; // 班级名称
  'grade_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.xxx_id}}</div>
      </div>
      <div class="flex">
        <div>教师名称</div><div>{{detail_Data.xxxfy_jsmc}}</div>
      </div>
      <div class="flex">
        <div>教师用户编号</div><div>{{detail_Data.xxxfy_js_user_id}}</div>
      </div>
      <div class="flex">
        <div>学期编号</div><div>{{detail_Data.team_id}}</div>
      </div>
      <div class="flex">
        <div>附言名称</div><div>{{detail_Data.xxxfy_fymc}}</div>
      </div>
      <div class="flex">
        <div>学期名称</div><div>{{detail_Data.team_name}}</div>
      </div>
      <div class="flex">
        <div>科目编号</div><div>{{detail_Data.subject_id}}</div>
      </div>
      <div class="flex">
        <div>科目名称</div><div>{{detail_Data.subject_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>
    </template>      
  </div>

</template>
