resetClass.vue 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795
  1. <template>
  2. <!-- m-container -->
  3. <div class>
  4. <!-- <h2>
  5. <div class='squrt'></div>
  6. 班级调整
  7. </h2>-->
  8. <div class="m-core">
  9. <div class="topWrap">
  10. <el-form :inline="true" :model="topForm">
  11. <el-form-item label="班级类型">
  12. <el-select
  13. v-model.trim="topForm.classType"
  14. clearable
  15. filterable
  16. @change="changeMixClass"
  17. >
  18. <el-option
  19. v-for="(item, index) in musicClassTypeList"
  20. :key="index"
  21. :label="item.label"
  22. :value="item.value"
  23. ></el-option>
  24. </el-select>
  25. </el-form-item>
  26. </el-form>
  27. <el-popover placement="left" width="500" trigger="click">
  28. <div class="popoverWrap">
  29. <p>线上基础技能班规则:</p>
  30. <p>班级数量:</p>
  31. <p>
  32. 乐团可创建的线上基础技能班数量为各声部人数/6向上取整之和(上低音号与长号合并计算)
  33. </p>
  34. <p>
  35. 例:乐团有长笛13人、上低音号8人、长号7人,则该乐团可创建上线基础技能班数量为
  36. </p>
  37. <p>13/6向上取整+(8+7)/6向上取整=3+3=6个线上基础技能班</p>
  38. <p>班级人数:</p>
  39. <p>线上基础技能班人数为3至6人</p>
  40. </div>
  41. <div class="newBand" slot="reference">建班规则</div>
  42. </el-popover>
  43. </div>
  44. <div class="tableWrap" style>
  45. <el-table
  46. :data="activeSingleList"
  47. style
  48. ref="multipleTable"
  49. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  50. tooltip-effect="dark"
  51. @selection-change="handleSelectionChange"
  52. >
  53. <!-- <el-table-column type="selection"
  54. v-bind:selectable="chkstu"
  55. width="55"></el-table-column> -->
  56. <el-table-column
  57. align="center"
  58. prop="name"
  59. label="班级名称"
  60. ></el-table-column>
  61. <el-table-column align="center" prop="type" label="班级类型">
  62. <template slot-scope="scope">
  63. <div>{{ scope.row.type | classType }}</div>
  64. </template>
  65. </el-table-column>
  66. <el-table-column
  67. align="center"
  68. prop="studentNum"
  69. label="当前班级人数"
  70. >
  71. <template slot-scope="scope">
  72. <div>{{ scope.row.studentNum }}人</div>
  73. </template>
  74. </el-table-column>
  75. <el-table-column align="center" prop label="主教老师">
  76. <template slot-scope="scope">
  77. <div v-if="scope.row.classGroupTeacherMapperList">
  78. <p
  79. v-for="(item, index) in scope.row.classGroupTeacherMapperList"
  80. v-if="item.teacherRole == 'BISHOP'"
  81. :key="index"
  82. >
  83. {{ item.userName }}
  84. </p>
  85. </div>
  86. </template>
  87. </el-table-column>
  88. <el-table-column align="center" label="助教老师">
  89. <template slot-scope="scope">
  90. <div v-if="scope.row.classGroupTeacherMapperList">
  91. <p
  92. v-for="(item, index) in scope.row.classGroupTeacherMapperList"
  93. v-if="item.teacherRole == 'TEACHING'"
  94. :key="index"
  95. >
  96. {{ item.userName }}
  97. </p>
  98. </div>
  99. </template>
  100. </el-table-column>
  101. <el-table-column align="center" label="已上课时">
  102. <template slot-scope="scope">
  103. <div>{{ scope.row.currentClassTimes }}</div>
  104. </template>
  105. </el-table-column>
  106. <el-table-column align="center" label="总课数">
  107. <template slot-scope="scope">
  108. <div>{{ scope.row.totalClassTimes }}</div>
  109. </template>
  110. </el-table-column>
  111. <el-table-column align="center" width="240px" label="操作">
  112. <template slot-scope="scope">
  113. <div>
  114. <!-- v-if="scope.row.type !='MIX'" -->
  115. <el-button
  116. type="text"
  117. @click="resetClass(scope.row)"
  118. v-permission="'classGroupStudent/updateClassGroupStudents'"
  119. v-if="scope.row.type != 'MUSIC_NETWORK'"
  120. >学员调整</el-button
  121. >
  122. <el-button
  123. type="text"
  124. @click="resetTeacher(scope.row)"
  125. v-permission="'classGroup/classGroupUpdate'"
  126. v-if="scope.row.type != 'MUSIC_NETWORK'"
  127. >老师调整</el-button
  128. >
  129. <el-button
  130. type="text"
  131. v-if="
  132. permission('classGroup/classGroupUpdate') ||
  133. permission('classGroup/revisionClassGroup') ||
  134. permission('classGroup/revisionAddClassGroup')
  135. "
  136. @click="classAdjustment(scope.row)"
  137. >排课</el-button
  138. >
  139. <!--<el-button type="text"
  140. @click="recourse(scope.row)">重新排课</el-button>-->
  141. <el-popover
  142. placement="top"
  143. width="200"
  144. :ref="`popover-${scope.$index}`"
  145. >
  146. <p>确定删除?</p>
  147. <div style="text-align: right; margin: 0">
  148. <el-button
  149. size="mini"
  150. type="text"
  151. @click="
  152. scope._self.$refs[`popover-${scope.$index}`].doClose()
  153. "
  154. >取消</el-button
  155. >
  156. <el-button
  157. type="primary"
  158. size="mini"
  159. @click="removeClass(scope)"
  160. >确定</el-button
  161. >
  162. </div>
  163. <!-- v-if="scope.row.type !='MIX'" -->
  164. <el-button
  165. type="text"
  166. v-if="
  167. scope.row.studentNum == '0' ||
  168. scope.row.totalClassTimes == '0'
  169. "
  170. slot="reference"
  171. >删除</el-button
  172. >
  173. </el-popover>
  174. </div>
  175. </template>
  176. </el-table-column>
  177. </el-table>
  178. <div class="floor">
  179. <div class="left">
  180. <div
  181. class="add"
  182. @click="studentResetVisiable = true"
  183. v-if="permission('classGroup/mergeClassSplitClassAffirm')"
  184. >
  185. 拆分班级
  186. </div>
  187. </div>
  188. <div class="right">
  189. <div class="add" @click="temporary">新建临时班</div>
  190. <div class="add" @click="addNewClass('NORMAL')">新建声部班</div>
  191. <div class="add" @click="addNewClass('MIX')">新建合奏班</div>
  192. <div class="add" @click="addNewClass('MUSIC_NETWORK')">
  193. 新建乐团网管课
  194. </div>
  195. <div class="add" @click="newClassVisible = true">基础技能班</div>
  196. </div>
  197. <!-- <div class="add"
  198. @click="addNewClass('HIGH_ONLINE')">线上基础技能班</div>-->
  199. </div>
  200. </div>
  201. </div>
  202. <el-dialog
  203. title="老师调整"
  204. width="750px"
  205. :visible.sync="teacherVisible"
  206. destroy-on-close
  207. >
  208. <changeTeacher
  209. v-if="teacherVisible && teacherDetail"
  210. :classGroupId="activeClass"
  211. :activeType="activeType"
  212. :teacherList="teacherList"
  213. :cooperationList="cooperationList"
  214. :detail="teacherDetail"
  215. @submited="teacherSubmited"
  216. @close="teacherVisible = false"
  217. />
  218. </el-dialog>
  219. <!-- 学员选择 -->
  220. <el-dialog
  221. :title="isOnlyChangeUser ? '学员调整' : '新建班级'"
  222. width="750px"
  223. :visible.sync="studentVisible"
  224. destroy-on-close
  225. >
  226. <selectStudent
  227. :activeListStudent="activeListStudent"
  228. :studentList="studentList"
  229. :soundList="activeSoundList"
  230. :classGroupId="activeClass"
  231. :teacherList="teacherList"
  232. :cooperationList="cooperationList"
  233. :isOnlyChangeUser="isOnlyChangeUser"
  234. :activeType="activeType"
  235. @changeActiveChioseSound="changeActiveChioseSound"
  236. @searchStudent="searchStudent(activeClass)"
  237. @submited="studentSubmited"
  238. @close="studentVisible = false"
  239. />
  240. </el-dialog>
  241. <!-- 老师以及课程设置 -->
  242. <el-dialog
  243. title="班级设置"
  244. width="950px"
  245. :visible.sync="infoVisible"
  246. :modal-append-to-body="false"
  247. >
  248. <classroomSetting
  249. v-if="infoVisible"
  250. :classType="classType"
  251. :teacherList="teacherList"
  252. :musicGroupId="teamid"
  253. :activeType="activeType"
  254. :courseTypeList="courseTypeList"
  255. :cooperationList="cooperationList"
  256. :detail="infoDetail"
  257. :studentSubmitedData="studentSubmitedData"
  258. @close="infoVisible = false"
  259. @submited="getList"
  260. />
  261. </el-dialog>
  262. <!-- 新增合奏班 -->
  263. <el-dialog
  264. title="新增合奏班"
  265. width="700px"
  266. :visible.sync="MixVisible"
  267. :modal-append-to-body="false"
  268. >
  269. <div class="studentMask">
  270. <div class="left">
  271. <div class="wrap">
  272. <!-- :disabled="!isNewClass" -->
  273. <el-input
  274. placeholder="请输入合奏班名称"
  275. v-model.trim="className"
  276. ></el-input>
  277. </div>
  278. <div class="chioseStudentList">
  279. <h4 style="padding-left: 10px">当前已选学生</h4>
  280. <div
  281. class="studentItem"
  282. v-for="(item, index) in activeListStudent"
  283. :key="index"
  284. >
  285. {{ item.name }}
  286. <el-button type="text" @click="removeSiginforMix(item)"
  287. >删除班级</el-button
  288. >
  289. </div>
  290. </div>
  291. </div>
  292. <div class="right">
  293. <!-- 列表开始 -->
  294. <div class="tableList">
  295. <el-table
  296. tooltip-effect="dark"
  297. style="width: 100%; margin-top: 10px"
  298. :data="singleList"
  299. ref="mixList"
  300. @selection-change="SelectionMix"
  301. >
  302. <el-table-column
  303. type="selection"
  304. align="center"
  305. width="55"
  306. ></el-table-column>
  307. <el-table-column
  308. prop="name"
  309. align="center"
  310. width="120"
  311. label="姓名"
  312. ></el-table-column>
  313. <el-table-column
  314. prop="gender"
  315. align="center"
  316. width="100"
  317. label="性别"
  318. >
  319. <template slot-scope="scope">
  320. <div>{{ scope.row.gender | sex }}</div>
  321. </template>
  322. </el-table-column>
  323. <el-table-column
  324. prop="subjectName"
  325. width="120"
  326. align="center"
  327. label="学员声部"
  328. ></el-table-column>
  329. </el-table>
  330. </div>
  331. </div>
  332. </div>
  333. <div slot="footer" class="dialog-footer">
  334. <el-button @click="studentVisible = false">取 消</el-button>
  335. <!-- 班级学员修改 -->
  336. <el-button type="primary" v-if="!isNewClass" @click="addSomeStudent"
  337. >确 定</el-button
  338. >
  339. <!-- 临时调整或者新建班级 -->
  340. <el-button type="primary" v-if="isNewClass" @click="setInfoMsg"
  341. >确 定</el-button
  342. >
  343. </div>
  344. </el-dialog>
  345. <el-dialog :visible.sync="newClassVisible" width="700px" title="新增班级">
  346. <el-form
  347. :model="newClassForm"
  348. :inline="true"
  349. label-width="120px"
  350. ref="newClassForm"
  351. class="newClassForm"
  352. >
  353. <el-form-item
  354. label="班级名称"
  355. :rules="[
  356. { required: true, message: '请输入班级姓名', trigger: 'blur' },
  357. ]"
  358. prop="className"
  359. >
  360. <el-input
  361. style="width: 180px"
  362. v-model="newClassForm.className"
  363. ></el-input>
  364. </el-form-item>
  365. <el-form-item
  366. label="班级类型"
  367. :rules="[
  368. { required: true, message: '请选择班级类型', trigger: 'blur' },
  369. ]"
  370. prop="type"
  371. >
  372. <el-select
  373. v-model.trim="newClassForm.type"
  374. clearable
  375. @change="chioseHightype"
  376. >
  377. <el-option
  378. v-for="(item, index) in highTypeList"
  379. :key="index"
  380. :label="item.label"
  381. :value="item.value"
  382. ></el-option>
  383. </el-select>
  384. </el-form-item>
  385. <el-form-item
  386. label="主教老师"
  387. prop="bishop"
  388. :rules="[
  389. { required: true, message: '请选择主教老师', trigger: 'blur' },
  390. ]"
  391. >
  392. <el-select
  393. v-model.trim="newClassForm.bishop"
  394. placeholder="请选择主教老师"
  395. clearable
  396. filterable
  397. >
  398. <el-option
  399. v-for="(item, index) in teacherList"
  400. :key="index"
  401. :label="item.realName"
  402. :value="String(item.id)"
  403. ></el-option>
  404. </el-select>
  405. <!-- <remote-search
  406. :commit="'setTeachers'"
  407. v-model="newClassForm.bishop"
  408. /> -->
  409. </el-form-item>
  410. <el-form-item
  411. label="预计招生数"
  412. prop="expectStudentNum"
  413. type="number"
  414. :rules="[
  415. { required: true, message: '请输入预计招生数', trigger: 'blur' },
  416. ]"
  417. @mousewheel.native.prevent
  418. >
  419. <el-input
  420. style="width: 180px"
  421. :disabled="newClassForm.type == 'HIGH_ONLINE'"
  422. v-model="newClassForm.expectStudentNum"
  423. ></el-input>
  424. </el-form-item>
  425. <el-form-item
  426. label="助教老师"
  427. v-if="
  428. newClassForm.type != 'HIGH_ONLINE' &&
  429. newClassForm.type != 'HIGH' &&
  430. newClassForm.type
  431. "
  432. prop="teaching"
  433. >
  434. <el-select
  435. v-model.trim="newClassForm.teaching"
  436. placeholder="请选择助教老师"
  437. filterable
  438. clearable
  439. multiple
  440. @change="setAssistant1"
  441. >
  442. <el-option
  443. v-for="(item, index) in cooperationList"
  444. :key="index"
  445. :label="item.realName"
  446. :value="item.id"
  447. ></el-option>
  448. </el-select>
  449. <!-- <remote-search
  450. :commit="'setTeachers'"
  451. v-model="newClassForm.teaching"
  452. @change="setAssistant1"
  453. :multiple="true"
  454. /> -->
  455. </el-form-item>
  456. <el-form-item
  457. label="声部"
  458. prop="subjectIdList"
  459. :rules="[{ required: true, message: '请选择声部', trigger: 'blur' }]"
  460. v-if="newClassForm.type == 'NORMAL'"
  461. :key="'HIGH'"
  462. >
  463. <el-select v-model="newClassForm.subjectIdList" clearable multiple>
  464. <el-option
  465. v-for="(item, index) in soundList"
  466. :key="index"
  467. :label="item.name"
  468. :value="item.id"
  469. ></el-option>
  470. </el-select>
  471. </el-form-item>
  472. <!-- <el-form-item 辜经理和焕焕狗要求不要可选声部
  473. label="可报名声部"
  474. prop="memo"
  475. :rules="[
  476. { required: true, message: '请选择可报名声部', trigger: 'blur' },
  477. ]"
  478. v-if="
  479. newClassForm.type == 'HIGH' || newClassForm.type == 'HIGH_ONLINE'
  480. "
  481. >
  482. <el-select
  483. v-model.trim="newClassForm.memo"
  484. multiple
  485. clearable
  486. @change="changeMemo"
  487. >
  488. <el-option
  489. :disabled="item.disabled || appoint"
  490. v-for="(item, index) in soundList"
  491. :key="index"
  492. :label="item.name"
  493. :value="item.id"
  494. ></el-option>
  495. </el-select>
  496. </el-form-item> -->
  497. <el-form-item
  498. label="网络教室声部"
  499. prop="subjectId"
  500. :rules="[
  501. { required: true, message: '请选择线上声部', trigger: 'blur' },
  502. ]"
  503. v-if="newClassForm.type == 'HIGH_ONLINE'"
  504. class="higheSelect"
  505. :key="'HIGH_ONLINE'"
  506. >
  507. <el-select v-model="newClassForm.subjectId" clearable>
  508. <el-option
  509. v-for="(item, index) in soundList"
  510. :key="index"
  511. :label="item.name"
  512. :value="item.id"
  513. ></el-option>
  514. </el-select>
  515. </el-form-item>
  516. </el-form>
  517. <div slot="footer" class="dialog-footer">
  518. <el-button @click="newClassVisible = false">取 消</el-button>
  519. <el-button type="primary" @click="newClassHight">确 定</el-button>
  520. </div>
  521. </el-dialog>
  522. <el-dialog
  523. title="学员列表"
  524. :visible.sync="studentListModalVisible"
  525. destroy-on-close
  526. >
  527. <viewStudentList
  528. :list="studentListModal"
  529. :showOk="true"
  530. @close="studentListModalVisible = false"
  531. />
  532. </el-dialog>
  533. <el-dialog
  534. title="学员班级调整"
  535. width="800px"
  536. :visible.sync="studentResetVisiable"
  537. >
  538. <studentResetView
  539. :teacherList="teacherList"
  540. :courseTypesByType="courseTypesByType"
  541. v-if="studentResetVisiable"
  542. :classList="mergeList"
  543. @close="closeStudentReset"
  544. />
  545. </el-dialog>
  546. </div>
  547. </template>
  548. <script>
  549. import {
  550. getAllClass,
  551. getAllSignClassandTeacher,
  552. getAllSignClass,
  553. removeSingleClass,
  554. getNoClassStudentAll,
  555. findSound,
  556. teamSoundStudent,
  557. findMusicGroupClassTeacher,
  558. revisionClassGroup,
  559. revisionAddClassGroup,
  560. getEmployeeOrgan,
  561. getTeacher,
  562. findNoClassSingle,
  563. getMusicGroupStuNoClassType,
  564. classGroupUpdate,
  565. getTeamBaseInfo,
  566. clearClassCourse,
  567. superFindClassGroups,
  568. createClass,
  569. pushMessage,
  570. } from "@/api/buildTeam";
  571. import {
  572. getClassAllStudent,
  573. removeStudents,
  574. addStudents,
  575. } from "@/api/studentManager";
  576. import { getOrganizationCourseUnitPriceSettings } from "@/api/specialSetting";
  577. import { queryEmployByOrganId } from "@/api/systemManage";
  578. import { diffTimerFormMinute, addTimerFormMinute } from "@/utils/date";
  579. import dayjs from "dayjs";
  580. import axios from "axios";
  581. import { classTimeList, musicClassTypeList } from "@/utils/searchArray";
  582. import viewStudentList from "./modals/view-student-list";
  583. import selectStudent from "./modals/select-student";
  584. import changeTeacher from "./modals/change-teacher";
  585. import classroomSetting from "./modals/classroom-setting";
  586. import studentResetView from "./modals/student-reset-view";
  587. import qs from "qs";
  588. import { permission } from "@/utils/directivePage";
  589. import { getCourseType } from "@/utils/utils";
  590. const formatClassGroupTeacherMapperList = (core, ass) => {
  591. const list = [];
  592. if (core) {
  593. list.push({ userId: core, teacherRole: "BISHOP" });
  594. }
  595. if (ass) {
  596. for (const item of ass) {
  597. list.push({ userId: item, teacherRole: "TEACHING" });
  598. }
  599. }
  600. return list;
  601. };
  602. export default {
  603. props: ["musicGroupInfo"],
  604. name: "tresetClass",
  605. components: {
  606. viewStudentList,
  607. selectStudent,
  608. classroomSetting,
  609. studentResetView,
  610. changeTeacher,
  611. },
  612. data() {
  613. return {
  614. teacherVisible: false,
  615. musicGroupInfos: this.musicGroupInfo,
  616. classType: 0,
  617. pickerOptions: {
  618. firstDayOfWeek: 1,
  619. disabledDate(time) {
  620. return time.getTime() + 86400000 <= new Date().getTime();
  621. },
  622. },
  623. step: "00:05",
  624. teamid: "",
  625. topForm: {
  626. classType: "",
  627. },
  628. studentSubmitedData: null,
  629. infoDetail: null,
  630. classTimeList,
  631. tableList: [],
  632. maxClassList: [],
  633. activeSingleList: [],
  634. studentListModal: [],
  635. studentListModalVisible: false,
  636. resetCourseVisible: false, // 重新排课弹窗
  637. resetClassVisible: false, // 班级调整弹窗
  638. studentVisible: false,
  639. MixVisible: false, // 新增合奏班弹窗
  640. activeListStudent: [], // 当前选中的学生列表
  641. activeChioseSound: "", //选择的声部
  642. chioseSoundList: [], //当前的所有声部
  643. studentList: [], //列表里的学生集合
  644. activeMixClass: "", // 选中的合奏班
  645. chioseStudent: [], // 勾选的学生信息
  646. isNewClass: false, // 是否为新建班级
  647. isOnlyChangeUser: false,
  648. isSearch: false, // 是否需要搜索
  649. isTemporary: false, // 是否为临时班级
  650. className: "", // 班级名称
  651. activeClass: "", // 当前操作的班级
  652. soundList: [],
  653. infoVisible: false, // 判断是否需要显示老师设置
  654. teacherForm: {
  655. isAdd: null,
  656. coreTeacher: "",
  657. assistant: [],
  658. courseType: "",
  659. courseTime: "",
  660. checked: true,
  661. courseNum: "",
  662. mixClassGroupId: "",
  663. sound: "",
  664. expectStudentNum: "",
  665. },
  666. teacherRules: {
  667. isAdd: [{ required: true, message: "请选择调整类型" }],
  668. coreTeacher: [{ required: true, message: "请选择主教老师" }],
  669. courseType: [{ required: true, message: "请选择上课类型" }],
  670. courseTime: [{ required: true, message: "请选择开始时间" }],
  671. courseNum: [{ required: true, message: "请输入排课次数" }],
  672. mixClassGroupId: [{ required: true, message: "请选择合奏班" }],
  673. sound: [{ required: true, message: "请选择合声部" }],
  674. expectStudentNum: [{ required: true, message: "请填写预计招生人数" }],
  675. },
  676. weekList: [],
  677. teacherList: [], // 存储的老师列表
  678. courseTypeList: [],
  679. weekDateList: [
  680. { value: "1", label: "星期一" },
  681. { value: "2", label: "星期二" },
  682. { value: "3", label: "星期三" },
  683. { value: "4", label: "星期四" },
  684. { value: "5", label: "星期五" },
  685. { value: "6", label: "星期六" },
  686. { value: "7", label: "星期日" },
  687. ],
  688. // 班级类型
  689. classTypeList: [
  690. { value: "NORMAL", label: "声部班" },
  691. { value: "MIX", label: "合奏班" },
  692. { value: "HIGH", label: "基础技能班" },
  693. { value: "SNAP", label: "临时班" },
  694. { value: "HIGH_ONLINE", label: "线上基础技能班" },
  695. { value: "MUSIC_NETWORK", label: "乐团网管课" },
  696. ],
  697. musicClassTypeList,
  698. // 基础技能班类型
  699. highTypeList: [
  700. { value: "HIGH", label: "基础技能班" },
  701. { value: "HIGH_ONLINE", label: "线上基础技能班" },
  702. ],
  703. cooperationList: [],
  704. singleList: [],
  705. activeSingleLists: [],
  706. activeType: "",
  707. resetClassForm: {
  708. // 班级调整form对象
  709. startTime: "",
  710. endTime: "",
  711. assistant: [],
  712. coreTeacher: "",
  713. },
  714. recourseForm: {
  715. courseType: "",
  716. checked: false,
  717. courseTime: "",
  718. courseNum: "",
  719. },
  720. teacherDetail: null,
  721. organId: "",
  722. newClassVisible: false,
  723. newClassForm: {
  724. className: null,
  725. type: null,
  726. subjectIdList: [],
  727. expectStudentNum: null,
  728. bishop: null,
  729. teaching: [],
  730. memo: [],
  731. subjectId: null,
  732. },
  733. classGroupIds: null,
  734. maxMun: 16,
  735. courseTime: "",
  736. studentResetVisiable: false,
  737. courseTypesByType: null,
  738. mergeList: [],
  739. activeSoundList: [],
  740. appoint: false,
  741. };
  742. },
  743. created() {
  744. this.init();
  745. },
  746. // activated() {
  747. // this.init();
  748. // },
  749. mounted() {},
  750. methods: {
  751. permission(val) {
  752. return permission(val);
  753. },
  754. async init() {
  755. this.teamid = this.$route.query.id;
  756. if (this.musicGroupInfo) {
  757. this.organId = this.musicGroupInfos.organId;
  758. this.chargeTypeId = this.musicGroupInfos.chargeTypeId;
  759. } else {
  760. getTeamBaseInfo({ musicGroupId: this.teamid }).then((res) => {
  761. if (res.code == 200) {
  762. this.musicGroupInfos = res.data.musicGroup;
  763. this.organId = this.musicGroupInfos.organId;
  764. this.chargeTypeId = this.musicGroupInfos.chargeTypeId;
  765. }
  766. });
  767. }
  768. this.$nextTick(async (res) => {
  769. try {
  770. if (this.organId && this.chargeTypeId) {
  771. const res = await getOrganizationCourseUnitPriceSettings({
  772. chargeTypeId: this.chargeTypeId,
  773. organId: this.organId,
  774. rows: 9999,
  775. });
  776. const d = {};
  777. this.courseTypes = res.data.rows;
  778. for (const item of this.courseTypes) {
  779. d[item.courseType] = item;
  780. }
  781. this.courseTypesByType = d;
  782. console.log(this.courseTypesByType);
  783. }
  784. } catch (error) {}
  785. // 根据乐团id获取乐团所属分部
  786. getTeacher({ organId: this.organId }).then((res) => {
  787. if (res.code == 200) {
  788. this.cooperationList = res.data;
  789. this.teacherList = res.data;
  790. }
  791. });
  792. getAllClass({ musicGroupId: this.teamid }).then((res) => {
  793. if (res.code == 200) {
  794. this.maxClassList = res.data;
  795. }
  796. });
  797. // 获取默认乐团内的所有班
  798. this.changeMixClass();
  799. // 根据乐团id获取乐团的所有声部
  800. findSound({ musicGroupId: this.teamid }).then((res) => {
  801. if (res.code == 200) {
  802. this.soundList = res.data;
  803. }
  804. });
  805. });
  806. // 根据分部id和缴费类型获取 可选课程类型
  807. },
  808. resetTeacher(row) {
  809. this.teacherVisible = true
  810. this.teacherDetail = row
  811. },
  812. teacherSubmited(data) {
  813. const obj = this.getSubmitData(data, {classGroupId: this.teacherDetail?.id, courseAddType: 'onlyUpdateTeacher'})
  814. classGroupUpdate(obj).then((res) => {
  815. if (res.code == 200) {
  816. this.$message.success("修改成功");
  817. this.teacherVisible = false;
  818. this.getList();
  819. }
  820. });
  821. },
  822. getSubmitData(data, more = {}) {
  823. return [{
  824. type: this.activeType,
  825. classGroupName: data?.name,
  826. musicGroupId: this.teamid,
  827. classGroupTeacherMapperList: formatClassGroupTeacherMapperList(
  828. data.coreTeacher,
  829. data.assistant
  830. ),
  831. students: data?.seleched,
  832. ...more
  833. }]
  834. },
  835. async submitClass(data) {
  836. const list = this.getSubmitData(data, {onlyCreateClassGroup: true});
  837. try {
  838. if (this.classType == 1) {
  839. // 0新建班级 2 3 4新增班级修改
  840. await revisionClassGroup(list);
  841. this.$message.success("提交成功");
  842. } else if (
  843. this.classType == 2 ||
  844. this.classType == 3 ||
  845. this.classType == 4
  846. ) {
  847. await revisionAddClassGroup(list);
  848. this.$message.success("提交成功");
  849. }
  850. this.studentVisible = false
  851. this.getList()
  852. } catch (error) {
  853. console.log(error);
  854. }
  855. },
  856. studentSubmited(data) {
  857. if (!this.isOnlyChangeUser) {
  858. this.submitClass(data)
  859. // this.studentSubmitedData = data;
  860. // this.infoVisible = true;
  861. } else {
  862. this.getList();
  863. }
  864. },
  865. recourse(row) {
  866. (this.weekList = [
  867. {
  868. week: "",
  869. startTime: "",
  870. endTime: "",
  871. id: new Date(),
  872. },
  873. ]),
  874. (this.resetCourseVisible = true);
  875. },
  876. addMix() {
  877. this.MixVisible = true;
  878. },
  879. changeActiveChioseSound(val) {
  880. this.activeChioseSound = val;
  881. },
  882. setAssistant(val) {
  883. for (let i in val) {
  884. if (val[i] == this.teacherForm.coreTeacher) {
  885. val.splice(i, 1);
  886. }
  887. }
  888. },
  889. changeMixClass(val) {
  890. // 根据合奏班id获取合奏班下的所有声部班
  891. this.getList(val);
  892. this.activeMixClass = val;
  893. },
  894. getList(val) {
  895. getAllSignClassandTeacher({ musicGroupId: this.teamid, type: val }).then(
  896. (res) => {
  897. if (res.code == 200) {
  898. this.activeSingleList = res.data;
  899. if (res.data?.length > 0) {
  900. this.mergeList = res.data.filter((item) => {
  901. return item.type != "MUSIC_NETWORK";
  902. });
  903. }
  904. // this.topForm.count = this.activeSingleList.length
  905. }
  906. }
  907. );
  908. },
  909. // 临时调整
  910. temporary() {
  911. this.classType = 1;
  912. this.activeClass = "";
  913. this.activeListStudent = [];
  914. this.studentList = [];
  915. this.isNewClass = true;
  916. this.studentVisible = true;
  917. this.isOnlyChangeUser = false;
  918. this.isSearch = true;
  919. this.className = "";
  920. this.isTemporary = true;
  921. this.activeType = "SPAN";
  922. this.activeChioseSound = null;
  923. this.setType("SNAP");
  924. this.getNoClassStudent("SNAP");
  925. },
  926. setType(type) {
  927. this.courseTypeList = getCourseType(type);
  928. this.activeSoundList = this.soundList;
  929. },
  930. // 新增班级
  931. addNewClass(type) {
  932. const types = {
  933. NORMAL: 2,
  934. MUSIC_NETWORK: 4,
  935. };
  936. this.isOnlyChangeUser = false;
  937. this.classType = types[type] || 3;
  938. this.setType(type);
  939. this.activeType = type;
  940. this.activeClass = "";
  941. this.activeListStudent = [];
  942. this.studentList = [];
  943. this.isNewClass = true;
  944. this.studentVisible = true;
  945. this.isSearch = false;
  946. this.className = "";
  947. this.isTemporary = false;
  948. this.activeChioseSound = null;
  949. this.getNoClassStudent(type);
  950. },
  951. searchStudent(classGroupId) {
  952. console.log(this.activeChioseSound);
  953. // 搜索学生
  954. // 根据声部id 乐团id搜索学生
  955. if (this.activeType == "SPAN") {
  956. teamSoundStudent({
  957. musicGroupId: this.teamid,
  958. actualSubjectId: this.activeChioseSound,
  959. }).then((res) => {
  960. if (res.code == 200) {
  961. this.studentList = res.data;
  962. }
  963. });
  964. } else {
  965. this.getNoClassStudent(
  966. this.activeType,
  967. this.activeChioseSound,
  968. classGroupId
  969. );
  970. }
  971. },
  972. // 选择学生的方法修改
  973. SelectionStudent(val) {
  974. this.chioseStudent = val;
  975. },
  976. // 新增选中的学生
  977. NewselectionStudent(val) {
  978. this.chioseStudent = val;
  979. // 这里新增的添加到选中的学生列表 根据学生id去重
  980. if (this.chioseStudent.length > 0) {
  981. this.chioseStudent = this.chioseStudent.concat(val);
  982. } else {
  983. this.chioseStudent = val;
  984. }
  985. // 联动版
  986. // this.activeListStudent = this.objArrayRemoval(this.chioseStudent, 'userId')
  987. // 非联动多选版
  988. this.activeListStudent = this.activeListStudent.concat(
  989. this.chioseStudent
  990. );
  991. // // 去重
  992. this.activeListStudent = this.objArrayRemoval(
  993. this.activeListStudent,
  994. "userId"
  995. );
  996. // 将其填入选中的学生
  997. },
  998. clearCourse(scope) {
  999. clearClassCourse({ classGroupId: scope.row.id })
  1000. .then((res) => {
  1001. if (res.code == 200) {
  1002. this.$message.success("清除成功");
  1003. scope._self.$refs[scope.$index].doClose();
  1004. // 重新请求列表
  1005. this.getList(this.activeMixClass);
  1006. } else {
  1007. this.$message.error(res.msg);
  1008. scope._self.$refs[scope.$index].doClose();
  1009. }
  1010. })
  1011. .catch((res) => {
  1012. scope._self.$refs[scope.$index].doClose();
  1013. });
  1014. // 清空课表
  1015. },
  1016. // 删除班级
  1017. removeClass(scope) {
  1018. removeSingleClass({ classGroupId: scope.row.id })
  1019. .then((res) => {
  1020. if (res.code == 200) {
  1021. scope._self.$refs[`popover-${scope.$index}`].doClose();
  1022. this.$message.success("删除成功");
  1023. // 重新请求列表
  1024. this.getList(this.activeMixClass);
  1025. } else {
  1026. this.$message.error(res.msg);
  1027. scope._self.$refs[`popover-${scope.$index}`].doClose();
  1028. }
  1029. })
  1030. .catch((res) => {
  1031. scope._self.$refs[`popover-${scope.$index}`].doClose();
  1032. });
  1033. },
  1034. // 修改班级
  1035. resetClass(row) {
  1036. this.isOnlyChangeUser = true;
  1037. this.isNewClass = false;
  1038. this.className = row.name;
  1039. this.studentVisible = true;
  1040. this.activeClass = row.id;
  1041. this.isSearch = false;
  1042. this.activeType = row.type;
  1043. this.activeChioseSound = null;
  1044. // 根据单机班id 查询声部班内的所有学生
  1045. getClassAllStudent({ classGroupId: row.id }).then((res) => {
  1046. if (res.code == 200) {
  1047. this.activeListStudent = res.data.map((item) => {
  1048. item.isVisible = false;
  1049. return item;
  1050. });
  1051. }
  1052. });
  1053. this.activeSoundList = this.soundList;
  1054. this.getNoClassStudent(row.type); // 基础技能班能获取所有
  1055. // if (this.activeType == "HIGH" || this.activeType == "HIGH_ONLINE") {
  1056. // this.getNoClassStudent(row.type, row.memo);
  1057. // let arr = row.memo.split(",");
  1058. // console.log(arr);
  1059. // this.activeSoundList = this.soundList.filter((sound) => {
  1060. // return arr.indexOf(sound.id + "") != -1;
  1061. // });
  1062. // } else {
  1063. // this.activeSoundList = this.soundList;
  1064. // this.getNoClassStudent(row.type);
  1065. // console.log(this.activeSoundList);
  1066. // }
  1067. },
  1068. // 班级调整
  1069. classAdjustment(row) {
  1070. this.infoDetail = row;
  1071. this.activeType = row.type;
  1072. this.activeClass = row.id;
  1073. // this.activeListStudent = row.subjectIdList.split(',')
  1074. this.setType(row.type);
  1075. // activeListStudent
  1076. this.isNewClass = false;
  1077. this.teacherForm.assistant = [];
  1078. for (let i in row.classGroupTeacherMapperList) {
  1079. if (row.classGroupTeacherMapperList[i].teacherRole == "BISHOP") {
  1080. this.teacherForm.coreTeacher =
  1081. row.classGroupTeacherMapperList[i].userId;
  1082. }
  1083. if (row.classGroupTeacherMapperList[i].teacherRole == "TEACHING") {
  1084. this.teacherForm.assistant.push(
  1085. row.classGroupTeacherMapperList[i].userId
  1086. );
  1087. }
  1088. }
  1089. this.infoVisible = true;
  1090. },
  1091. async getNoClassStudent(type, actualSubjectId, classGroupId) {
  1092. const params = {
  1093. musicGroupId: this.teamid,
  1094. type,
  1095. actualSubjectId,
  1096. classGroupId,
  1097. };
  1098. await getMusicGroupStuNoClassType(params).then((res) => {
  1099. if (res.code == 200) {
  1100. this.studentList = res.data;
  1101. // }
  1102. }
  1103. });
  1104. },
  1105. // 删除学生 调整
  1106. removeStudent(item) {
  1107. // 这里做判断如果是线上基础技能班 学生人数不能少于3人
  1108. if (
  1109. this.activeType == "HIGH_ONLINE" &&
  1110. this.activeListStudent.length <= 3
  1111. ) {
  1112. this.$message.error("线上基础技能课不能小于3人");
  1113. return;
  1114. }
  1115. removeStudents({
  1116. classGroupId: this.activeClass,
  1117. userId: item.userId,
  1118. }).then((res) => {
  1119. if (res.code == 200) {
  1120. this.$message.success("删除成功");
  1121. item.isVisible = false;
  1122. // 这里刷新 this.studentList this.activeListStudent
  1123. this.getList(this.activeMixClass);
  1124. getClassAllStudent({ classGroupId: this.activeClass }).then((res) => {
  1125. if (res.code == 200) {
  1126. this.activeListStudent = res.data;
  1127. }
  1128. });
  1129. this.getNoClassStudent(this.activeType, null, this.activeClass);
  1130. // getNoClassStudentAll({ musicGroupId: this.teamid }).then(res => {
  1131. // if (res.code == 200) {
  1132. // this.$message.success('删除成功');
  1133. // this.studentList = res.data.map(item => {
  1134. // item.isVisible = false;
  1135. // return item;
  1136. // });
  1137. // }
  1138. // })
  1139. }
  1140. });
  1141. },
  1142. // 批量添加学生
  1143. addSomeStudent() {
  1144. // 获取勾选的学生
  1145. let arr = this.chioseStudent.map((item) => {
  1146. return item.userId;
  1147. });
  1148. if (arr.length <= 0) {
  1149. if (this.isNewClass) {
  1150. this.$message.error("至少添加一名学员");
  1151. return;
  1152. } else {
  1153. this.studentVisible = false;
  1154. return;
  1155. }
  1156. }
  1157. if (this.activeType == "HIGH_ONLINE") {
  1158. superFindClassGroups({ classGroupId: this.activeClass }).then((res) => {
  1159. if (res.code == 200) {
  1160. if (
  1161. this.activeListStudent.length + this.chioseStudent.length > 6 ||
  1162. this.activeListStudent.length + this.chioseStudent.length < 3
  1163. ) {
  1164. this.$message.error("线上技能班必须为3-6人");
  1165. return;
  1166. } else {
  1167. addStudents({
  1168. classGroupId: this.activeClass,
  1169. userIdsStr: arr.join(","),
  1170. }).then((res) => {
  1171. if (res.code == 200) {
  1172. this.studentVisible = false;
  1173. this.$message.success("添加成功");
  1174. this.getList();
  1175. return;
  1176. }
  1177. });
  1178. }
  1179. }
  1180. });
  1181. } else {
  1182. addStudents({
  1183. classGroupId: this.activeClass,
  1184. userIdsStr: arr.join(","),
  1185. }).then((res) => {
  1186. if (res.code == 200) {
  1187. this.studentVisible = false;
  1188. this.$message.success("添加成功");
  1189. this.getList();
  1190. }
  1191. });
  1192. }
  1193. },
  1194. SelectionMix(val) {
  1195. this.activeSingleLists = val;
  1196. },
  1197. removeSiginforMix(item) {
  1198. for (let k in this.activeSingleLists) {
  1199. if (this.activeSingleLists[k].id == item.id) {
  1200. this.$refs["mixList"].toggleRowSelection(item, false);
  1201. }
  1202. }
  1203. },
  1204. temporaryRemoveStudent(item) {
  1205. // 列表中删除
  1206. for (let i in this.activeListStudent) {
  1207. if (this.activeListStudent[i].userId == item.userId) {
  1208. this.activeListStudent.splice(i, 1);
  1209. }
  1210. }
  1211. // 查询列表中的项 取消勾选 temporaryStudentList toggleRowSelection
  1212. // 循环列表 找到相应的行取消勾选
  1213. for (let k in this.studentList) {
  1214. if (this.studentList[k].userId == item.userId) {
  1215. this.$refs["temporaryStudentList"].toggleRowSelection(item, false);
  1216. }
  1217. }
  1218. // this.$refs['temporaryStudentList'].toggleRowSelection(row, selected);
  1219. },
  1220. // 对象数组去重
  1221. objArrayRemoval(arr, attr) {
  1222. let obj = {};
  1223. let result = [];
  1224. for (let x in arr) {
  1225. if (!obj[arr[x][attr]]) {
  1226. result.push(arr[x]);
  1227. obj[arr[x][attr]] = true;
  1228. }
  1229. }
  1230. return result;
  1231. },
  1232. setInfoMsg() {
  1233. // 判断班级名称是否输入
  1234. if (!this.className) {
  1235. this.$message.error("请输入班级名称");
  1236. return;
  1237. }
  1238. // 判断有没有勾选学生
  1239. if (this.activeListStudent.length <= 0) {
  1240. // 没有勾学生
  1241. this.$message.error("班级里至少要有一名学生");
  1242. return;
  1243. }
  1244. if (this.activeType == "HIGH_ONLINE") {
  1245. if (
  1246. this.activeListStudent.length > 6 ||
  1247. this.activeListStudent.length < 3
  1248. ) {
  1249. this.$message.error("线上技能班必须为3-6人");
  1250. return;
  1251. }
  1252. this.teacherForm.expectStudentNum = this.activeListStudent.length;
  1253. }
  1254. this.infoVisible = true;
  1255. },
  1256. addWeek() {
  1257. // 添加循环周期
  1258. this.weekList.push({
  1259. dayOfWeek: "",
  1260. startClassTime: "",
  1261. endClassTime: "",
  1262. time: this.courseTime,
  1263. id: new Date().getTime(),
  1264. });
  1265. },
  1266. // 删除循环周
  1267. removeWeek(item) {
  1268. for (let i in this.weekList) {
  1269. if (this.weekList[i].id == item.id) {
  1270. this.weekList.splice(i, 1);
  1271. }
  1272. }
  1273. },
  1274. // 提交临时班的信息
  1275. submitTemporary(type) {
  1276. // 参数是一样 type为1 新增临时班
  1277. // type为2 新增声部班
  1278. // type为3 修改班级信息
  1279. if (type == 1) {
  1280. this.isTemporary = true;
  1281. } else {
  1282. this.isTemporary = false;
  1283. }
  1284. this.$refs["teacherForm"].validate((item) => {
  1285. if (item) {
  1286. let week = this.weekList;
  1287. if (this.teacherForm.isAdd != "onlyUpdateTeacher") {
  1288. if (
  1289. !week[0] ||
  1290. !week[0].startClassTime ||
  1291. !week[0].endClassTime ||
  1292. !week[0].dayOfWeek
  1293. ) {
  1294. this.$message.error("至少排一节课");
  1295. return;
  1296. }
  1297. }
  1298. // 这里代表排课成功 发请求 新增临时班
  1299. let classGroupName = this.className;
  1300. let classGroupTeacherMapperList = [
  1301. { userId: this.teacherForm.coreTeacher, teacherRole: "BISHOP" },
  1302. ];
  1303. for (let i in this.teacherForm.assistant) {
  1304. classGroupTeacherMapperList.push({
  1305. userId: this.teacherForm.assistant[i],
  1306. teacherRole: "TEACHING",
  1307. });
  1308. }
  1309. // let mixClassGroupId = this.teacherForm.mixClassGroupId;
  1310. let musicGroupId = this.teamid;
  1311. let startDate = this.teacherForm.courseTime;
  1312. let courseType = this.teacherForm.courseType;
  1313. let courseTimes = this.teacherForm.courseNum;
  1314. if (
  1315. courseTimes <= 0 &&
  1316. this.teacherForm.isAdd != "onlyUpdateTeacher"
  1317. ) {
  1318. this.$message.error("请至少排一节课");
  1319. return;
  1320. } else if (courseTimes > this.maxMun) {
  1321. this.$message.error(`一次最多排${this.maxMun}节课`);
  1322. return;
  1323. }
  1324. let students = this.activeListStudent.map((item) => {
  1325. return item.userId;
  1326. });
  1327. let holiday = this.teacherForm.checked;
  1328. let courseList = [];
  1329. for (let i in this.weekList) {
  1330. courseList.push(this.weekList[i]);
  1331. }
  1332. if (
  1333. courseList.length <= 0 &&
  1334. this.teacherForm.isAdd != "onlyUpdateTeacher"
  1335. ) {
  1336. this.$message.error("新增班级至少排一节课");
  1337. return;
  1338. }
  1339. if (this.teacherForm.isAdd == "onlyUpdateTeacher") {
  1340. startDate = null;
  1341. courseType = null;
  1342. students = null;
  1343. holiday = null;
  1344. courseTimes = null;
  1345. (courseList = null), (mineType = null);
  1346. }
  1347. // mixClassGroupId,
  1348. let mineType = this.activeType;
  1349. let obj = {
  1350. classGroupName,
  1351. classGroupTeacherMapperList,
  1352. musicGroupId,
  1353. startDate,
  1354. courseType,
  1355. students,
  1356. holiday,
  1357. courseTimes,
  1358. courseTimeDtoList: courseList,
  1359. type: mineType,
  1360. courseAddType: this.teacherForm.isAdd,
  1361. };
  1362. if (type == 1) {
  1363. // 新增临时班级
  1364. revisionClassGroup(obj).then((res) => {
  1365. if (res.code == 200) {
  1366. // 提示修改成功
  1367. this.$message.success("修改成功");
  1368. this.infoVisible = false;
  1369. this.studentVisible = false;
  1370. this.getList();
  1371. }
  1372. });
  1373. } else if (type == 2) {
  1374. (obj.subjectId = this.teacherForm.sound),
  1375. (obj.expectStudentNum = this.teacherForm.expectStudentNum);
  1376. // 新增声部班
  1377. revisionAddClassGroup(obj).then((res) => {
  1378. if (res.code == 200) {
  1379. // 修改成功
  1380. this.$message.success("修改成功");
  1381. this.infoVisible = false;
  1382. this.studentVisible = false;
  1383. this.getList();
  1384. }
  1385. });
  1386. } else if (type == 3) {
  1387. // 乐团修改
  1388. obj.classGroupId = this.activeClass;
  1389. classGroupUpdate(obj).then((res) => {
  1390. if (res.code == 200) {
  1391. this.$message.success("修改成功");
  1392. this.infoVisible = false;
  1393. this.getList();
  1394. }
  1395. });
  1396. }
  1397. } else {
  1398. this.$message.error("请填写必要信息");
  1399. return;
  1400. }
  1401. });
  1402. },
  1403. // 新建基础技能班
  1404. newClassHight() {
  1405. this.$refs["newClassForm"].validate((res) => {
  1406. if (res) {
  1407. let obj = {};
  1408. obj.musicGroupId = this.teamid;
  1409. obj.name = this.newClassForm.className;
  1410. obj.type = this.newClassForm.type;
  1411. obj.groupType = "MUSIC";
  1412. obj.expectStudentNum = this.newClassForm.expectStudentNum;
  1413. obj.teacherMapperList = [];
  1414. obj.teacherMapperList.push({
  1415. userId: this.newClassForm.bishop,
  1416. teacherRole: "BISHOP",
  1417. });
  1418. let subjectIdList;
  1419. if (this.newClassForm.type == "HIGH_ONLINE") {
  1420. subjectIdList = this.newClassForm.subjectId;
  1421. if (this.newClassForm.memo.length > 0) {
  1422. obj.memo = this.newClassForm.memo.join(",");
  1423. }
  1424. } else {
  1425. subjectIdList =
  1426. this.newClassForm.memo.length > 0
  1427. ? this.newClassForm.memo.join(",")
  1428. : null;
  1429. for (let i in this.newClassForm.teaching) {
  1430. obj.teacherMapperList.push({
  1431. userId: this.newClassForm.teaching[i],
  1432. teacherRole: "TEACHING",
  1433. });
  1434. }
  1435. obj.memo = subjectIdList;
  1436. }
  1437. obj.subjectIdList = subjectIdList;
  1438. createClass(obj).then((res) => {
  1439. if (res.code == 200) {
  1440. this.$message.success("创建成功");
  1441. this.getList();
  1442. this.resetClassFrom();
  1443. this.newClassVisible = false;
  1444. }
  1445. });
  1446. }
  1447. });
  1448. },
  1449. resetClassFrom() {
  1450. this.newClassForm = {
  1451. className: null,
  1452. type: null,
  1453. subjectIdList: [],
  1454. subjectId: "",
  1455. expectStudentNum: null,
  1456. bishop: null,
  1457. teaching: [],
  1458. memo: [],
  1459. };
  1460. this.changeMemo([]);
  1461. },
  1462. setAssistant1(val) {
  1463. if (val) {
  1464. for (let i in val) {
  1465. if (val[i] == this.newClassForm.bishop) {
  1466. val.splice(i, 1);
  1467. }
  1468. }
  1469. }
  1470. },
  1471. handleSelectionChange(val) {
  1472. if (val.length > 0) {
  1473. this.classGroupIds = val
  1474. .map((item) => {
  1475. return item.id;
  1476. })
  1477. .join(",");
  1478. } else {
  1479. this.classGroupIds = null;
  1480. }
  1481. },
  1482. chkstu(row, index) {
  1483. return (
  1484. (row.type == "HIGH_ONLINE" && row.totalClassTimes <= 0) ||
  1485. (row.type == "HIGH" && row.totalClassTimes <= 0)
  1486. );
  1487. },
  1488. startRegest() {
  1489. if (!this.classGroupIds) {
  1490. this.$message.error("请至少选择1个基础技能班");
  1491. return;
  1492. }
  1493. this.$confirm("是否开启报名?", "提示", {
  1494. confirmButtonText: "确定",
  1495. cancelButtonText: "取消",
  1496. type: "warning",
  1497. })
  1498. .then(() => {
  1499. pushMessage({
  1500. classGroupIds: this.classGroupIds,
  1501. musicGroupId: this.teamid,
  1502. }).then((res) => {
  1503. if (res.code == 200) {
  1504. this.$message.success(`开启成功,已推送${res.data}名学生`);
  1505. this.getList();
  1506. }
  1507. });
  1508. })
  1509. .catch(() => {});
  1510. },
  1511. toggleSelection(rows) {
  1512. if (rows) {
  1513. rows.forEach((row) => {
  1514. this.$refs.multipleTable.toggleRowSelection(row);
  1515. });
  1516. } else {
  1517. this.$refs.multipleTable.clearSelection();
  1518. }
  1519. },
  1520. chioseHightype(val) {
  1521. this.changeMemo([]);
  1522. if (val == "HIGH_ONLINE") {
  1523. this.newClassForm.teaching = [];
  1524. }
  1525. this.newClassForm.subjectId = "";
  1526. this.$set(this.newClassForm, "subjectIdList", []);
  1527. this.$set(this.newClassForm, "memo", []);
  1528. },
  1529. changeStartClassTime(item) {
  1530. // item.endClassTime = ''
  1531. this.$set(item, "endClassTime", "");
  1532. },
  1533. changeEndClassTime(item, val) {
  1534. this.$set(item, "endClassTime", val);
  1535. },
  1536. changeCourseType(val) {
  1537. console.log(val);
  1538. if (val) {
  1539. this.classTimeList.forEach((item) => {
  1540. if (item.value == val) {
  1541. this.courseTime = item.label;
  1542. }
  1543. });
  1544. // courseTime
  1545. this.weekList = [
  1546. {
  1547. week: "",
  1548. startTime: "",
  1549. endTime: "",
  1550. time: this.courseTime,
  1551. id: new Date().getTime(),
  1552. },
  1553. ];
  1554. } else {
  1555. this.courseTime = null;
  1556. this.weekList = [];
  1557. }
  1558. // if (val === 'HIGH_ONLINE' || val === 'HIGH' || val === 'MUSIC_NETWORK') {
  1559. // this.step = '00:05'
  1560. // } else {
  1561. // this.step = '00:15'
  1562. // }
  1563. },
  1564. changeStartTimes(val, item) {
  1565. if (val && item.time) {
  1566. let str = dayjs(new Date()).format("YYYY-MM-DD");
  1567. this.$set(
  1568. item,
  1569. "endClassTime",
  1570. addTimerFormMinute(str, val, item.time)
  1571. );
  1572. } else {
  1573. this.$set(item, "endClassTime", "");
  1574. this.$message.error("请先设置课程时间");
  1575. }
  1576. if (!item.endClassTime) {
  1577. this.$set(item, "startClassTime", "");
  1578. }
  1579. },
  1580. setItem(item, index) {
  1581. // console.log(item, index)
  1582. this.weekList[index].startClassTime = "";
  1583. this.weekList[index].endClassTime = "";
  1584. console.log();
  1585. },
  1586. closeStudentReset() {
  1587. this.studentResetVisiable = false;
  1588. },
  1589. changeMemo(val) {
  1590. // 声部id
  1591. // let flag = false;
  1592. // if (val.length < 1) {
  1593. // this.soundList.forEach((sound) => {
  1594. // sound.disabled = false;
  1595. // this.appoint = false;
  1596. // });
  1597. // } else {
  1598. // this.soundList.forEach((sound) => {
  1599. // if (sound.id == val[0]) {
  1600. // if (
  1601. // sound.name.indexOf("上低音号") > -1 ||
  1602. // sound.name.indexOf("长号") > -1
  1603. // ) {
  1604. // // 要么选中长号 要么选中上低音号
  1605. // sound.disabled = false;
  1606. // flag = true;
  1607. // } else {
  1608. // sound.disabled = true;
  1609. // this.appoint = true;
  1610. // }
  1611. // }
  1612. // });
  1613. // if (flag) {
  1614. // this.soundList.forEach((sound) => {
  1615. // if (
  1616. // sound.name.indexOf("上低音号") > -1 ||
  1617. // sound.name.indexOf("长号") > -1
  1618. // ) {
  1619. // // 要么选中长号 要么选中上低音号
  1620. // sound.disabled = false;
  1621. // } else {
  1622. // sound.disabled = true;
  1623. // }
  1624. // });
  1625. // }
  1626. // }
  1627. },
  1628. },
  1629. watch: {
  1630. "newClassForm.type"() {
  1631. if (this.newClassForm.type === "HIGH_ONLINE") {
  1632. this.$set(this.newClassForm, "expectStudentNum", 6);
  1633. }
  1634. },
  1635. infoVisible(val) {
  1636. if (!val) {
  1637. this.teacherForm = {
  1638. isAdd: null,
  1639. coreTeacher: "",
  1640. assistant: [],
  1641. courseType: "",
  1642. courseTime: "",
  1643. checked: true,
  1644. courseNum: "",
  1645. mixClassGroupId: "",
  1646. sound: "",
  1647. expectStudentNum: "",
  1648. };
  1649. this.infoDetail = null;
  1650. // this.$refs["teacherForm"].resetFields();
  1651. this.weekList = [];
  1652. }
  1653. },
  1654. newClassVisible(val) {
  1655. if (!val) {
  1656. this.newClassForm = {
  1657. className: null,
  1658. type: null,
  1659. subjectIdList: [],
  1660. expectStudentNum: null,
  1661. bishop: null,
  1662. teaching: null,
  1663. memo: [],
  1664. };
  1665. this.resetClassFrom();
  1666. }
  1667. },
  1668. },
  1669. };
  1670. </script>
  1671. <style lang="scss" scoped>
  1672. .topWrap {
  1673. display: flex;
  1674. flex-direction: row;
  1675. justify-content: space-between;
  1676. }
  1677. .floor {
  1678. padding-right: 20px;
  1679. display: flex;
  1680. flex-direction: row;
  1681. justify-content: space-between;
  1682. width: 100%;
  1683. height: 48px;
  1684. line-height: 48px;
  1685. background: rgba(237, 238, 240, 1);
  1686. font-size: 14px;
  1687. color: #444;
  1688. align-items: center;
  1689. position: relative;
  1690. z-index: 1;
  1691. .right {
  1692. display: flex;
  1693. flex-direction: row;
  1694. justify-content: flex-start;
  1695. .remove {
  1696. width: 98px;
  1697. height: 32px;
  1698. background: rgba(248, 80, 67, 1);
  1699. border-radius: 3px;
  1700. color: #fff;
  1701. line-height: 32px;
  1702. text-align: center;
  1703. margin-left: 164px;
  1704. cursor: pointer;
  1705. }
  1706. }
  1707. .add {
  1708. width: auto;
  1709. padding: 0 10px;
  1710. height: 32px;
  1711. background: rgba(20, 146, 138, 1);
  1712. border-radius: 3px;
  1713. color: #fff;
  1714. line-height: 32px;
  1715. text-align: center;
  1716. margin-left: 20px;
  1717. cursor: pointer;
  1718. }
  1719. }
  1720. .studentMask {
  1721. display: flex;
  1722. flex-direction: row;
  1723. justify-content: flex-start;
  1724. .left {
  1725. width: 200px;
  1726. margin-right: 20px;
  1727. .wrap {
  1728. margin-bottom: 20px;
  1729. }
  1730. h4 {
  1731. font-size: 16px;
  1732. color: #444;
  1733. line-height: 38px;
  1734. }
  1735. .chioseStudentList {
  1736. height: 500px;
  1737. overflow-y: auto;
  1738. border: 1px solid #ccc;
  1739. .studentItem {
  1740. padding-left: 10px;
  1741. line-height: 25px;
  1742. }
  1743. }
  1744. }
  1745. .right {
  1746. width: calc(100% - 200px);
  1747. .tableList {
  1748. max-height: 500px;
  1749. overflow-y: auto;
  1750. }
  1751. }
  1752. }
  1753. .resetClassForm {
  1754. /deep/.el-date-editor.el-input,
  1755. /deep/.el-date-editor.el-input__inner {
  1756. width: 180px !important;
  1757. }
  1758. }
  1759. // /deep/.el-date-editor.el-input,
  1760. // /deep/.el-date-editor.el-input__inner {
  1761. // width: 100px !important;
  1762. // }
  1763. .higheSelect {
  1764. /deep/.el-input__inner {
  1765. height: 40px !important;
  1766. }
  1767. }
  1768. /deep/ .el-alert__content {
  1769. display: block;
  1770. width: 100%;
  1771. }
  1772. .alert-content {
  1773. display: flex;
  1774. justify-content: space-between;
  1775. > strong {
  1776. cursor: pointer;
  1777. }
  1778. }
  1779. </style>