courseInfo.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <div class="courseInfo">
  3. <save-form :model="searchList" :inline="true" @submit="search" save-key='teacherDetail-courseInfo'>
  4. <el-form-item label="乐团状态">
  5. <el-select v-model.trim="searchList.status" clearable>
  6. <el-option
  7. v-for="item in musicGroupStatus"
  8. :key="item.value"
  9. :label="item.text"
  10. :value="item.value"
  11. >
  12. </el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item>
  16. <el-button type="danger" native-type="submit">搜索</el-button>
  17. </el-form-item>
  18. <el-form-item>
  19. <div
  20. class="newBand"
  21. @click="resetCourses"
  22. v-permission="'courseSchedule/classGroupTeacherAdjust'"
  23. >
  24. 课程移交
  25. </div>
  26. </el-form-item>
  27. </save-form>
  28. <div class="tableWrap">
  29. <el-table
  30. :data="tableList"
  31. @selection-change="handleSelectionChange"
  32. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  33. >
  34. <el-table-column type="selection" :selectable="selectable" width="55">
  35. </el-table-column>
  36. <el-table-column label="乐团编号" align="center" prop="musicGroupId">
  37. </el-table-column>
  38. <el-table-column label="乐团名称" align="center" prop="musicGroupName">
  39. </el-table-column>
  40. <el-table-column label="老师类型" align="center" prop="jobType">
  41. <template slot-scope="scope">
  42. {{ scope.row.jobNature | jobNature }}
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="乐团职位" align="center">
  46. <template slot-scope="scope">
  47. {{ scope.row.teacherRole | workType }}
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="执教班级" align="center">
  51. <template slot-scope="scope">
  52. {{ scope.row.classGroupNames | joinArray }}
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="乐团状态" align="center">
  56. <template slot-scope="scope">
  57. {{ scope.row.status | musicGroupType }}
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="出勤次数" align="center" prop="attendanceNum">
  61. </el-table-column>
  62. <el-table-column label="是否可调整" align="center">
  63. <template slot-scope="scope">
  64. <!-- 1.没有剩余课时,2.乐团筹备中 -->
  65. <div>
  66. <p v-if="scope.row.status == 'PROGRESS'">
  67. {{ scope.row.hasRestClass > 0 ? "是" : "否" }}
  68. </p>
  69. <p v-else>否</p>
  70. </div>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="操作" align="center">
  74. <template slot-scope="scope">
  75. <div>
  76. <el-button
  77. type="text"
  78. v-if="
  79. scope.row.hasRestClass > 0 && scope.row.status == 'PROGRESS'
  80. "
  81. v-permission="'courseSchedule/classGroupTeacherAdjust'"
  82. @click="resetCourse(scope.row)"
  83. >操作</el-button
  84. >
  85. </div>
  86. </template>
  87. </el-table-column>
  88. </el-table>
  89. <pagination
  90. save-key='teacherDetail-courseInfo'
  91. sync
  92. :total.sync="pageInfo.total"
  93. :page.sync="pageInfo.page"
  94. :limit.sync="pageInfo.limit"
  95. :page-sizes="pageInfo.page_size"
  96. @pagination="getList"
  97. />
  98. </div>
  99. <el-dialog title="课程移交" :visible.sync="maskVisible" width="400px">
  100. <el-form :model="maskForm" ref="maskForm">
  101. <el-form-item
  102. label="选择老师"
  103. prop="targetTeacherId"
  104. :rules="[{ required: true, message: '请选择老师', trigger: 'blur' }]"
  105. >
  106. <el-select v-model="maskForm.targetTeacherId" clearable filterable>
  107. <el-option
  108. v-for="(item, index) in teacherList"
  109. :label="item.realName"
  110. :value="item.id"
  111. :key="index"
  112. ></el-option>
  113. </el-select>
  114. </el-form-item>
  115. <!-- <el-form-item label="备注"
  116. prop='memo'
  117. :rules="[{ required: true, message: '请填写备注',trigger: 'blur'}]">
  118. <el-input type="textarea"
  119. :rows="5"
  120. v-model="maskForm.memo"></el-input>
  121. </el-form-item> -->
  122. </el-form>
  123. <div slot="footer" class="dialog-footer">
  124. <el-button @click="maskVisible = false">取 消</el-button>
  125. <el-button type="primary" @click="submitReset">确定</el-button>
  126. </div>
  127. </el-dialog>
  128. </div>
  129. </template>
  130. <script>
  131. import {
  132. getTeacherMusicClass,
  133. classGroupTeacherAdjust,
  134. } from "@/api/teacherManager";
  135. import { getTeacher } from "@/api/buildTeam";
  136. import { musicGroupStatus } from "@/utils/searchArray";
  137. import pagination from "@/components/Pagination/index";
  138. import store from "@/store";
  139. export default {
  140. name: "courseInfo",
  141. components: {
  142. pagination,
  143. },
  144. data() {
  145. return {
  146. tableList: [],
  147. teacherId: this.$route.query.teacherId,
  148. organId: null,
  149. searchList: {
  150. status: "",
  151. },
  152. musicGroupStatus,
  153. teacherList: [],
  154. pageInfo: {
  155. // 分页规则
  156. limit: 10, // 限制显示条数
  157. page: 1, // 当前页
  158. total: 1, // 总条数
  159. page_size: [10, 20, 40, 50], // 选择限制显示条数
  160. },
  161. activeRow: null,
  162. maskVisible: false,
  163. maskForm: {
  164. targetTeacherId: null,
  165. memo: null,
  166. },
  167. isMultiple: false,
  168. chioseList: [],
  169. };
  170. },
  171. activated() {
  172. this.teacherId = this.$route.query.teacherId;
  173. this.getList();
  174. this.musicGroupStatus = musicGroupStatus;
  175. },
  176. mounted() {
  177. this.teacherId = this.$route.query.teacherId;
  178. this.getList();
  179. this.musicGroupStatus = musicGroupStatus;
  180. // 获取指导老师
  181. getTeacher({}).then((res) => {
  182. if (res.code == 200) {
  183. this.teacherList = res.data;
  184. }
  185. });
  186. },
  187. methods: {
  188. selectable(row, index) {
  189. return row.hasRestClass > 0 && row.status == "PROGRESS";
  190. },
  191. handleSelectionChange(val) {
  192. this.chioseList = val;
  193. },
  194. search() {
  195. this.pageInfo.page = 1;
  196. this.getList();
  197. },
  198. getList() {
  199. getTeacherMusicClass({
  200. rows: this.pageInfo.limit,
  201. page: this.pageInfo.page,
  202. search: this.teacherId,
  203. status: this.searchList.status || null,
  204. }).then((res) => {
  205. if (res.code == 200) {
  206. this.tableList = res.data.rows;
  207. this.pageInfo.total = res.data.total;
  208. }
  209. });
  210. },
  211. resetCourse(row) {
  212. this.activeRow = row;
  213. this.isMultiple = false;
  214. this.maskVisible = true;
  215. },
  216. resetCourses() {
  217. if (this.chioseList.length <= 0) {
  218. this.$message.error("请至少选择一个乐团");
  219. return;
  220. }
  221. this.isMultiple = true;
  222. this.maskVisible = true;
  223. },
  224. submitReset() {
  225. this.$refs["maskForm"].validate((valid) => {
  226. if (valid) {
  227. let obj = {};
  228. if (this.isMultiple) {
  229. // 批量调整
  230. obj.classGroupIds = this.chioseList
  231. .map((res) => {
  232. return res.classGroupIds;
  233. })
  234. .join(",");
  235. } else {
  236. // 单词调整
  237. obj.classGroupIds = this.activeRow.classGroupIds;
  238. }
  239. obj.targetTeacherId = this.maskForm.targetTeacherId;
  240. obj.teacherId = this.teacherId;
  241. // obj.memo = this.maskForm.memo;
  242. classGroupTeacherAdjust(obj).then((res) => {
  243. if (res.code == 200) {
  244. this.maskVisible = false;
  245. this.$message.success("修改成功");
  246. this.getList();
  247. }
  248. });
  249. }
  250. });
  251. },
  252. },
  253. watch: {
  254. maskVisible(val) {
  255. if (!val) {
  256. this.maskForm.targetTeacherId = null;
  257. this.maskForm.memo = null;
  258. }
  259. },
  260. },
  261. };
  262. </script>
  263. <style lang="scss" scope>
  264. .courseInfo {
  265. h4 {
  266. margin-bottom: 20px;
  267. }
  268. .tableMargin {
  269. margin-top: 20px;
  270. }
  271. }
  272. </style>