setClassV2.vue 55 KB

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