setClassV2.vue 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579
  1. <!-- -->
  2. <template>
  3. <div class="m-core">
  4. <el-form :inline="true"
  5. :model="searchForm">
  6. <el-form-item>
  7. <el-select v-model.trim="searchForm.classType"
  8. placeholder="班级类型"
  9. clearable
  10. filterable
  11. @change="changeClassGetList">
  12. <el-option v-for="(item,index) in classTypeList"
  13. :key="index"
  14. :label="item.label"
  15. :value="item.value"></el-option>
  16. </el-select>
  17. </el-select>
  18. </el-form-item>
  19. </el-form>
  20. <div class="buttonWrap">
  21. <div class="newBand"
  22. @click="newClass"
  23. v-permission="'classGroup/create'">新建班级</div>
  24. <div class="newBand"
  25. @click="arrangeStart"
  26. v-permission="'courseSchedule/batchAddCourseSchedule'">批量排课</div>
  27. <!-- <div class="newBand">删除排课</div> -->
  28. <!-- <p class="expectMsg">基础技能班参考数量: 线上:XX/线下:XX</p> -->
  29. </div>
  30. <div class="tableWrap">
  31. <el-table style="width: 100%"
  32. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  33. :data="tableList"
  34. @selection-change="selectionTable">
  35. <el-table-column type="selection"
  36. width="55">
  37. </el-table-column>
  38. <el-table-column align="center"
  39. prop="name"
  40. label="班级名称"></el-table-column>
  41. <el-table-column align="center"
  42. prop="type"
  43. label="班级类型">
  44. <template slot-scope="scope">
  45. <div>
  46. {{ scope.row.type | classType}}
  47. </div>
  48. </template>
  49. </el-table-column>
  50. <el-table-column align="center"
  51. prop="studentNum"
  52. label="班级人数">
  53. <template slot-scope="scope">
  54. <div>
  55. {{scope.row.studentNum+'/'+scope.row.expectStudentNum}}
  56. </div>
  57. </template>
  58. </el-table-column>
  59. <el-table-column align="center"
  60. prop="studentId"
  61. label="主教老师名称">
  62. <template slot-scope="scope">
  63. <div v-if="scope.row.teacherMapperList[0]">
  64. {{scope.row.teacherMapperList | getBishopName}}
  65. </div>
  66. </template>
  67. </el-table-column>
  68. <el-table-column align="center"
  69. prop="studentId"
  70. label="助教人数">
  71. <template slot-scope="scope">
  72. <div v-if="scope.row.teacherMapperList[0]">
  73. {{scope.row.teacherMapperList | getTeachingNum}}
  74. </div>
  75. </template>
  76. </el-table-column>
  77. <el-table-column prop="totalClassTimes"
  78. label="排课课次"></el-table-column>
  79. <el-table-column align="center"
  80. prop=""
  81. label="操作">
  82. <template slot-scope="scope">
  83. <div>
  84. <el-button type="text"
  85. v-permission="'classGroup/classGroupUpdate'"
  86. @click="classAdjustment(scope.row)">老师调整</el-button>
  87. <el-popover placement="top"
  88. width="160"
  89. :ref="scope.$index"
  90. v-permission="'classGroup/delSingle'">
  91. <p>确定删除?</p>
  92. <div style="text-align: right; margin: 0">
  93. <el-button size="mini"
  94. type="text"
  95. @click="scope._self.$refs[scope.$index].doClose()">取消</el-button>
  96. <el-button type="primary"
  97. size="mini"
  98. @click="removeClass(scope)">确定</el-button>
  99. </div>
  100. <!-- v-if="scope.row.type !='MIX'" -->
  101. <el-button type="text"
  102. slot="reference">删除班级</el-button>
  103. </el-popover>
  104. <!-- v-if="scope.row.type
  105. !='HIGH'
  106. &&scope.row.type
  107. !='HIGH_ONLINE'
  108. " -->
  109. <el-button type="text"
  110. v-permission="'classGroupStudent/findAllStudent'"
  111. @click="resetClass(scope.row)">学员调整</el-button>
  112. </div>
  113. </template>
  114. </el-table-column>
  115. </el-table>
  116. <pagination :total="rules.total"
  117. :page.sync="rules.page"
  118. :limit.sync="rules.limit"
  119. :page-sizes="rules.page_size"
  120. @pagination="getList" />
  121. </div>
  122. <el-dialog :visible.sync="newClassVisible"
  123. width="700px"
  124. title="新增班级">
  125. <el-form :model="newClassForm"
  126. :inline="true"
  127. label-width="100px"
  128. ref='newClassForm'
  129. class="newClassForm">
  130. <el-form-item label="班级名称"
  131. :rules="[{ required: true, message: '请输入班级姓名',trigger: 'blur'}]"
  132. prop="className">
  133. <el-input style="width:180px;"
  134. v-model="newClassForm.className"></el-input>
  135. </el-form-item>
  136. <el-form-item label="班级类型"
  137. :rules="[{ required: true, message: '请输入班级人数',trigger: 'blur'}]"
  138. prop="type">
  139. <el-select v-model.trim="newClassForm.type"
  140. clearable
  141. filterable>
  142. <el-option v-for="(item,index) in classTypeList"
  143. :key="index"
  144. :label="item.label"
  145. :value="item.value"></el-option>
  146. </el-select>
  147. </el-form-item>
  148. <el-form-item label="声部"
  149. prop="subjectIdList"
  150. :rules="[{ required: true, message: '请选择声部',trigger: 'blur'}]"
  151. v-if="newClassForm.type =='HIGH' || newClassForm.type =='NORMAL'">
  152. <el-select v-model.trim="newClassForm.subjectIdList"
  153. clearable
  154. multiple>
  155. <el-option v-for="(item,index) in soundList"
  156. :key="index"
  157. :label="item.name"
  158. :value="item.id"></el-option>
  159. </el-select>
  160. </el-form-item>
  161. <el-form-item label="声部"
  162. prop="subjectIdList"
  163. :rules="[{ required: true, message: '请选择声部',trigger: 'blur'}]"
  164. v-if=" newClassForm.type == 'HIGH_ONLINE'">
  165. <el-select v-model.trim="newClassForm.subjectIdList"
  166. clearable>
  167. <el-option v-for="(item,index) in soundList"
  168. :key="index"
  169. :label="item.name"
  170. :value="item.id"></el-option>
  171. </el-select>
  172. </el-form-item>
  173. <el-form-item label="预计招生数"
  174. prop="expectStudentNum"
  175. :rules="[{ required: true, message: '请输入预计招生数',trigger: 'blur'},{pattern:/[3-5]/,message:'班级人数必须为3-5人',trigger: 'blur'}]"
  176. v-if=" newClassForm.type == 'HIGH_ONLINE'">
  177. <el-input style="width:180px;"
  178. type="number"
  179. @mousewheel.native.prevent
  180. v-model="newClassForm.expectStudentNum"></el-input>
  181. </el-form-item>
  182. <el-form-item label="预计招生数"
  183. prop="expectStudentNum"
  184. type="number"
  185. :rules="[{ required: true, message: '请输入预计招生数',trigger: 'blur'}]"
  186. @mousewheel.native.prevent
  187. v-else>
  188. <el-input style="width:180px;"
  189. v-model="newClassForm.expectStudentNum"></el-input>
  190. </el-form-item>
  191. <el-form-item label="主教老师"
  192. prop="bishop"
  193. :rules="[{ required: true, message: '请选择主教老师',trigger: 'blur'}]">
  194. <el-select placeholder="请选择主教老师"
  195. v-model="newClassForm.bishop"
  196. clearable
  197. filterable>
  198. <el-option v-for="(item,index) in teacherList"
  199. :label="item.realName"
  200. :value="item.id"
  201. :key="index"></el-option>
  202. </el-select>
  203. </el-form-item>
  204. <el-form-item label="助教老师"
  205. prop="teaching">
  206. <el-select placeholder="请选择助教老师"
  207. v-model="newClassForm.teaching"
  208. @change="setAssistant1"
  209. clearable
  210. multiple
  211. filterable>
  212. <el-option v-for="(item,index) in teacherList"
  213. :label="item.realName"
  214. :value="item.id"
  215. :key="index"></el-option>
  216. </el-select>
  217. </el-form-item>
  218. </el-form>
  219. <div slot="footer"
  220. class="dialog-footer">
  221. <el-button @click="newClassVisible = false">取 消</el-button>
  222. <!-- 乐团课 -->
  223. <el-button type="primary"
  224. @click="newClassHight"
  225. v-if=" newClassForm.type == 'HIGH_ONLINE' || newClassForm.type =='HIGH'">确 定</el-button>
  226. <!-- 基础技能课 -->
  227. <el-button type="primary"
  228. v-else
  229. @click="newClassSecond">确 定</el-button>
  230. </div>
  231. </el-dialog>
  232. <el-dialog title="学员选择"
  233. width="700px"
  234. :visible.sync="studentVisible"
  235. :modal-append-to-body="true">
  236. <div class="studentMask">
  237. <div class="left">
  238. <div class="chioseStudentList">
  239. <h4 style="padding-left:10px;">当前已选学员</h4>
  240. <div class="studentItem"
  241. v-for="(item,index) in activeListStudent"
  242. :key="index">
  243. {{ item.name }}
  244. <el-popover v-if="!isNewClass"
  245. placement="top"
  246. v-model.trim="item.isVisible"
  247. width="160">
  248. <p>确定删除?</p>
  249. <div style="text-align: right; margin: 0">
  250. <el-button size="mini"
  251. type="text"
  252. @click="item.isVisible = false">取消</el-button>
  253. <el-button type="primary"
  254. size="mini"
  255. @click="removeStudent(item)">确定</el-button>
  256. </div>
  257. <el-button type="text"
  258. slot="reference">删除</el-button>
  259. </el-popover>
  260. <el-button v-if="isNewClass"
  261. type="text"
  262. @click="temporaryRemoveStudent(item)">删除</el-button>
  263. </div>
  264. </div>
  265. </div>
  266. <div class="right">
  267. <!-- multiple
  268. collapse-tags-->
  269. <el-select v-if="isSearch"
  270. v-model.trim="activeChioseSound"
  271. style="width:180px"
  272. @change="searchStudent"
  273. clearable
  274. filterable
  275. placeholder="声部选择">
  276. <el-option v-for="(item,index) in soundList"
  277. :key="index"
  278. :label="item.name"
  279. :value="item.id"></el-option>
  280. </el-select>
  281. <!-- <el-button v-if="isSearch"
  282. type="danger"
  283. style="margin-left:20px;"
  284. @click="searchStudent">搜索</el-button>-->
  285. <!-- 列表开始 -->
  286. <div class="tableList">
  287. <el-table tooltip-effect="dark"
  288. v-if="!isNewClass"
  289. style="width: 100%; margin-top:10px;"
  290. :data="studentList"
  291. ref="studentList"
  292. @selection-change="SelectionStudent">
  293. <el-table-column type="selection"
  294. align="center"
  295. width="55"></el-table-column>
  296. <el-table-column prop="name"
  297. align="center"
  298. width="120"
  299. label="姓名"></el-table-column>
  300. <el-table-column prop="gender"
  301. align="center"
  302. width="100"
  303. label="性别">
  304. <template slot-scope="scope">
  305. <div>{{ scope.row.gender | sex }}</div>
  306. </template>
  307. </el-table-column>
  308. <el-table-column prop="subjectName"
  309. width="100"
  310. align="center"
  311. label="学员声部"></el-table-column>
  312. </el-table>
  313. <!-- 临时调整table -->
  314. <el-table tooltip-effect="dark"
  315. v-if="isNewClass"
  316. style="width: 100%; margin-top:10px;"
  317. :data="studentList"
  318. ref="temporaryStudentList"
  319. @selection-change="NewselectionStudent">
  320. <el-table-column type="selection"
  321. align="center"
  322. width="55"></el-table-column>
  323. <el-table-column prop="name"
  324. align="center"
  325. width="120"
  326. label="姓名"></el-table-column>
  327. <el-table-column prop="gender"
  328. align="center"
  329. width="100"
  330. label="性别">
  331. <template slot-scope="scope">
  332. <div>{{ scope.row.gender | sex }}</div>
  333. </template>
  334. </el-table-column>
  335. <el-table-column prop="subjectName"
  336. width="100"
  337. align="center"
  338. label="学员声部"></el-table-column>
  339. </el-table>
  340. </div>
  341. </div>
  342. </div>
  343. <div slot="footer"
  344. class="dialog-footer">
  345. <el-button @click="studentVisible = false">取 消</el-button>
  346. <!-- 班级学员修改 -->
  347. <el-button type="primary"
  348. v-if="!isNewClass"
  349. @click="addSomeStudent">确 定</el-button>
  350. <!-- 临时调整或者新建班级 -->
  351. <el-button type="primary"
  352. v-if="isNewClass"
  353. @click="createMusiceClass">确 定</el-button>
  354. </div>
  355. </el-dialog>
  356. <!-- 老师以及课程设置 -->
  357. <el-dialog title="老师调整"
  358. width="700px"
  359. :visible.sync="infoVisible"
  360. :modal-append-to-body="false">
  361. <el-form :inline="true"
  362. :model="teacherForm"
  363. ref="teacherForm"
  364. :rules="teacherRules"
  365. label-position="right"
  366. label-width="100px;">
  367. <!-- <el-form-item label="合奏班"
  368. v-if='!isTemporary&&activeType=="NORMAL"'
  369. prop="mixClassGroupId">
  370. <el-select v-model.trim="teacherForm.mixClassGroupId">
  371. <el-option v-for="(item,index) in maxClassList"
  372. :label="item.name"
  373. :key="index"
  374. :value="item.id"></el-option>
  375. </el-select>
  376. </el-form-item>-->
  377. <!-- <el-form-item label="调整方式"
  378. v-if="!isNewClass"
  379. prop="isAdd"> -->
  380. <!-- <el-radio v-model.trim="teacherForm.isAdd"
  381. label="new">班级加课</el-radio>
  382. <el-radio v-model.trim="teacherForm.isAdd"
  383. label="renew">重新排课</el-radio> -->
  384. <!-- <el-radio v-model.trim="teacherForm.isAdd"
  385. label="onlyUpdateTeacher">修改老师</el-radio> -->
  386. </el-form-item>
  387. <br />
  388. <el-form-item label="主教老师"
  389. prop="coreTeacher">
  390. <el-select v-model.trim="teacherForm.coreTeacher"
  391. clearable
  392. filterable>
  393. <el-option v-for="(item,index) in teacherList"
  394. :key="index"
  395. :label="item.realName"
  396. :value="item.id"></el-option>
  397. </el-select>
  398. </el-form-item>
  399. <el-form-item label="助教老师"
  400. prop="assistant">
  401. <el-select v-model.trim="teacherForm.assistant"
  402. filterable
  403. clearable
  404. @change="setAssistant"
  405. multiple>
  406. <el-option v-for="(item,index) in cooperationList"
  407. :key="index"
  408. :label="item.realName"
  409. :value="item.id"></el-option>
  410. </el-select>
  411. </el-form-item>
  412. <el-form-item label="课程类型"
  413. prop="courseType"
  414. v-if="teacherForm.isAdd !='onlyUpdateTeacher'">
  415. <el-select v-model.trim="teacherForm.courseType"
  416. clearable
  417. filterable>
  418. <el-option v-for="(item,index) in courseTypeList"
  419. :key="index"
  420. :value="item.value"
  421. :label="item.label"></el-option>
  422. </el-select>
  423. </el-form-item>
  424. <br />
  425. <el-form-item label="排课次数"
  426. prop="courseNum"
  427. v-if="teacherForm.isAdd !='onlyUpdateTeacher'">
  428. <el-input type="number"
  429. @mousewheel.native.prevent
  430. v-model.trim="teacherForm.courseNum"></el-input>
  431. </el-form-item>
  432. <el-form-item label="排课起始时间"
  433. prop="courseTime"
  434. v-if="teacherForm.isAdd !='onlyUpdateTeacher'">
  435. <el-date-picker v-model.trim="teacherForm.courseTime"
  436. :picker-options="pickerOptions"
  437. style="width:200px!important;"
  438. type="date"
  439. value-format="yyyy-MM-dd"
  440. placeholder="选择日期"></el-date-picker>
  441. <el-checkbox style="margin-left:10px;"
  442. v-model.trim="teacherForm.checked">是否跳过节假日</el-checkbox>
  443. </el-form-item>
  444. </el-form>
  445. <div class="WeekWrap"
  446. v-if="teacherForm.isAdd !='onlyUpdateTeacher'">
  447. <h3 style="margin-bottom:20px;">
  448. 循环次数
  449. <el-button type="text"
  450. style="margin-left:10px;"
  451. @click="addWeek">添加</el-button>
  452. </h3>
  453. <div class="countWrap"
  454. style="margin-bottom:10px;">
  455. <div class="countItem"
  456. style="margin-bottom:20px;"
  457. v-for="(item,index) in weekList"
  458. :key="index">
  459. <span>循环周期:</span>
  460. <el-select v-model.trim="item.dayOfWeek"
  461. clearable
  462. filterable>
  463. <el-option v-for="(item,index) in weekDateList"
  464. :key="index"
  465. :label="item.label"
  466. :value="item.value"></el-option>
  467. </el-select>
  468. <span>开始时间</span>
  469. <el-time-select placeholder
  470. v-model.trim="item.startClassTime"
  471. :picker-options="{
  472. start: '04:30',
  473. step: '00:05',
  474. end: '23:55'
  475. }"></el-time-select>
  476. <span>结束时间</span>
  477. <el-time-select placeholder
  478. v-model.trim="item.endClassTime"
  479. :picker-options="{
  480. start: '04:30',
  481. step: '00:05',
  482. end: '23:55',
  483. minTime:item.startClassTime
  484. }"></el-time-select>
  485. <el-button type="danger"
  486. @click="removeWeek(item)"
  487. icon="el-icon-delete"
  488. circle></el-button>
  489. </div>
  490. </div>
  491. </div>
  492. <div slot="footer"
  493. class="dialog-footer">
  494. <!-- 1为临时班级 -->
  495. <el-button type="primary"
  496. v-if="isNewClass"
  497. @click="submitTemporary(1)">确 定</el-button>
  498. <!-- 修改班级信息 -->
  499. <el-button type="primary"
  500. v-if="!isNewClass"
  501. @click="submitTemporary(3)">确 定</el-button>
  502. </div>
  503. </el-dialog>
  504. <!-- 排课 -->
  505. <el-dialog title="批量排课"
  506. width="700px"
  507. :visible.sync="arrangeVisible"
  508. :modal-append-to-body="false">
  509. <el-form :model="arrangeForm"
  510. ref="arrangeForm"
  511. label-width="100px"
  512. label-position="right">
  513. <el-form-item label="选择班级数"
  514. prop="classNum">
  515. <el-input type="number"
  516. style="width:180px;"
  517. @mousewheel.native.prevent
  518. :value="arrangeForm.classNum"
  519. disabled></el-input>
  520. </el-form-item>
  521. <el-form-item label="课程类型"
  522. prop="courseType"
  523. :rules="[{ required: true, message: '请选择课程类型',trigger: 'blur'}]">
  524. <el-select v-model.trim="arrangeForm.courseType"
  525. clearable
  526. filterable>
  527. <el-option v-for="(item,index) in courseTypeList"
  528. :key="index"
  529. :value="item.value"
  530. :label="item.label"></el-option>
  531. </el-select>
  532. </el-form-item>
  533. <el-form-item label="上课形式"
  534. prop="teachMode"
  535. :rules="[{ required: true, message: '请选择课程类型',trigger: 'blur'}]">
  536. <el-select v-model.trim="arrangeForm.teachMode"
  537. disabled>
  538. <el-option value="ONLINE"
  539. label="线上"></el-option>
  540. <el-option value="OFFLINE"
  541. label="线下"></el-option>
  542. </el-select>
  543. </el-form-item>
  544. <el-form-item label="开始日期"
  545. prop="courseTime"
  546. :rules="[{ required: true, message: '请选择开始日期',trigger: 'blur'}]">
  547. <!-- value-format="yyyy-MM-dd" -->
  548. <el-date-picker v-model.trim="arrangeForm.courseTime"
  549. :picker-options="pickerOptions"
  550. style="width:200px!important;"
  551. type="date"
  552. placeholder="选择日期"></el-date-picker>
  553. <el-checkbox style="margin-left:10px;"
  554. v-model.trim="arrangeForm.checked">是否跳过节假日</el-checkbox>
  555. </el-form-item>
  556. <el-form-item label="排课次数"
  557. :rules="[{ required: true, message: '请输入排课次数',trigger: 'blur'}]"
  558. prop="courseNum">
  559. <el-input type="number"
  560. style="width:180px;"
  561. @mousewheel.native.prevent
  562. v-model.trim="arrangeForm.courseNum"></el-input>
  563. </el-form-item>
  564. </el-form>
  565. <div class="WeekWrap">
  566. <h3 style="margin-bottom:20px;">
  567. 循环次数
  568. <el-button type="text"
  569. style="margin-left:10px;"
  570. @click="addWeek">添加</el-button>
  571. </h3>
  572. <div class="countWrap"
  573. style="margin-bottom:10px;">
  574. <div class="countItem"
  575. style="margin-bottom:20px;"
  576. v-for="(item,index) in weekList"
  577. :key="index">
  578. <span>循环周期:</span>
  579. <el-select v-model.trim="item.dayOfWeek"
  580. clearable
  581. filterable>
  582. <el-option v-for="(item,index) in weekDateList"
  583. :key="index"
  584. :label="item.label"
  585. :value="item.value"></el-option>
  586. </el-select>
  587. <span>开始时间</span>
  588. <el-time-select placeholder
  589. v-model.trim="item.startClassTime"
  590. :picker-options="{
  591. start: '04:30',
  592. step: '00:05',
  593. end: '23:55'
  594. }"></el-time-select>
  595. <span>结束时间</span>
  596. <el-time-select placeholder
  597. v-model.trim="item.endClassTime"
  598. :picker-options="{
  599. start: '04:30',
  600. step: '00:05',
  601. end: '23:55',
  602. minTime:item.startClassTime
  603. }"></el-time-select>
  604. <el-button type="danger"
  605. @click="removeWeek(item)"
  606. icon="el-icon-delete"
  607. circle></el-button>
  608. </div>
  609. </div>
  610. </div>
  611. <div slot="footer"
  612. class="dialog-footer">
  613. <el-button @click="">取 消</el-button>
  614. <el-button type="primary"
  615. @click="arrangeFormSubmit">确 定</el-button>
  616. </div>
  617. </el-dialog>
  618. </div>
  619. </template>
  620. <script>
  621. import axios from "axios";
  622. import { getToken } from "@/utils/auth";
  623. import pagination from "@/components/Pagination/index";
  624. import load from "@/utils/loading";
  625. import { getTeacher, getEmployeeOrgan, getMusicGroupClass, createClass, findSound, getMusicGroupStuNoClassType, classGroupUpdate, removeSingleClass, workOut, superFindClassGroups } from "@/api/buildTeam";
  626. import {
  627. getClassAllStudent,
  628. removeStudents,
  629. addStudents
  630. } from "@/api/studentManager";
  631. import {
  632. sysConfigList
  633. } from "@/api/generalSettings";
  634. export default {
  635. components: { pagination },
  636. props: {
  637. isSetSalary: {
  638. type: Boolean,
  639. required: true
  640. }
  641. },
  642. data () {
  643. return {
  644. pickerOptions: {
  645. disabledDate (time) {
  646. return time.getTime() + 86400000 <= new Date().getTime();
  647. }
  648. },
  649. searchForm: {
  650. classType: null
  651. },
  652. soundList: [],
  653. teacherList: [],
  654. tableList: [],
  655. classTypeList: [
  656. { value: "NORMAL", label: "单技班" },
  657. { value: "MIX", label: "合奏班" },
  658. { value: "HIGH", label: "基础技能班" },
  659. { value: "HIGH_ONLINE", label: "基础技能班(线上)" }
  660. ],
  661. rules: {
  662. // 分页规则
  663. limit: 10, // 限制显示条数
  664. page: 1, // 当前页
  665. total: 0, // 总条数
  666. page_size: [10, 20, 40, 50] // 选择限制显示条数
  667. },
  668. isInit: false,
  669. newClassVisible: false,
  670. newClassForm: {
  671. className: null,
  672. type: null,
  673. subjectIdList: null,
  674. expectStudentNum: null,
  675. bishop: null,
  676. teaching: [],
  677. },
  678. chioseStudent: [], // 选中的学生
  679. activeListStudent: [], // 待选的学生
  680. isNewClass: true, // 是否是新增班级
  681. studentVisible: false, // 选择学员弹窗
  682. activeChioseSound: [],
  683. isSearch: false,
  684. studentList: [],
  685. activeChioseSound: null, // 默认选择的声部
  686. infoVisible: false, // 班级调整弹窗
  687. teacherForm: {
  688. isAdd: 'onlyUpdateTeacher',
  689. coreTeacher: "",
  690. assistant: [],
  691. courseType: "",
  692. courseTime: "",
  693. checked: false,
  694. courseNum: "",
  695. mixClassGroupId: "",
  696. },
  697. teacherRules: {
  698. isAdd: [{ required: true, message: "请选择调整类型" }],
  699. coreTeacher: [{ required: true, message: "请选择主教老师" }],
  700. courseType: [{ required: true, message: "请选择上课类型" }],
  701. courseTime: [{ required: true, message: "请选择开始时间" }],
  702. courseNum: [{ required: true, message: "请输入排课次数" }],
  703. mixClassGroupId: [{ required: true, message: "请选择合奏班" }]
  704. },
  705. weekDateList: [
  706. { value: "1", label: "星期一" },
  707. { value: "2", label: "星期二" },
  708. { value: "3", label: "星期三" },
  709. { value: "4", label: "星期四" },
  710. { value: "5", label: "星期五" },
  711. { value: "6", label: "星期六" },
  712. { value: "7", label: "星期日" }
  713. ],
  714. weekList: [
  715. {
  716. week: "",
  717. startTime: "",
  718. endTime: "",
  719. id: new Date().getTime()
  720. }
  721. ],
  722. cooperationList: [],
  723. courseTypeList: [],
  724. arrangeVisible: false,
  725. arrangeForm: {
  726. courseNum: null,
  727. classNum: null,
  728. courseType: null,
  729. courseTime: null,
  730. teachMode: null,
  731. checked: false,
  732. }, // 排课信息
  733. chioseTab: [], // 记录选中的项
  734. classCardList: [], // 课表的集合
  735. teamid: null
  736. };
  737. },
  738. //生命周期 - 创建完成(可以访问当前this实例)
  739. created () { },
  740. //生命周期 - 挂载完成(可以访问DOM元素)
  741. mounted () {
  742. getTeacher().then(res => {
  743. if (res.code == 200) {
  744. this.teacherList = res.data;
  745. this.cooperationList = res.data;
  746. }
  747. });
  748. // 获取声部
  749. findSound({ musicGroupId: this.teamid }).then(res => {
  750. if (res.code == 200) {
  751. this.soundList = res.data;
  752. }
  753. });
  754. // 获取节假日
  755. this.init();
  756. sysConfigList({ group: 'holiday' }).then(res => {
  757. if (res.code == 200 && res.data.length > 0) {
  758. if (res.data[0].paranValue) {
  759. this.holidayList = JSON.parse(res.data[0].paranValue)
  760. }
  761. }
  762. })
  763. },
  764. activated () {
  765. this.init();
  766. },
  767. methods: {
  768. init () {
  769. this.getList();
  770. },
  771. getList () {
  772. this.teamid = this.$route.query.id;
  773. getMusicGroupClass({ groupType: 'MUSIC', musicGroupId: this.teamid, type: this.searchForm.classType, page: this.rules.page }).then(res => {
  774. if (res.code == 200) {
  775. this.tableList = res.data.rows;
  776. this.rules.total = res.data.total
  777. }
  778. })
  779. },
  780. changeClassGetList (val) {
  781. this.getList()
  782. },
  783. newClass () {
  784. if (this.isSetSalary) {
  785. this.$message.error('课酬确认后无法编辑')
  786. return;
  787. }
  788. this.newClassVisible = true;
  789. },
  790. newClassSecond () {
  791. // 判断当前选择的课程类型
  792. // 单技 合奏等等
  793. this.$refs['newClassForm'].validate(res => {
  794. if (res) {
  795. this.isNewClass = true;
  796. let type = this.newClassForm.type;
  797. this.isSearch = true;
  798. this.getNoClassStudent(type, null)
  799. this.studentVisible = true;
  800. }
  801. })
  802. },
  803. newClassHight () {
  804. this.$refs['newClassForm'].validate(res => {
  805. if (res) {
  806. let obj = {}
  807. obj.musicGroupId = this.teamid;
  808. obj.name = this.newClassForm.className;
  809. obj.type = this.newClassForm.type;
  810. obj.groupType = 'MUSIC'
  811. let subjectIdList;
  812. if (this.newClassForm.type == 'HIGH_ONLINE') {
  813. subjectIdList = this.newClassForm.subjectIdList
  814. } else {
  815. subjectIdList = this.newClassForm.subjectIdList.length > 0 ? this.newClassForm.subjectIdList.join(',') : null
  816. }
  817. obj.subjectIdList = subjectIdList
  818. obj.expectStudentNum = this.newClassForm.expectStudentNum;
  819. obj.teacherMapperList = [];
  820. obj.teacherMapperList.push({ userId: this.newClassForm.bishop, teacherRole: 'BISHOP' })
  821. for (let i in this.newClassForm.teaching) {
  822. obj.teacherMapperList.push({ userId: this.newClassForm.teaching[i], teacherRole: 'TEACHING' })
  823. }
  824. createClass(obj).then(res => {
  825. if (res.code == 200) {
  826. this.$message.success('创建成功');
  827. this.getList();
  828. this.newClassVisible = false;
  829. }
  830. })
  831. }
  832. })
  833. },
  834. removeStudent (item) {
  835. removeStudents({
  836. classGroupId: this.activeClass,
  837. userId: item.userId
  838. }).then(res => {
  839. if (res.code == 200) {
  840. this.$message.success("删除成功");
  841. item.isVisible = false;
  842. // 这里刷新 this.studentList this.activeListStudent
  843. this.getList(this.activeMixClass);
  844. getClassAllStudent({ classGroupId: this.activeClass }).then(res => {
  845. if (res.code == 200) {
  846. this.activeListStudent = res.data;
  847. }
  848. });
  849. this.getNoClassStudent(this.activeType);
  850. }
  851. });
  852. },
  853. addSomeStudent () {
  854. // 获取勾选的学生
  855. let arr = this.chioseStudent.map(item => {
  856. return item.userId;
  857. });
  858. if (arr.length <= 0) {
  859. this.$message.error("至少添加一名学员");
  860. return;
  861. }
  862. if (this.activeType == 'HIGH_ONLINE') {
  863. superFindClassGroups({ classGroupId: this.activeClass }).then(res => {
  864. if (res.code == 200) {
  865. let maxNum = res.data.rows[0].expectStudentNum;
  866. if (arr.length + this.activeListStudent.length > maxNum) {
  867. this.$message.error('超过预计招生人数');
  868. return;
  869. } else {
  870. addStudents({
  871. classGroupId: this.activeClass,
  872. userIdsStr: arr.join(",")
  873. }).then(res => {
  874. if (res.code == 200) {
  875. this.studentVisible = false;
  876. this.$message.success("添加成功");
  877. this.getList();
  878. }
  879. });
  880. }
  881. }
  882. })
  883. }
  884. // 在此处做拦截
  885. },
  886. temporaryRemoveStudent (item) {
  887. console.log(item);
  888. // 列表中删除
  889. for (let i in this.activeListStudent) {
  890. if (this.activeListStudent[i].userId == item.userId) {
  891. this.activeListStudent.splice(i, 1);
  892. }
  893. }
  894. // 查询列表中的项 取消勾选 temporaryStudentList toggleRowSelection
  895. // 循环列表 找到相应的行取消勾选
  896. for (let k in this.studentList) {
  897. if (this.studentList[k].userId == item.userId) {
  898. this.$refs["temporaryStudentList"].toggleRowSelection(item, false);
  899. }
  900. }
  901. // this.$refs['temporaryStudentList'].toggleRowSelection(row, selected);
  902. },
  903. // 对象数组去重
  904. objArrayRemoval (arr, attr) {
  905. let obj = {};
  906. let result = [];
  907. for (let x in arr) {
  908. if (!obj[arr[x][attr]]) {
  909. result.push(arr[x]);
  910. obj[arr[x][attr]] = true;
  911. }
  912. }
  913. return result;
  914. },
  915. // 新增选中的学生
  916. NewselectionStudent (val) {
  917. this.chioseStudent = val;
  918. // 这里新增的添加到选中的学生列表 根据学生id去重
  919. if (this.chioseStudent.length > 0) {
  920. this.chioseStudent = this.chioseStudent.concat(val);
  921. } else {
  922. this.chioseStudent = val;
  923. }
  924. // 联动版
  925. // this.activeListStudent = this.objArrayRemoval(this.chioseStudent, 'userId')
  926. // 非联动多选版
  927. this.activeListStudent = this.activeListStudent.concat(
  928. this.chioseStudent
  929. );
  930. // // 去重
  931. this.activeListStudent = this.objArrayRemoval(
  932. this.activeListStudent,
  933. "userId"
  934. );
  935. // 将其填入选中的学生
  936. },
  937. // 获取乐团中没课的学生
  938. getNoClassStudent (type, sound) {
  939. if (!sound) {
  940. let sound = null;
  941. }
  942. getMusicGroupStuNoClassType({ musicGroupId: this.teamid, type, actualSubjectId: sound }).then(
  943. res => {
  944. if (res.code == 200) {
  945. this.studentList = res.data;
  946. }
  947. }
  948. );
  949. },
  950. // 根据声部id 获取学生
  951. searchStudent (val) {
  952. this.getNoClassStudent(this.newClassForm.type, val)
  953. },
  954. createMusiceClass () {
  955. // console.log(this.activeListStudent)
  956. let userIds = null;
  957. if (this.activeListStudent.length > 0) {
  958. userIds = this.activeListStudent.map(item => {
  959. return item.userId
  960. }).join(',')
  961. }
  962. // 创建班级
  963. let obj = {}
  964. obj.musicGroupId = this.teamid;
  965. obj.name = this.newClassForm.className;
  966. obj.type = this.newClassForm.type;
  967. obj.groupType = 'MUSIC'
  968. obj.userIds = userIds;
  969. obj.teacherMapperList = [];
  970. obj.expectStudentNum = this.newClassForm.expectStudentNum;
  971. let subjectIdList;
  972. if (this.newClassForm.type == 'HIGH_ONLINE') {
  973. subjectIdList = this.newClassForm.subjectIdList
  974. } else {
  975. subjectIdList = this.newClassForm.subjectIdList.length > 0 ? this.newClassForm.subjectIdList.join(',') : null
  976. }
  977. obj.subjectIdList = subjectIdList;
  978. obj.teacherMapperList.push({ userId: this.newClassForm.bishop, teacherRole: 'BISHOP' })
  979. for (let i in this.newClassForm.teaching) {
  980. obj.teacherMapperList.push({ userId: this.newClassForm.teaching[i], teacherRole: 'TEACHING' })
  981. }
  982. createClass(obj).then(res => {
  983. if (res.code == 200) {
  984. this.$message.success('创建成功');
  985. this.getList();
  986. this.studentVisible = false;
  987. this.newClassVisible = false;
  988. }
  989. })
  990. },
  991. classAdjustment (row) {
  992. if (this.isSetSalary) {
  993. this.$message.error('课酬确认后无法编辑')
  994. return;
  995. }
  996. this.activeType = row.type;
  997. this.activeClass = row.id;
  998. // this.activeListStudent = row.subjectIdList.split(',')
  999. this.setType(row.type);
  1000. // activeListStudent
  1001. this.isNewClass = false;
  1002. this.teacherForm.assistant = [];
  1003. for (let i in row.classGroupTeacherMapperList) {
  1004. if (row.classGroupTeacherMapperList[i].teacherRole == "BISHOP") {
  1005. this.teacherForm.coreTeacher =
  1006. row.classGroupTeacherMapperList[i].userId;
  1007. }
  1008. if (row.classGroupTeacherMapperList[i].teacherRole == "TEACHING") {
  1009. this.teacherForm.assistant.push(
  1010. row.classGroupTeacherMapperList[i].userId
  1011. );
  1012. }
  1013. }
  1014. this.infoVisible = true;
  1015. },
  1016. setType (type) {
  1017. switch (type) {
  1018. case "NORMAL": {
  1019. this.courseTypeList = [
  1020. { value: "SINGLE", label: "单技课" },
  1021. { value: "TRAINING_SINGLE", label: "集训单技课" },
  1022. { value: "COMPREHENSIVE", label: "综合课" },
  1023. { value: "CLASSROOM", label: "课堂课" }
  1024. ];
  1025. break;
  1026. }
  1027. case "MIX": {
  1028. this.courseTypeList = [
  1029. { value: "MIX", label: "合奏课" },
  1030. { value: "TRAINING_MIX", label: "集训合奏课" },
  1031. { value: "COMPREHENSIVE", label: "综合课" },
  1032. { value: "CLASSROOM", label: "课堂课" }
  1033. ];
  1034. break;
  1035. }
  1036. case "HIGH": {
  1037. this.courseTypeList = [
  1038. { value: "HIGH", label: "基础技能课" },
  1039. ];
  1040. break;
  1041. }
  1042. case "HIGH_ONLINE": {
  1043. this.courseTypeList = [
  1044. { value: "HIGH_ONLINE", label: "线上基础技能课" },
  1045. ];
  1046. break;
  1047. }
  1048. case "SNAP": {
  1049. this.courseTypeList = [
  1050. { value: "SINGLE", label: "单技课" },
  1051. { value: "MIX", label: "合奏课" },
  1052. { value: "TRAINING_SINGLE", label: "集训单技课" },
  1053. { value: "TRAINING_MIX", label: "集训合奏课" },
  1054. { value: "HIGH", label: "基础技能课" },
  1055. { value: "COMPREHENSIVE", label: "综合课" },
  1056. { value: "CLASSROOM", label: "课堂课" }
  1057. ];
  1058. }
  1059. }
  1060. },
  1061. // 删除班级
  1062. removeClass (scope) {
  1063. if (this.isSetSalary) {
  1064. this.$message.error('课酬确认后无法编辑')
  1065. return;
  1066. }
  1067. removeSingleClass({ classGroupId: scope.row.id })
  1068. .then(res => {
  1069. if (res.code == 200) {
  1070. this.$message.success("删除成功");
  1071. scope._self.$refs[scope.$index].doClose();
  1072. // 重新请求列表
  1073. this.getList();
  1074. } else {
  1075. this.$message.error(res.msg);
  1076. scope._self.$refs[scope.$index].doClose();
  1077. }
  1078. })
  1079. .catch(res => {
  1080. scope._self.$refs[scope.$index].doClose();
  1081. });
  1082. },
  1083. setAssistant (val) {
  1084. for (let i in val) {
  1085. if (val[i] == this.teacherForm.coreTeacher) {
  1086. val.splice(i, 1);
  1087. }
  1088. }
  1089. },
  1090. setAssistant1 (val) {
  1091. for (let i in val) {
  1092. if (val[i] == this.newClassForm.bishop) {
  1093. val.splice(i, 1);
  1094. }
  1095. }
  1096. },
  1097. SelectionStudent (val) {
  1098. // console.log(val);
  1099. // this.activeListStudent = val;
  1100. this.chioseStudent = val;
  1101. },
  1102. addWeek () {
  1103. // 添加循环周期
  1104. this.weekList.push({
  1105. dayOfWeek: "",
  1106. startClassTime: "",
  1107. endClassTime: "",
  1108. id: new Date()
  1109. });
  1110. },
  1111. // 提交临时班的信息
  1112. submitTemporary (type) {
  1113. // 参数是一样 type为1 新增临时班
  1114. // type为2 新增单技班
  1115. // type为3 修改班级信息
  1116. if (type == 1) {
  1117. this.isTemporary = true;
  1118. } else {
  1119. this.isTemporary = false;
  1120. }
  1121. this.$refs["teacherForm"].validate(item => {
  1122. if (item) {
  1123. let week = this.weekList;
  1124. if (this.teacherForm.isAdd != "onlyUpdateTeacher") {
  1125. if (
  1126. !week[0] ||
  1127. !week[0].startClassTime ||
  1128. !week[0].endClassTime ||
  1129. !week[0].dayOfWeek
  1130. ) {
  1131. this.$message.error("至少排一节课");
  1132. return;
  1133. }
  1134. }
  1135. // 这里代表排课成功 发请求 新增临时班
  1136. let classGroupName = this.className;
  1137. let classGroupTeacherMapperList = [
  1138. { userId: this.teacherForm.coreTeacher, teacherRole: "BISHOP" }
  1139. ];
  1140. for (let i in this.teacherForm.assistant) {
  1141. classGroupTeacherMapperList.push({
  1142. userId: this.teacherForm.assistant[i],
  1143. teacherRole: "TEACHING"
  1144. });
  1145. }
  1146. // let mixClassGroupId = this.teacherForm.mixClassGroupId;
  1147. let musicGroupId = this.teamid;
  1148. let startDate = this.teacherForm.courseTime;
  1149. let courseType = this.teacherForm.courseType;
  1150. let courseTimes = this.teacherForm.courseNum;
  1151. if (
  1152. courseTimes <= 0 &&
  1153. this.teacherForm.isAdd != "onlyUpdateTeacher"
  1154. ) {
  1155. this.$message.error("请至少排一节课");
  1156. return;
  1157. }
  1158. let students = this.activeListStudent.map(item => {
  1159. return item.userId;
  1160. });
  1161. let holiday = this.teacherForm.checked;
  1162. let courseList = [];
  1163. for (let i in this.weekList) {
  1164. courseList.push(this.weekList[i]);
  1165. }
  1166. if (
  1167. courseList.length <= 0 &&
  1168. this.teacherForm.isAdd != "onlyUpdateTeacher"
  1169. ) {
  1170. this.$message.error("新增班级至少排一节课");
  1171. return;
  1172. }
  1173. if (this.teacherForm.isAdd == "onlyUpdateTeacher") {
  1174. startDate = null
  1175. courseType = null
  1176. students = null
  1177. holiday = null
  1178. courseTimes = null
  1179. courseList = null,
  1180. mineType = null
  1181. }
  1182. // mixClassGroupId,
  1183. let mineType = this.activeType;
  1184. let obj = {
  1185. classGroupName,
  1186. classGroupTeacherMapperList,
  1187. musicGroupId,
  1188. startDate,
  1189. courseType,
  1190. students,
  1191. holiday,
  1192. courseTimes,
  1193. courseTimeDtoList: courseList,
  1194. type: mineType,
  1195. courseAddType: this.teacherForm.isAdd
  1196. };
  1197. if (type == 1) {
  1198. // 新增临时班级
  1199. revisionClassGroup(obj).then(res => {
  1200. if (res.code == 200) {
  1201. // 提示修改成功
  1202. this.$message.success("修改成功");
  1203. this.infoVisible = false;
  1204. this.studentVisible = false;
  1205. this.getList();
  1206. }
  1207. });
  1208. } else if (type == 2) {
  1209. // 新增单技班
  1210. revisionAddClassGroup(obj).then(res => {
  1211. if (res.code == 200) {
  1212. // 修改成功
  1213. this.$message.success("修改成功");
  1214. this.infoVisible = false;
  1215. this.studentVisible = false;
  1216. this.getList();
  1217. }
  1218. });
  1219. } else if (type == 3) {
  1220. // activeClass
  1221. obj.classGroupId = this.activeClass;
  1222. classGroupUpdate(obj).then(res => {
  1223. if (res.code == 200) {
  1224. this.$message.success("修改成功");
  1225. this.infoVisible = false;
  1226. this.getList();
  1227. }
  1228. });
  1229. }
  1230. } else {
  1231. this.$message.error("请填写必要信息");
  1232. return;
  1233. }
  1234. });
  1235. },
  1236. resetClass (row) {
  1237. if (this.isSetSalary) {
  1238. this.$message.error('课酬确认后无法编辑')
  1239. return;
  1240. }
  1241. this.isNewClass = false;
  1242. this.className = row.name;
  1243. this.studentVisible = true;
  1244. this.activeClass = row.id;
  1245. this.isSearch = false;
  1246. this.activeType = row.type;
  1247. // 根据单机班id 查询单技班内的所有学生
  1248. getClassAllStudent({ classGroupId: row.id }).then(res => {
  1249. if (res.code == 200) {
  1250. this.activeListStudent = res.data.map(item => {
  1251. item.isVisible = false;
  1252. return item;
  1253. });
  1254. }
  1255. });
  1256. this.getNoClassStudent(row.type);
  1257. },
  1258. // 排课开始
  1259. arrangeStart () {
  1260. if (this.isSetSalary) {
  1261. this.$message.error('课酬确认后无法编辑')
  1262. return;
  1263. }
  1264. if (this.chioseTab.length < 1) {
  1265. this.$message.error('请至少选择一个班级')
  1266. return;
  1267. }
  1268. let type = this.chioseTab[0].type;
  1269. let isSome = this.chioseTab.every(item => {
  1270. return item.type == type
  1271. })
  1272. if (!isSome) {
  1273. this.$message.error('请选择相同类型的班级')
  1274. return false;
  1275. }
  1276. this.setType(this.chioseTab[0].type);
  1277. this.arrangeForm.courseType = this.courseTypeList[0].value;
  1278. this.arrangeVisible = true;
  1279. if (this.arrangeForm.courseType == 'HIGH_ONLINE') {
  1280. this.arrangeForm.teachMode = 'ONLINE'
  1281. } else {
  1282. this.arrangeForm.teachMode = 'OFFLINE'
  1283. }
  1284. },
  1285. selectionTable (val) {
  1286. this.chioseTab = val;
  1287. this.arrangeForm.classNum = val.length;
  1288. },
  1289. // 开始排课
  1290. arrangeFormSubmit () {
  1291. // 获取要排课的班级 id
  1292. if (this.weekList.length < 0 || !this.weekList[0].dayOfWeek) {
  1293. this.$message.error('请设置排课周期')
  1294. return
  1295. }
  1296. // 组拼课程信息
  1297. this.$refs['arrangeForm'].validate(res => {
  1298. if (res) {
  1299. let date = this.arrangeForm.courseTime
  1300. let classCount = this.arrangeForm.courseNum
  1301. let weekArr = this.weekList;
  1302. let courseType = this.arrangeForm.courseType
  1303. let teachMode = this.arrangeForm.teachMode
  1304. this.classCardList = [];
  1305. this.workOut(date, classCount, weekArr, courseType, teachMode)
  1306. }
  1307. })
  1308. },
  1309. // 排课: 开始日期 几节课 星期几 什么类型的课
  1310. workOut (date, classCount, weekArr, courseType, teachMode) {
  1311. // 验证是不是添加的循环周期里每一项都有值
  1312. let flag = weekArr.every(item => {
  1313. return item.dayOfWeek && item.startClassTime && item.endClassTime
  1314. })
  1315. if (!flag) {
  1316. this.$message.error('请保证循环周期信息完整')
  1317. return
  1318. }
  1319. // 这里是一天排一节课 现在要改成一天排多节
  1320. while (classCount && classCount > 0) {
  1321. for (let i in weekArr) {
  1322. let date1 = new Date(date.getTime());
  1323. let num; // 下次上课上几天后
  1324. // 星期4 - 当前是星期几 =>
  1325. weekArr[i].dayOfWeek - date.getDay() >= 0 ? num = weekArr[i].dayOfWeek - date.getDay() : num = weekArr[i].dayOfWeek - date.getDay() + 7
  1326. let dataStr = this.getThinkDate(date, num);
  1327. let monthDay = this.getThinkDate(date1, num)
  1328. if (this.arrangeForm.checked) {
  1329. if (this.holidayList.indexOf(monthDay) != -1) {
  1330. // 这里说明有节假日
  1331. continue
  1332. }
  1333. }
  1334. let nowStartTime = weekArr[i].startClassTime
  1335. let nowEndTime = weekArr[i].endClassTime
  1336. // 这里开始排课 哪几个班
  1337. for (let j in this.chioseTab) {
  1338. this.classCardList.push({
  1339. 'classDate': dataStr,
  1340. 'classGroupId': this.chioseTab[j].id,
  1341. 'startClassTimeStr': nowStartTime,
  1342. 'endClassTimeStr': nowEndTime,
  1343. 'type': courseType,
  1344. 'weekNum': weekArr[i].dayOfWeek,
  1345. 'name': this.chioseTab[j].name,
  1346. 'teachMode': teachMode,
  1347. 'option': 1
  1348. })
  1349. }
  1350. classCount--
  1351. if (classCount == 0) break
  1352. }
  1353. date.setDate(date.getDate() + 7);
  1354. }
  1355. // 直接调接口排课进去
  1356. workOut({ musicGroupID: this.teamid, courseSchedules: this.classCardList }).then(res => {
  1357. if (res.code == 200) {
  1358. this.$message.success('恭喜您排课成功')
  1359. this.classCardList = [];
  1360. this.arrangeVisible = false;
  1361. this.getList()
  1362. }
  1363. }).catch(res => {
  1364. // this.tableList = [];
  1365. console.log('排课来了')
  1366. this.classCardList = [];
  1367. this.resetTime();
  1368. })
  1369. },
  1370. getThinkDate (date, num, type = 1) {
  1371. let Stamp = new Date(date.getTime());
  1372. Stamp.setDate(Stamp.getDate() + parseInt(num)) // 获取当前月数的第几天
  1373. var year = Stamp.getFullYear(); //获取完整的年份(4位,1970-????)
  1374. var month = Stamp.getMonth() + 1; //获取当前月份(0-11,0代表1月)
  1375. var mvar = '';
  1376. if (month < 10) {
  1377. mvar = '0' + month;
  1378. } else {
  1379. mvar = month + '';
  1380. }
  1381. var day = Stamp.getDate();
  1382. var dvar = '';
  1383. if (day < 10) {
  1384. dvar = '0' + day;
  1385. } else {
  1386. dvar = day + '';
  1387. }
  1388. if (type == 2) {
  1389. return mvar + dvar;
  1390. } else {
  1391. return year + "-" + mvar + '-' + dvar;
  1392. }
  1393. },
  1394. resetTime () {
  1395. this.arrangeForm.courseTime = null;
  1396. this.weekList = [
  1397. {
  1398. week: "",
  1399. startTime: "",
  1400. endTime: "",
  1401. id: new Date().getTime()
  1402. }
  1403. ]
  1404. }
  1405. },
  1406. filters: {
  1407. getBishopName (val) {
  1408. let name = '';
  1409. if (val && val.length > 0) {
  1410. for (let i in val) {
  1411. if (val[i].teacherRole == 'BISHOP') {
  1412. name = val[i].userName;
  1413. }
  1414. }
  1415. }
  1416. return name;
  1417. },
  1418. getTeachingNum (val) {
  1419. let num = 0;
  1420. if (val && val.length > 0) {
  1421. for (let i in val) {
  1422. if (val[i].teacherRole == 'TEACHING') {
  1423. num++
  1424. }
  1425. }
  1426. }
  1427. return num;
  1428. },
  1429. },
  1430. watch: {
  1431. newClassVisible (val) {
  1432. if (!val) {
  1433. this.newClassForm = {
  1434. className: null,
  1435. type: null,
  1436. subjectIdList: null,
  1437. expectStudentNum: null,
  1438. bishop: null,
  1439. teaching: null
  1440. }
  1441. }
  1442. },
  1443. studentVisible (val) {
  1444. if (!val) {
  1445. this.newClassVisible = false;
  1446. this.activeListStudent = [];
  1447. }
  1448. },
  1449. infoVisible (val) {
  1450. if (!val) {
  1451. this.teacherForm = {
  1452. isAdd: 'onlyUpdateTeacher',
  1453. coreTeacher: "",
  1454. assistant: [],
  1455. courseType: "",
  1456. courseTime: "",
  1457. checked: false,
  1458. courseNum: "",
  1459. mixClassGroupId: ""
  1460. }
  1461. this.$refs['teacherForm'].resetFields()
  1462. }
  1463. },
  1464. arrangeVisible (val) {
  1465. if (!val) {
  1466. this.arrangeForm = {
  1467. courseNum: null,
  1468. classNum: null,
  1469. courseType: null,
  1470. courseTime: null,
  1471. teachMode: null,
  1472. checked: false,
  1473. }
  1474. this.$refs['arrangeForm'].resetFields()
  1475. this.weekList = [
  1476. {
  1477. week: "",
  1478. startTime: "",
  1479. endTime: "",
  1480. id: new Date().getTime()
  1481. }
  1482. ]
  1483. }
  1484. }
  1485. }
  1486. };
  1487. </script>
  1488. <style lang='scss' scoped>
  1489. .m-core {
  1490. background-color: #fff;
  1491. box-sizing: border-box;
  1492. padding: 30px 42px;
  1493. }
  1494. .buttonWrap {
  1495. display: flex;
  1496. justify-content: flex-start;
  1497. .newBand {
  1498. margin-right: 20px;
  1499. }
  1500. .expectMsg {
  1501. position: relative;
  1502. top: 3px;
  1503. line-height: 36px;
  1504. font-size: 14px;
  1505. }
  1506. }
  1507. .studentMask {
  1508. display: flex;
  1509. flex-direction: row;
  1510. justify-content: flex-start;
  1511. .left {
  1512. width: 200px;
  1513. margin-right: 20px;
  1514. .wrap {
  1515. margin-bottom: 20px;
  1516. }
  1517. h4 {
  1518. font-size: 16px;
  1519. color: #444;
  1520. line-height: 38px;
  1521. }
  1522. .chioseStudentList {
  1523. height: 500px;
  1524. overflow-y: auto;
  1525. border: 1px solid #ccc;
  1526. .studentItem {
  1527. padding-left: 10px;
  1528. line-height: 25px;
  1529. }
  1530. }
  1531. }
  1532. .right {
  1533. width: calc(100% - 200px);
  1534. .tableList {
  1535. max-height: 500px;
  1536. overflow-y: auto;
  1537. }
  1538. }
  1539. }
  1540. .resetClassForm {
  1541. /deep/.el-date-editor.el-input,
  1542. /deep/.el-date-editor.el-input__inner {
  1543. width: 180px !important;
  1544. }
  1545. }
  1546. /deep/.el-date-editor.el-input,
  1547. /deep/.el-date-editor.el-input__inner {
  1548. width: 100px !important;
  1549. }
  1550. </style>