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

// #region (constant)
const TABLE_KEY = 'xpyjl_id'
const URL_CUT = '/xdjx/xszhsz_xspygl_pyjl'
// #endregion

// #region (type)
type TYPE_TABLE_FIELD = {
  [TABLE_KEY]: string;
  'xpyjl_xsxm': string; // 学生姓名
  'xpyjl_xsxh': string; // 学生学号
  'xpyjl_pynr': string; // 评语内容
  'xpy_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.xpyjl_xsxm}}</div>
      </div>
      <div class="flex">
        <div>学生学号</div><div>{{detail_Data.xpyjl_xsxh}}</div>
      </div>
      <div class="flex">
        <div>评语内容</div><div>{{detail_Data.xpyjl_pynr}}</div>
      </div>
      <div class="flex">
        <div>所属评语编号</div><div>{{detail_Data.xpy_id}}</div>
      </div>
    </template>      
  </div>

</template>
