setClassV2.vue 61 KB

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