accompanys.vue 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174
  1. <template>
  2. <div class="m-container">
  3. <div class="titlewrap">
  4. <h2>
  5. <el-page-header @back="goBack"
  6. :content="name"></el-page-header>
  7. </h2>
  8. <p style="margin-bottom:10px; margin-left:30px;">课程有效期:{{ timers }}</p>
  9. </div>
  10. <!-- v-permission="'vipGroupManage/updateVipBaseInfo'" -->
  11. <div class="wrap">
  12. <div class="newBand"
  13. @click="resetTeachers"
  14. v-if="courseType&&courseType!='TRIAL'"
  15. v-permission="'courseSchedule/practiceGroupTeacherAdjust'">课程组调整</div>
  16. <!-- // accompanys/addCourse -->
  17. <div v-permission="{ child:'courseSchedule/batchAddCourses',parent:'/accompanys'}"
  18. class="newBand"
  19. @click="addCourse">网管课加课</div>
  20. <div class="newBand"
  21. v-if="courseType&&courseType!='TRIAL'"
  22. v-permission="'courseSchedule/batchUpdateCourseSchedule'"
  23. @click="adjustment">批量调整</div>
  24. <div class="newBand"
  25. v-permission="'courseSchedule/updateCoursesExpireDate'"
  26. @click="expireVisible = true">有效期调整</div>
  27. </div>
  28. <div class="tableWrap">
  29. <el-table :data="tableList"
  30. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  31. @selection-change="handleSelectionChange">
  32. <el-table-column type="selection"
  33. :selectable="isDisabled"
  34. width="55"></el-table-column>
  35. <el-table-column label="课程编号"
  36. align="center"
  37. prop="id"></el-table-column>
  38. <el-table-column label="课程名称"
  39. align="center"
  40. prop="name"></el-table-column>
  41. <el-table-column label="主教老师"
  42. align="center"
  43. prop="teacherName"></el-table-column>
  44. <!-- <el-table-column label="主教老师" align="center" >
  45. <template slot-scope="scope">
  46. <div v-show="scope.row.teacher">
  47. {{scope.row.teacher.realName}}
  48. </div>
  49. </template>
  50. </el-table-column>-->
  51. <!-- <el-table-column label="班级id"
  52. align="center"
  53. prop="classGroupId">
  54. </el-table-column>-->
  55. <el-table-column label="上课日期"
  56. align="center"
  57. prop="classDate">
  58. <template slot-scope="scope">
  59. <div>{{ scope.row.classDate | formatTimer}}</div>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="是否点名"
  63. align="center"
  64. prop="status">
  65. <template slot-scope="scope">{{ scope.row.isCallNames ? '是' : '否' }}</template>
  66. </el-table-column>
  67. <el-table-column label="课程状态"
  68. align="center"
  69. prop="status">
  70. <template slot-scope="scope">
  71. <div>{{ scope.row.status | coursesStatus }}</div>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="结算状态"
  75. align="center">
  76. <template slot-scope="scope">
  77. <div>{{scope.row.isSettlement?'已结算':'未结算'}}</div>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="开始时间"
  81. align="center"
  82. prop="startClassTimeStr">
  83. <template slot-scope="scope">
  84. <div>{{ scope.row.startClassTimeStr | timerForMinFormat}}</div>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="结束时间"
  88. align="center"
  89. prop="endClassTimeStr">
  90. <template slot-scope="scope">
  91. <div>{{ scope.row.endClassTimeStr | timerForMinFormat}}</div>
  92. </template>
  93. </el-table-column>
  94. <!-- <el-table-column label="教学点" align="center" prop="schoolName">
  95. <template slot-scope="scope">
  96. <div>{{scope.row.schoolName?scope.row.schoolName:'网络教室'}}</div>
  97. </template>
  98. </el-table-column>-->
  99. <el-table-column label="操作"
  100. width="250px"
  101. align="center"
  102. fixed="right">
  103. <template slot-scope="scope">
  104. <div>
  105. <el-button type="text"
  106. v-if="!scope.row.isSettlement && permission('courseSchedule/practiceCourseAdjust')"
  107. @click="resetClass(scope.row)">调整</el-button>
  108. <el-button type="text"
  109. v-if="!scope.row.isSettlement && scope.row.status == 'NOT_START' && permission('accompanys/remove')"
  110. @click="removeClass(scope.row)">删除</el-button>
  111. <el-button type="text"
  112. v-if="scope.row.status == 'NOT_START'&&courseType!='TRIAL'&& permission('courseSchedule/practiceCourseTeacherAdjust')"
  113. @click="resetTeacher(scope.row)">更换老师</el-button>
  114. <el-button v-if="scope.row.status == 'OVER' && scope.row.isSettlement == 0 && permission('/accompanys/teacherAttendance/updateTeacherAttendance')"
  115. type="text"
  116. @click="onMarkAttendance(scope.row)">补考勤</el-button>
  117. <!-- && permission('studentAttendance/updateStudentAttendances', '/accompanys') -->
  118. <el-button v-if="scope.row.status == 'OVER' && permission('/accompanys/studentAttendance/updateStudentAttendances')"
  119. type="text"
  120. @click="onCallName(scope.row)">点名表</el-button>
  121. <el-button type="text"
  122. v-if="!scope.row.isSettlement && permission('accompanys/cleanAttendance')"
  123. @click="clearAttend(scope.row)">清除考勤</el-button>
  124. </div>
  125. </template>
  126. </el-table-column>
  127. </el-table>
  128. <!-- <pagination :total="rules.total"
  129. :page.sync="rules.page"
  130. :limit.sync="rules.limit"
  131. :page-sizes="rules.page_size"
  132. @pagination="getList" /> 乔乔说后台没有分页所以一口气都展示-->
  133. </div>
  134. <el-dialog title="有效期调整"
  135. width="400px"
  136. :before-close="expireClose"
  137. :visible.sync="expireVisible">
  138. <el-form :model="expireForm"
  139. ref="expireForm"
  140. :rules="expireRules"
  141. label-position="right"
  142. label-width="80px;"
  143. :inline="true">
  144. <el-form-item label="课程结束时间"
  145. prop="coursesExpireDate">
  146. <el-date-picker v-model.trim="expireForm.coursesExpireDate"
  147. style="width:200px!important;"
  148. type="date"
  149. :picker-options="bigin"
  150. value-format="yyyy-MM-dd"
  151. placeholder="选择日期"></el-date-picker>
  152. </el-form-item>
  153. <div style="padding-left: 15px; color: red;">课程结束时间不得晚于,{{ expireForm.tempCoursesExpireDate }}</div>
  154. </el-form>
  155. <div slot="footer"
  156. class="dialog-footer">
  157. <el-button @click="expireVisible = false">取 消</el-button>
  158. <el-button type="primary"
  159. @click="submitExpireDate">确 定</el-button>
  160. </div>
  161. </el-dialog>
  162. <el-dialog title="补考勤"
  163. width="400px"
  164. :visible.sync="markAttendance.status">
  165. <el-form>
  166. <el-form-item label="签到状态">{{ markAttendance.dataInfo.isSignIn | attendanceType }}</el-form-item>
  167. <el-form-item label="签到时间">{{ markAttendance.dataInfo.signInTime}}</el-form-item>
  168. <el-form-item label="签退状态">{{ markAttendance.dataInfo.isSignOut | attendanceOutType }}</el-form-item>
  169. <el-form-item label="签退时间">{{ markAttendance.dataInfo.signOutTime}}</el-form-item>
  170. </el-form>
  171. <div slot="footer"
  172. class="dialog-footer">
  173. <el-button @click="markAttendance.status = false">取 消</el-button>
  174. <el-button type="primary"
  175. :disabled="markAttendance.dataInfo.isSignIn == 1 && markAttendance.dataInfo.isSignOut == 1 ? true : false"
  176. @click="batchAdjustmentTime">确定补卡</el-button>
  177. </div>
  178. </el-dialog>
  179. <el-dialog title="课程调整"
  180. width="400px"
  181. :before-close="handleClose"
  182. :visible.sync="courseVisible">
  183. <el-form :model="maskForm"
  184. ref="maskForm"
  185. :rules="maskRules"
  186. label-position="right"
  187. label-width="80px"
  188. :inline="true">
  189. <el-form-item label="上课日期"
  190. prop="date"
  191. v-if="courseType != 'TRIAL'">
  192. <el-date-picker v-model.trim="maskForm.date"
  193. type="date"
  194. :picker-options="courseOption"
  195. value-format="yyyy-MM-dd"
  196. placeholder="选择日期"></el-date-picker>
  197. </el-form-item>
  198. <el-form-item label="上课日期"
  199. prop="date"
  200. v-else>
  201. <el-date-picker v-model.trim="maskForm.date"
  202. style="width:200px!important;"
  203. type="date"
  204. value-format="yyyy-MM-dd"
  205. :picker-options="{
  206. firstDayOfWeek: 1
  207. }"
  208. placeholder="选择日期"></el-date-picker>
  209. </el-form-item>
  210. <el-form-item label="开始时间"
  211. prop="startTime">
  212. <el-time-picker placeholder="起始时间"
  213. v-model="startTime"
  214. @change="changeStartTime"
  215. format='HH:mm'
  216. value-format='HH:mm'
  217. :picker-options="{
  218. selectableRange: '04:30:00 - 23:30:00'
  219. }"></el-time-picker>
  220. </el-form-item>
  221. <el-form-item label="结束时间"
  222. prop="endTime">
  223. <el-time-picker placeholder="结束时间"
  224. format='HH:mm'
  225. value-format='HH:mm'
  226. v-model="maskForm.endTime"
  227. disabled>
  228. </el-time-picker>
  229. </el-form-item> <!-- v-show="maskForm.teachMode=='OFFLINE'"-->
  230. <!-- <el-form-item label="课程类型" prop="courseType">
  231. <el-select clearable v-model.trim="maskForm.teachMode">
  232. <el-option label="线上课" value="ONLINE"></el-option>
  233. <el-option label="线下课" value="OFFLINE"></el-option>
  234. </el-select>
  235. </el-form-item>-->
  236. <!-- <el-form-item label="教学地点" v-show="maskForm.teachMode == 'OFFLINE'">
  237. <el-select v-model.trim="maskForm.address" filterable clearable>
  238. <el-option
  239. v-for="(item,index) in schoolList"
  240. :key="index"
  241. :value="item.id"
  242. :label="item.name"
  243. ></el-option>
  244. </el-select>
  245. </el-form-item> 1-->
  246. </el-form>
  247. <div slot="footer"
  248. class="dialog-footer">
  249. <el-button @click="courseVisible = false">取 消</el-button>
  250. <el-button type="primary"
  251. @click="submitResetClass">确 定</el-button>
  252. </div>
  253. </el-dialog>
  254. <el-dialog :title="isMultiple?'课程组调整':'更换老师'"
  255. width="400px"
  256. :before-close="teacherClose"
  257. :visible.sync="teacherVisible">
  258. <el-form :model="teacherForm"
  259. ref="teacherForm"
  260. :rules="teacherRules"
  261. label-position="right"
  262. label-width="80px;"
  263. :inline="true">
  264. <el-form-item label="课程班名称"
  265. v-show="isMultiple">
  266. <el-input v-model.trim="teacherForm.name"
  267. disabled></el-input>
  268. </el-form-item>
  269. <el-form-item label="课程组声部"
  270. v-show="isMultiple">
  271. <el-select v-model.trim="teacherForm.subjectId"
  272. @change="changeSound"
  273. filterable
  274. clearable>
  275. <el-option v-for="(item,index) in subjectList"
  276. :key="index"
  277. :value="item.id"
  278. :label="item.name"></el-option>
  279. </el-select>
  280. </el-form-item>
  281. <el-form-item label="课程组老师"
  282. v-if="isMultiple">
  283. <el-select v-model.trim="teacherForm.teacher"
  284. filterable
  285. clearable>
  286. <el-option v-for="(item,index) in teacherList"
  287. :key="index"
  288. :value="item.id"
  289. :label="item.realName"></el-option>
  290. </el-select>
  291. </el-form-item>
  292. <el-form-item label="指导老师"
  293. v-else="isMultiple">
  294. <el-select v-model.trim="teacherForm.teacher"
  295. filterable
  296. clearable>
  297. <el-option v-for="(item,index) in teacherList"
  298. :key="index"
  299. :value="item.id"
  300. :label="item.realName"></el-option>
  301. </el-select>
  302. </el-form-item>
  303. <el-form-item label="乐团主管"
  304. v-show="isMultiple">
  305. <el-select v-model.trim="teacherForm.educationalTeacherId"
  306. filterable
  307. clearable>
  308. <el-option v-for="(item,index) in educationList"
  309. :key="index"
  310. :value="item.userId"
  311. :label="item.userName"></el-option>
  312. </el-select>
  313. </el-form-item>
  314. <el-form-item v-if="isMultiple">
  315. <p style="color:#FF5353">*更改课程组老师,将更换全部未开始课程的老师</p>
  316. </el-form-item>
  317. </el-form>
  318. <div slot="footer"
  319. class="dialog-footer">
  320. <el-button @click="teacherVisible = false">取 消</el-button>
  321. <el-button type="primary"
  322. @click="subresetTeacher">确 定</el-button>
  323. </div>
  324. </el-dialog>
  325. <el-dialog :title="adjustmentName"
  326. width="800px"
  327. :visible.sync="adjustmentVisible">
  328. <el-form :model="adjustmentForm"
  329. label-position="right"
  330. label-width="120px"
  331. ref="adjustmentForm"
  332. :rules="adjustmentRules"
  333. :inline="true">
  334. <el-form-item label="已选择课时数"
  335. v-if="!isaddCourse">
  336. <el-input disabled
  337. v-model.trim="adjustmentForm.count"></el-input>
  338. </el-form-item>
  339. <el-form-item label="添加课时数"
  340. prop="addCount"
  341. v-if="isaddCourse">
  342. <el-input type="number"
  343. @mousewheel.native.prevent
  344. v-model.trim="adjustmentForm.addCount"></el-input>
  345. </el-form-item>
  346. <br />
  347. <!-- <el-form-item label="单课费用" prop="fee" v-show="isaddCourse">
  348. <el-input v-model.trim="adjustmentForm.fee"></el-input>
  349. </el-form-item>-->
  350. <el-form-item label="排课起始时间"
  351. prop="courseTime">
  352. <el-date-picker v-model.trim="adjustmentForm.courseTime"
  353. :picker-options="pickerOptions"
  354. style="width:200px!important;"
  355. type="date"
  356. value-format="yyyy-MM-dd"
  357. placeholder="选择日期"></el-date-picker>
  358. <el-checkbox style="margin-left:10px;"
  359. v-model.trim="adjustmentForm.checked">是否跳过节假日</el-checkbox>
  360. </el-form-item>
  361. </el-form>
  362. <div class="WeekWrap">
  363. <h3 style="margin-bottom:20px;">
  364. 循环次数
  365. <el-button type="text"
  366. style="margin-left:10px;"
  367. @click="addWeek">添加</el-button>
  368. </h3>
  369. <div class="countWrap"
  370. style="margin-bottom:10px;">
  371. <div class="countItem"
  372. style="margin-bottom:20px;"
  373. v-for="(item,index) in weekList"
  374. :key="index">
  375. <span>循环周期:</span>
  376. <el-select v-model.trim="item.dayOfWeek"
  377. filterable
  378. clearable>
  379. <el-option v-for="(item,index) in weekDateList"
  380. :key="index"
  381. :label="item.label"
  382. :value="item.value"></el-option>
  383. </el-select>
  384. <span style="margin-left:10px;">开始时间</span>
  385. <el-time-picker style="margin-left:10px;"
  386. placeholder
  387. v-model.trim="item.startClassTime"
  388. @change="(val)=>{changeStartTimes(val,item)}"
  389. format='HH:mm'
  390. value-format='HH:mm'
  391. :picker-options="{
  392. selectableRange: '04:30:00 - 23:30:00'
  393. }"></el-time-picker>
  394. <span style="margin-left:10px;">结束时间</span>
  395. <el-time-picker style="margin-left:10px;"
  396. placeholder
  397. v-model.trim="item.endClassTime"
  398. format='HH:mm'
  399. value-format='HH:mm'
  400. disabled
  401. :picker-options="{
  402. selectableRange: '04:30:00 - 23:30:00'
  403. }"></el-time-picker>
  404. <el-button style="margin-left:10px;"
  405. type="danger"
  406. @click="removeWeek(item)"
  407. icon="el-icon-delete"
  408. circle></el-button>
  409. </div>
  410. </div>
  411. </div>
  412. <div slot="footer"
  413. class="dialog-footer">
  414. <el-button @click="adjustmentVisible = false">取 消</el-button>
  415. <el-button type="primary"
  416. v-show="!isaddCourse"
  417. @click="submitAdjustment">确 定</el-button>
  418. <el-button type="primary"
  419. v-show="isaddCourse"
  420. @click="addCourseSubmit">确 定</el-button>
  421. </div>
  422. </el-dialog>
  423. <el-dialog title='点名表'
  424. width="700px"
  425. :visible.sync="rollCall.status">
  426. <el-table :data="rollCall.gridData">
  427. <el-table-column align='center'
  428. property="userName"
  429. label="学员姓名"></el-table-column>
  430. <el-table-column align='center'
  431. property="phone"
  432. label="手机号"></el-table-column>
  433. <el-table-column align='center'
  434. property="subjectName"
  435. label="学员声部"></el-table-column>
  436. <el-table-column align='center'
  437. label="到课状态">
  438. <template slot-scope="scope">
  439. {{ scope.row.status | studentCallName }}
  440. </template>
  441. </el-table-column>
  442. <el-table-column align='center'
  443. label="操作"
  444. v-if="rollCall.selectItem.isSettlement == 0"
  445. width="220px">
  446. <template slot-scope="scope">
  447. <el-button size="small"
  448. @click="onChangeRollCall('TRUANT', scope.row)"
  449. type="primary"
  450. round>未到</el-button>
  451. <el-button size="small"
  452. @click="onChangeRollCall('LEAVE', scope.row)"
  453. type="warning"
  454. round>请假</el-button>
  455. <el-button size="small"
  456. @click="onChangeRollCall('NORMAL', scope.row)"
  457. type="success"
  458. round>到课</el-button>
  459. </template>
  460. </el-table-column>
  461. </el-table>
  462. <pagination :total="rollCall.total"
  463. :page.sync="rollCall.page"
  464. :limit.sync="rollCall.limit"
  465. :page-sizes="rollCall.page_size"
  466. @pagination="getCallName" />
  467. </el-dialog>
  468. </div>
  469. </template>
  470. <script>
  471. import pagination from "@/components/Pagination/index";
  472. import { permission } from "@/utils/directivePage";
  473. import { nextMonthLastDay } from "@/utils/validate";
  474. import {
  475. findPracticeGroupCourseSchedules,
  476. practiceCourseAdjus,
  477. getTeacher,
  478. practiceGroupManage,
  479. practiceGroupTeacherAdjust,
  480. practiceCourseTeacherAdjust,
  481. cleanAttendance,
  482. batchAddCourses,
  483. getPracticeApplySubjects,
  484. batchUpdateCourseSchedule,
  485. findEducationUsers,
  486. updateTeacherAttendance,
  487. updateCoursesExpireDate,
  488. findAttendanceStudentByCourseWithPage,
  489. updateStudentAttendances,
  490. resetCourse
  491. } from "@/api/buildTeam";
  492. import {
  493. vipCourseAdjust,
  494. batchAppendVipGroupCourses,
  495. bathDelete
  496. } from "@/api/vipSeting";
  497. // import { start } from 'repl';
  498. import { diffTimerFormMinute, addTimerFormMinute } from '@/utils/date'
  499. import dayjs from 'dayjs'
  500. export default {
  501. components: {
  502. pagination
  503. },
  504. data () {
  505. return {
  506. adjustmentName: "",
  507. isaddCourse: false,
  508. adjustmentVisible: false,
  509. expireVisible: false,
  510. isMultiple: true,
  511. name: "网管课程组",
  512. courseVisible: false,
  513. teacherVisible: false,
  514. Frules: null,
  515. FsearchForm: null,
  516. userId: null,
  517. activeRow: null,
  518. courseType: null,
  519. rules: {
  520. // 分页规则
  521. limit: 20, // 限制显示条数
  522. page: 1, // 当前页
  523. total: 0, // 总条数
  524. page_size: [10, 20, 50, 100] // 选择限制显示条数
  525. },
  526. tableList: [],
  527. teacherList: [],
  528. courseData: [],
  529. practiceId: null,
  530. subjectList: [],
  531. maskForm: {
  532. date: "",
  533. startTime: "",
  534. id: "",
  535. endTime: ""
  536. },
  537. adjustmentForm: {
  538. count: "",
  539. courseTime: "",
  540. checked: false,
  541. addCount: "",
  542. courseType: "",
  543. fee: ""
  544. },
  545. startTime: null,
  546. expireForm: {
  547. coursesExpireDate: null,
  548. tempCoursesExpireDate: null
  549. },
  550. expireRules: {
  551. coursesExpireDate: [{ required: true, message: "请选择课程结束时间", trigger: "blur" }]
  552. },
  553. maskRules: {
  554. date: [{ required: true, message: "请选择上课时间", trigger: "blur" }],
  555. // startTime: [{ required: true, message: '请选择上课开始时间', trigger: 'blur' },],
  556. // endTime: [
  557. // { required: true, message: "请选择上课结束时间", trigger: "blur" }
  558. // ]
  559. },
  560. teacherRules: {
  561. teacher: [{ required: true, message: "请选择老师", trigger: "blur" }],
  562. subjectId: [{ required: true, message: "请选择声部", trigger: "blur" }],
  563. educationalTeacherId: [{ required: true, message: "请选择乐团主管", trigger: "blur" }]
  564. },
  565. teacherForm: {
  566. teacher: null,
  567. name: null,
  568. subjectId: null,
  569. educationalTeacherId: null
  570. },
  571. courseOption: null,
  572. coursesExpireDate: null,
  573. adjustmentRules: {
  574. courseTime: [{ required: true, message: "请选择开始时间" }],
  575. addCount: [{ required: true, message: "请输入加课次数" }],
  576. courseType: [{ required: true, message: "请选择课程类型" }],
  577. fee: [{ required: true, message: "请输入费用" }]
  578. },
  579. pickerOptions: {
  580. firstDayOfWeek: 1,
  581. disabledDate (time) {
  582. return time.getTime() + 86400000 <= new Date().getTime();
  583. }
  584. },
  585. weekList: [
  586. {
  587. dayOfWeek: "",
  588. startTime: "",
  589. endTime: "",
  590. moid: new Date().getTime()
  591. }
  592. ],
  593. weekDateList: [
  594. { value: "1", label: "星期一" },
  595. { value: "2", label: "星期二" },
  596. { value: "3", label: "星期三" },
  597. { value: "4", label: "星期四" },
  598. { value: "5", label: "星期五" },
  599. { value: "6", label: "星期六" },
  600. { value: "7", label: "星期日" }
  601. ],
  602. activeList: [],
  603. educationList: [],
  604. timers: null,
  605. markAttendance: {
  606. // 考勤状态
  607. status: false,
  608. dataInfo: {}
  609. },
  610. bigin: this.beginDate(),
  611. rollCall: { // 点名表
  612. status: false,
  613. gridData: [],
  614. selectItem: {}, // 选中状态
  615. limit: 10, // 限制显示条数
  616. page: 1, // 当前页
  617. total: 0, // 总条数
  618. page_size: [10, 20, 40, 50] // 选择限制显示条数
  619. },
  620. accompanTime: 25
  621. };
  622. },
  623. mounted () {
  624. this.init();
  625. },
  626. activated () {
  627. this.init();
  628. },
  629. methods: {
  630. init () {
  631. this.practiceId = this.$route.query.id;
  632. this.userId = this.$route.query.userId;
  633. this.courseType = this.$route.query.type;
  634. if (this.$route.query.rules) {
  635. this.Frules = this.$route.query.rules;
  636. }
  637. if (this.$route.query.searchForm) {
  638. this.FsearchForm = this.$route.query.searchForm;
  639. }
  640. // 获取乐团主管
  641. findEducationUsers({
  642. }).then(res => {
  643. if (res.code == 200) {
  644. this.educationList = res.data
  645. }
  646. });
  647. // <!-- 状态 指导老师 活动方案-->
  648. getTeacher({ organId: this.organId }).then(res => {
  649. if (res.code == 200) {
  650. this.teacherList = res.data;
  651. }
  652. });
  653. // 获取默认声部信息
  654. getPracticeApplySubjects().then(res => {
  655. if (res.code == 200) {
  656. this.subjectList = res.data;
  657. }
  658. });
  659. // 获取课程组信息
  660. this.courseOption = this.coursesDate();
  661. this.getCourseGroup();
  662. this.getList();
  663. },
  664. onCallName (item) { // 点名表
  665. this.rollCall.page = 1
  666. this.rollCall.selectItem = item
  667. this.getCallName()
  668. },
  669. getCallName () {
  670. let rollCall = this.rollCall
  671. let params = {
  672. page: rollCall.page,
  673. rows: rollCall.limit,
  674. courseScheduleId: rollCall.selectItem.id
  675. }
  676. findAttendanceStudentByCourseWithPage(params).then(res => {
  677. let result = res.data
  678. rollCall.status = true
  679. if (res.code == 200) {
  680. rollCall.gridData = result.rows
  681. rollCall.total = result.total
  682. }
  683. })
  684. },
  685. onChangeRollCall (type, row) {
  686. let rollCall = this.rollCall
  687. let params = {
  688. courseScheduleId: rollCall.selectItem.id,
  689. studentAttendances: [{
  690. userId: row.studentId,
  691. status: type
  692. }]
  693. }
  694. updateStudentAttendances(params).then(res => {
  695. if (res.code == 200) {
  696. this.$message.success('修改成功')
  697. row.status = type
  698. this.getList()
  699. } else {
  700. this.$message.error(res.msg)
  701. }
  702. })
  703. },
  704. lookStudents (row) {
  705. let id = row.id;
  706. getStudyStudents({ courseScheduleId: id }).then(res => {
  707. if (res.code == 200) {
  708. this.studentList = res.data;
  709. this.studentVisible = true;
  710. }
  711. })
  712. },
  713. getCourseGroup () {
  714. practiceGroupManage({ search: this.practiceId }).then(res => {
  715. if (res.code == 200) {
  716. this.courseData = res.data.rows;
  717. if (this.courseData.length > 0) {
  718. this.name = this.courseData[0].name;
  719. this.expireForm.coursesExpireDate = this.courseData[0].coursesExpireDate.substring(0, 10);
  720. this.timers =
  721. this.courseData[0].coursesStartDate.substring(0, 10) +
  722. "至" +
  723. this.courseData[0].coursesExpireDate.substring(0, 10);
  724. let originalStartDate = this.courseData[0].coursesStartDate ? new Date(this.courseData[0].coursesStartDate) : new Date()
  725. let buyMonths = this.courseData[0].buyMonths
  726. let lastDayNum = nextMonthLastDay(originalStartDate.getFullYear(), (originalStartDate.getMonth() + buyMonths + 1))
  727. if (lastDayNum[2] >= originalStartDate.getDate()) {
  728. originalStartDate.setMonth(originalStartDate.getMonth() + buyMonths)
  729. } else {
  730. originalStartDate = new Date(lastDayNum.join('-'))
  731. }
  732. originalStartDate.setDate(originalStartDate.getDate() - 1)
  733. let overTime = originalStartDate.getFullYear() + '-' + (originalStartDate.getMonth() + 1) + '-' + originalStartDate.getDate()
  734. this.expireForm.tempCoursesExpireDate = overTime
  735. }
  736. }
  737. });
  738. },
  739. permission (str, parent) {
  740. return permission(str, parent);
  741. },
  742. beginDate () {
  743. let self = this
  744. return {
  745. firstDayOfWeek: 1,
  746. disabledDate (time) {
  747. if (self.expireForm.tempCoursesExpireDate) {
  748. return new Date(self.expireForm.tempCoursesExpireDate).getTime() > time.getTime()
  749. } else {
  750. return time.getTime() >= Date.now()
  751. //开始时间不选时,结束时间最大值小于等于当天
  752. }
  753. }
  754. }
  755. },
  756. submitExpireDate () {
  757. this.$refs.expireForm.validate(some => {
  758. if (some) {
  759. updateCoursesExpireDate({
  760. practiceGroupId: this.practiceId,
  761. coursesExpireDate: this.expireForm.coursesExpireDate
  762. }).then(res => {
  763. if (res.code == 200) {
  764. this.$message.success("有效期修改成功")
  765. this.expireVisible = false
  766. this.getCourseGroup()
  767. this.getList();
  768. } else {
  769. this.$message.error(res.msg)
  770. }
  771. })
  772. } else {
  773. return;
  774. }
  775. });
  776. },
  777. onMarkAttendance (item) {
  778. // 补考勤
  779. this.markAttendance = {
  780. status: true,
  781. dataInfo: item
  782. };
  783. },
  784. batchAdjustmentTime () {
  785. let tempData = this.markAttendance.dataInfo;
  786. let params = {
  787. teacherId: tempData.actualTeacherId,
  788. courseScheduleId: tempData.id,
  789. signInStatus: 1,
  790. signOutStatus: 1
  791. };
  792. updateTeacherAttendance(params).then(res => {
  793. if (res.code == 200) {
  794. this.$message.success("补卡成功");
  795. this.markAttendance.status = false;
  796. this.getList();
  797. } else {
  798. this.$message.error(res.msg);
  799. }
  800. });
  801. },
  802. getList () {
  803. // 乔乔说后台分页数据是假的所以不分页 page: this.rules.page, rows: this.rules.limit this.rules.total = res.data.pageInfo.total;
  804. findPracticeGroupCourseSchedules({ practiceId: this.practiceId, }).then(
  805. res => {
  806. if (res.code == 200) {
  807. this.tableList = res.data.pageInfo.rows;
  808. }
  809. }
  810. );
  811. },
  812. goBack () {
  813. this.$router.push({
  814. path: "/business/accompany",
  815. query: { rules: this.Frules, searchForm: this.FsearchForm }
  816. });
  817. },
  818. teacherClose () {
  819. this.isMultiple = false;
  820. this.teacherForm.teacher = null;
  821. this.teacherVisible = false;
  822. },
  823. handleClose () {
  824. this.courseVisible = false;
  825. this.startTime = "";
  826. this.maskForm = {
  827. date: "",
  828. startTime: "",
  829. id: ""
  830. };
  831. this.$refs["maskForm"].resetFields();
  832. },
  833. expireClose () {
  834. this.expireVisible = false;
  835. this.expireForm.coursesExpireDate = null
  836. this.$refs["expireForm"].resetFields();
  837. },
  838. submitResetClass () {
  839. // endClassTimeStr: this.maskForm.endTime,
  840. if (!this.startTime) {
  841. this.$message.error("请填写修改时间");
  842. return;
  843. }
  844. let obj = {
  845. startClassTime: dayjs(this.maskForm.date + ' ' + this.startTime).format('YYYY-MM-DD HH:mm:ss'),
  846. id: this.maskForm.id,
  847. classDate: this.maskForm.date,
  848. groupType: 'PRACTICE'
  849. };
  850. resetCourse(obj).then(res => {
  851. if (res.code == 200) {
  852. this.$message.success("修改成功");
  853. this.courseVisible = false;
  854. this.getList();
  855. } //else {
  856. // this.$message.error(res.msg)
  857. // }
  858. });
  859. },
  860. resetClass (row) {
  861. /**
  862. * maskForm.startTime
  863. *
  864. */
  865. this.maskForm.date = dayjs(row.classDate).format('YYYY-MM-DD');
  866. this.startTime = row.startClassTimeStr.substring(0, 5);
  867. this.maskForm.endTime = row.endClassTimeStr.substring(0, 5);
  868. this.maskForm.id = row.id;
  869. this.coursesExpireDate = row.coursesExpireDate;
  870. // 修改课时
  871. this.courseVisible = true;
  872. },
  873. resetTeacher (row) {
  874. // 单节课
  875. this.isMultiple = false;
  876. this.activeRow = row;
  877. this.teacherForm.teacher = row.actualTeacherId;
  878. this.teacherVisible = true;
  879. },
  880. resetTeachers () {
  881. // 课程组
  882. this.isMultiple = true;
  883. this.teacherForm.teacher = this.courseData[0].userId;
  884. this.teacherForm.name = this.courseData[0].name;
  885. this.teacherForm.subjectId = this.courseData[0].subjectId;
  886. this.teacherForm.educationalTeacherId = this.courseData[0].educationalTeacherId || null;
  887. this.teacherVisible = true;
  888. },
  889. // 提交课程组修改
  890. subresetTeacher () {
  891. this.$refs.teacherForm.validate(some => {
  892. if (some) {
  893. if (this.isMultiple) {
  894. // 修改课程组老师
  895. practiceGroupTeacherAdjust({
  896. practiceGroupId: this.practiceId,
  897. teacherId: this.teacherForm.teacher,
  898. subjectId: this.teacherForm.subjectId,
  899. educationalTeacherId: this.teacherForm.educationalTeacherId
  900. }).then(res => {
  901. if (res.code == 200) {
  902. this.$message.success("修改成功");
  903. this.getCourseGroup();
  904. this.getList();
  905. this.teacherVisible = false;
  906. }
  907. });
  908. } else {
  909. // 修改单节课老师
  910. practiceCourseTeacherAdjust({
  911. courseScheduleId: this.activeRow.id,
  912. teacherId: this.teacherForm.teacher
  913. }).then(res => {
  914. if (res.code == 200) {
  915. this.$message.success("修改成功");
  916. this.getList();
  917. this.teacherVisible = false;
  918. }
  919. });
  920. }
  921. } else {
  922. return;
  923. }
  924. });
  925. },
  926. coursesDate () {
  927. let self = this;
  928. return {
  929. firstDayOfWeek: 1,
  930. disabledDate: time => {
  931. // if (self.leftForm.courseStart) {
  932. // let date = new Date(self.leftForm.courseStart.replace(/-/, "/"));
  933. // coursesExpireDate
  934. let date = new Date(this.coursesExpireDate.replace(/-/, "/"));
  935. return time.getTime() > date.getTime();
  936. // }
  937. // return;
  938. }
  939. };
  940. },
  941. // 是否允许批量调整
  942. isDisabled (row, index) {
  943. // || !row.isCallNames
  944. if (row.isSettlement) {
  945. return false;
  946. } else {
  947. return true;
  948. }
  949. },
  950. onCourseExpireDate () {
  951. // 修改课程有效期
  952. },
  953. adjustment () {
  954. this.adjustmentName = "批量调整";
  955. this.isaddCourse = false;
  956. if (this.adjustmentForm.count <= 0) {
  957. this.$message.error("请至少勾选一节课");
  958. } else {
  959. this.adjustmentVisible = true;
  960. }
  961. },
  962. changeSound (val) {
  963. if (val) {
  964. this.subjectList.forEach(item => {
  965. if (item.id == val) {
  966. let strArr = this.teacherForm.name.split("•");
  967. this.teacherForm.name = item.name + "•" + strArr[1];
  968. }
  969. });
  970. }
  971. },
  972. addWeek () {
  973. // 添加循环周期
  974. this.weekList.push({
  975. dayOfWeek: "",
  976. startClassTime: "",
  977. endClassTime: "",
  978. id: new Date()
  979. });
  980. },
  981. // 删除循环周
  982. removeWeek (item) {
  983. for (let i in this.weekList) {
  984. if (this.weekList[i].id == item.id) {
  985. this.weekList.splice(i, 1);
  986. }
  987. }
  988. },
  989. // 批量调整
  990. submitAdjustment () {
  991. this.$refs["adjustmentForm"].validate(item => {
  992. if (item) {
  993. let week = this.weekList;
  994. if (!week[0] || !week[0].startClassTime || !week[0].dayOfWeek) {
  995. this.$message.error("至少排一节课");
  996. return;
  997. }
  998. // 开始
  999. let obj = {};
  1000. let idArr = this.activeList.map(item => {
  1001. return item.id;
  1002. });
  1003. // courseScheduleIdList
  1004. let courseScheduleIdList = idArr;
  1005. obj.courseScheduleIdList = courseScheduleIdList;
  1006. obj.startDate = this.adjustmentForm.courseTime;
  1007. obj.coursesTimes = this.adjustmentForm.addCount;
  1008. obj.teachingArrangementList = this.weekList;
  1009. obj.isJumpHoliday = this.adjustmentForm.checked;
  1010. obj.musicGroupId = this.practiceId;
  1011. obj.teachMode = "ONLINE";
  1012. obj.type = "PRACTICE";
  1013. batchUpdateCourseSchedule(obj).then(res => {
  1014. if (res.code == 200) {
  1015. this.$message.success("恭喜您修改成功");
  1016. this.adjustmentVisible = false;
  1017. this.getList();
  1018. }
  1019. });
  1020. }
  1021. });
  1022. },
  1023. handleSelectionChange (val) {
  1024. this.adjustmentForm.count = val.length;
  1025. this.activeList = val;
  1026. },
  1027. clearAttend (row) {
  1028. this.$confirm("是否清除考勤记录?", "提示", {
  1029. confirmButtonText: "确定",
  1030. cancelButtonText: "取消",
  1031. type: "warning"
  1032. })
  1033. .then(() => {
  1034. cleanAttendance({ courseScheduleIds: row.id }).then(res => {
  1035. if (res.code == 200) {
  1036. this.$message.success("清除成功");
  1037. this.getList();
  1038. } else {
  1039. this.$message.error(res.msg);
  1040. }
  1041. });
  1042. })
  1043. .catch(() => { });
  1044. },
  1045. // 网管课加课弹窗
  1046. addCourse () {
  1047. this.adjustmentName = "网管课加课";
  1048. this.isaddCourse = true;
  1049. this.adjustmentVisible = true;
  1050. },
  1051. // 网管课加课提交
  1052. addCourseSubmit () {
  1053. this.$refs["adjustmentForm"].validate(item => {
  1054. if (item) {
  1055. let week = this.weekList;
  1056. if (!week[0] || !week[0].startClassTime || !week[0].dayOfWeek) {
  1057. this.$message.error("至少排一节课");
  1058. return;
  1059. }
  1060. // 开始
  1061. let obj = {};
  1062. obj.startDate = this.adjustmentForm.courseTime;
  1063. obj.coursesTimes = this.adjustmentForm.addCount;
  1064. obj.teachingArrangementList = this.weekList;
  1065. obj.isJumpHoliday = this.adjustmentForm.checked;
  1066. obj.musicGroupId = this.practiceId;
  1067. obj.teachMode = "ONLINE";
  1068. obj.type = "PRACTICE";
  1069. batchAddCourses(obj).then(res => {
  1070. if (res.code == 200) {
  1071. this.$message.success("恭喜您添加成功");
  1072. this.adjustmentVisible = false;
  1073. this.getList();
  1074. }
  1075. });
  1076. }
  1077. });
  1078. },
  1079. // 删除
  1080. removeClass (row) {
  1081. this.$confirm("是否删除该课程?", "提示", {
  1082. confirmButtonText: "确定",
  1083. cancelButtonText: "取消",
  1084. type: "warning"
  1085. }).then(() => {
  1086. bathDelete({ courseScheduleIds: row.id }).then(res => {
  1087. if (res.code == 200) {
  1088. this.$message.success("删除成功");
  1089. this.getList();
  1090. }
  1091. });
  1092. });
  1093. },
  1094. changeStartTime (val) {
  1095. this.$nextTick(res => {
  1096. if (val) {
  1097. this.$set(this.maskForm, 'endTime', addTimerFormMinute(this.maskForm.date, val, this.accompanTime))
  1098. } else {
  1099. this.$set(this.maskForm, 'endTime', '')
  1100. }
  1101. })
  1102. },
  1103. changeStartTimes (val, item) {
  1104. this.$nextTick(res => {
  1105. if (val) {
  1106. let str = dayjs(new Date()).format('YYYY-MM-DD')
  1107. this.$set(item, 'endClassTime', addTimerFormMinute(str, val, this.accompanTime))
  1108. } else {
  1109. this.$set(item, 'endClassTime', '')
  1110. }
  1111. })
  1112. }
  1113. },
  1114. filters: {
  1115. studentCallName: value => {
  1116. let template = {
  1117. NORMAL: "到课",
  1118. TRUANT: "未到",
  1119. LEAVE: "请假",
  1120. DROP_OUT: "退学",
  1121. '': '未到'
  1122. }
  1123. return template[value]
  1124. }
  1125. },
  1126. watch: {
  1127. adjustmentVisible (val) {
  1128. if (!val) {
  1129. this.$refs.adjustmentForm.resetFields();
  1130. }
  1131. }
  1132. }
  1133. };
  1134. </script>
  1135. <style lang="scss" scoped>
  1136. .titlewrap {
  1137. display: flex;
  1138. flex-direction: row;
  1139. justify-content: flex-start;
  1140. align-items: center;
  1141. }
  1142. .wrap {
  1143. display: flex;
  1144. flex-direction: row;
  1145. justify-content: flex-start;
  1146. div {
  1147. margin-right: 20px;
  1148. }
  1149. }
  1150. .countWrap {
  1151. /deep/.el-date-editor.el-input,
  1152. /deep/.el-date-editor.el-input__inner {
  1153. width: 100px !important;
  1154. }
  1155. }
  1156. </style>