setClassV2.vue 58 KB

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