teacherNetwork.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <!-- -->
  2. <template>
  3. <div class>
  4. <div class="newBand"
  5. @click="resetCourses"
  6. v-permission="'courseSchedule/batchPracticeGroupTeacherAdjust?t=819'">课程移交</div>
  7. <div class="m-core">
  8. <div class="tableWrap">
  9. <el-table style="width: 100%"
  10. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  11. @selection-change="handleSelectionChange"
  12. :data="tableList">
  13. <el-table-column type="selection"
  14. :selectable='selectable'
  15. width="55">
  16. </el-table-column>
  17. <el-table-column align="center"
  18. prop="id"
  19. label="课程组编号"></el-table-column>
  20. <el-table-column align="center"
  21. prop="name"
  22. label="课程组名称"></el-table-column>
  23. <!-- <el-table-column align="center" prop="subjectName" label="声部"></el-table-column>
  24. <el-table-column align="center" prop="teacherName" label="指导老师"></el-table-column> -->
  25. <el-table-column align="center"
  26. prop="type"
  27. label="课程组类型"
  28. width="100">
  29. <template slot-scope="scope">
  30. <div>
  31. <p>{{scope.row.type | comType}}</p>
  32. </div>
  33. </template>
  34. </el-table-column>
  35. <el-table-column align="center"
  36. prop="groupStatus"
  37. label="课程组状态">
  38. <template slot-scope="scope">
  39. <div>
  40. <p>{{scope.row.groupStatus | comCourseGroup}}</p>
  41. </div>
  42. </template>
  43. </el-table-column>
  44. <el-table-column align="center"
  45. label="开始时间">
  46. <template slot-scope="scope">
  47. <div>
  48. <div>{{scope.row.coursesStartDate|dateForMinFormat}}</div>
  49. </div>
  50. </template>
  51. </el-table-column>
  52. <el-table-column align="center"
  53. label="结束时间">
  54. <template slot-scope="scope">
  55. <div>
  56. <div>{{scope.row.coursesExpireDate|dateForMinFormat}}</div>
  57. </div>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="是否可调整"
  61. align="center">
  62. <template slot-scope="scope">
  63. {{ scope.row.totalClassTimes-scope.row.currentClassTimes>0?'是':'否' }}
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="操作"
  67. align="center">
  68. <template slot-scope="scope">
  69. <div>
  70. <el-button type="text"
  71. v-if="(scope.row.totalClassTimes-scope.row.currentClassTimes)>0"
  72. v-permission="'courseSchedule/batchPracticeGroupTeacherAdjust?t=819'"
  73. @click="resetCourse(scope.row)">课程移交</el-button>
  74. </div>
  75. </template>
  76. </el-table-column>
  77. </el-table>
  78. <pagination
  79. sync
  80. :total.sync="rules.total"
  81. :page.sync="rules.page"
  82. :limit.sync="rules.limit"
  83. :page-sizes="rules.page_size"
  84. @pagination="getList" />
  85. </div>
  86. </div>
  87. <el-dialog title='课程移交'
  88. :visible.sync="maskVisible"
  89. width="400px">
  90. <el-form :model="maskForm"
  91. ref="maskForm">
  92. <el-form-item label="选择老师"
  93. prop="teacherId"
  94. :rules="[{ required: true, message: '请选择老师',trigger: 'blur'}]">
  95. <el-select v-model="maskForm.teacherId"
  96. clearable
  97. filterable>
  98. <el-option v-for="(item,index) in teacherList"
  99. :label="item.realName"
  100. :value="item.id"
  101. :key="index"></el-option>
  102. </el-select>
  103. </el-form-item>
  104. <!-- <el-form-item label="备注"
  105. :rules="[{ required: true, message: '请填写备注',trigger: 'blur'}]"
  106. prop='memo'>
  107. <el-input type="textarea"
  108. :rows="5"
  109. v-model="maskForm.memo"></el-input>
  110. </el-form-item> -->
  111. </el-form>
  112. <div slot="footer"
  113. class="dialog-footer">
  114. <el-button @click="maskVisible = false">取 消</el-button>
  115. <el-button type="primary"
  116. @click="submitReset">确定</el-button>
  117. </div>
  118. </el-dialog>
  119. </div>
  120. </template>
  121. <script>
  122. import pagination from "@/components/Pagination/index";
  123. import load from "@/utils/loading";
  124. import { practiceGroupManage, getTeacher, batchPracticeGroupTeacherAdjust } from "@/api/buildTeam";
  125. export default {
  126. components: { pagination },
  127. data () {
  128. return {
  129. searchForm: {
  130. search: null
  131. },
  132. teacherId: null,
  133. tableList: [],
  134. isMultiple: false,
  135. maskVisible: false,
  136. teacherList: [],
  137. chioseList: [],
  138. maskForm: {
  139. teacherId: null,
  140. memo: null
  141. },
  142. rules: {
  143. // 分页规则
  144. limit: 10, // 限制显示条数
  145. page: 1, // 当前页
  146. total: 0, // 总条数
  147. page_size: [10, 20, 40, 50] // 选择限制显示条数
  148. }
  149. };
  150. },
  151. //生命周期 - 创建完成(可以访问当前this实例)
  152. created () { },
  153. //生命周期 - 挂载完成(可以访问DOM元素)
  154. mounted () {
  155. getTeacher({}).then(res => {
  156. if (res.code == 200) {
  157. this.teacherList = res.data;
  158. }
  159. });
  160. // 获取分部
  161. this.init();
  162. },
  163. activated () {
  164. this.init();
  165. },
  166. methods: {
  167. selectable (row, index) {
  168. return row.totalClassTimes - row.currentClassTimes > 0
  169. },
  170. init () {
  171. this.teacherId = this.$route.query.teacherId
  172. this.getList();
  173. },
  174. getList () {
  175. practiceGroupManage({
  176. teacherId: this.teacherId,
  177. page: this.rules.page,
  178. rows: this.rules.limit
  179. }).then(res => {
  180. if (res.code == 200) {
  181. this.tableList = res.data.rows;
  182. this.rules.total = res.data.total;
  183. }
  184. });
  185. },
  186. resetCourse (row) {
  187. this.activeRow = row;
  188. this.isMultiple = false
  189. this.maskVisible = true
  190. },
  191. resetCourses () {
  192. if (this.chioseList.length <= 0) {
  193. this.$message.error('请至少选择一个乐团')
  194. return
  195. }
  196. this.isMultiple = true
  197. this.maskVisible = true
  198. },
  199. handleSelectionChange (val) {
  200. this.chioseList = val
  201. },
  202. submitReset () {
  203. this.$refs['maskForm'].validate(valid => {
  204. if (valid) {
  205. let obj = {};
  206. if (this.isMultiple) {
  207. // 批量调整
  208. obj.practiceGroupId = this.chioseList.map(res => {
  209. return res.id
  210. }).join(',')
  211. } else {
  212. // 单词调整
  213. obj.practiceGroupId = this.activeRow.id
  214. }
  215. obj.teacherId = this.maskForm.teacherId;
  216. obj.oldTeacherId = this.teacherId;
  217. // obj.memo = this.maskForm.memo;
  218. batchPracticeGroupTeacherAdjust(obj).then(res => {
  219. if (res.code == 200) {
  220. this.maskVisible = false;
  221. this.$message.success('修改成功')
  222. this.getList()
  223. }
  224. })
  225. }
  226. })
  227. }
  228. },
  229. watch: {
  230. maskVisible (val) {
  231. if (!val) {
  232. this.maskForm.teacherId = null;
  233. this.maskForm.memo = null
  234. }
  235. }
  236. }
  237. };
  238. </script>
  239. <style lang='scss' scoped>
  240. </style>