index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <ContentWrap>
  3. <!-- 搜索工作栏 -->
  4. <el-form
  5. class="-mb-15px"
  6. :model="queryParams"
  7. ref="queryFormRef"
  8. :inline="true"
  9. label-width="68px"
  10. >
  11. <el-form-item label="参与导师" prop="supervisorIds">
  12. <el-select
  13. v-model="queryParams.supervisorId"
  14. placeholder="请选择参与导师"
  15. clearable
  16. filterable
  17. class="!w-240px"
  18. >
  19. <el-option
  20. v-for="supervisor in supervisors"
  21. :key="supervisor.id"
  22. :label="supervisor.nickname"
  23. :value="supervisor.id"
  24. />
  25. </el-select>
  26. </el-form-item>
  27. <!-- <el-form-item label="学硕名额" prop="academicSlots">-->
  28. <!-- <el-input-->
  29. <!-- v-model="queryParams.academicSlots"-->
  30. <!-- placeholder="请输入学硕名额"-->
  31. <!-- clearable-->
  32. <!-- @keyup.enter="handleQuery"-->
  33. <!-- class="!w-240px"-->
  34. <!-- />-->
  35. <!-- </el-form-item>-->
  36. <!-- <el-form-item label="专硕名额" prop="professionalSlots">-->
  37. <!-- <el-input-->
  38. <!-- v-model="queryParams.professionalSlots"-->
  39. <!-- placeholder="请输入专硕名额"-->
  40. <!-- clearable-->
  41. <!-- @keyup.enter="handleQuery"-->
  42. <!-- class="!w-240px"-->
  43. <!-- />-->
  44. <!-- </el-form-item>-->
  45. <el-form-item>
  46. <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
  47. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  48. <el-button
  49. plain
  50. type="primary"
  51. @click="openForm('update', scope.row.id)"
  52. v-hasPermi="['system:student-select-supervisor-record:update']"
  53. v-if="userInfo?.userType === '1'"
  54. >
  55. 志愿编辑
  56. </el-button>
  57. <!-- <el-button-->
  58. <!-- type="primary"-->
  59. <!-- plain-->
  60. <!-- @click="openForm('create')"-->
  61. <!-- v-hasPermi="['system:supervisor-selection-setting:create']"-->
  62. <!-- >-->
  63. <!-- <Icon icon="ep:plus" class="mr-5px" /> 新增-->
  64. <!-- </el-button>-->
  65. <!-- <el-button-->
  66. <!-- type="success"-->
  67. <!-- plain-->
  68. <!-- @click="handleExport"-->
  69. <!-- :loading="exportLoading"-->
  70. <!-- v-hasPermi="['system:supervisor-selection-setting:export']"-->
  71. <!-- >-->
  72. <!-- <Icon icon="ep:download" class="mr-5px" /> 导出-->
  73. <!-- </el-button>-->
  74. </el-form-item>
  75. </el-form>
  76. </ContentWrap>
  77. <!-- 列表 -->
  78. <ContentWrap>
  79. <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
  80. <el-table-column type="index" width="50" />
  81. <!-- <el-table-column label="项目名称" align="center" prop="projectId" />-->
  82. <el-table-column label="导师姓名" align="center" prop="supervisorName" />
  83. <el-table-column
  84. label="导师类型"
  85. align="center"
  86. prop="userType"
  87. :formatter="userTypeFormatter"
  88. />
  89. <el-table-column label="招生指标" align="center">
  90. <template #default="scope">
  91. 学硕/{{ scope.row.academicSlots }} 专硕/{{ scope.row.professionalSlots }}
  92. </template>
  93. </el-table-column>
  94. <!-- <el-table-column label="学硕名额" align="center" prop="academicSlots" />-->
  95. <!-- <el-table-column label="专硕名额" align="center" prop="professionalSlots" />-->
  96. <el-table-column label="已招生名额" align="center">
  97. <template #default="scope">
  98. <span>
  99. <span v-if="scope.row.occupiedAcademicSlots">
  100. 学硕/{{ scope.row.occupiedAcademicSlots }}
  101. </span>
  102. <span v-if="scope.row.occupiedProfessionalSlots">
  103. 专硕/{{ scope.row.occupiedProfessionalSlots }}
  104. </span>
  105. <span v-if="!scope.row.occupiedAcademicSlots && !scope.row.occupiedProfessionalSlots">
  106. 暂无
  107. </span>
  108. </span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="剩余名额" align="center">
  112. <template #default="scope">
  113. 学硕/{{ scope.row.academicSlots -scope.row.occupiedAcademicSlots }} 专硕/{{ scope.row.professionalSlots-scope.row.occupiedProfessionalSlots }}
  114. </template>
  115. </el-table-column>
  116. <el-table-column
  117. label="更新时间"
  118. align="center"
  119. prop="updateTime"
  120. :formatter="dateFormatter"
  121. width="180px"
  122. />
  123. <el-table-column label="导师详情" align="center" min-width="120px" v-if="userInfo?.userType === '4' || userInfo?.userType === '1'">
  124. <template #default="scope">
  125. <el-button link
  126. type="primary"
  127. @click="openTeacherRequireForm( scope.row.supervisorId)"
  128. v-hasPermi="['system:user:query']"
  129. >
  130. <Icon icon="ep:bell" />
  131. 查看
  132. </el-button>
  133. </template>
  134. </el-table-column>
  135. <!-- 学生志愿填报-->
  136. <el-table-column label="志愿填报" align="center" min-width="120px" v-if=" userInfo?.userType === '1'">
  137. <template #default="scope">
  138. <el-button
  139. type="primary"
  140. link
  141. @click="openStudentSelectSupervisorPop('create', scope.row.projectId,scope.row.supervisorId,null,null)"
  142. v-hasPermi="['system:student-select-supervisor-record:create']"
  143. v-if="userInfo?.userType === '1'"
  144. >
  145. <Icon icon="ep:bell" />
  146. 选择
  147. </el-button>
  148. </template>
  149. </el-table-column>
  150. <el-table-column label="操作" align="center" min-width="120px">
  151. <template #default="scope">
  152. <!-- 学院查看招生详情-->
  153. <el-button type="text" v-if="userInfo?.userType === '4'" @click="openStudentSelectSupervisorRecord(scope.row.projectId,scope.row.supervisorId)" v-hasPermi="['system:student-select-supervisor-record:query']"
  154. >
  155. <Icon icon="ep:bell" />
  156. 招生详情
  157. </el-button>
  158. <!-- 志愿填报修改-->
  159. <el-button
  160. link
  161. type="primary"
  162. @click="handelWithdraw( scope.row.supervisorId)"
  163. v-hasPermi="['system:student-select-supervisor-record:withdraw']"
  164. v-if="userInfo?.userType === '1'&&scope.row.selectType ==1"
  165. >
  166. 撤回
  167. </el-button>
  168. <!--名额设置-->
  169. <el-button
  170. link
  171. type="primary"
  172. @click="openForm('update', scope.row.id)"
  173. v-hasPermi="['system:supervisor-selection-setting:update']"
  174. v-if="userInfo?.userType === '4'"
  175. >
  176. 编辑
  177. </el-button>
  178. <!-- <el-button-->
  179. <!-- link-->
  180. <!-- type="danger"-->
  181. <!-- @click="handleDelete(scope.row.id)"-->
  182. <!-- v-hasPermi="['system:supervisor-selection-setting:delete']"-->
  183. <!-- >-->
  184. <!-- 删除-->
  185. <!-- </el-button>-->
  186. </template>
  187. </el-table-column>
  188. </el-table>
  189. <!-- 分页 -->
  190. <Pagination
  191. :total="total"
  192. v-model:page="queryParams.pageNo"
  193. v-model:limit="queryParams.pageSize"
  194. @pagination="getList"
  195. />
  196. </ContentWrap>
  197. <!-- 是学生-->
  198. <ContentWrap v-if="userInfo.userType==='1' ||userInfo.userType==='4'" >
  199. <el-table
  200. v-loading="loading"
  201. :data="selectionList"
  202. row-key="id"
  203. >
  204. <el-table-column type="index" width="50" />
  205. <el-table-column label="学生姓名" align="center" prop="studentName" />
  206. <el-table-column label="硕士类型" align="center" prop="masterType" >
  207. <template #default="scope">
  208. <dict-tag :type="DICT_TYPE.SYSTEM_STUDENT_MASTER_TYPE" :value="scope.row.masterType" />
  209. </template>
  210. </el-table-column>
  211. <el-table-column label="导师姓名" align="center" prop="supervisor" />
  212. <el-table-column
  213. label="导师类型"
  214. align="center"
  215. prop="supervisorType"
  216. :formatter="userTypeFormatter"
  217. />
  218. <!-- <el-table-column label="专业" align="center" prop="major" />-->
  219. <!-- <el-table-column label="简历" align="center" prop="introduction" />-->
  220. <el-table-column label="申请状态" align="center" prop="selectType" >
  221. <template #default="scope">
  222. <dict-tag :type="DICT_TYPE.SYSTEM_STUDENT_SELECT_RECORD_SELECT_TYPE" :value="scope.row.selectType" />
  223. </template>
  224. </el-table-column>
  225. <!-- <el-table-column label="学生电子签名" align="center" prop="studentSignature" />-->
  226. <!-- <el-table-column label="导师电子签名" align="center" prop="supervisorSignature" />-->
  227. <el-table-column
  228. label="提交时间"
  229. align="center"
  230. prop="createTime"
  231. :formatter="dateFormatter"
  232. width="180px"
  233. />
  234. <el-table-column
  235. label="导师审批时间"
  236. align="center"
  237. prop="supervisorApproveTime"
  238. :formatter="dateFormatter"
  239. width="180px"
  240. />
  241. </el-table>
  242. </ContentWrap>
  243. <!-- 表单弹窗:添加/修改 -->
  244. <supervisorSelectionSettingForm ref="formRef" @success="getList" />
  245. <!-- 导师详情弹窗-->
  246. <teacherRequireForm ref="teacherRequireFormRef" @success="getList"/>
  247. <studentSelectSupervisorRecordForm ref="studentSelectSupervisorPop" @success="getList"/>
  248. </template>
  249. <script setup lang="ts">
  250. import { ref } from 'vue'
  251. import { dateFormatter } from '@/utils/formatTime'
  252. import download from '@/utils/download'
  253. import { supervisorSelectionSettingApi, supervisorSelectionSettingVO } from '@/api/system/supervisorSelectionSetting'
  254. import supervisorSelectionSettingForm from './supervisorSelectionSettingForm.vue'
  255. import teacherRequireForm from '../userDetail/teacher.vue'
  256. import studentSelectSupervisorRecordForm from '../studentSelectSupervisorRecord/studentSelectSupervisorRecordForm.vue'
  257. import * as UserApi from '@/api/system/user'
  258. import { getUserProfile, ProfileVO } from '@/api/system/user/profile'
  259. import {
  260. studentSelectSupervisorRecordApi,
  261. studentSelectSupervisorRecordVO
  262. } from "@/api/system/studentSelectSupervisorRecord";
  263. import {DICT_TYPE} from "@/utils/dict";
  264. /** 导师学硕专硕名额设置 列表 */
  265. defineOptions({ name: 'supervisorSelectionSetting' })
  266. const message = useMessage() // 消息弹窗
  267. const { t } = useI18n() // 国际化
  268. const loading = ref(true) // 列表的加载中
  269. const list = ref<supervisorSelectionSettingVO[]>([]) // 列表的数据
  270. const total = ref(0) // 列表的总页数
  271. const queryParams = reactive({
  272. pageNo: 1,
  273. pageSize: 10,
  274. projectId: undefined,
  275. supervisorId: undefined,
  276. academicSlots: undefined,
  277. professionalSlots: undefined,
  278. supervisorName:undefined,
  279. userType:undefined,
  280. createTime: [],
  281. })
  282. const queryFormRef = ref() // 搜索的表单
  283. const exportLoading = ref(false) // 导出的加载中
  284. //记录页面
  285. const router = useRouter()
  286. const openStudentSelectSupervisorRecord = (projectId,supervisorId) => {
  287. router.push({ name: 'studentSelectSupervisorRecord', query: { projectId: projectId ,supervisorId :supervisorId} });
  288. }
  289. //导师类型
  290. const userTypeFormatter = (row, column, cellValue, index) => {
  291. switch (cellValue) {
  292. case "3":
  293. return '校内导师';
  294. case "5":
  295. return '校外导师';
  296. default:
  297. return '未知';
  298. }
  299. };
  300. /** 查询列表 */
  301. const getList = async () => {
  302. loading.value = true
  303. try {
  304. const data = await supervisorSelectionSettingApi.getSupervisorSelectionSettingPage(queryParams)
  305. list.value = data.list
  306. total.value = data.total
  307. } finally {
  308. loading.value = false
  309. }
  310. }
  311. //获取登录人员信息
  312. const userInfo = ref({} as ProfileVO)
  313. const getUserInfo = async () => {
  314. const users = await getUserProfile()
  315. userInfo.value = users
  316. }
  317. /** 搜索按钮操作 */
  318. const handleQuery = () => {
  319. queryParams.pageNo = 1
  320. getList()
  321. }
  322. /** 重置按钮操作 */
  323. const resetQuery = () => {
  324. queryFormRef.value.resetFields()
  325. handleQuery()
  326. }
  327. /** 添加/修改操作 */
  328. const formRef = ref()
  329. const openForm = (type: string, id?: number) => {
  330. formRef.value.open(type, id)
  331. }
  332. /** 删除按钮操作 */
  333. const handleDelete = async (id: number) => {
  334. try {
  335. // 删除的二次确认
  336. await message.delConfirm()
  337. // 发起删除
  338. await supervisorSelectionSettingApi.deleteSupervisorSelectionSetting(id)
  339. message.success(t('common.delSuccess'))
  340. // 刷新列表
  341. await getList()
  342. } catch {}
  343. }
  344. /** 导出按钮操作 */
  345. const handleExport = async () => {
  346. try {
  347. // 导出的二次确认
  348. await message.exportConfirm()
  349. // 发起导出
  350. exportLoading.value = true
  351. const data = await supervisorSelectionSettingApi.exportSupervisorSelectionSetting(queryParams)
  352. download.excel(data, '导师学硕专硕名额设置.xls')
  353. } catch {
  354. } finally {
  355. exportLoading.value = false
  356. }
  357. }
  358. //获取所有导师
  359. const supervisors = ref()
  360. const getSupervisor= async () => {
  361. try {
  362. const result = await UserApi.getSupervisor()
  363. supervisors.value = result
  364. } catch (error) {
  365. console.error('未获取到导师', error)
  366. }
  367. }
  368. //传supervisorId给formData.supervisorId
  369. const teacherRequireFormRef = ref()
  370. const openTeacherRequireForm = (supervisorId?: number) => {
  371. teacherRequireFormRef.value.open("detail",supervisorId)
  372. }
  373. //志愿填报弹窗
  374. const studentSelectSupervisorPop= ref()
  375. const openStudentSelectSupervisorPop = (type: string, projectId?: number,supervisorId? :number,id:number,studentId:number) => {
  376. studentSelectSupervisorPop.value.open(type, projectId ,supervisorId,id,studentId)
  377. }
  378. //没处理好
  379. const recordData = ref({
  380. id: undefined,
  381. projectId: undefined,
  382. studentId: undefined,
  383. supervisorId: undefined,
  384. selectType: undefined,
  385. studentSignature: "",
  386. supervisorApproveTime: undefined,
  387. supervisorSignature: "",
  388. externalSupervisorId: undefined,
  389. masterType:undefined,
  390. studentSignDate:[],
  391. supervisorSignDate:[],
  392. })
  393. const handelWithdraw = async (supervisorId:number) => {
  394. try {
  395. await message.confirm()
  396. recordData.value.supervisorId=supervisorId
  397. const data =recordData.value as unknown as studentSelectSupervisorRecordVO
  398. await studentSelectSupervisorRecordApi.withdrawStudentSelectSupervisorRecord(data)
  399. message.success("撤回了申请")
  400. await getList()
  401. } catch {}
  402. }
  403. const selectionList = ref<studentSelectSupervisorRecordVO[]>([]) //下面的选择记录列表
  404. /** 查询互选记录列表 */
  405. const getRecordList = async () => {
  406. loading.value = true
  407. try {
  408. const data = await studentSelectSupervisorRecordApi.getSelectSupervisorRecordList()
  409. selectionList.value = data
  410. } finally {
  411. loading.value = false
  412. }
  413. }
  414. /** 初始化 **/
  415. onMounted(async () => {
  416. getList()
  417. getUserInfo()
  418. getSupervisor()
  419. await getRecordList()
  420. })
  421. </script>