memberClassList.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. <template>
  2. <div class="m-container">
  3. <div class="line"></div>
  4. <h2>
  5. <el-page-header @back="goBack" :content="$route.query.name">
  6. </el-page-header>
  7. </h2>
  8. <div class="topWrap">
  9. <el-form :inline="true" :model="topForm">
  10. <el-form-item label="班级类型">
  11. <el-select
  12. v-model.trim="topForm.classType"
  13. clearable
  14. filterable
  15. @change="changeMixClass"
  16. >
  17. <el-option
  18. v-for="(item, index) in musicClassTypeList"
  19. :key="index"
  20. :label="item.label"
  21. :value="item.value"
  22. ></el-option>
  23. </el-select>
  24. </el-form-item>
  25. </el-form>
  26. </div>
  27. <div class="btnList">
  28. <el-form :inline="true">
  29. <el-form-item label="开课日期:">
  30. <p>{{ form.startCourseDate }}</p>
  31. </el-form-item>
  32. <el-form-item>
  33. <auth auths="musicGroupSchoolTermCourseDetail/upset/4444">
  34. <el-button type="primary" @click="resetStartTime">修改</el-button>
  35. </auth>
  36. </el-form-item>
  37. <el-form-item v-if="form.endSchoolTerm">
  38. <p style="color: red">该学期结束日期为:{{ form.endSchoolTerm }}</p>
  39. </el-form-item>
  40. </el-form>
  41. </div>
  42. <div class="tableWrap" style>
  43. <el-table
  44. :data="activeSingleList"
  45. @expand-change="changeDetail"
  46. style
  47. ref="multipleTable"
  48. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  49. tooltip-effect="dark"
  50. ><el-table-column type="expand">
  51. <template slot-scope="props">
  52. <el-table
  53. :data="props.row.courseData"
  54. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  55. >
  56. <el-table-column align="center" prop="name" label="课程类型">
  57. <template slot-scope="scope">
  58. <div>{{ scope.row.type | courseTypeFormat }}</div>
  59. </template>
  60. </el-table-column>
  61. <el-table-column align="center" prop="name" label="课程名称">
  62. <template slot-scope="scope">
  63. <div>{{ scope.row.name }}</div>
  64. </template>
  65. </el-table-column>
  66. <el-table-column
  67. align="center"
  68. prop="name"
  69. label="预开始时间"
  70. width="200px"
  71. >
  72. <template slot-scope="scope"
  73. >{{
  74. scope.row.startClassTime
  75. ? scope.row.startClassTime.substr(0, 16)
  76. : ""
  77. }}-{{
  78. scope.row.endClassTime
  79. ? scope.row.endClassTime.substr(11, 5)
  80. : ""
  81. }}</template
  82. >
  83. </el-table-column>
  84. <el-table-column
  85. align="center"
  86. prop="name"
  87. label="课程时长(分钟)"
  88. >
  89. <template slot-scope="scope">
  90. <div>
  91. {{ getCourseTime(scope.row) }}
  92. </div>
  93. </template>
  94. </el-table-column>
  95. <el-table-column
  96. align="center"
  97. prop="actualTeacherName"
  98. label="主教老师"
  99. ></el-table-column>
  100. <el-table-column
  101. align="center"
  102. prop="teachingTeacherNames"
  103. label="助教老师"
  104. ></el-table-column>
  105. </el-table>
  106. </template>
  107. </el-table-column>
  108. <el-table-column
  109. align="center"
  110. prop="name"
  111. label="班级名称"
  112. ></el-table-column>
  113. <el-table-column align="center" prop="type" label="班级类型">
  114. <template slot-scope="scope">
  115. <div>{{ scope.row.type | classType }}</div>
  116. </template>
  117. </el-table-column>
  118. <el-table-column align="center" prop="studentNum" label="当前班级人数">
  119. <template slot-scope="scope">
  120. <div>{{ scope.row.studentNum }}人</div>
  121. </template>
  122. </el-table-column>
  123. <el-table-column align="center" prop label="主教老师">
  124. <template slot-scope="scope">
  125. <div v-if="scope.row.classGroupTeacherMapperList">
  126. <p
  127. v-for="(item, index) in scope.row.classGroupTeacherMapperList"
  128. :key="index"
  129. >
  130. <span v-if="item.teacherRole == 'BISHOP'">
  131. {{ item.userName }}
  132. </span>
  133. </p>
  134. </div>
  135. </template>
  136. </el-table-column>
  137. <el-table-column align="center" label="助教老师">
  138. <template slot-scope="scope">
  139. <div v-if="scope.row.classGroupTeacherMapperList">
  140. <p
  141. v-for="(item, index) in scope.row.classGroupTeacherMapperList"
  142. :key="index"
  143. >
  144. <span v-if="item.teacherRole == 'TEACHING'">
  145. {{ item.userName }}
  146. </span>
  147. </p>
  148. </div>
  149. </template>
  150. </el-table-column>
  151. <el-table-column align="center" label="已预排课次(节)">
  152. <template slot-scope="scope">
  153. <div>{{ scope.row.preTotalClassTimes }}</div>
  154. </template>
  155. </el-table-column>
  156. <el-table-column align="center" label="已预排课时长(分钟)">
  157. <template slot-scope="scope">
  158. <div>{{ scope.row.preMinutes }}</div>
  159. </template>
  160. </el-table-column>
  161. <el-table-column align="center" label="剩余可排课时长(分钟)">
  162. <template slot-scope="scope">
  163. <div>{{ scope.row.preSubMinutes }}</div>
  164. </template>
  165. </el-table-column>
  166. <el-table-column
  167. align="center"
  168. width="240px"
  169. label="操作"
  170. v-if="team_status == 'PREPARE' || team_status == 'PROGRESS'"
  171. >
  172. <template slot-scope="scope" v-if="scope.row.lockFlag != 1">
  173. <div>
  174. <el-button
  175. type="text"
  176. v-if="scope.row.preTotalClassTimes == 0"
  177. @click="planCourse(scope.row)"
  178. >预排课</el-button
  179. >
  180. <el-button type="text" v-else @click="cancleCourse(scope.row)"
  181. >取消排课</el-button
  182. >
  183. </div>
  184. </template>
  185. </el-table-column>
  186. </el-table>
  187. <div class="lastBtnWrap">
  188. <el-button type="primary" @click="submitCourse">确认排课</el-button>
  189. </div>
  190. </div>
  191. <el-dialog
  192. title="请设置开课日期"
  193. :visible.sync="startVisible"
  194. width="500px"
  195. >
  196. <el-form :model="form" ref="form">
  197. <el-form-item
  198. label="开课日期"
  199. prop="startCourseDate"
  200. :rules="[{ required: true, message: '请选择开课日期' }]"
  201. >
  202. <el-date-picker
  203. v-model.trim="form.startCourseDate"
  204. type="date"
  205. :picker-options="pickerOptions"
  206. value-format="yyyy-MM-dd"
  207. placeholder="请选择时间"
  208. />
  209. </el-form-item>
  210. </el-form>
  211. <div slot="footer" class="dialog-footer">
  212. <el-button type="primary" @click="setStartTime">确 定</el-button>
  213. </div>
  214. </el-dialog>
  215. <!-- /**
  216. :classType="classType" // 调整类型
  217. :teacherList="teacherList"
  218. :cooperationList="cooperationList" // 助教列表
  219. :musicGroupId="teamid"
  220. :activeType="activeType" // 班级类型
  221. :courseTypeList="courseTypeList" // 班级可排课类型
  222. :detail="infoDetail" // activeRow
  223. :studentSubmitedData="studentSubmitedData" 班级的学生信息
  224. @close="infoVisible = false" // 显示隐藏
  225. @submited="getList" 刷新列表 */ -->
  226. <el-dialog
  227. title="班级排课"
  228. width="1200px"
  229. :modal-append-to-body="false"
  230. :visible.sync="courseVisible"
  231. >
  232. <memberClassSetting
  233. v-if="courseVisible"
  234. :musicGroupSchoolTermCourseDetailId="musicGroupSchoolTermCourseDetailId"
  235. :teacherList="teacherList"
  236. :cooperationList="cooperationList"
  237. :courseTypeList="courseTypeList"
  238. :musicGroupId="teamid"
  239. :activeType="activeType"
  240. :detail="classDteail"
  241. :startCourseDate="form.startCourseDate"
  242. :endSchoolTerm="form.endSchoolTerm"
  243. @close="courseVisible = false"
  244. @submited="getList"
  245. />
  246. </el-dialog>
  247. </div>
  248. </template>
  249. <script>
  250. import {
  251. getAllSignClassandTeacher,
  252. getTeamBaseInfo,
  253. musicGroupSchoolTermCourseDetail,
  254. getTeacher,
  255. cancelPreCourseSchedule,
  256. getPreCourseList,
  257. confirmPreCourseSchedule,
  258. } from "@/api/buildTeam";
  259. import { classTimeList, musicClassTypeList } from "@/utils/searchArray";
  260. import memberClassSetting from "./modals/member-class-setting.vue";
  261. import { getCourseType } from "@/utils/utils";
  262. import { diffTimerFormMinute } from "@/utils/date";
  263. import dayjs from "dayjs";
  264. export default {
  265. components: { memberClassSetting },
  266. data() {
  267. return {
  268. musicClassTypeList,
  269. topForm: {
  270. classType: "",
  271. },
  272. team_status: "",
  273. activeSingleList: [],
  274. form: { startCourseDate: "", endSchoolTerm: "" },
  275. startVisible: false,
  276. pickerOptions: {
  277. firstDayOfWeek: 1,
  278. disabledDate(time) {
  279. return time.getTime() + 86400000 <= new Date().getTime(); //开始时间不选时,结束时间最大值小于等于当天
  280. },
  281. },
  282. lastDate: "",
  283. musicGroupSchoolTermCourseDetailId: "",
  284. courseVisible: false,
  285. teacherList: [],
  286. courseTypeList: [],
  287. cooperationList: [],
  288. activeType: "",
  289. teamid: "",
  290. classDteail: null,
  291. };
  292. },
  293. mounted() {
  294. this.init();
  295. },
  296. methods: {
  297. async init() {
  298. this.teamid = this.$route.query.id;
  299. this.team_status = this.$route.query.team_status;
  300. if (this.musicGroupInfo) {
  301. this.organId = this.musicGroupInfos.organId;
  302. this.chargeTypeId = this.musicGroupInfos.chargeTypeId;
  303. this.courseViewType = this.musicGroupInfos.courseViewType;
  304. } else {
  305. getTeamBaseInfo({ musicGroupId: this.teamid }).then((res) => {
  306. if (res.code == 200) {
  307. this.musicGroupInfos = res.data.musicGroup;
  308. this.organId = this.musicGroupInfos.organId;
  309. this.chargeTypeId = this.musicGroupInfos.chargeTypeId;
  310. this.courseViewType = this.musicGroupInfos.courseViewType;
  311. }
  312. });
  313. }
  314. // 请求接口 获取乐团排课时长
  315. try {
  316. const res = await musicGroupSchoolTermCourseDetail({
  317. musicGroupId: this.teamid,
  318. });
  319. if (!res.data) {
  320. // 说明没有设置时间 弹窗设置
  321. this.startVisible = true;
  322. } else {
  323. this.form.startCourseDate = dayjs(res.data.startCourseDate).format(
  324. "YYYY-MM-DD"
  325. );
  326. this.form.endSchoolTerm = dayjs(res.data.endSchoolTerm).format(
  327. "YYYY-MM-DD"
  328. );
  329. this.musicGroupSchoolTermCourseDetailId = res.data.id;
  330. }
  331. } catch (e) {
  332. console.log(e);
  333. }
  334. // 获取主教老师和助教老师
  335. getTeacher({ organId: this.organId }).then((res) => {
  336. if (res.code == 200) {
  337. this.cooperationList = res.data;
  338. this.teacherList = res.data;
  339. }
  340. });
  341. await this.getList();
  342. },
  343. changeMixClass(val) {
  344. // 根据合奏班id获取合奏班下的所有声部班
  345. console.log(val);
  346. this.getList(val);
  347. this.activeMixClass = val;
  348. },
  349. getList(val) {
  350. return getAllSignClassandTeacher({
  351. musicGroupId: this.teamid,
  352. type: val,
  353. }).then((res) => {
  354. if (res.code == 200) {
  355. this.activeSingleList = [];
  356. res.data.map((item) => {
  357. if (
  358. item.type != "HIGH" &&
  359. item.type != "DEMO" &&
  360. item.type != "HIGH_ONLINE" &&
  361. item.type != "MUSIC_NETWORK"
  362. ) {
  363. this.activeSingleList.push(item);
  364. }
  365. });
  366. // this.topForm.count = this.activeSingleList.length
  367. }
  368. });
  369. },
  370. goBack() {
  371. this.$router.push({
  372. path: "/business/resetTeaming",
  373. query: { ...this.$route.query },
  374. });
  375. this.$store.dispatch("delVisitedViews", this.$route);
  376. },
  377. setStartTime() {
  378. this.$refs.form.validate(async (res) => {
  379. if (res) {
  380. try {
  381. const res = await musicGroupSchoolTermCourseDetail({
  382. musicGroupId: this.teamid,
  383. startCourseDate: this.form.startCourseDate,
  384. });
  385. if (res.code == 207) {
  386. this.$confirm(res.msg, "提示", {
  387. confirmButtonText: "确定",
  388. cancelButtonText: "取消",
  389. type: "warning",
  390. })
  391. .then(async () => {
  392. try {
  393. const res = await musicGroupSchoolTermCourseDetail({
  394. musicGroupId: this.teamid,
  395. startCourseDate: this.form.startCourseDate,
  396. cleanPreCourseFlag: true,
  397. });
  398. if (res.data) {
  399. this.$message.success("修改成功");
  400. this.form.startCourseDate = dayjs(
  401. res.data.startCourseDate
  402. ).format("YYYY-MM-DD");
  403. this.form.endSchoolTerm = dayjs(
  404. res.data.endSchoolTerm
  405. ).format("YYYY-MM-DD");
  406. this.musicGroupSchoolTermCourseDetailId = res.data.id;
  407. this.startVisible = false;
  408. this.getList();
  409. }
  410. } catch (e) {
  411. this.form.startCourseDate = this.lastDate;
  412. }
  413. })
  414. .catch(() => {
  415. this.form.startCourseDate = this.lastDate;
  416. });
  417. }
  418. console.log(res);
  419. if (res.code == 200) {
  420. if (res.data) {
  421. this.form.startCourseDate = dayjs(
  422. res.data.startCourseDate
  423. ).format("YYYY-MM-DD");
  424. this.form.endSchoolTerm = dayjs(res.data.endSchoolTerm).format(
  425. "YYYY-MM-DD"
  426. );
  427. this.musicGroupSchoolTermCourseDetailId = res.data.id;
  428. this.$message.success("修改成功");
  429. this.startVisible = false;
  430. this.getList();
  431. }
  432. }
  433. } catch (e) {
  434. this.form.startCourseDate = this.lastDate;
  435. console.log(e);
  436. }
  437. }
  438. });
  439. },
  440. resetStartTime() {
  441. this.lastDate = JSON.parse(JSON.stringify(this.form.startCourseDate));
  442. this.startVisible = true;
  443. },
  444. planCourse(row) {
  445. this.classDteail = row;
  446. this.activeType = row.type;
  447. this.setType(row.type);
  448. this.courseVisible = true;
  449. },
  450. setType(type) {
  451. this.courseTypeList = getCourseType(type);
  452. },
  453. cancleCourse(row) {
  454. this.$confirm("是否取消预排课", "提示", {
  455. confirmButtonText: "确定",
  456. cancelButtonText: "取消",
  457. type: "warning",
  458. })
  459. .then(async () => {
  460. try {
  461. const res = await cancelPreCourseSchedule({
  462. classGroupId: row.id,
  463. musicGroupSchoolTermCourseDetailId:
  464. this.musicGroupSchoolTermCourseDetailId,
  465. });
  466. this.$message.success("取消成功");
  467. this.getList();
  468. } catch (e) {}
  469. // musicGroupSchoolTermCourseDetailId
  470. })
  471. .catch(() => {});
  472. },
  473. async changeDetail(row, expandedRows) {
  474. if (expandedRows.length > 0) {
  475. // 展开 请求接口
  476. try {
  477. const res = await getPreCourseList({ classGroupId: row.id });
  478. this.activeSingleList.forEach((item, index) => {
  479. if (item.id == row.id) {
  480. this.activeSingleList[index].courseData = res.data;
  481. }
  482. });
  483. console.log(this.activeSingleList);
  484. } catch (e) {
  485. console.log(e);
  486. }
  487. }
  488. },
  489. submitCourse() {
  490. // confirmPreCourseSchedule
  491. this.$confirm("确定提交预排课列表", "提示", {
  492. confirmButtonText: "确定",
  493. cancelButtonText: "取消",
  494. type: "warning",
  495. })
  496. .then(async () => {
  497. try {
  498. const res = await confirmPreCourseSchedule({
  499. musicGroupSchoolTermCourseDetailId:
  500. this.musicGroupSchoolTermCourseDetailId,
  501. });
  502. this.$message.success("提交成功");
  503. await this.getList();
  504. this.goBack();
  505. } catch (e) {}
  506. //
  507. })
  508. .catch(() => {});
  509. },
  510. getCourseTime(row) {
  511. return diffTimerFormMinute(
  512. dayjs(row.classDate).format("YYYY-MM-DD"),
  513. dayjs(row.startClassTime).format("HH:mm"),
  514. dayjs(row.endClassTime).format("HH:mm")
  515. );
  516. },
  517. },
  518. async beforeRouteLeave(to, from, next) {
  519. let flag = false;
  520. // if (this.activeSingleList.length > 0) {
  521. // }
  522. this.activeSingleList.forEach((item) => {
  523. if (item.preTotalClassTimes != 0) {
  524. flag = true;
  525. }
  526. });
  527. if (flag) {
  528. this.$confirm("预排课程尚未提交,是否确认跳转其他页面?", "提示", {
  529. confirmButtonText: "确定",
  530. cancelButtonText: "取消",
  531. type: "warning",
  532. })
  533. .then(async () => {
  534. next();
  535. // musicGroupSchoolTermCourseDetailId
  536. })
  537. .catch(() => {});
  538. } else {
  539. next();
  540. }
  541. },
  542. };
  543. </script>
  544. <style lang="scss" scoped>
  545. .lastBtnWrap {
  546. margin-top: 20px;
  547. display: flex;
  548. flex-direction: row;
  549. align-items: center;
  550. justify-content: flex-end;
  551. margin-right: 1%;
  552. }
  553. </style>