setClassV2.vue 52 KB

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