resetClass.vue 28 KB

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