round-select.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <div class="app-container">
  3. <el-card shadow="hover">
  4. <template #header>选科信息</template>
  5. <el-row :gutter="20">
  6. <el-col :span="12">
  7. <el-form ref="form" v-if="selectObj" label-position="right" label-width="80px">
  8. <el-form-item label="选科轮次" class="form-item-readonly">{{ selectObj.year }}{{ selectObj.name }}
  9. </el-form-item>
  10. <el-form-item label="选科时间" class="form-item-readonly">{{ selectObj.beginTime }} 至 {{ selectObj.endTime }}
  11. </el-form-item>
  12. </el-form>
  13. </el-col>
  14. <el-col :span="12" style="vertical-align: center">
  15. 为了让同学们更好地选科,请完成左侧几项功能,如有疑问,请观看此
  16. <el-link type="primary" icon="el-icon-video-play" underline @click="helpVideo.visible=true">介绍视频</el-link>
  17. 、咨询客服或拨打电话4001797985
  18. </el-col>
  19. </el-row>
  20. </el-card>
  21. <!-- 自选专业 推荐专业 -->
  22. <select-subject class="mt20" :evaluationMajors="evaluationMajors" :optionalMajors="optionalMajors"
  23. :list="roundGroups"></select-subject>
  24. <!-- 选科报名表 -->
  25. <el-card class="box-card mt20">
  26. <template #header>
  27. <elective-generation-steps v-if="selectObj" v-model="activeStep" :generation="generation"
  28. disable-hidden-feature></elective-generation-steps>
  29. </template>
  30. <report-table :generation="generation" :optional-majors="optionalMajors"></report-table>
  31. </el-card>
  32. <el-card shadow="hover" class="mt20">
  33. <template #header>选科通知</template>
  34. </el-card>
  35. <el-dialog :visible.sync="helpVideo.visible">
  36. <mx-video v-if="helpVideo.visible" :src="helpVideo.src" :ali-id-type="helpVideo.aliIdType"
  37. class="mt15"
  38. ></mx-video>
  39. </el-dialog>
  40. </div>
  41. </template>
  42. <script>
  43. import { saveStudentSelected } from '@/api/webApi/selection'
  44. import TestEntry from '@/views/elective/test/components/test-entry'
  45. import TestResult from '@/views/elective/test/components/test-result'
  46. import SelectSubject from '@/views/system/user/profile/components/select-subject'
  47. import ReportTable from '@/views/system/user/profile/components/report-table'
  48. import ElectiveGenerationSteps from '@/views/elective/generation/components/elective-generation-steps'
  49. import config from '@/common/mx-config'
  50. import {
  51. getStudentElectiveModels,
  52. getOptionalMajors,
  53. getStudentSelected,
  54. getRecommendMajor
  55. } from '@/api/webApi/elective/selected-subject'
  56. export default {
  57. provide() {
  58. return {
  59. optionalMajors: this.getOptionalMajors
  60. }
  61. },
  62. components: { SelectSubject, TestResult, TestEntry, ReportTable, ElectiveGenerationSteps },
  63. name: 'round-select',
  64. data() {
  65. return {
  66. helpVideo: {
  67. visible: false,
  68. src: '9fca0b997b8346ce8c3ce69feaf89294',
  69. aliIdType: 2
  70. },
  71. //
  72. optionalMajors: [],
  73. evaluationMajors: [],
  74. //
  75. selectObj: null,
  76. allowSelect: false,
  77. stepOptions: config.electiveGenerationOptions,
  78. activeStep: '',
  79. generationModels: []
  80. }
  81. },
  82. computed: {
  83. currentOpt() {
  84. /// 当前进程代对应的配置项,可能没有值
  85. return Object.values(this.stepOptions).find(opt => opt.value == this.selectObj.currentGeneration)
  86. },
  87. activeOpt() {
  88. return Object.values(this.stepOptions).find(opt => opt.key == this.activeStep)
  89. },
  90. activeModels() {
  91. if (!this.activeStep || !this.selectObj) return []
  92. if (this.activeOpt.value > this.selectObj.currentGeneration) return []
  93. /// 当前选中的进程代,可能没有值
  94. return this.generationModels.filter(gm => gm.generation <= this.activeOpt.value)
  95. },
  96. roundGroups() {
  97. if (!this.selectObj?.groupIds) return []
  98. if (!this.generationModels.length) return []
  99. const currentModels = this.generationModels.last().models
  100. return this.selectObj.groupIds?.split(',').map(groupId => {
  101. const matched = currentModels.find(m => m.groupId == groupId) || {}
  102. return ({
  103. ...matched,
  104. groupId: groupId
  105. })
  106. }) || []
  107. },
  108. generation() {
  109. if (!this.selectObj) return {}
  110. return {
  111. // generation key value
  112. hiddenGenerations: [],
  113. options: this.stepOptions,
  114. current: this.selectObj.currentGeneration,
  115. currentOpt: this.currentOpt,
  116. active: this.activeOpt?.value,
  117. activeOpt: this.activeOpt,
  118. roundGroups: this.roundGroups,
  119. status: {
  120. ...this.selectObj,
  121. roundName: this.selectObj.name || ''
  122. },
  123. models: this.generationModels,
  124. activeModels: this.activeModels
  125. }
  126. }
  127. },
  128. mounted() {
  129. this.loadStudentSelected()
  130. this.getStudentElectiveModels()
  131. this.getOptionalMajors()
  132. this.getRecommendMajor()
  133. },
  134. methods: {
  135. getStudentElectiveModels() {
  136. getStudentElectiveModels().then(res => {
  137. this.generationModels = res.data
  138. })
  139. },
  140. getRecommendMajor() {
  141. getRecommendMajor().then(res => {
  142. this.evaluationMajors = res.data
  143. })
  144. },
  145. getOptionalMajors() {
  146. getOptionalMajors().then(res => {
  147. this.optionalMajors = res.data.reverse().splice(0, 6)
  148. })
  149. },
  150. loadStudentSelected() {
  151. getStudentSelected().then(res => {
  152. console.log('getStudentSelected', res)
  153. const selectStatus = res.data.selectResult
  154. selectStatus.currentGeneration = 3 // 当前所处的状态
  155. selectStatus.preferenceCount = 3 // 志愿数
  156. // selectStatus.groupIds = selectStatus.groupIds || '1,2,3,4,5,6'
  157. selectStatus.groupIds = '1,2,3,4,5,6'
  158. this.selectObj = selectStatus
  159. this.allowSelect = res.data.allowSelect
  160. })
  161. }
  162. }
  163. }
  164. </script>
  165. <style scoped>
  166. </style>