setImprovement.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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
  100. type="text"
  101. @click="scope._self.$refs[scope.$index].doClose()">取消</el-button>
  102. <el-button type="primary"
  103. @click="removeStudent(scope)">确定</el-button>
  104. </div>
  105. <el-button type="text"
  106. slot="reference">删除</el-button>
  107. </el-popover>
  108. <!-- <el-button type="text"
  109. v-permission="'classGroupStudent/adjustClassGroup'"
  110. @click="resetClass(scope.row)">调整班级</el-button> -->
  111. </div>
  112. </template>
  113. </el-table-column>
  114. </el-table>
  115. </el-dialog>
  116. <el-dialog title="学员班级调整"
  117. width="600px"
  118. append-to-body
  119. :visible.sync="resetVisible">
  120. <div class="radioBox"
  121. v-for="(item,index) in tableList"
  122. :key="index">
  123. <el-radio v-model.trim="studentRadio"
  124. style="width:120px;"
  125. :label="item.id">{{ item.name }}</el-radio>
  126. <div>预计人数:{{ item.expectStudentNum }}</div>
  127. <div>实际人数:{{ item.studentNum }}</div>
  128. </div>
  129. <div slot="footer"
  130. class="dialog-footer">
  131. <el-button type="primary"
  132. @click="resetStudent">确 定</el-button>
  133. </div>
  134. </el-dialog>
  135. </div>
  136. </template>
  137. <script>
  138. import { highClassGroups, teamSoundStudent, resetHighClass, pushMessage, getMusicGroupStuNoClassType } from '@/api/buildTeam'
  139. import { getClassAllStudent, addStudents, removeStudents } from '@/api/studentManager'
  140. // import QRCode from 'qrcodejs2'
  141. export default {
  142. name: 'setImprovement',
  143. data () {
  144. return {
  145. tableList: [],
  146. teamid: '',
  147. lookDeatilVisible: false,
  148. addStudentVisible: false,
  149. resetVisible: false,
  150. studentList: [], // 乐团所有学生
  151. activeStudentList: [], // 选中的学生集合
  152. activeClass: '', // 选中的班级id
  153. classList: [],
  154. activeStudent: null,
  155. studentRadio: '', // 学生新选择的班级
  156. qrcodeStatus: false, // 生成二维码
  157. qrcodes: true,
  158. qrcode: null,
  159. codeUrl: null,
  160. Fsearch: null,
  161. Frules: null
  162. }
  163. },
  164. mounted () {
  165. this.init()
  166. },
  167. activated () {
  168. this.init()
  169. },
  170. methods: {
  171. init () {
  172. this.teamid = this.$route.query.id;
  173. if (this.$route.query.search) {
  174. this.Fsearch = this.$route.query.search;
  175. }
  176. if (this.$route.query.rules) {
  177. this.Frules = this.$route.query.rules
  178. }
  179. this.getList();
  180. // teamSoundStudent({ musicGroupId: this.teamid }).then(res => {
  181. // if (res.code == 200) {
  182. // this.studentList = res.data;
  183. // }
  184. // })
  185. },
  186. onApply () {
  187. this.$confirm('您确定开启报名吗?', '提示', {
  188. confirmButtonText: '确定',
  189. cancelButtonText: '取消',
  190. type: 'warning'
  191. }).then(() => {
  192. pushMessage({ musicGroupId: this.teamid }).then(res => {
  193. let result = res.data
  194. if (res.code == 200) {
  195. this.$message.success('开启成功')
  196. } else {
  197. this.$message.error(res.msg)
  198. }
  199. })
  200. }).catch(() => { })
  201. },
  202. // onCreateQRCode () { // 生成报名二维码
  203. // this.qrcodeStatus = true
  204. // let id = this.$route.query.id
  205. // let teamName = this.$route.query.name
  206. // if (this.qrcodes) {
  207. // this.qrcodes = false
  208. // setTimeout(() => {
  209. // this.qrcode = new QRCode('qrcode', {
  210. // width: 200,
  211. // height: 200,
  212. // colorDark: '#000000',
  213. // colorLight: '#ffffff',
  214. // correctLevel: QRCode.CorrectLevel.H
  215. // })
  216. // this.qrcode.makeCode('http://mstudev.dayaedu.com/#/smallLogin?musicGroupId=' + id)
  217. // this.codeUrl = 'http://mstudev.dayaedu.com/#/smallLogin?musicGroupId=' + id
  218. // }, 500)
  219. // }
  220. // },
  221. getList () {
  222. highClassGroups({ musicGroupId: this.teamid }).then(res => {
  223. if (res.code == 200) {
  224. this.tableList = res.data;
  225. }
  226. })
  227. },
  228. lookDeatil (row) {
  229. console.log(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. let type = row.type;
  242. getMusicGroupStuNoClassType({ musicGroupId: this.teamid, type}).then(res => {
  243. if (res.code == 200) {
  244. this.studentList = res.data;
  245. this.addStudentVisible = true;
  246. }
  247. })
  248. },
  249. addStudnt () {
  250. // 发请求添加学生
  251. let classGroupId = this.activeClass;
  252. let userIdsStr = this.activeStudentList.map(item => {
  253. return item.userId
  254. }).join(',')
  255. addStudents({ userIdsStr, classGroupId }).then(res => {
  256. if (res.code == 200) {
  257. this.$message.success('添加成功')
  258. this.activeStudentList = [];
  259. this.addStudentVisible = false;
  260. // 取消列表的勾选
  261. this.$refs.studentList.clearSelection();
  262. this.getList();
  263. }
  264. })
  265. },
  266. selectStudent (val) {
  267. this.activeStudentList = val;
  268. },
  269. // 删除学生
  270. removeStudent (scope) {
  271. removeStudents({ classGroupId: this.activeClass, userId: scope.row.userId }).then(res => {
  272. if (res.code == 200) {
  273. this.$message.success('恭喜你删除成功');
  274. scope._self.$refs[scope.$index].doClose();
  275. getClassAllStudent({ classGroupId: this.activeClass }).then(res => {
  276. if (res.code == 200) {
  277. this.classList = res.data;
  278. this.getList()
  279. }
  280. })
  281. }
  282. })
  283. },
  284. onCancel () {
  285. this.$router.push({ path: '/teamList', query: { search: this.Fsearch, rules: this.Frules } })
  286. },
  287. resetClass (row) {
  288. this.activeStudent = row.userId;
  289. this.resetVisible = true;
  290. },
  291. resetStudent () {
  292. // this.studentRadio; // 选中的班级
  293. // this.activeClass; // 要调整的班级
  294. // this.activeStudent // 学生id
  295. resetHighClass({ classGroupId: this.studentRadio, oldClassGroupId: this.activeClass, userId: this.activeStudent }).then(res => {
  296. if (res.code == 200) {
  297. this.$message.success('调剂成功')
  298. this.resetVisible = false;
  299. this.getList();
  300. this.lookDeatil()
  301. }
  302. })
  303. }
  304. },
  305. }
  306. </script>
  307. <style lang="scss">
  308. .radioBox {
  309. display: flex;
  310. flex-direction: row;
  311. justify-content: flex-start;
  312. margin-bottom: 20px;
  313. div {
  314. margin-right: 30px;
  315. width: 80px;
  316. }
  317. }
  318. </style>