setClassV2.vue 56 KB

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