setClassV2.vue 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656
  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: "请输入排课次数", trigger: 'blur' }],
  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. maxMun: 16
  736. };
  737. },
  738. //生命周期 - 创建完成(可以访问当前this实例)
  739. created () { },
  740. //生命周期 - 挂载完成(可以访问DOM元素)
  741. mounted () {
  742. // 获取节假日
  743. this.init();
  744. },
  745. activated () {
  746. this.init();
  747. },
  748. methods: {
  749. init () {
  750. this.teamid = this.$route.query.id;
  751. getTeacher().then(res => {
  752. if (res.code == 200) {
  753. this.teacherList = res.data;
  754. this.cooperationList = res.data;
  755. }
  756. });
  757. // 获取声部
  758. findSound({ musicGroupId: this.teamid }).then(res => {
  759. if (res.code == 200) {
  760. this.soundList = res.data;
  761. }
  762. });
  763. this.getList();
  764. sysConfigList({ group: "holiday" }).then(res => {
  765. if (res.code == 200 && res.data.length > 0) {
  766. if (res.data[0].paranValue) {
  767. this.holidayList = JSON.parse(res.data[0].paranValue);
  768. }
  769. }
  770. });
  771. },
  772. getList () {
  773. this.teamid = this.$route.query.id;
  774. //
  775. getMusicGroupClass({
  776. groupType: "MUSIC",
  777. musicGroupId: this.teamid,
  778. type: this.searchForm.classType,
  779. page: this.rules.page,
  780. rows: this.rules.limit
  781. }).then(res => {
  782. if (res.code == 200) {
  783. this.tableList = res.data.rows;
  784. this.rules.total = res.data.total;
  785. }
  786. });
  787. },
  788. changeClassGetList (val) {
  789. this.getList();
  790. },
  791. newClass () {
  792. if (this.isSetSalary) {
  793. this.$message.error("课酬确认后无法编辑");
  794. return;
  795. }
  796. this.newClassVisible = true;
  797. },
  798. newClassSecond () {
  799. // 判断当前选择的课程类型
  800. // 单技 合奏等等
  801. this.$refs["newClassForm"].validate(res => {
  802. if (res) {
  803. this.isNewClass = true;
  804. let type = this.newClassForm.type;
  805. this.isSearch = true;
  806. this.getNoClassStudent(type, null);
  807. this.studentVisible = true;
  808. }
  809. });
  810. },
  811. newClassHight () {
  812. this.$refs["newClassForm"].validate(res => {
  813. if (res) {
  814. let obj = {};
  815. obj.musicGroupId = this.teamid;
  816. obj.name = this.newClassForm.className;
  817. obj.type = this.newClassForm.type;
  818. obj.groupType = "MUSIC";
  819. // if (this.newClassForm.memo.length > 0) {
  820. // obj.memo = this.newClassForm.memo.join(',')
  821. // } else {
  822. // obj.memo = null
  823. // }
  824. obj.expectStudentNum = this.newClassForm.expectStudentNum;
  825. obj.teacherMapperList = [];
  826. obj.teacherMapperList.push({
  827. userId: this.newClassForm.bishop,
  828. teacherRole: "BISHOP"
  829. });
  830. let subjectIdList;
  831. if (this.newClassForm.type == "HIGH_ONLINE") {
  832. subjectIdList = this.newClassForm.subjectId;
  833. if (this.newClassForm.memo.length > 0) {
  834. obj.memo = this.newClassForm.memo.join(",");
  835. }
  836. } else {
  837. subjectIdList =
  838. this.newClassForm.subjectIdList.length > 0
  839. ? this.newClassForm.subjectIdList.join(",")
  840. : null;
  841. for (let i in this.newClassForm.teaching) {
  842. obj.teacherMapperList.push({
  843. userId: this.newClassForm.teaching[i],
  844. teacherRole: "TEACHING"
  845. });
  846. }
  847. obj.memo = null;
  848. }
  849. obj.subjectIdList = subjectIdList;
  850. createClass(obj).then(res => {
  851. if (res.code == 200) {
  852. this.$message.success('创建成功');
  853. this.getList();
  854. this.newClassVisible = false;
  855. }
  856. });
  857. }
  858. });
  859. },
  860. removeStudent (item) {
  861. removeStudents({
  862. classGroupId: this.activeClass,
  863. userId: item.userId
  864. }).then(res => {
  865. if (res.code == 200) {
  866. this.$message.success("删除成功");
  867. item.isVisible = false;
  868. // 这里刷新 this.studentList this.activeListStudent
  869. this.getList(this.activeMixClass);
  870. getClassAllStudent({ classGroupId: this.activeClass }).then(res => {
  871. if (res.code == 200) {
  872. this.activeListStudent = res.data;
  873. }
  874. });
  875. this.getNoClassStudent(this.activeType);
  876. }
  877. });
  878. },
  879. addSomeStudent () {
  880. // 获取勾选的学生
  881. let arr = this.chioseStudent.map(item => {
  882. return item.userId;
  883. });
  884. if (arr.length <= 0) {
  885. this.$message.error("至少添加一名学员");
  886. return;
  887. }
  888. if (this.activeType == "HIGH_ONLINE") {
  889. superFindClassGroups({ classGroupId: this.activeClass }).then(res => {
  890. if (res.code == 200) {
  891. let maxNum = res.data.rows[0].expectStudentNum;
  892. if (arr.length + this.activeListStudent.length > maxNum) {
  893. this.$message.error("超过预计招生人数");
  894. return;
  895. } else {
  896. addStudents({
  897. classGroupId: this.activeClass,
  898. userIdsStr: arr.join(",")
  899. }).then(res => {
  900. if (res.code == 200) {
  901. this.studentVisible = false;
  902. this.$message.success("添加成功");
  903. this.getList();
  904. return;
  905. }
  906. });
  907. }
  908. }
  909. });
  910. } else {
  911. addStudents({
  912. classGroupId: this.activeClass,
  913. userIdsStr: arr.join(",")
  914. }).then(res => {
  915. if (res.code == 200) {
  916. this.studentVisible = false;
  917. this.$message.success("添加成功");
  918. this.getList();
  919. }
  920. });
  921. }
  922. // 在此处做拦截
  923. },
  924. temporaryRemoveStudent (item) {
  925. // console.log(item);
  926. // 列表中删除
  927. for (let i in this.activeListStudent) {
  928. if (this.activeListStudent[i].userId == item.userId) {
  929. this.activeListStudent.splice(i, 1);
  930. }
  931. }
  932. // 查询列表中的项 取消勾选 temporaryStudentList toggleRowSelection
  933. // 循环列表 找到相应的行取消勾选
  934. for (let k in this.studentList) {
  935. if (this.studentList[k].userId == item.userId) {
  936. this.$refs["temporaryStudentList"].toggleRowSelection(item, false);
  937. }
  938. }
  939. // this.$refs['temporaryStudentList'].toggleRowSelection(row, selected);
  940. },
  941. // 对象数组去重
  942. objArrayRemoval (arr, attr) {
  943. let obj = {};
  944. let result = [];
  945. for (let x in arr) {
  946. if (!obj[arr[x][attr]]) {
  947. result.push(arr[x]);
  948. obj[arr[x][attr]] = true;
  949. }
  950. }
  951. return result;
  952. },
  953. // 新增选中的学生
  954. NewselectionStudent (val) {
  955. this.chioseStudent = val;
  956. // 这里新增的添加到选中的学生列表 根据学生id去重
  957. if (this.chioseStudent.length > 0) {
  958. this.chioseStudent = this.chioseStudent.concat(val);
  959. } else {
  960. this.chioseStudent = val;
  961. }
  962. // 联动版
  963. // this.activeListStudent = this.objArrayRemoval(this.chioseStudent, 'userId')
  964. // 非联动多选版
  965. this.activeListStudent = this.activeListStudent.concat(
  966. this.chioseStudent
  967. );
  968. // // 去重
  969. this.activeListStudent = this.objArrayRemoval(
  970. this.activeListStudent,
  971. "userId"
  972. );
  973. // 将其填入选中的学生
  974. },
  975. // 获取乐团中没课的学生
  976. getNoClassStudent (type, sound) {
  977. if (!sound) {
  978. let sound = null;
  979. }
  980. getMusicGroupStuNoClassType({
  981. musicGroupId: this.teamid,
  982. type,
  983. actualSubjectId: sound
  984. }).then(res => {
  985. if (res.code == 200) {
  986. this.studentList = res.data;
  987. }
  988. });
  989. },
  990. // 根据声部id 获取学生
  991. searchStudent (val) {
  992. this.getNoClassStudent(this.newClassForm.type, val);
  993. },
  994. createMusiceClass () {
  995. // console.log(this.activeListStudent)
  996. let userIds = null;
  997. if (this.activeListStudent.length > 0) {
  998. userIds = this.activeListStudent
  999. .map(item => {
  1000. return item.userId;
  1001. })
  1002. .join(",");
  1003. }
  1004. // 创建班级
  1005. let obj = {};
  1006. obj.musicGroupId = this.teamid;
  1007. obj.name = this.newClassForm.className;
  1008. obj.type = this.newClassForm.type;
  1009. obj.groupType = "MUSIC";
  1010. obj.userIds = userIds;
  1011. obj.teacherMapperList = [];
  1012. obj.expectStudentNum = this.newClassForm.expectStudentNum;
  1013. let subjectIdList;
  1014. if (this.newClassForm.type == "HIGH_ONLINE") {
  1015. subjectIdList = this.newClassForm.subjectIdList;
  1016. } else if (this.newClassForm.type == "MIX") {
  1017. subjectIdList = null;
  1018. } else {
  1019. subjectIdList =
  1020. this.newClassForm.subjectIdList.length > 0
  1021. ? this.newClassForm.subjectIdList.join(",")
  1022. : null;
  1023. }
  1024. obj.subjectIdList = subjectIdList;
  1025. obj.teacherMapperList.push({
  1026. userId: this.newClassForm.bishop,
  1027. teacherRole: "BISHOP"
  1028. });
  1029. for (let i in this.newClassForm.teaching) {
  1030. obj.teacherMapperList.push({
  1031. userId: this.newClassForm.teaching[i],
  1032. teacherRole: "TEACHING"
  1033. });
  1034. }
  1035. createClass(obj).then(res => {
  1036. if (res.code == 200) {
  1037. this.$message.success("创建成功");
  1038. this.getList();
  1039. this.studentVisible = false;
  1040. this.newClassVisible = false;
  1041. }
  1042. });
  1043. },
  1044. classAdjustment (row) {
  1045. if (this.isSetSalary) {
  1046. this.$message.error("课酬确认后无法编辑");
  1047. return;
  1048. }
  1049. this.activeType = row.type;
  1050. this.activeClass = row.id;
  1051. // this.activeListStudent = row.subjectIdList.split(',')
  1052. this.setType(row.type);
  1053. // activeListStudent
  1054. this.isNewClass = false;
  1055. this.teacherForm.assistant = [];
  1056. for (let i in row.teacherMapperList) {
  1057. if (row.teacherMapperList[i].teacherRole == "BISHOP") {
  1058. this.teacherForm.coreTeacher =
  1059. row.teacherMapperList[i].userId;
  1060. }
  1061. if (row.teacherMapperList[i].teacherRole == "TEACHING") {
  1062. this.teacherForm.assistant.push(
  1063. row.teacherMapperList[i].userId
  1064. );
  1065. }
  1066. }
  1067. console.log(this.teacherForm)
  1068. this.infoVisible = true;
  1069. },
  1070. // 删除循环周
  1071. removeWeek (item) {
  1072. for (let i in this.weekList) {
  1073. if (this.weekList[i].id == item.id) {
  1074. this.weekList.splice(i, 1);
  1075. }
  1076. }
  1077. },
  1078. setType (type) {
  1079. switch (type) {
  1080. case "NORMAL": {
  1081. this.courseTypeList = [
  1082. { value: "SINGLE", label: "单技课" },
  1083. { value: "TRAINING_SINGLE", label: "集训单技课" },
  1084. { value: "COMPREHENSIVE", label: "综合课" },
  1085. { value: "CLASSROOM", label: "课堂课" }
  1086. ];
  1087. break;
  1088. }
  1089. case "MIX": {
  1090. this.courseTypeList = [
  1091. { value: "MIX", label: "合奏课" },
  1092. { value: "TRAINING_MIX", label: "集训合奏课" },
  1093. { value: "COMPREHENSIVE", label: "综合课" },
  1094. { value: "CLASSROOM", label: "课堂课" }
  1095. ];
  1096. break;
  1097. }
  1098. case "HIGH": {
  1099. this.courseTypeList = [{ value: "HIGH", label: "基础技能课" }];
  1100. break;
  1101. }
  1102. case "HIGH_ONLINE": {
  1103. this.courseTypeList = [
  1104. { value: "HIGH_ONLINE", label: "线上基础技能课" }
  1105. ];
  1106. break;
  1107. }
  1108. case "SNAP": {
  1109. this.courseTypeList = [
  1110. { value: "SINGLE", label: "单技课" },
  1111. { value: "MIX", label: "合奏课" },
  1112. { value: "TRAINING_SINGLE", label: "集训单技课" },
  1113. { value: "TRAINING_MIX", label: "集训合奏课" },
  1114. { value: "HIGH", label: "基础技能课" },
  1115. { value: "COMPREHENSIVE", label: "综合课" },
  1116. { value: "CLASSROOM", label: "课堂课" }
  1117. ];
  1118. }
  1119. }
  1120. },
  1121. // 删除班级
  1122. removeClass (scope) {
  1123. if (this.isSetSalary) {
  1124. this.$message.error("课酬确认后无法编辑");
  1125. return;
  1126. }
  1127. removeSingleClass({ classGroupId: scope.row.id })
  1128. .then(res => {
  1129. if (res.code == 200) {
  1130. this.$message.success("删除成功");
  1131. scope._self.$refs[scope.$index].doClose();
  1132. // 重新请求列表
  1133. this.getList();
  1134. } else {
  1135. this.$message.error(res.msg);
  1136. scope._self.$refs[scope.$index].doClose();
  1137. }
  1138. })
  1139. .catch(res => {
  1140. scope._self.$refs[scope.$index].doClose();
  1141. });
  1142. },
  1143. setAssistant (val) {
  1144. for (let i in val) {
  1145. if (val[i] == this.teacherForm.coreTeacher) {
  1146. val.splice(i, 1);
  1147. }
  1148. }
  1149. },
  1150. setAssistant1 (val) {
  1151. for (let i in val) {
  1152. if (val[i] == this.newClassForm.bishop) {
  1153. val.splice(i, 1);
  1154. }
  1155. }
  1156. },
  1157. SelectionStudent (val) {
  1158. // console.log(val);
  1159. // this.activeListStudent = val;
  1160. this.chioseStudent = val;
  1161. },
  1162. addWeek () {
  1163. // 添加循环周期
  1164. this.weekList.push({
  1165. dayOfWeek: "",
  1166. startClassTime: "",
  1167. endClassTime: "",
  1168. id: new Date()
  1169. });
  1170. },
  1171. // 提交临时班的信息
  1172. submitTemporary (type) {
  1173. // 参数是一样 type为1 新增临时班
  1174. // type为2 新增单技班
  1175. // type为3 修改班级信息
  1176. if (type == 1) {
  1177. this.isTemporary = true;
  1178. } else {
  1179. this.isTemporary = false;
  1180. }
  1181. this.$refs["teacherForm"].validate(item => {
  1182. if (item) {
  1183. let week = this.weekList;
  1184. if (this.teacherForm.isAdd != "onlyUpdateTeacher") {
  1185. if (
  1186. !week[0] ||
  1187. !week[0].startClassTime ||
  1188. !week[0].endClassTime ||
  1189. !week[0].dayOfWeek
  1190. ) {
  1191. this.$message.error("至少排一节课");
  1192. return;
  1193. }
  1194. }
  1195. // 这里代表排课成功 发请求 新增临时班
  1196. let classGroupName = this.className;
  1197. let classGroupTeacherMapperList = [
  1198. { userId: this.teacherForm.coreTeacher, teacherRole: "BISHOP" }
  1199. ];
  1200. for (let i in this.teacherForm.assistant) {
  1201. classGroupTeacherMapperList.push({
  1202. userId: this.teacherForm.assistant[i],
  1203. teacherRole: "TEACHING"
  1204. });
  1205. }
  1206. // let mixClassGroupId = this.teacherForm.mixClassGroupId;
  1207. let musicGroupId = this.teamid;
  1208. let startDate = this.teacherForm.courseTime;
  1209. let courseType = this.teacherForm.courseType;
  1210. let courseTimes = this.teacherForm.courseNum;
  1211. if (
  1212. courseTimes <= 0 &&
  1213. this.teacherForm.isAdd != "onlyUpdateTeacher"
  1214. ) {
  1215. this.$message.error("请至少排一节课");
  1216. return;
  1217. }
  1218. let students = this.activeListStudent.map(item => {
  1219. return item.userId;
  1220. });
  1221. let holiday = this.teacherForm.checked;
  1222. let courseList = [];
  1223. for (let i in this.weekList) {
  1224. courseList.push(this.weekList[i]);
  1225. }
  1226. if (
  1227. courseList.length <= 0 &&
  1228. this.teacherForm.isAdd != "onlyUpdateTeacher"
  1229. ) {
  1230. this.$message.error("新增班级至少排一节课");
  1231. return;
  1232. }
  1233. if (this.teacherForm.isAdd == "onlyUpdateTeacher") {
  1234. startDate = null;
  1235. courseType = null;
  1236. students = null;
  1237. holiday = null;
  1238. courseTimes = null;
  1239. (courseList = null), (mineType = null);
  1240. }
  1241. // mixClassGroupId,
  1242. let mineType = this.activeType;
  1243. let obj = {
  1244. classGroupName,
  1245. classGroupTeacherMapperList,
  1246. musicGroupId,
  1247. startDate,
  1248. courseType,
  1249. students,
  1250. holiday,
  1251. courseTimes,
  1252. courseTimeDtoList: courseList,
  1253. type: mineType,
  1254. courseAddType: this.teacherForm.isAdd
  1255. };
  1256. if (type == 1) {
  1257. // 新增临时班级
  1258. revisionClassGroup(obj).then(res => {
  1259. if (res.code == 200) {
  1260. // 提示修改成功
  1261. this.$message.success("修改成功");
  1262. this.infoVisible = false;
  1263. this.studentVisible = false;
  1264. this.getList();
  1265. }
  1266. });
  1267. } else if (type == 2) {
  1268. // 新增单技班
  1269. revisionAddClassGroup(obj).then(res => {
  1270. if (res.code == 200) {
  1271. // 修改成功
  1272. this.$message.success("修改成功");
  1273. this.infoVisible = false;
  1274. this.studentVisible = false;
  1275. this.getList();
  1276. }
  1277. });
  1278. } else if (type == 3) {
  1279. // activeClass
  1280. obj.classGroupId = this.activeClass;
  1281. classGroupUpdate(obj).then(res => {
  1282. if (res.code == 200) {
  1283. this.$message.success("修改成功");
  1284. this.infoVisible = false;
  1285. this.getList();
  1286. }
  1287. });
  1288. }
  1289. } else {
  1290. this.$message.error("请填写必要信息");
  1291. return;
  1292. }
  1293. });
  1294. },
  1295. resetClass (row) {
  1296. if (this.isSetSalary) {
  1297. this.$message.error("课酬确认后无法编辑");
  1298. return;
  1299. }
  1300. this.isNewClass = false;
  1301. this.className = row.name;
  1302. this.studentVisible = true;
  1303. this.activeClass = row.id;
  1304. this.isSearch = false;
  1305. this.activeType = row.type;
  1306. this.newClassForm.type = row.type
  1307. this.activeChioseSound = null
  1308. // 根据单机班id 查询单技班内的所有学生
  1309. getClassAllStudent({ classGroupId: row.id }).then(res => {
  1310. if (res.code == 200) {
  1311. this.activeListStudent = res.data.map(item => {
  1312. item.isVisible = false;
  1313. return item;
  1314. });
  1315. }
  1316. });
  1317. this.getNoClassStudent(row.type);
  1318. },
  1319. // 排课开始
  1320. arrangeStart () {
  1321. if (this.isSetSalary) {
  1322. this.$message.error("课酬确认后无法编辑");
  1323. return;
  1324. }
  1325. if (this.chioseTab.length < 1) {
  1326. this.$message.error("请至少选择一个班级");
  1327. return;
  1328. }
  1329. let type = this.chioseTab[0].type;
  1330. let isSome = this.chioseTab.every(item => {
  1331. return item.type == type;
  1332. });
  1333. if (!isSome) {
  1334. this.$message.error("请选择相同类型的班级");
  1335. return false;
  1336. }
  1337. //
  1338. this.setType(this.chioseTab[0].type);
  1339. this.arrangeForm.courseType = this.courseTypeList[0].value;
  1340. this.arrangeVisible = true;
  1341. if (this.arrangeForm.courseType == "HIGH_ONLINE") {
  1342. this.arrangeForm.teachMode = "ONLINE";
  1343. } else {
  1344. this.arrangeForm.teachMode = "OFFLINE";
  1345. }
  1346. this.arrangeForm.classNum = this.chioseTab.length;
  1347. },
  1348. selectionTable (val) {
  1349. this.chioseTab = val;
  1350. this.arrangeForm.classNum = val.length;
  1351. },
  1352. // 开始排课
  1353. arrangeFormSubmit () {
  1354. // 获取要排课的班级 id
  1355. if (this.weekList.length < 0 || !this.weekList[0].dayOfWeek) {
  1356. this.$message.error("请设置排课周期");
  1357. return;
  1358. }
  1359. if (this.arrangeForm.courseNum > this.maxMun || this.arrangeForm.courseNum < 1) {
  1360. this.$message.error(`排课数量必须大于1或小于${this.maxMun}`)
  1361. return
  1362. }
  1363. // 组拼课程信息
  1364. this.$refs["arrangeForm"].validate(res => {
  1365. if (res) {
  1366. let date = this.arrangeForm.courseTime;
  1367. let classCount = this.arrangeForm.courseNum;
  1368. let weekArr = this.weekList;
  1369. let courseType = this.arrangeForm.courseType;
  1370. let teachMode = this.arrangeForm.teachMode;
  1371. this.classCardList = [];
  1372. this.workOut(date, classCount, weekArr, courseType, teachMode);
  1373. }
  1374. });
  1375. },
  1376. // 排课: 开始日期 几节课 星期几 什么类型的课
  1377. workOut (date, classCount, weekArr, courseType, teachMode) {
  1378. // 验证是不是添加的循环周期里每一项都有值
  1379. let flag = weekArr.every(item => {
  1380. return item.dayOfWeek && item.startClassTime && item.endClassTime;
  1381. });
  1382. if (!flag) {
  1383. this.$message.error("请保证循环周期信息完整");
  1384. return;
  1385. }
  1386. // 这里是一天排一节课 现在要改成一天排多节
  1387. while (classCount && classCount > 0) {
  1388. for (let i in weekArr) {
  1389. let date1 = new Date(date.getTime());
  1390. let num; // 下次上课上几天后
  1391. // 星期4 - 当前是星期几 =>
  1392. weekArr[i].dayOfWeek - date.getDay() >= 0
  1393. ? (num = weekArr[i].dayOfWeek - date.getDay())
  1394. : (num = weekArr[i].dayOfWeek - date.getDay() + 7);
  1395. let dataStr = this.getThinkDate(date, num);
  1396. let monthDay = this.getThinkDate(date1, num);
  1397. if (this.arrangeForm.checked) {
  1398. if (this.holidayList.indexOf(monthDay) != -1) {
  1399. // 这里说明有节假日
  1400. continue;
  1401. }
  1402. }
  1403. let nowStartTime = weekArr[i].startClassTime;
  1404. let nowEndTime = weekArr[i].endClassTime;
  1405. // 这里开始排课 哪几个班
  1406. for (let j in this.chioseTab) {
  1407. this.classCardList.push({
  1408. classDate: dataStr,
  1409. classGroupId: this.chioseTab[j].id,
  1410. startClassTimeStr: nowStartTime,
  1411. endClassTimeStr: nowEndTime,
  1412. type: courseType,
  1413. weekNum: weekArr[i].dayOfWeek,
  1414. teachMode: teachMode,
  1415. option: 1
  1416. });
  1417. }
  1418. classCount--;
  1419. if (classCount == 0) break;
  1420. }
  1421. date.setDate(date.getDate() + 7);
  1422. }
  1423. // 直接调接口排课进去
  1424. workOut({
  1425. musicGroupID: this.teamid,
  1426. courseSchedules: this.classCardList
  1427. })
  1428. .then(res => {
  1429. if (res.code == 200) {
  1430. this.$message.success("恭喜您排课成功");
  1431. this.classCardList = [];
  1432. this.arrangeVisible = false;
  1433. this.getList();
  1434. }
  1435. })
  1436. .catch(res => {
  1437. // this.tableList = [];
  1438. console.log("排课来了");
  1439. this.classCardList = [];
  1440. this.resetTime();
  1441. });
  1442. },
  1443. getThinkDate (date, num, type = 1) {
  1444. let Stamp = new Date(date.getTime());
  1445. Stamp.setDate(Stamp.getDate() + parseInt(num)); // 获取当前月数的第几天
  1446. var year = Stamp.getFullYear(); //获取完整的年份(4位,1970-????)
  1447. var month = Stamp.getMonth() + 1; //获取当前月份(0-11,0代表1月)
  1448. var mvar = "";
  1449. if (month < 10) {
  1450. mvar = "0" + month;
  1451. } else {
  1452. mvar = month + "";
  1453. }
  1454. var day = Stamp.getDate();
  1455. var dvar = "";
  1456. if (day < 10) {
  1457. dvar = "0" + day;
  1458. } else {
  1459. dvar = day + "";
  1460. }
  1461. if (type == 2) {
  1462. return mvar + dvar;
  1463. } else {
  1464. return year + "-" + mvar + "-" + dvar;
  1465. }
  1466. },
  1467. resetTime () {
  1468. this.arrangeForm.courseTime = null;
  1469. this.weekList = [
  1470. {
  1471. week: "",
  1472. startTime: "",
  1473. endTime: "",
  1474. id: new Date().getTime()
  1475. }
  1476. ];
  1477. },
  1478. chioseHightype (val) {
  1479. this.$set(this.newClassForm, 'subjectIdList', [])
  1480. this.newClassForm.subjectId = ''
  1481. if (val == 'HIGH_ONLINE') {
  1482. this.newClassForm.teaching = []
  1483. } else {
  1484. this.newClassForm.memo = []
  1485. }
  1486. }
  1487. },
  1488. filters: {
  1489. getBishopName (val) {
  1490. let name = "";
  1491. if (val && val.length > 0) {
  1492. for (let i in val) {
  1493. if (val[i].teacherRole == "BISHOP") {
  1494. name = val[i].userName;
  1495. }
  1496. }
  1497. }
  1498. return name;
  1499. },
  1500. getTeachingNum (val) {
  1501. let num = 0;
  1502. if (val && val.length > 0) {
  1503. for (let i in val) {
  1504. if (val[i].teacherRole == "TEACHING") {
  1505. num++;
  1506. }
  1507. }
  1508. }
  1509. return num;
  1510. },
  1511. },
  1512. watch: {
  1513. newClassVisible (val) {
  1514. if (!val) {
  1515. this.newClassForm = {
  1516. className: null,
  1517. type: null,
  1518. subjectIdList: [],
  1519. subjectId: '',
  1520. expectStudentNum: null,
  1521. bishop: null,
  1522. teaching: null,
  1523. memo: []
  1524. };
  1525. }
  1526. },
  1527. studentVisible (val) {
  1528. if (!val) {
  1529. this.newClassVisible = false;
  1530. this.activeListStudent = [];
  1531. }
  1532. },
  1533. infoVisible (val) {
  1534. if (!val) {
  1535. this.teacherForm = {
  1536. isAdd: "onlyUpdateTeacher",
  1537. coreTeacher: "",
  1538. assistant: [],
  1539. courseType: "",
  1540. courseTime: "",
  1541. checked: true,
  1542. courseNum: "",
  1543. mixClassGroupId: ""
  1544. };
  1545. this.$refs["teacherForm"].resetFields();
  1546. }
  1547. },
  1548. arrangeVisible (val) {
  1549. if (!val) {
  1550. this.arrangeForm = {
  1551. courseNum: null,
  1552. classNum: null,
  1553. courseType: null,
  1554. courseTime: null,
  1555. teachMode: null,
  1556. checked: true
  1557. };
  1558. this.$refs["arrangeForm"].resetFields();
  1559. this.weekList = [
  1560. {
  1561. week: "",
  1562. startTime: "",
  1563. endTime: "",
  1564. id: new Date().getTime()
  1565. }
  1566. ];
  1567. }
  1568. }
  1569. }
  1570. };
  1571. </script>
  1572. <style lang='scss' scoped>
  1573. .m-core {
  1574. background-color: #fff;
  1575. box-sizing: border-box;
  1576. padding: 30px 42px;
  1577. }
  1578. .buttonWrap {
  1579. display: flex;
  1580. justify-content: flex-start;
  1581. .newBand {
  1582. margin-right: 20px;
  1583. }
  1584. .expectMsg {
  1585. position: relative;
  1586. top: 3px;
  1587. line-height: 36px;
  1588. font-size: 14px;
  1589. }
  1590. }
  1591. .studentMask {
  1592. display: flex;
  1593. flex-direction: row;
  1594. justify-content: flex-start;
  1595. .left {
  1596. width: 200px;
  1597. margin-right: 20px;
  1598. .wrap {
  1599. margin-bottom: 20px;
  1600. }
  1601. h4 {
  1602. font-size: 16px;
  1603. color: #444;
  1604. line-height: 38px;
  1605. }
  1606. .chioseStudentList {
  1607. height: 500px;
  1608. overflow-y: auto;
  1609. border: 1px solid #ccc;
  1610. .studentItem {
  1611. padding-left: 10px;
  1612. line-height: 25px;
  1613. }
  1614. }
  1615. }
  1616. .right {
  1617. width: calc(100% - 200px);
  1618. .tableList {
  1619. max-height: 500px;
  1620. overflow-y: auto;
  1621. }
  1622. }
  1623. }
  1624. .resetClassForm {
  1625. /deep/.el-date-editor.el-input,
  1626. /deep/.el-date-editor.el-input__inner {
  1627. width: 180px !important;
  1628. }
  1629. }
  1630. /deep/.el-date-editor.el-input,
  1631. /deep/.el-date-editor.el-input__inner {
  1632. width: 100px !important;
  1633. }
  1634. </style>