setImprovement.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <el-page-header @back="onCancel"
  5. content="基础技能班报名详情"></el-page-header>
  6. <!-- <div class='squrt'></div> -->
  7. <!-- <span @click="onCreateQRCode" style="font-size: 16px; padding-left: 20px; font-weight: 400;cursor: pointer; ">查看报名连接</span> -->
  8. <span @click="onApply"
  9. v-permission="'musicGroup/pushMessage'"
  10. style="font-size: 16px; padding-left: 20px; font-weight: 400;cursor: pointer; color: #409eff;">开启报名</span>
  11. </h2>
  12. <div class='m-core'>
  13. <div class="tableWrap">
  14. <el-table :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  15. :data='tableList'>
  16. <el-table-column label="班级名称"
  17. align="center"
  18. prop="name">
  19. </el-table-column>
  20. <el-table-column label="声部"
  21. align="center"
  22. prop="subjectName">
  23. </el-table-column>
  24. <el-table-column label="预计人数"
  25. align="center"
  26. prop="expectStudentNum">
  27. </el-table-column>
  28. <el-table-column label="实际人数"
  29. align="center"
  30. prop="studentNum">
  31. </el-table-column>
  32. <el-table-column label="操作">
  33. <template slot-scope="scope">
  34. <div>
  35. <el-button type="text"
  36. v-permission="'classGroupStudent/findAllStudent'"
  37. @click='lookDeatil(scope.row)'>查看</el-button>
  38. <el-button type="text"
  39. v-permission="'classGroupStudent/addStudents'"
  40. @click="addstudentBtn(scope.row)">添加学员</el-button>
  41. </div>
  42. </template>
  43. </el-table-column>
  44. </el-table>
  45. </div>
  46. </div>
  47. <el-dialog title="报名二维码"
  48. :visible.sync="qrcodeStatus"
  49. width="300px">
  50. <div class="left-code"
  51. style="display: flex; flex-direction: column; align-items: center;">
  52. <h2>小班课报名连接</h2>
  53. <div id="qrcode"
  54. class="qrcode code"
  55. ref="qrCodeUrl"></div>
  56. <p class="code-url"
  57. style="width: 220px"
  58. v-if="codeUrl">{{ codeUrl }}</p>
  59. </div>
  60. </el-dialog>
  61. <el-dialog title="添加学员"
  62. width="600px"
  63. :visible.sync="addStudentVisible">
  64. <el-table :data="studentList"
  65. ref='studentList'
  66. @selection-change="selectStudent"
  67. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  68. <el-table-column type="selection"
  69. width="55"></el-table-column>
  70. <el-table-column prop='name'
  71. label="学生姓名"></el-table-column>
  72. <el-table-column property="classGroupName"
  73. label="所在班级"></el-table-column>
  74. </el-table>
  75. <div slot="footer"
  76. class="dialog-footer">
  77. <el-button type="primary"
  78. v-permission="'classGroupStudent/addStudents'"
  79. @click="addStudnt">确 定</el-button>
  80. </div>
  81. </el-dialog>
  82. <el-dialog title="小班课学员详情"
  83. width="600px"
  84. :visible.sync="lookDeatilVisible">
  85. <el-table :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  86. :data='classList'>
  87. <el-table-column label="学员姓名"
  88. prop="name">
  89. </el-table-column>
  90. <el-table-column label="操作">
  91. <template slot-scope="scope">
  92. <div>
  93. <el-popover placement="top"
  94. v-permission="'classGroupStudent/del'"
  95. width="160"
  96. :ref="scope.$index">
  97. <p>确定删除该学生?</p>
  98. <div style="text-align: right; margin-top: 20px">
  99. <el-button size="mini"
  100. type="text"
  101. @click="scope._self.$refs[scope.$index].doClose()">取消</el-button>
  102. <el-button type="primary"
  103. size="mini"
  104. @click="removeStudent(scope)">确定</el-button>
  105. </div>
  106. <el-button type="text"
  107. slot="reference">删除</el-button>
  108. </el-popover>
  109. <el-button type="text"
  110. v-permission="'classGroupStudent/adjustClassGroup'"
  111. @click="resetClass(scope.row)">调整班级</el-button>
  112. </div>
  113. </template>
  114. </el-table-column>
  115. </el-table>
  116. </el-dialog>
  117. <el-dialog title="学员班级调整"
  118. width="600px"
  119. append-to-body
  120. :visible.sync="resetVisible">
  121. <div class="radioBox"
  122. v-for="(item,index) in tableList"
  123. :key="index">
  124. <el-radio v-model.trim="studentRadio"
  125. style="width:120px;"
  126. :label="item.id">{{ item.name }}</el-radio>
  127. <div>预计人数:{{ item.expectStudentNum }}</div>
  128. <div>实际人数:{{ item.studentNum }}</div>
  129. </div>
  130. <div slot="footer"
  131. class="dialog-footer">
  132. <el-button type="primary"
  133. @click="resetStudent">确 定</el-button>
  134. </div>
  135. </el-dialog>
  136. </div>
  137. </template>
  138. <script>
  139. import { highClassGroups, teamSoundStudent, resetHighClass, pushMessage } from '@/api/buildTeam'
  140. import { getClassAllStudent, addStudents, removeStudents } from '@/api/studentManager'
  141. // import QRCode from 'qrcodejs2'
  142. export default {
  143. name: 'setImprovement',
  144. data () {
  145. return {
  146. tableList: [],
  147. teamid: '',
  148. lookDeatilVisible: false,
  149. addStudentVisible: false,
  150. resetVisible: false,
  151. studentList: [], // 乐团所有学生
  152. activeStudentList: [], // 选中的学生集合
  153. activeClass: '', // 选中的班级id
  154. classList: [],
  155. activeStudent: null,
  156. studentRadio: '', // 学生新选择的班级
  157. qrcodeStatus: false, // 生成二维码
  158. qrcodes: true,
  159. qrcode: null,
  160. codeUrl: null,
  161. Fsearch: null,
  162. Frules: null
  163. }
  164. },
  165. mounted () {
  166. this.init()
  167. },
  168. activated () {
  169. this.init()
  170. },
  171. methods: {
  172. init () {
  173. this.teamid = this.$route.query.id;
  174. if (this.$route.query.search) {
  175. this.Fsearch = this.$route.query.search;
  176. }
  177. if (this.$route.query.rules) {
  178. this.Frules = this.$route.query.rules
  179. }
  180. this.getList();
  181. teamSoundStudent({ musicGroupId: this.teamid }).then(res => {
  182. if (res.code == 200) {
  183. this.studentList = res.data;
  184. }
  185. })
  186. },
  187. onApply () {
  188. this.$confirm('您确定开启报名吗?', '提示', {
  189. confirmButtonText: '确定',
  190. cancelButtonText: '取消',
  191. type: 'warning'
  192. }).then(() => {
  193. pushMessage({ musicGroupId: this.teamid }).then(res => {
  194. let result = res.data
  195. if (res.code == 200) {
  196. this.$message.success('开启成功')
  197. } else {
  198. this.$message.error(res.msg)
  199. }
  200. })
  201. }).catch(() => { })
  202. },
  203. // onCreateQRCode () { // 生成报名二维码
  204. // this.qrcodeStatus = true
  205. // let id = this.$route.query.id
  206. // let teamName = this.$route.query.name
  207. // if (this.qrcodes) {
  208. // this.qrcodes = false
  209. // setTimeout(() => {
  210. // this.qrcode = new QRCode('qrcode', {
  211. // width: 200,
  212. // height: 200,
  213. // colorDark: '#000000',
  214. // colorLight: '#ffffff',
  215. // correctLevel: QRCode.CorrectLevel.H
  216. // })
  217. // this.qrcode.makeCode('http://mstudev.dayaedu.com/#/smallLogin?musicGroupId=' + id)
  218. // this.codeUrl = 'http://mstudev.dayaedu.com/#/smallLogin?musicGroupId=' + id
  219. // }, 500)
  220. // }
  221. // },
  222. getList () {
  223. highClassGroups({ musicGroupId: this.teamid }).then(res => {
  224. if (res.code == 200) {
  225. this.tableList = res.data;
  226. }
  227. })
  228. },
  229. lookDeatil (row) {
  230. this.lookDeatilVisible = true;
  231. this.activeClass = row.id;
  232. getClassAllStudent({ classGroupId: this.activeClass }).then(res => {
  233. if (res.code == 200) {
  234. this.classList = res.data;
  235. }
  236. })
  237. return
  238. },
  239. addstudentBtn (row) {
  240. this.activeClass = row.id;
  241. this.addStudentVisible = true;
  242. },
  243. addStudnt () {
  244. // 发请求添加学生
  245. let classGroupId = this.activeClass;
  246. let userIdsStr = this.activeStudentList.map(item => {
  247. return item.userId
  248. }).join(',')
  249. addStudents({ userIdsStr, classGroupId }).then(res => {
  250. if (res.code == 200) {
  251. this.$message.success('添加成功')
  252. this.activeStudentList = [];
  253. this.addStudentVisible = false;
  254. // 取消列表的勾选
  255. this.$refs.studentList.clearSelection();
  256. this.getList();
  257. }
  258. })
  259. },
  260. selectStudent (val) {
  261. this.activeStudentList = val;
  262. },
  263. // 删除学生
  264. removeStudent (scope) {
  265. removeStudents({ classGroupId: this.activeClass, userId: scope.row.userId }).then(res => {
  266. if (res.code == 200) {
  267. this.$message.success('恭喜你删除成功');
  268. scope._self.$refs[scope.$index].doClose();
  269. getClassAllStudent({ classGroupId: this.activeClass }).then(res => {
  270. if (res.code == 200) {
  271. this.classList = res.data;
  272. this.getList();
  273. }
  274. })
  275. }
  276. })
  277. },
  278. onCancel () {
  279. this.$router.push({ path: '/business/teamDetail', query: { search: this.Fsearch, rules: this.Frules } })
  280. },
  281. resetClass (row) {
  282. this.activeStudent = row.userId;
  283. this.resetVisible = true;
  284. },
  285. resetStudent () {
  286. // this.studentRadio; // 选中的班级
  287. // this.activeClass; // 要调整的班级
  288. // this.activeStudent // 学生id
  289. resetHighClass({ classGroupId: this.studentRadio, oldClassGroupId: this.activeClass, userId: this.activeStudent }).then(res => {
  290. if (res.code == 200) {
  291. this.$message.success('调剂成功')
  292. this.resetVisible = false;
  293. this.getList();
  294. }
  295. })
  296. }
  297. },
  298. }
  299. </script>
  300. <style lang="scss">
  301. .radioBox {
  302. display: flex;
  303. flex-direction: row;
  304. justify-content: flex-start;
  305. margin-bottom: 20px;
  306. div {
  307. margin-right: 30px;
  308. width: 80px;
  309. }
  310. }
  311. </style>