resetClass.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. <template>
  2. <!-- m-container -->
  3. <div class="">
  4. <!-- <h2>
  5. <div class='squrt'></div>
  6. 班级调整
  7. </h2> -->
  8. <div class="m-core">
  9. <el-form :inline="true"
  10. :model="topForm">
  11. <el-form-item label="班级类型">
  12. <el-select v-model="topForm.classType"
  13. clearable
  14. @change="changeMixClass">
  15. <el-option v-for='(item,index) in classTypeList'
  16. :key="index"
  17. :label="item.label"
  18. :value="item.value"></el-option>
  19. </el-select>
  20. </el-form-item>
  21. </el-form>
  22. <div class="tableWrap"
  23. style=" width: 800px;">
  24. <el-table :data='activeSingleList'
  25. style="width:800px;"
  26. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  27. <el-table-column align='center'
  28. prop="name"
  29. label="班级名称">
  30. </el-table-column>
  31. <el-table-column align='center'
  32. prop="studentNum"
  33. label="班级人数">
  34. </el-table-column>
  35. <el-table-column align='center'
  36. prop=""
  37. label="主教老师">
  38. <template slot-scope="scope">
  39. <div v-if="scope.row.classGroupTeacherMapperList">
  40. <p v-for="(item,index) in scope.row.classGroupTeacherMapperList"
  41. v-if="item.teacherRole == 'BISHOP'"
  42. :key='index'>{{item.userName}}</p>
  43. </div>
  44. </template>
  45. </el-table-column>
  46. <el-table-column align='center'
  47. label="助教老师">
  48. <template slot-scope="scope">
  49. <div v-if="scope.row.classGroupTeacherMapperList">
  50. <p v-for="(item,index) in scope.row.classGroupTeacherMapperList"
  51. v-if="item.teacherRole == 'TEACHING'"
  52. :key='index'>{{item.userName}}</p>
  53. </div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column align='center'
  57. label="是否排课">
  58. <template slot-scope="scope">
  59. <div>
  60. <p v-if="scope.row.totalClassTimes > 0"> 是</p>
  61. <p v-if="scope.row.totalClassTimes <= 0"> 否</p>
  62. </div>
  63. </template>
  64. </el-table-column>
  65. <el-table-column align='center'
  66. label="操作">
  67. <template slot-scope="scope">
  68. <div>
  69. <el-popover placement="top"
  70. width="160"
  71. :ref="scope.$index">
  72. <p>确定删除?</p>
  73. <div style="text-align: right; margin: 0">
  74. <el-button size="mini"
  75. type="text"
  76. @click="scope._self.$refs[scope.$index].doClose()">取消</el-button>
  77. <el-button type="primary"
  78. size="mini"
  79. @click="removeClass(scope)">确定</el-button>
  80. </div>
  81. <el-button type="text"
  82. slot="reference">删除</el-button>
  83. </el-popover>
  84. <el-button type="text"
  85. @click="resetClass(scope.row)">修改</el-button>
  86. </div>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <div class="floor">
  91. <div class="add"
  92. @click="temporary">临时调整</div>
  93. <div class='add'
  94. @click="addNewClass">新建班级</div>
  95. </div>
  96. </div>
  97. </div>
  98. <el-dialog title="学员选择"
  99. width="700px"
  100. :visible.sync="studentVisible"
  101. :modal-append-to-body="false">
  102. <div class="studentMask">
  103. <div class="left">
  104. <div class="wrap">
  105. <el-input placeholder="请输入班级名称"
  106. :disabled="!isNewClass"
  107. v-model="className"></el-input>
  108. </div>
  109. <div class="chioseStudentList">
  110. <h4 style="padding-left:10px;">当前已选学员</h4>
  111. <div class="studentItem"
  112. v-for="(item,index) in activeListStudent"
  113. :key="index">
  114. {{ item.name }}
  115. <el-popover v-if="!isNewClass"
  116. placement="top"
  117. v-model="item.isVisible"
  118. width="160">
  119. <p>确定删除?</p>
  120. <div style="text-align: right; margin: 0">
  121. <el-button size="mini"
  122. type="text"
  123. @click="item.isVisible = false">取消</el-button>
  124. <el-button type="primary"
  125. size="mini"
  126. @click="removeStudent(item)">确定</el-button>
  127. </div>
  128. <el-button type="text"
  129. slot="reference">删除</el-button>
  130. </el-popover>
  131. <el-button v-if="isNewClass"
  132. type='text'
  133. @click="temporaryRemoveStudent(item)">删除</el-button>
  134. </div>
  135. </div>
  136. </div>
  137. <div class="right">
  138. <!-- multiple
  139. collapse-tags -->
  140. <el-select v-if="isSearch"
  141. v-model="activeChioseSound"
  142. style="width:180px"
  143. clearable
  144. placeholder="声部选择">
  145. <el-option v-for='(item,index) in soundList'
  146. :key='index'
  147. :label="item.name"
  148. :value="item.id"></el-option>
  149. </el-select>
  150. <el-button v-if="isSearch"
  151. type="danger"
  152. style="margin-left:20px;"
  153. @click="searchStudent">搜索</el-button>
  154. <!-- 列表开始 -->
  155. <div class="tableList">
  156. <el-table tooltip-effect="dark"
  157. v-if="!isNewClass"
  158. style="width: 100%; margin-top:10px;"
  159. :data='studentList'
  160. ref='studentList'
  161. @selection-change="SelectionStudent">
  162. <el-table-column type="selection"
  163. align='center'
  164. width="55">
  165. </el-table-column>
  166. <el-table-column prop="name"
  167. align='center'
  168. width="80"
  169. label="姓名">
  170. </el-table-column>
  171. <el-table-column prop="gender"
  172. align='center'
  173. width="55"
  174. label="性别">
  175. <template slot-scope="scope">
  176. <div>
  177. {{ scope.row.gender | sex }}
  178. </div>
  179. </template>
  180. </el-table-column>
  181. <el-table-column prop="subjectName"
  182. align='center'
  183. label="学员声部">
  184. </el-table-column>
  185. </el-table>
  186. <!-- 临时调整table -->
  187. <el-table tooltip-effect="dark"
  188. v-if="isNewClass"
  189. style="width: 100%; margin-top:10px;"
  190. :data='studentList'
  191. ref='temporaryStudentList'
  192. @selection-change="NewselectionStudent">
  193. <el-table-column type="selection"
  194. align='center'
  195. width="55">
  196. </el-table-column>
  197. <el-table-column prop="name"
  198. align='center'
  199. width="80"
  200. label="姓名">
  201. </el-table-column>
  202. <el-table-column prop="gender"
  203. align='center'
  204. width="55"
  205. label="性别">
  206. <template slot-scope="scope">
  207. <div>
  208. {{ scope.row.gender | sex }}
  209. </div>
  210. </template>
  211. </el-table-column>
  212. <el-table-column prop="subjectName"
  213. align='center'
  214. label="学员声部">
  215. </el-table-column>
  216. </el-table>
  217. </div>
  218. </div>
  219. </div>
  220. <div slot="footer"
  221. class="dialog-footer">
  222. <el-button @click="studentVisible = false">取 消</el-button>
  223. <!-- 班级学员修改 -->
  224. <el-button type="primary"
  225. v-if="!isNewClass"
  226. @click="addSomeStudent">确 定</el-button>
  227. <!-- 临时调整或者新建班级 -->
  228. <el-button type="primary"
  229. v-if="isNewClass"
  230. @click="setInfoMsg">确 定</el-button>
  231. </div>
  232. </el-dialog>
  233. <!-- 老师以及课程设置 -->
  234. <el-dialog title="班级设置"
  235. width="700px"
  236. :visible.sync="infoVisible"
  237. :modal-append-to-body="false">
  238. <el-form :inline="true"
  239. :model='teacherForm'
  240. ref='teacherForm'
  241. :rules="teacherRules"
  242. label-position='right'
  243. label-width="100px;">
  244. <el-form-item label="主教老师"
  245. prop='coreTeacher'>
  246. <el-select v-model="teacherForm.coreTeacher"
  247. filterable>
  248. <el-option v-for="(item,index) in teacherList"
  249. :key="index"
  250. :label="item.name"
  251. :value="item.userId"></el-option>
  252. </el-select>
  253. </el-form-item>
  254. <el-form-item label="助教老师"
  255. prop="assistant">
  256. <el-select v-model="teacherForm.assistant"
  257. filterable
  258. multiple>
  259. <el-option v-for="(item,index) in teacherList"
  260. :key="index"
  261. :label="item.name"
  262. :value="item.userId"></el-option>
  263. </el-select>
  264. </el-form-item>
  265. <el-form-item label="课程类型"
  266. prop="courseType">
  267. <el-select v-model="teacherForm.courseType">
  268. <el-option v-for="(item,index) in courseTypeList"
  269. :key="index"
  270. :value="item.value"
  271. :label="item.label"></el-option>
  272. </el-select>
  273. </el-form-item>
  274. <el-form-item label="排课次数"
  275. prop="courseNum">
  276. <el-input type='number'
  277. v-model="teacherForm.courseNum"></el-input>
  278. </el-form-item>
  279. <el-form-item label="排课起始时间"
  280. prop="courseTime">
  281. <el-date-picker v-model="teacherForm.courseTime"
  282. style="width:200px;"
  283. type="date"
  284. value-format="yyyy-MM-dd"
  285. placeholder="选择日期">
  286. </el-date-picker>
  287. <el-checkbox style='margin-left:10px;'
  288. v-model="teacherForm.checked">是否跳过节假日</el-checkbox>
  289. </el-form-item>
  290. </el-form>
  291. <div class="WeekWrap">
  292. <h3 style="margin-bottom:20px;">循环次数 <el-button type="text"
  293. style='margin-left:10px;'
  294. @click="addWeek">添加</el-button>
  295. </h3>
  296. <div class="countWrap"
  297. style="margin-bottom:10px;">
  298. <div class="countItem"
  299. style="margin-bottom:20px;"
  300. v-for="(item,index) in weekList"
  301. :key="index">
  302. <span>循环周期: </span>
  303. <el-select v-model="item.dayOfWeek">
  304. <el-option v-for="(item,index) in weekDateList"
  305. :key='index'
  306. :label="item.label"
  307. :value="item.value"></el-option>
  308. </el-select>
  309. <span>开始时间</span>
  310. <el-time-select placeholder=""
  311. v-model="item.startClassTime"
  312. :picker-options="{
  313. start: '08:30',
  314. step: '00:15',
  315. end: '18:30'
  316. }">
  317. </el-time-select>
  318. <span>结束时间</span>
  319. <el-time-select placeholder=""
  320. v-model="item.endClassTime"
  321. :picker-options="{
  322. start: '08:30',
  323. step: '00:15',
  324. end: '18:30'
  325. }">
  326. </el-time-select>
  327. <el-button type="danger"
  328. @click="removeWeek(item)"
  329. icon="el-icon-delete"
  330. circle></el-button>
  331. </div>
  332. </div>
  333. </div>
  334. <div slot="footer"
  335. class="dialog-footer">
  336. <!-- 1为临时班级 -->
  337. <el-button type="primary"
  338. v-if="isTemporary"
  339. @click="submitTemporary(1)">确 定</el-button>
  340. <!-- 2为新增班级 -->
  341. <el-button type="primary"
  342. v-if="!isTemporary"
  343. @click="submitTemporary(2)">确 定</el-button>
  344. </div>
  345. </el-dialog>
  346. </div>
  347. </template>
  348. <script>
  349. import { getAllClass, getAllSignClassandTeacher, getAllSignClass, removeSingleClass, getNoClassStudentAll, findSound, teamSoundStudent, findMusicGroupClassTeacher, revisionClassGroup, revisionAddClassGroup } from '@/api/buildTeam'
  350. import { getClassAllStudent, removeStudents, addStudents } from '@/api/studentManager'
  351. import axios from 'axios'
  352. import qs from 'qs'
  353. export default {
  354. data () {
  355. return {
  356. teamid: '',
  357. topForm: {
  358. classType: ''
  359. },
  360. tableList: [],
  361. maxClassList: [],
  362. activeSingleList: [],
  363. studentVisible: false,
  364. activeListStudent: [], // 当前选中的学生列表
  365. activeChioseSound: '', //选择的声部
  366. chioseSoundList: [], //当前的所有声部
  367. studentList: [], //列表里的学生集合
  368. activeMixClass: '', // 选中的合奏班
  369. chioseStudent: [],// 勾选的学生信息
  370. isNewClass: false, // 是否为新建班级
  371. isSearch: false, // 是否需要搜索
  372. isTemporary: false, // 是否为临时班级
  373. className: '', // 班级名称
  374. activeClass: '', // 当前操作的班级
  375. soundList: [],
  376. infoVisible: false, // 判断是否需要显示老师设置
  377. teacherForm: {
  378. coreTeacher: '',
  379. assistant: [],
  380. courseType: '',
  381. courseTime: '',
  382. checked: false,
  383. courseNum: ''
  384. },
  385. teacherRules: {
  386. coreTeacher: [{ required: true, message: '请选择主教老师' }],
  387. courseType: [{ required: true, message: '请选择上课类型' }],
  388. courseTime: [{ required: true, message: '请选择开始时间' }],
  389. courseNum: [{ required: true, message: '请输入排课次数' }]
  390. },
  391. weekList: [{
  392. week: '',
  393. startTime: '',
  394. endTime: '',
  395. id: new Date()
  396. }],
  397. teacherList: [], // 存储的老师列表
  398. courseTypeList: [
  399. { value: 'SINGLE', label: '单技课' },
  400. { value: 'MIX', label: '合奏课' },
  401. { value: 'TRAINING_SINGLE', label: '集训单技课' },
  402. { value: 'TRAINING_MIX', label: '集训合奏课' },
  403. { value: 'HIGH', label: '基础技能班' },
  404. { value: 'COMPREHENSIVE', label: '综合课' },
  405. { value: 'CLASSROOM', label: '课堂课' },
  406. ],
  407. weekDateList: [
  408. { value: '1', label: '星期一' },
  409. { value: '2', label: '星期二' },
  410. { value: '3', label: '星期三' },
  411. { value: '4', label: '星期四' },
  412. { value: '5', label: '星期五' },
  413. { value: '6', label: '星期六' },
  414. { value: '7', label: '星期日' },
  415. ],
  416. // 班级类型
  417. classTypeList: [
  418. { value: 'NORMAL', label: '单技班' },
  419. { value: 'MIX', label: '合奏班' },
  420. { value: 'HIGH', label: '基础技能班' },
  421. { value: 'SNAP', label: '临时班' },
  422. ]
  423. }
  424. },
  425. created () {
  426. this.teamid = this.$route.query.id;
  427. },
  428. mounted () {
  429. sessionStorage.setItem('resetCode', 3)
  430. // 1.获取乐团下所有的合奏班
  431. // 2.根据合奏班获取所有的单技班
  432. // 3.根据乐团id 查询 此乐团所有的合奏班
  433. // 4.获取当年的所有节假日
  434. // getAllClass({ musicGroupId: this.teamid }).then(res => {
  435. // if (res.code == 200) {
  436. // this.maxClassList = res.data;
  437. // }
  438. // })
  439. // let year = new Date().getFullYear();
  440. // axios.post('/jiari/', qs.stringify({ d: year })).then(res => {
  441. // this.holidayList = Object.keys(res.data[year])
  442. // })
  443. // getNoClassStudentAll({ musicGroupId: this.teamid }).then(res => {
  444. // })
  445. // 获取默认乐团内的所有班
  446. this.changeMixClass()
  447. // 根据乐团id获取乐团的所有声部
  448. findSound({ musicGroupId: this.teamid }).then(res => {
  449. if (res.code == 200) {
  450. this.soundList = res.data
  451. }
  452. })
  453. // 获取所有老师
  454. findMusicGroupClassTeacher({
  455. musicGroupId: this.teamid
  456. }).then(res => {
  457. if (res.code == 200) {
  458. this.teacherList = res.data
  459. }
  460. })
  461. // 课程类型
  462. },
  463. methods: {
  464. changeMixClass (val) {
  465. // 根据合奏班id获取合奏班下的所有单技班
  466. this.getList(val);
  467. this.activeMixClass = val;
  468. },
  469. getList (val) {
  470. getAllSignClassandTeacher({ musicGroupId: this.teamid, type: val }).then(res => {
  471. if (res.code == 200) {
  472. this.activeSingleList = res.data;
  473. // this.topForm.count = this.activeSingleList.length
  474. }
  475. })
  476. },
  477. // 临时调整
  478. temporary () {
  479. this.activeClass = '';
  480. this.activeListStudent = [];
  481. this.studentList = [];
  482. this.isNewClass = true;
  483. this.studentVisible = true;
  484. this.isSearch = true;
  485. this.className = '';
  486. this.isTemporary = true;
  487. },
  488. // 新增班级
  489. addNewClass () {
  490. this.activeClass = '';
  491. this.activeListStudent = [];
  492. this.studentList = [];
  493. this.isNewClass = true;
  494. this.studentVisible = true;
  495. this.isSearch = false;
  496. this.className = '';
  497. this.isTemporary = false;
  498. this.getNoClassStudent()
  499. },
  500. searchStudent () {
  501. // 搜索学生
  502. // 根据声部id 乐团id搜索学生
  503. teamSoundStudent({ musicGroupId: this.teamid, actualSubjectId: this.activeChioseSound }).then(res => {
  504. if (res.code == 200) {
  505. this.studentList = res.data;
  506. }
  507. })
  508. },
  509. // 选择学生的方法修改
  510. SelectionStudent (val) {
  511. this.chioseStudent = val;
  512. },
  513. // 新增选中的学生
  514. NewselectionStudent (val) {
  515. this.chioseStudent = val;
  516. // 这里新增的添加到选中的学生列表 根据学生id去重
  517. if (this.chioseStudent.length > 0) {
  518. this.chioseStudent = this.chioseStudent.concat(val);
  519. } else {
  520. this.chioseStudent = val;
  521. }
  522. this.activeListStudent = this.activeListStudent.concat(this.chioseStudent);
  523. // 去重
  524. this.activeListStudent = this.objArrayRemoval(this.activeListStudent, 'userId');
  525. // 将其填入选中的学生
  526. },
  527. // 删除班级
  528. removeClass (scope) {
  529. removeSingleClass({ classGroupId: scope.row.id }).then(res => {
  530. if (res.code == 200) {
  531. this.$message.success('删除成功')
  532. scope._self.$refs[scope.$index].doClose();
  533. // 重新请求列表
  534. this.getList(this.activeMixClass);
  535. } else {
  536. this.$message.error(res.msg)
  537. scope._self.$refs[scope.$index].doClose();
  538. }
  539. }).catch(res => {
  540. scope._self.$refs[scope.$index].doClose();
  541. })
  542. },
  543. // 修改班级
  544. resetClass (row) {
  545. this.isNewClass = false;
  546. this.className = row.name;
  547. this.studentVisible = true;
  548. this.activeClass = row.id
  549. this.isSearch = false;
  550. // 根据单机班id 查询单技班内的所有学生
  551. getClassAllStudent({ classGroupId: row.id }).then(res => {
  552. if (res.code == 200) {
  553. this.activeListStudent = res.data.map(item => {
  554. item.isVisible = false;
  555. return item;
  556. });
  557. }
  558. })
  559. this.getNoClassStudent()
  560. },
  561. getNoClassStudent () {
  562. // 获取乐团内所有未分班的学生
  563. getNoClassStudentAll({ musicGroupId: this.teamid }).then(res => {
  564. if (res.code == 200) {
  565. this.studentList = res.data
  566. }
  567. })
  568. },
  569. // 删除学生 调整
  570. removeStudent (item) {
  571. // console.log(item.userId);
  572. // removeStudents({ classGroupId:}).then(res => {
  573. removeStudents({ classGroupId: this.activeClass, userId: item.userId }).then(res => {
  574. if (res.code == 200) {
  575. item.isVisible = false;
  576. // 这里刷新 this.studentList this.activeListStudent
  577. this.getList(this.activeMixClass);
  578. getClassAllStudent({ classGroupId: this.activeClass }).then(res => {
  579. if (res.code == 200) {
  580. this.activeListStudent = res.data;
  581. }
  582. })
  583. getNoClassStudentAll({ musicGroupId: this.teamid }).then(res => {
  584. if (res.code == 200) {
  585. this.$message.success('删除成功');
  586. this.studentList = res.data.map(item => {
  587. item.isVisible = false;
  588. return item;
  589. });
  590. }
  591. })
  592. }
  593. })
  594. },
  595. // 批量添加学生
  596. addSomeStudent () {
  597. // 获取勾选的学生
  598. let arr = this.chioseStudent.map(item => {
  599. return item.userId;
  600. });
  601. addStudents({ classGroupId: this.activeClass, userIdsStr: arr.join(',') }).then(res => {
  602. if (res.code == 200) {
  603. this.studentVisible = false;
  604. }
  605. })
  606. },
  607. //
  608. temporaryRemoveStudent (item) {
  609. // 列表中删除
  610. for (let i in this.activeListStudent) {
  611. if (this.activeListStudent[i].userId == item.userId) {
  612. this.activeListStudent.splice(i, 1);
  613. }
  614. }
  615. // 查询列表中的项 取消勾选 temporaryStudentList toggleRowSelection
  616. // 循环列表 找到相应的行取消勾选
  617. for (let k in this.studentList) {
  618. if (this.studentList[k].userId == item.userId) {
  619. this.$refs['temporaryStudentList'].toggleRowSelection(item, false)
  620. }
  621. }
  622. // console.log(this.$refs['temporaryStudentList'].toggleRowSelection)
  623. // this.$refs['temporaryStudentList'].toggleRowSelection(row, selected);
  624. },
  625. // 对象数组去重
  626. objArrayRemoval (arr, attr) {
  627. let obj = {};
  628. let result = [];
  629. // console.log(this.allActiveStudent.length);
  630. for (let x in arr) {
  631. if (!obj[arr[x][attr]]) {
  632. result.push(arr[x]);
  633. obj[arr[x][attr]] = true;
  634. }
  635. }
  636. return result;
  637. },
  638. setInfoMsg () {
  639. // 判断班级名称是否输入
  640. if (!this.className) {
  641. this.$message.error('请输入班级名称')
  642. return
  643. }
  644. // 判断有没有勾选学生
  645. if (this.activeListStudent.length <= 0) {
  646. // 没有勾学生
  647. this.$message.error('班级里至少要有一名学生')
  648. return
  649. }
  650. this.infoVisible = true;
  651. },
  652. addWeek () {
  653. // 添加循环周期
  654. this.weekList.push({
  655. dayOfWeek: '',
  656. startClassTime: '',
  657. endClassTime: '',
  658. id: new Date()
  659. })
  660. },
  661. // 删除循环周
  662. removeWeek (item) {
  663. for (let i in this.weekList) {
  664. if (this.weekList[i].id == item.id) {
  665. this.weekList.splice(i, 1)
  666. }
  667. }
  668. },
  669. // 提交临时班的信息
  670. submitTemporary (type) {
  671. this.$refs['teacherForm'].validate(item => {
  672. if (item) {
  673. let week = this.weekList;
  674. if (!week[0] || !week[0].startClassTime || !week[0].endClassTime || !week[0].dayOfWeek) {
  675. this.$message.error('至少排一节课');
  676. return
  677. }
  678. // 这里代表排课成功 发请求 新增临时班
  679. let classGroupName = this.className;
  680. let classGroupTeacherMapperList = [{ userId: this.teacherForm.coreTeacher, teacherRole: 'BISHOP' }]
  681. for (let i in this.teacherForm.assistant) {
  682. classGroupTeacherMapperList.push({ userId: this.teacherForm.assistant[i], teacherRole: 'TEACHING' })
  683. }
  684. let mixClassGroupId = this.activeMixClass;
  685. let musicGroupId = this.teamid;
  686. let startDate = this.teacherForm.courseTime;
  687. let courseType = this.teacherForm.courseType;
  688. let courseTimes = this.teacherForm.courseNum
  689. let students = this.activeListStudent.map(item => {
  690. return item.userId;
  691. })
  692. let holiday = this.teacherForm.checked;
  693. /**
  694. * this.weekList.push({
  695. week: '',
  696. startTime: '',
  697. endTime: '',
  698. *
  699. */
  700. let courseList = [];
  701. for (let i in this.weekList) {
  702. courseList.push(this.weekList[i])
  703. }
  704. if (courseList.length <= 0) {
  705. this.$message.error('新增班级至少排一节课')
  706. return
  707. }
  708. let obj = {
  709. classGroupName,
  710. classGroupTeacherMapperList,
  711. mixClassGroupId,
  712. musicGroupId,
  713. startDate,
  714. courseType,
  715. students,
  716. holiday,
  717. courseTimes,
  718. courseTimeDtoList: courseList
  719. }
  720. if (type == 1) {
  721. revisionClassGroup(obj).then(res => {
  722. if (res.code == 200) {
  723. // 提示修改成功
  724. this.$message.success('修改成功')
  725. this.infoVisible = false;
  726. this.studentVisible = false;
  727. this.getList(this.activeMixClass);
  728. }
  729. })
  730. } else if (type == 2) {
  731. revisionAddClassGroup(obj).then(res => {
  732. if (res.code == 200) {
  733. // 修改成功
  734. this.$message.success('修改成功');
  735. this.infoVisible = false;
  736. this.studentVisible = false;
  737. this.getList(this.activeMixClass);
  738. }
  739. })
  740. }
  741. } else {
  742. this.$message.error('请填写必要信息')
  743. return;
  744. }
  745. })
  746. },
  747. },
  748. watch: {
  749. infoVisible (val) {
  750. if (!val) {
  751. this.teacherForm;
  752. this.$refs['teacherForm'].resetFields();
  753. this.weekList = [];
  754. }
  755. }
  756. }
  757. }
  758. </script>
  759. <style lang="scss" scoped>
  760. .floor {
  761. padding-right: 20px;
  762. display: flex;
  763. flex-direction: row;
  764. justify-content: flex-end;
  765. width: 100%;
  766. height: 48px;
  767. line-height: 48px;
  768. background: rgba(237, 238, 240, 1);
  769. font-size: 14px;
  770. color: #444;
  771. align-items: center;
  772. position: relative;
  773. z-index: 1;
  774. .remove {
  775. width: 98px;
  776. height: 32px;
  777. background: rgba(248, 80, 67, 1);
  778. border-radius: 3px;
  779. color: #fff;
  780. line-height: 32px;
  781. text-align: center;
  782. margin-left: 164px;
  783. cursor: pointer;
  784. }
  785. .add {
  786. width: 98px;
  787. height: 32px;
  788. background: rgba(20, 146, 138, 1);
  789. border-radius: 3px;
  790. color: #fff;
  791. line-height: 32px;
  792. text-align: center;
  793. margin-left: 20px;
  794. cursor: pointer;
  795. }
  796. }
  797. .studentMask {
  798. display: flex;
  799. flex-direction: row;
  800. justify-content: flex-start;
  801. .left {
  802. width: 200px;
  803. margin-right: 20px;
  804. .wrap {
  805. margin-bottom: 20px;
  806. }
  807. h4 {
  808. font-size: 16px;
  809. color: #444;
  810. line-height: 38px;
  811. }
  812. .chioseStudentList {
  813. height: 500px;
  814. overflow-y: auto;
  815. border: 1px solid #ccc;
  816. .studentItem {
  817. padding-left: 10px;
  818. line-height: 25px;
  819. }
  820. }
  821. }
  822. .right {
  823. .tableList {
  824. max-height: 500px;
  825. overflow-y: auto;
  826. }
  827. }
  828. }
  829. .el-date-editor.el-input,
  830. .el-date-editor.el-input__inner {
  831. width: 100px;
  832. }
  833. </style>