setClassV2.vue 55 KB

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