serveStudentList.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <div class='courseInfo'>
  3. <div class="newBand"
  4. @click="resetCourses"
  5. v-permission="'studentManage/batchUpdateAdviser'">学员移交</div>
  6. <div class="tableWrap tableMargin">
  7. <!-- <h4>试听课</h4> -->
  8. <el-table :data='tableList'
  9. @selection-change="handleSelectionChange"
  10. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  11. <el-table-column type="selection"
  12. width="55">
  13. </el-table-column>
  14. <el-table-column label="学员编号"
  15. width="150"
  16. prop='userId'>
  17. </el-table-column>
  18. <el-table-column label="学员名字"
  19. width="150"
  20. prop="name">
  21. </el-table-column>
  22. <el-table-column label="操作"
  23. align="right"
  24. prop="subjectNames">
  25. <template slot-scope="scope">
  26. <div>
  27. <el-button type="text"
  28. v-permission="'studentManage/batchUpdateAdviser'"
  29. @click="resetCourse(scope.row)">操作</el-button>
  30. </div>
  31. </template>
  32. </el-table-column>
  33. <el-table-column width="40"
  34. align="right">
  35. </el-table-column>
  36. </el-table>
  37. <pagination :total="pageInfo.total"
  38. :page.sync="pageInfo.page"
  39. :limit.sync="pageInfo.limit"
  40. :page-sizes="pageInfo.page_size"
  41. @pagination="getList" />
  42. </div>
  43. <el-dialog title='学员移交'
  44. :visible.sync="maskVisible"
  45. width="400px">
  46. <el-form :model="maskForm"
  47. ref="maskForm">
  48. <el-form-item label="选择老师"
  49. prop="teacherId"
  50. :rules="[{ required: true, message: '请选择老师',trigger: 'blur'}]">
  51. <el-select v-model="maskForm.teacherId"
  52. clearable
  53. filterable>
  54. <el-option v-for="(item,index) in teacherList"
  55. :label="item.realName"
  56. :value="item.id"
  57. :key="index"></el-option>
  58. </el-select>
  59. </el-form-item>
  60. <!-- <el-form-item label="备注"
  61. prop='memo'
  62. :rules="[{ required: true, message: '请填写备注',trigger: 'blur'}]">
  63. <el-input type="textarea"
  64. :rows="5"
  65. v-model="maskForm.memo"></el-input>
  66. </el-form-item> -->
  67. </el-form>
  68. <div slot="footer"
  69. class="dialog-footer">
  70. <el-button @click="maskVisible = false">取 消</el-button>
  71. <el-button type="primary"
  72. @click="submitReset">确定</el-button>
  73. </div>
  74. </el-dialog>
  75. </div>
  76. </template>
  77. <script>
  78. import { queryStudent, batchUpdateAdviser } from '@/api/teacherManager'
  79. import { getTeacher } from "@/api/buildTeam";
  80. import pagination from '@/components/Pagination/index'
  81. import store from '@/store'
  82. export default {
  83. name: 'courseInfo2',
  84. components: {
  85. pagination
  86. },
  87. data () {
  88. return {
  89. tableList: [],
  90. organId: null,
  91. teacherId: this.$route.query.teacherId,
  92. isMultiple: false,
  93. maskVisible: false,
  94. teacherList: [],
  95. chioseList: [],
  96. maskForm: {
  97. educationalTeacherId: null,
  98. memo: null
  99. },
  100. pageInfo: {
  101. // 分页规则
  102. limit: 10, // 限制显示条数
  103. page: 1, // 当前页
  104. total: 1, // 总条数
  105. page_size: [10, 20, 40, 50] // 选择限制显示条数
  106. }
  107. }
  108. },
  109. mounted () {
  110. getTeacher({}).then(res => {
  111. if (res.code == 200) {
  112. this.teacherList = res.data;
  113. }
  114. });
  115. // this.getList()
  116. },
  117. activated () {
  118. this.teacherId = this.$route.query.teacherId
  119. this.getList()
  120. },
  121. methods: {
  122. getList () {
  123. queryStudent({
  124. search: this.teacherId,
  125. page: this.pageInfo.page,
  126. rows: this.pageInfo.limit
  127. }).then(res => {
  128. if (res.code == 200) {
  129. this.tableList = res.data.rows;
  130. this.pageInfo.total = res.data.total;
  131. }
  132. })
  133. },
  134. resetCourse (row) {
  135. this.activeRow = row;
  136. this.isMultiple = false
  137. this.maskVisible = true
  138. },
  139. resetCourses () {
  140. if (this.chioseList.length <= 0) {
  141. this.$message.error('请至少选择一个乐团')
  142. return
  143. }
  144. this.isMultiple = true
  145. this.maskVisible = true
  146. },
  147. handleSelectionChange (val) {
  148. this.chioseList = val
  149. },
  150. submitReset () {
  151. this.$refs['maskForm'].validate(valid => {
  152. if (valid) {
  153. let obj = {};
  154. if (this.isMultiple) {
  155. // 批量调整
  156. obj.studentIds = this.chioseList.map(res => {
  157. return res.userId
  158. }).join(',')
  159. } else {
  160. // 单词调整
  161. obj.studentIds = this.activeRow.userId
  162. }
  163. obj.teacherId = this.maskForm.teacherId;
  164. // obj.memo = this.maskForm.memo;
  165. batchUpdateAdviser(obj).then(res => {
  166. if (res.code == 200) {
  167. this.maskVisible = false;
  168. this.$message.success('修改成功')
  169. this.getList()
  170. }
  171. })
  172. }
  173. })
  174. }
  175. },
  176. watch: {
  177. maskVisible (val) {
  178. if (!val) {
  179. this.maskForm.teacherId = null;
  180. }
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss" scope>
  186. .courseInfo {
  187. h4 {
  188. margin-bottom: 20px;
  189. }
  190. .tableMargin {
  191. margin-top: 20px;
  192. }
  193. }
  194. </style>