index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <!-- 学生列表 -->
  2. <template>
  3. <v-card class="px-3">
  4. <!-- 筛选条件 -->
  5. <div class="d-flex justify-space-between mt-8 mb-10">
  6. <div class="d-flex align-center">
  7. <!-- <span class="mx-3 color-666 font-size-14">院系</span> -->
  8. <Autocomplete class="mr-3" v-model="query.schoolDepartmentName" :item="yuanXi"></Autocomplete>
  9. <v-btn color="primary" class="half-button ml-3" @click="handleSearch()">查 询</v-btn>
  10. <v-btn class="half-button ml-3" prepend-icon="mdi-refresh" variant="outlined" color="primary" @click="handleSearch(true)">刷 新</v-btn>
  11. </div>
  12. <v-btn :loading="exportLoading" prepend-icon="mdi-export-variant" color="primary" variant="tonal" class="ml-3" @click="null">导出</v-btn>
  13. </div>
  14. <!-- 列表 -->
  15. <div class="mt-5" style="min-height: 500px;">
  16. <CtTable
  17. :items="tableData"
  18. :headers="headers"
  19. :loading="loading"
  20. :elevation="0"
  21. :is-tools="false"
  22. :showPage="true"
  23. :total="total"
  24. :page-info="query"
  25. itemKey="id"
  26. @pageHandleChange="handleChangePage"
  27. >
  28. <template #studentName="{ item }">
  29. <div class="d-flex align-center cursor-pointer" @click="studentDetails(item.id)">
  30. <v-avatar size="40" :image="getUserAvatar(item?.person?.avatar, item?.person?.sex)"></v-avatar>
  31. <span class="ml-3">{{ item?.person?.name }}</span>
  32. </div>
  33. </template>
  34. <template #actions="{ item }">
  35. <v-btn v-if="!item?.recommendationLetter" color="primary" variant="text" @click="handleUploadLetter(item.id)">上传推荐信</v-btn>
  36. <v-btn v-if="!item?.evaluate" color="#00897B" variant="text" @click="handleIssueCertificate(item.id)">颁发实习证书</v-btn>
  37. </template>
  38. </CtTable>
  39. <!-- <Loading :visible="loading"></Loading> -->
  40. </div>
  41. </v-card >
  42. </template>
  43. <script setup>
  44. defineOptions({name: 'studentList-index'})
  45. import { ref } from 'vue'
  46. import Snackbar from '@/plugins/snackbar'
  47. import { formatName } from '@/utils/getText'
  48. import { getUserAvatar } from '@/utils/avatar'
  49. import { schoolOrganization, studentList } from '@/api/school'
  50. import { useRouter } from 'vue-router'; const router = useRouter()
  51. const loading = ref(false)
  52. const query = ref({
  53. pageSize: 20,
  54. pageNo: 1,
  55. schoolDepartmentName: null,
  56. })
  57. const headers = [
  58. { title: '学生姓名', key: 'studentName', sortable: false },
  59. { title: '学生学号', key: 'test', sortable: false },
  60. { title: '所属专业', key: 'test', sortable: false },
  61. { title: '录用企业', key: 'test', sortable: false, value: item => formatName(item.test) },
  62. { title: '录用部门', key: 'test', sortable: false, value: item => formatName(item.test) },
  63. { title: '录用岗位', key: 'test', sortable: false, value: item => formatName(item.test) },
  64. { title: '操作', key: 'actions', sortable: false }
  65. ]
  66. const tableData = ref([])
  67. tableData.value = [{ test: 'ces', person: { name: '123' }, id: '1'}]
  68. const total = ref(0)
  69. // 列表
  70. const getData = async (isRefresh = false) => {
  71. query.value.schoolDepartmentName = '中文系'
  72. const { data, total: number } = await studentList(query.value)
  73. tableData.value = data?.records?.length && data.records.map(item=>{
  74. const { enterpeiseName, enterpriseRecruitJobName, jobDept } = item
  75. return { ...item.student, enterpeiseName, enterpriseRecruitJobName, jobDept }
  76. })
  77. total.value = number
  78. if (isRefresh) Snackbar.success('刷新成功')
  79. }
  80. const handleChangePage = (val) => {
  81. query.value.pageNo = val
  82. getData()
  83. }
  84. const handleSearch = (refresh = false) => {
  85. query.value.pageNo = 1
  86. getData(refresh)
  87. }
  88. const schoolInfo = ref(localStorage.getItem('schoolInfo') ? JSON.parse(localStorage.getItem('schoolInfo')) : {})
  89. const yuanXi = ref({ width: 300, items: [], clearable: false, hideDetails: true, label: '请选择院系' })
  90. // 列表
  91. const getYuanXiItem = async () => {
  92. const schoolId = schoolInfo.value?.school?.schoolId || null
  93. if (!schoolId) return Snackbar.warning('获取学校信息失败!')
  94. const { data } = await schoolOrganization({ schoolId })
  95. yuanXi.value.items = data?.length && data.map(item=> {
  96. return item?.title ? { label: item.title, value: item.title } : null
  97. }).filter(Boolean)
  98. if (yuanXi.value.items?.length) {
  99. query.value.schoolDepartmentName = yuanXi.value.items[0].value
  100. getData()
  101. }
  102. }
  103. getYuanXiItem()
  104. const studentDetails = (id) => {
  105. if (id) router.push(`/recruit/teacher/studentList/detail/${id}`)
  106. }
  107. const exportLoading = ref(false)
  108. </script>
  109. <style lang="scss" scoped>
  110. .title {
  111. color: var(--color-333);
  112. font-weight: 600;
  113. font-size: 16px;
  114. }
  115. .left {
  116. min-width: 200px;
  117. }
  118. </style>