<script setup lang="ts">
import type { ClassItem } from '../types'

import { getClassStudentList } from '../api'

interface Props {
  data: ClassItem
}

const props = defineProps<Props>()

// 列表配置
const listOptions = {
  remote: {
    httpRequest: getClassStudentList,
    params: { class_id: props.data?.id }
  },
  columns: [
    { label: '序号', type: 'index', width: 60 },
    { label: '学号', prop: 'id_number' },
    { label: '姓名', prop: 'name' },
    { label: '性别', prop: 'gender_name' },
    { label: '所属部门/学校', prop: 'organ_id_name' },
    { label: '专业', prop: 'specialty_id_name' },
    { label: '班级', prop: 'class_id_name' }
  ]
}
</script>
<template>
  <el-dialog title="查看班级学生">
    <AppList v-bind="listOptions"></AppList>
    <el-row justify="center">
      <el-button round auto-insert-space @click="$emit('update:modelValue', false)">关闭</el-button>
    </el-row>
  </el-dialog>
</template>
