resetClass.vue 56 KB

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