setImprovement.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class='squrt'></div>提高班报名详情
  5. </h2>
  6. <div class='m-core'>
  7. <div class="tableWrap">
  8. <el-table :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  9. :data='tableList'>
  10. <el-table-column label="班级名称"
  11. prop="name">
  12. </el-table-column>
  13. <el-table-column label="声部"
  14. prop="subjectName">
  15. </el-table-column>
  16. <el-table-column label="预计人数"
  17. prop="expectStudentNum">
  18. </el-table-column>
  19. <el-table-column label="实际人数"
  20. prop="studentNum">
  21. </el-table-column>
  22. <el-table-column label="操作">
  23. <template slot-scope="scope">
  24. <div>
  25. <el-button type="text"
  26. @click='lookDeatil(scope.row)'>查看</el-button>
  27. <el-button type="text"
  28. @click="addstudentBtn(scope.row)">添加学员</el-button>
  29. </div>
  30. </template>
  31. </el-table-column>
  32. </el-table>
  33. </div>
  34. </div>
  35. <el-dialog title="添加学员"
  36. width="600px"
  37. :visible.sync="addStudentVisible">
  38. <el-table :data="studentList"
  39. ref='studentList'
  40. @selection-change="selectStudent"
  41. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  42. <el-table-column type="selection"
  43. width="55"></el-table-column>
  44. <el-table-column prop='name'
  45. label="学生姓名"></el-table-column>
  46. <el-table-column property="classGroupName"
  47. label="所在班级"></el-table-column>
  48. </el-table>
  49. <div slot="footer"
  50. class="dialog-footer">
  51. <el-button type="primary"
  52. @click="addStudnt">确 定</el-button>
  53. </div>
  54. </el-dialog>
  55. <el-dialog title="小班课学员详情"
  56. width="600px"
  57. :visible.sync="lookDeatilVisible">
  58. <el-table :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  59. :data='classList'>
  60. <el-table-column label="学员姓名"
  61. prop="name">
  62. </el-table-column>
  63. <el-table-column label="操作">
  64. <template slot-scope="scope">
  65. <div>
  66. <el-popover placement="top"
  67. width="160"
  68. :ref="scope.$index">
  69. <p>确定删除该学生?</p>
  70. <div style="text-align: right; margin-top: 20px">
  71. <el-button size="mini"
  72. type="text"
  73. @click="scope._self.$refs[scope.$index].doClose()">取消</el-button>
  74. <el-button type="primary"
  75. size="mini"
  76. @click="removeStudent(scope)">确定</el-button>
  77. </div>
  78. <el-button type="text"
  79. slot="reference">删除</el-button>
  80. </el-popover>
  81. <el-button type="text">调整班级</el-button>
  82. </div>
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. </el-dialog>
  87. <el-dialog title="学员班级调整"
  88. width="600px"
  89. append-to-body
  90. :visible.sync="resetVisible">
  91. <div class="radioBox">
  92. <el-radio v-model="studentRadio"
  93. label="1">备选项</el-radio>
  94. <div>预计人数:</div>
  95. <div>实际人数:</div>
  96. </div>
  97. </el-dialog>
  98. </div>
  99. </template>
  100. <script>
  101. import { highClassGroups, teamSoundStudent } from '@/api/buildTeam'
  102. import { getClassAllStudent, addStudents } from '@/api/studentManager'
  103. export default {
  104. data () {
  105. return {
  106. tableList: [],
  107. teamid: '',
  108. lookDeatilVisible: false,
  109. addStudentVisible: false,
  110. resetVisible: false,
  111. studentList: [], // 乐团所有学生
  112. activeStudentList: [], // 选中的学生集合
  113. activeClass: '', // 选中的班级id
  114. classList: [],
  115. activeStudent: null,
  116. studentRadio: '' // 学生新选择的班级
  117. }
  118. },
  119. mounted () {
  120. this.teamid = this.$route.query.id;
  121. // console.log(this.teamid)
  122. this.getList();
  123. teamSoundStudent({ musicGroupId: this.teamid }).then(res => {
  124. if (res.code == 200) {
  125. this.studentList = res.data;
  126. }
  127. })
  128. },
  129. methods: {
  130. getList () {
  131. highClassGroups({ musicGroupId: this.teamid }).then(res => {
  132. if (res.code == 200) {
  133. this.tableList = res.data;
  134. }
  135. })
  136. },
  137. lookDeatil (row) {
  138. this.lookDeatilVisible = true;
  139. console.log(row.id);
  140. getClassAllStudent({ classGroupId: row.id }).then(res => {
  141. if (res.code == 200) {
  142. this.classList = res.data;
  143. }
  144. })
  145. return
  146. },
  147. addstudentBtn (row) {
  148. this.activeClass = row.id;
  149. this.addStudentVisible = true;
  150. },
  151. addStudnt () {
  152. // 发请求添加学生
  153. let classGroupId = this.activeClass;
  154. let userIdsStr = this.activeStudentList.map(item => {
  155. return item.id
  156. }).join(',')
  157. addStudents({ userIdsStr, classGroupId }).then(res => {
  158. if (res.code == 200) {
  159. this.$message.success('添加成功')
  160. this.activeStudentList = [];
  161. this.addStudentVisible = false;
  162. // 取消列表的勾选
  163. this.$refs.studentList.clearSelection();
  164. this.getList();
  165. }
  166. })
  167. },
  168. selectStudent (val) {
  169. this.activeStudentList = val;
  170. },
  171. // 删除学生
  172. removeStudent (scope) {
  173. console.log(scope.row.id);
  174. scope._self.$refs[scope.$index].doClose();
  175. }
  176. },
  177. }
  178. </script>
  179. <style lang="scss">
  180. .radioBox {
  181. display: flex;
  182. flex-direction: row;
  183. justify-content: flex-start;
  184. margin-bottom: 20px;
  185. div {
  186. margin-right: 30px;
  187. }
  188. }
  189. </style>