courseList.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960
  1. <template>
  2. <div class="cl-container">
  3. <!-- 搜索类型 -->
  4. <save-form :inline="true"
  5. save-key='teamDetails-courseList'
  6. class="searchForm"
  7. ref='searchForm'
  8. :model="searchForm" @submit="search" @reset="onReSet">
  9. <el-form-item prop="courseStatus">
  10. <el-select v-model.trim="searchForm.courseStatus"
  11. clearable
  12. filterable
  13. placeholder="课程类型">
  14. <el-option v-for="(item, index) in courseArray"
  15. :key="index"
  16. :label="item.label"
  17. :value="item.value"></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item prop="classStatus">
  21. <el-select v-model.trim="searchForm.classStatus"
  22. clearable
  23. filterable
  24. placeholder="课程状态">
  25. <el-option label="未开始"
  26. value="NOT_START"></el-option>
  27. <el-option label="进行中"
  28. value="UNDERWAY"></el-option>
  29. <el-option label="已结束"
  30. value="OVER"></el-option>
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item prop="class">
  34. <!-- getMusicGroupAllClass -->
  35. <el-select v-model.trim="searchForm.class"
  36. placeholder="班级名称"
  37. filterable
  38. clearable>
  39. <el-option v-for="(item,index) in classList"
  40. :key="index"
  41. :value="item.id"
  42. :label="item.name"></el-option>
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item prop="isSettlement">
  46. <el-select v-model.trim="searchForm.isSettlement"
  47. placeholder="是否结算"
  48. filterable
  49. clearable>
  50. <el-option value="0"
  51. label="未结算"></el-option>
  52. <el-option value="1"
  53. label="已结算"></el-option>
  54. </el-select>
  55. </el-form-item>
  56. <el-form-item prop="timer">
  57. <el-date-picker v-model.trim="searchForm.timer"
  58. style="width:420px;"
  59. type="daterange"
  60. value-format="yyyy-MM-dd"
  61. range-separator="至"
  62. start-placeholder="课程开始日期"
  63. end-placeholder="课程结束日期"
  64. :picker-options="{
  65. firstDayOfWeek: 1
  66. }"></el-date-picker>
  67. </el-form-item>
  68. <el-form-item>
  69. <el-button native-type="submit" type="danger">搜索</el-button>
  70. <el-button type="primary" native-type="reset">重置</el-button>
  71. </el-form-item>
  72. </save-form>
  73. <div class="btnWraps">
  74. <!-- <div class="newBand"
  75. @click="removeCourses"
  76. v-permission="'courseSchedule/batchDelete'">批量删除</div> -->
  77. <!-- <div class="newBand"
  78. @click="resetTimer">修改日期</div>-->
  79. </div>
  80. <!-- -->
  81. <!-- 列表 -->
  82. <div class="tableWrap">
  83. <el-table :data="tableList"
  84. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  85. @selection-change="handleSelectionChange">
  86. <el-table-column type="selection"
  87. width="55"
  88. :selectable="checkSelectable"></el-table-column>
  89. <el-table-column align='center'
  90. prop="courseScheduleId"
  91. label="课程编号"></el-table-column>
  92. <el-table-column align="center"
  93. width="180px"
  94. label="时间">
  95. <template slot-scope="scope">{{ scope.row.classDate }} {{ scope.row.startClassTime ? scope.row.startClassTime.substr(0, 5) : '' }}-{{ scope.row.endClassTime ? scope.row.endClassTime.substr(0, 5) : '' }}</template>
  96. </el-table-column>
  97. <el-table-column align="center"
  98. prop="courseScheduleName"
  99. label="课程名称"></el-table-column>
  100. </el-table-column>
  101. <el-table-column align="center"
  102. prop="courseScheduleType"
  103. label="课程类型">
  104. <template slot-scope="scope">
  105. <div>{{ scope.row.courseScheduleType | coursesType}}</div>
  106. </template>
  107. </el-table-column>
  108. <el-table-column align="center"
  109. prop="courseScheduleStatus"
  110. label="课程状态">
  111. <template slot-scope="scope">
  112. <div>{{ scope.row.courseScheduleStatus | coursesStatus }}</div>
  113. </template>
  114. </el-table-column>
  115. <el-table-column align="center"
  116. label="老师签到">
  117. <template slot-scope="scope">
  118. <div>{{ scope.row.signInStatus | attendanceType}}</div>
  119. </template>
  120. </el-table-column>
  121. <el-table-column align="center"
  122. label="老师签退">
  123. <template slot-scope="scope">
  124. <div>{{ scope.row.signOutStatus | attendanceOutType}}</div>
  125. </template>
  126. </el-table-column>
  127. <el-table-column align="center"
  128. prop="masterTeacherName"
  129. label="指导老师"></el-table-column>
  130. <el-table-column align="center"
  131. label="结算状态">
  132. <template slot-scope="scope">{{ scope.row.settlementTime ? '已结算' : '未结算' }}</template>
  133. </el-table-column>
  134. <el-table-column align="center"
  135. prop="remark"
  136. label="是否点名">
  137. <template slot-scope="scope">{{ scope.row.isCallNames ? '已点名' : '未点名' }}</template>
  138. </el-table-column>
  139. <el-table-column align="center"
  140. prop="remark"
  141. label="备注"></el-table-column>
  142. <el-table-column align="center"
  143. width="280px"
  144. label="操作"
  145. fixed="right">
  146. <template slot-scope="scope">
  147. <div>
  148. <!-- {child: 'teacherAttendance/updateTeacherAttendance', parent: '/teamDetails/courseList'} -->
  149. <el-button v-if="scope.row.courseScheduleStatus == 'OVER' && !scope.row.settlementTime && permission('teacherAttendance/updateTeacherAttendance?t=568')"
  150. type="text"
  151. @click="onMarkAttendance(scope.row)">补考勤</el-button>
  152. <el-button v-if="scope.row.courseScheduleStatus == 'OVER' && permission('studentAttendance/updateStudentAttendances?t=570')"
  153. type="text"
  154. @click="onCallName(scope.row)">点名表</el-button>
  155. <!-- OVER -->
  156. <!-- <el-button
  157. v-if="scope.row.courseScheduleStatus == 'OVER' && permission('courseSchedule/classStartDateAdjust1')"
  158. type="text"
  159. @click="resetClass(scope.row)"
  160. >调整</el-button>-->
  161. <el-button v-if="!scope.row.settlementTime && permission('courseSchedule/classStartDateAdjust')"
  162. type="text"
  163. @click="resetClass(scope.row)">调整</el-button>
  164. <!-- <el-button v-if="scope.row.courseScheduleStatus == 'NOT_START' && permission('courseSchedule/batchDelete')"
  165. type="text"
  166. @click="removeSingleClass(scope.row)">删除</el-button> -->
  167. <!-- v-if="scope.row.courseScheduleStatus == 'NOT_START' && permission('courseSchedule/batchDelete')" teamDetail/resetTpye-->
  168. <!-- <el-button type="text"
  169. @click="resetType(scope.row)"
  170. v-if="permission('teamDetail/resetTpye')&&scope.row.courseScheduleType!='HIGH_ONLINE'&&scope.row.courseScheduleType!='MUSIC_NETWORK'">类型调整</el-button> -->
  171. <el-button type="text"
  172. v-if="scope.row.courseScheduleStatus == 'OVER' && !scope.row.settlementTime &&permission('courseSchedule/cleanAttendance')"
  173. @click="clearAttend(scope.row)">清除考勤</el-button>
  174. </div>
  175. </template>
  176. </el-table-column>
  177. </el-table>
  178. <pagination
  179. save-key='teamDetails-courseList'
  180. sync
  181. :total.sync="rules.total"
  182. :page.sync="rules.page"
  183. :limit.sync="rules.limit"
  184. :page-sizes="rules.page_size"
  185. @pagination="getList" />
  186. </div>
  187. <el-dialog title="课程调整"
  188. width="400px"
  189. :before-close="handleClose"
  190. :visible.sync="courseVisible">
  191. <el-form :model="maskForm"
  192. v-if="courseVisible"
  193. class="maskForm"
  194. ref="maskForm"
  195. :rules="maskRules"
  196. label-position="right"
  197. label-width="120px"
  198. :inline="true">
  199. <el-form-item label="主教老师"
  200. prop="teacher">
  201. <remote-search :commit="'setTeachers'" v-model="maskForm.teacher" :width='220'/>
  202. </el-form-item>
  203. <el-form-item label="助教老师"
  204. v-if="maskForm.courseScheduleType != 'MUSIC_NETWORK'&&maskForm.courseScheduleType != 'HIGH_ONLINE'"
  205. prop="assistant">
  206. <remote-search :commit="'setTeachers'" v-model="maskForm.assistant" :width='220' :multiple='true'/>
  207. </el-form-item>
  208. <el-form-item label="上课日期"
  209. prop="date">
  210. <el-date-picker v-model.trim="maskForm.date"
  211. type="date"
  212. :picker-options="beginDate()"
  213. @change="changeDate"
  214. value-format="yyyy-MM-dd"
  215. placeholder="选择日期"></el-date-picker>
  216. </el-form-item>
  217. <el-form-item label="课程时长"
  218. v-if="courseVisible"
  219. prop="timer">
  220. <el-select v-model="maskForm.timer" @change="changeTime">
  221. <el-option v-for="(item,index) in typeTimeList"
  222. :key="index"
  223. :value="parseInt(item)"
  224. :label="item"></el-option>
  225. </el-select>
  226. </el-form-item>
  227. <el-form-item label="开始时间"
  228. v-if="courseVisible"
  229. prop="startTime">
  230. <el-time-picker placeholder="起始时间"
  231. v-model.trim="maskForm.startTime"
  232. @change="changeStartTime"
  233. format='HH:mm'
  234. value-format='HH:mm'
  235. :picker-options="{
  236. selectableRange: `${nowTime} - 23:30:00`,
  237. }"
  238. ></el-time-picker>
  239. </el-form-item>
  240. <el-form-item label="结束时间"
  241. v-if="courseVisible"
  242. prop="endTime">
  243. <el-time-select placeholder="结束时间"
  244. v-model.trim="maskForm.endTime"
  245. disabled
  246. :picker-options="{
  247. start: '04:30',
  248. step: '00:05',
  249. end: '23:30',
  250. minTime: maskForm.startTime
  251. }"></el-time-select>
  252. </el-form-item>
  253. <el-form-item label="教学地点"
  254. prop="schoolId"
  255. v-if="maskForm.courseScheduleType != 'HIGH_ONLINE'&&maskForm.courseScheduleType != 'MUSIC_NETWORK'">
  256. <el-select v-model.trim="
  257. maskForm.schoolId"
  258. style="width:220px!important"
  259. filterable
  260. clearable>
  261. <el-option v-for="(item,index) in schoolList"
  262. :key="index"
  263. :value="item.id"
  264. :label="item.name"></el-option>
  265. </el-select>
  266. </el-form-item>
  267. </el-form>
  268. <div slot="footer"
  269. class="dialog-footer">
  270. <el-button @click="courseVisible = false">取 消</el-button>
  271. <el-button type="primary"
  272. @click="submitResetClass">确 定</el-button>
  273. </div>
  274. </el-dialog>
  275. <el-dialog title="修改时间"
  276. width="400px"
  277. :before-close="handleCloseTimer"
  278. :visible.sync="timerVisible">
  279. <el-form :model="timerMask">
  280. <el-form-item label="上课日期"
  281. :rules=" [{ required: true, message: '请选择日期', trigger: 'blur' },]">
  282. <el-date-picker v-model.trim="timerMask.timer"
  283. type="date"
  284. format="yyyy-MM-dd"
  285. value-format="yyyy-MM-dd"
  286. :picker-options="{
  287. firstDayOfWeek:1
  288. }"
  289. placeholder="选择日期"></el-date-picker>
  290. </el-form-item>
  291. </el-form>
  292. <div slot="footer"
  293. class="dialog-footer">
  294. <el-button @click="timerVisible = false">取 消</el-button>
  295. <el-button type="primary"
  296. @click="batchAdjustmentTime">确 定</el-button>
  297. </div>
  298. </el-dialog>
  299. <el-dialog title="补考勤"
  300. width="400px"
  301. :visible.sync="markAttendance.status">
  302. <el-form>
  303. <el-form-item label="签到状态">{{ markAttendance.dataInfo.signInStatus | attendanceType }}</el-form-item>
  304. <el-form-item label="签到时间">{{ markAttendance.dataInfo.signInTime}}</el-form-item>
  305. <el-form-item label="签退状态">{{ markAttendance.dataInfo.signOutStatus | attendanceOutType }}</el-form-item>
  306. <el-form-item label="签退时间">{{ markAttendance.dataInfo.signOutTime}}</el-form-item>
  307. </el-form>
  308. <div slot="footer"
  309. class="dialog-footer">
  310. <el-button @click="markAttendance.status = false">取 消</el-button>
  311. <el-button type="primary"
  312. :disabled="markAttendance.dataInfo.signOutStatus == 1 && markAttendance.dataInfo.signInStatus == 1 ? true : false"
  313. @click="batchAdjustmentTime">确定补卡</el-button>
  314. </div>
  315. </el-dialog>
  316. <el-dialog title="点名表"
  317. width="800px"
  318. :visible.sync="rollCall.status">
  319. <el-table :data="rollCall.gridData">
  320. <el-table-column align="center"
  321. property="userName"
  322. label="学员姓名"></el-table-column>
  323. <el-table-column align="center"
  324. property="phone"
  325. label="手机号"></el-table-column>
  326. <el-table-column align="center"
  327. property="subjectName"
  328. label="学员声部"></el-table-column>
  329. <el-table-column align="center"
  330. label="到课状态">
  331. <template slot-scope="scope">{{ scope.row.status | studentCallName }}</template>
  332. </el-table-column>
  333. <el-table-column align="center"
  334. v-if="!rollCall.selectItem.settlementTime"
  335. label="操作"
  336. width="240px">
  337. <template slot-scope="scope">
  338. <el-button size="small"
  339. @click="onChangeRollCall('TRUANT', scope.row)"
  340. type="primary"
  341. round>未到</el-button>
  342. <el-button size="small"
  343. @click="onChangeRollCall('LEAVE', scope.row)"
  344. type="warning"
  345. round>请假</el-button>
  346. <el-button size="small"
  347. @click="onChangeRollCall('NORMAL', scope.row)"
  348. type="success"
  349. round>到课</el-button>
  350. </template>
  351. </el-table-column>
  352. </el-table>
  353. <pagination
  354. sync
  355. :total.sync="rollCall.total"
  356. :page.sync="rollCall.page"
  357. :limit.sync="rollCall.limit"
  358. :page-sizes="rollCall.page_size"
  359. @pagination="getCallName" />
  360. </el-dialog>
  361. </div>
  362. </template>
  363. <script>
  364. import dayjs from "dayjs";
  365. import pagination from "@/components/Pagination/index";
  366. import { bathDelete } from "@/api/vipSeting";
  367. import {
  368. getCourseList,
  369. findMusicGroupClassTeacher,
  370. resetCourse,
  371. getTeacher,
  372. getMusicGroupAllClass,
  373. getCourseSchedule,
  374. batchAdjustment,
  375. updateTeacherAttendance,
  376. findAttendanceStudentByCourseWithPage,
  377. updateStudentAttendances,
  378. cleanAttendance,
  379. getOrganCourseDurationSettings,
  380. } from "@/api/buildTeam";
  381. import { permission } from "@/utils/directivePage";
  382. import { diffTimerFormMinute, addTimerFormMinute } from "@/utils/date";
  383. import { classTimeList, musicCourseType } from "@/utils/searchArray";
  384. import { getSchool } from "@/api/systemManage";
  385. import cleanDeep from "clean-deep";
  386. let that
  387. export default {
  388. name: "tcourseList",
  389. data() {
  390. return {
  391. classTimeList,
  392. courseArray: musicCourseType,
  393. typeVisible: false,
  394. timerVisible: false,
  395. courseVisible: false,
  396. searchForm: {
  397. courseStatus: "", // 课程类型
  398. classStatus: "", // 课程状态
  399. timer: [], // 时间
  400. class: "",
  401. isSettlement: "",
  402. },
  403. tableList: [],
  404. searchLsit: [],
  405. rules: {
  406. // 分页规则
  407. limit: 10, // 限制显示条数
  408. page: 1, // 当前页
  409. total: 0, // 总条数
  410. page_size: [10, 20, 40, 50], // 选择限制显示条数
  411. },
  412. maskForm: {
  413. teacher: "",
  414. assistant: "",
  415. date: "",
  416. id: "",
  417. startTime: "",
  418. endTime: "",
  419. type: "",
  420. timer: "",
  421. courseScheduleType: null,
  422. address: "",
  423. teachMode: "",
  424. schoolId: "",
  425. },
  426. typeForm: {
  427. teacher: "",
  428. assistant: "",
  429. date: "",
  430. startTime: "",
  431. endTime: "",
  432. type: null,
  433. id: null,
  434. },
  435. maskRules: {
  436. schoolId: [
  437. { required: true, message: "请选教学地点", trigger: "blur" },
  438. ],
  439. teacher: [
  440. { required: true, message: "请选择主教老师名称", trigger: "blur" },
  441. ],
  442. date: [{ required: true, message: "请选择上课时间", trigger: "blur" }],
  443. // startTime: [{ required: true, message: '请选择上课开始时间', trigger: 'blur' },],
  444. // endTime: [{ required: true, message: '请选择上课结束时间', trigger: 'blur' },],
  445. },
  446. typeRules: {
  447. type: [{ required: true, message: "请选择课程类型", trigger: "blur" }],
  448. },
  449. teacherList: [],
  450. classList: [],
  451. activeCourseList: [],
  452. timerMask: {
  453. timer: "",
  454. },
  455. markAttendance: {
  456. // 考勤状态
  457. status: false,
  458. dataInfo: {},
  459. },
  460. rollCall: {
  461. // 点名表
  462. status: false,
  463. gridData: [],
  464. selectItem: {}, // 选中状态
  465. limit: 10, // 限制显示条数
  466. page: 1, // 当前页
  467. total: 0, // 总条数
  468. page_size: [10, 20, 40, 50], // 选择限制显示条数
  469. },
  470. organId: "",
  471. schoolList: [],
  472. courseTimeList: {},
  473. typeTimeList: [],
  474. };
  475. },
  476. components: {
  477. pagination,
  478. },
  479. created(){
  480. that = this;
  481. },
  482. mounted() {
  483. this.init();
  484. getSchool({ organId: this.$route.query.organId }).then((res) => {
  485. if (res.code == 200) {
  486. this.schoolList = res.data;
  487. }
  488. });
  489. },
  490. activated() {
  491. this.init();
  492. },
  493. methods: {
  494. async init() {
  495. this.teamid = this.$route.query.id;
  496. this.organId = this.$route.query.organId;
  497. try {
  498. const res = await getOrganCourseDurationSettings({
  499. organId: this.organId,
  500. });
  501. this.courseTimeList = res.data;
  502. } catch {}
  503. // MusicStore.dispatch('getBaseInfo', {
  504. // data: { musicGroupId: this.teamid }
  505. // }).then((res) => {
  506. // console.log(res)
  507. // })
  508. this.getList();
  509. // 获取所有老师
  510. // findMusicGroupClassTeacher({ musicGroupId: this.teamid }).then(res => {
  511. // if (res.code == 200) {
  512. // this.teacherList = res.data;
  513. // }
  514. // })
  515. // getTeacher().then(res => {
  516. // if (res.code == 200) {
  517. // this.teacherList = res.data;
  518. // }
  519. // });
  520. // 获取班级列表
  521. getMusicGroupAllClass({ musicGroupId: this.teamid }).then((res) => {
  522. if (res.code == 200) {
  523. this.classList = res.data;
  524. }
  525. });
  526. },
  527. onMarkAttendance(item) {
  528. // 补考勤
  529. this.markAttendance = {
  530. status: true,
  531. dataInfo: item,
  532. };
  533. },
  534. onCallName(item) {
  535. // 点名表
  536. this.rollCall.page = 1;
  537. this.rollCall.selectItem = item;
  538. this.getCallName();
  539. },
  540. getCallName() {
  541. let rollCall = this.rollCall;
  542. let params = {
  543. page: rollCall.page,
  544. rows: rollCall.limit,
  545. courseScheduleId: rollCall.selectItem.courseScheduleId,
  546. };
  547. findAttendanceStudentByCourseWithPage(params).then((res) => {
  548. let result = res.data;
  549. rollCall.status = true;
  550. if (res.code == 200) {
  551. rollCall.gridData = result.rows;
  552. rollCall.total = result.total;
  553. }
  554. });
  555. },
  556. onChangeRollCall(type, row) {
  557. let rollCall = this.rollCall;
  558. let params = {
  559. courseScheduleId: rollCall.selectItem.courseScheduleId,
  560. studentAttendances: [
  561. {
  562. userId: row.studentId,
  563. status: type,
  564. },
  565. ],
  566. };
  567. updateStudentAttendances(params).then((res) => {
  568. if (res.code == 200) {
  569. this.$message.success("修改成功");
  570. row.status = type;
  571. this.getList();
  572. } else {
  573. this.$message.error(res.msg);
  574. }
  575. });
  576. },
  577. permission(str, parent) {
  578. return permission(str, parent);
  579. },
  580. search() {
  581. this.rules.page = 1;
  582. this.getList();
  583. },
  584. getList() {
  585. let searchForm = this.searchForm;
  586. if (!searchForm.timer) {
  587. searchForm.timer = [];
  588. }
  589. let obj = {
  590. classScheduleStatus: searchForm.classStatus || null,
  591. classScheduleType: searchForm.courseStatus || null,
  592. musicGroupId: this.teamid,
  593. startTime: searchForm.timer[0] || null,
  594. endTime: searchForm.timer[1] || null,
  595. page: this.rules.page,
  596. rows: this.rules.limit,
  597. classGroupId: searchForm.class || null,
  598. isSettlement: searchForm.isSettlement || null,
  599. };
  600. getCourseSchedule(obj).then((res) => {
  601. if (res.code == 200) {
  602. this.tableList = res.data.rows;
  603. this.rules.total = res.data.total;
  604. }
  605. });
  606. },
  607. resetClass(row) {
  608. this.maskForm.teacher = parseInt(row.masterTeacherId);
  609. this.maskForm.courseScheduleType = row.courseScheduleType;
  610. // this.courseTimeList
  611. for (let key in this.courseTimeList) {
  612. if (key == row.courseScheduleType) {
  613. this.typeTimeList = this.courseTimeList[key].split(",");
  614. }
  615. }
  616. // this.maskForm.type = row.courseScheduleType;
  617. this.maskForm.assistant = [];
  618. for (let i in row.teachingTeachers) {
  619. if (row.teachingTeachers[i].teacherRole == "TEACHING") {
  620. this.maskForm.assistant.push(row.teachingTeachers[i].userId);
  621. }
  622. }
  623. this.maskForm.date = row.classDate;
  624. this.$set(
  625. this.maskForm,
  626. "startTime",
  627. row.startClassTimeStr.substring(0, 5)
  628. );
  629. let time = diffTimerFormMinute(
  630. row.classDate,
  631. row.startClassTimeStr,
  632. row.endClassTimeStr
  633. );
  634. this.maskForm.timer = time;
  635. this.maskForm.endTime = addTimerFormMinute(
  636. row.classDate,
  637. row.startClassTimeStr,
  638. time
  639. );
  640. // this.maskForm.endTime = row.endClassTimeStr.substring(0, 5);
  641. this.maskForm.id = row.courseScheduleId;
  642. this.maskForm.schoolId = row.schoolId;
  643. this.courseVisible = true;
  644. // 修改课时
  645. // let obj = {
  646. // actualTeacherId: this.maskForm.teacher,
  647. // classDate: this.maskForm.date,
  648. // classGroupId: row.id
  649. // }
  650. },
  651. removeSingleClass(row) {
  652. this.$confirm("是否删除该课程?", "提示", {
  653. confirmButtonText: "确定",
  654. cancelButtonText: "取消",
  655. type: "warning",
  656. })
  657. .then(() => {
  658. let courseScheduleIds = row.courseScheduleId;
  659. bathDelete({ courseScheduleIds }).then((res) => {
  660. if (res.code == 200) {
  661. this.$message.success("删除成功");
  662. this.getList();
  663. }
  664. });
  665. })
  666. .catch(() => {});
  667. },
  668. removeCourses() {
  669. // 批量删除
  670. if (this.activeCourseList.length < 1) {
  671. this.$message.error("请至少选择一节课");
  672. return;
  673. }
  674. let arr = [];
  675. arr = this.activeCourseList.map((item) => {
  676. return item.courseScheduleId;
  677. });
  678. this.$confirm("是否删除该课程?", "提示", {
  679. confirmButtonText: "确定",
  680. cancelButtonText: "取消",
  681. type: "warning",
  682. })
  683. .then(() => {
  684. let courseScheduleIds = arr.join(",");
  685. bathDelete({ courseScheduleIds }).then((res) => {
  686. if (res.code == 200) {
  687. this.$message.success("删除成功");
  688. this.getList();
  689. }
  690. });
  691. })
  692. .catch(() => {});
  693. },
  694. submitResetClass() {
  695. let maskForm = this.maskForm;
  696. if (!maskForm.startTime || !maskForm.endTime) {
  697. this.$message.error("请填写开始时间或结束时间");
  698. return;
  699. }
  700. this.$confirm("是否确定?", "提示", {
  701. confirmButtonText: "确定",
  702. cancelButtonText: "取消",
  703. type: "warning",
  704. })
  705. .then(() => {
  706. let teachingTeacherIdList = maskForm.assistant.join(",");
  707. if (teachingTeacherIdList.length <= 0) {
  708. let teachingTeacherIdList = null;
  709. }
  710. let obj = {
  711. actualTeacherId: maskForm.teacher,
  712. startClassTimeStr: maskForm.startTime,
  713. endClassTimeStr: maskForm.endTime,
  714. id: maskForm.id,
  715. teachingTeacherIdList,
  716. classDate: maskForm.date,
  717. type: maskForm.type,
  718. groupType: "MUSIC",
  719. schoolId: maskForm.schoolId,
  720. };
  721. resetCourse(cleanDeep(obj)).then((res) => {
  722. if (res.code == 200) {
  723. this.$message.success("修改成功");
  724. this.getList();
  725. this.courseVisible = false;
  726. }
  727. });
  728. })
  729. .catch(() => {});
  730. },
  731. handleClose() {
  732. this.courseVisible = false;
  733. (this.maskForm = {
  734. teacher: "",
  735. assistant: "",
  736. date: "",
  737. id: "",
  738. startTime: "",
  739. endTime: "",
  740. schoolId: null,
  741. }),
  742. this.$refs["maskForm"].resetFields();
  743. },
  744. handleSelectionChange(val) {
  745. this.activeCourseList = val;
  746. },
  747. checkSelectable(val) {
  748. return val.courseScheduleStatus == "NOT_START";
  749. // return true;
  750. },
  751. batchAdjustmentTime() {
  752. let tempData = this.markAttendance.dataInfo;
  753. let params = {
  754. teacherId: tempData.masterTeacherId,
  755. courseScheduleId: tempData.courseScheduleId,
  756. signInStatus: 1,
  757. signOutStatus: 1,
  758. };
  759. updateTeacherAttendance(params).then((res) => {
  760. if (res.code == 200) {
  761. this.$message.success("补卡成功");
  762. this.markAttendance.status = false;
  763. this.getList();
  764. } else {
  765. this.$message.error(res.msg);
  766. }
  767. });
  768. },
  769. handleCloseTimer() {
  770. this.timerVisible = false;
  771. this.timerMask.timer = "";
  772. },
  773. resetTimer() {
  774. if (this.activeCourseList.length < 1) {
  775. this.$message.error("请至少选择一节课");
  776. return;
  777. }
  778. this.timerVisible = true;
  779. },
  780. resetType(row) {
  781. this.typeForm.type = row.courseScheduleType;
  782. this.typeForm.id = row.courseScheduleId;
  783. this.typeForm.teacher = parseInt(row.masterTeacherId);
  784. // this.maskForm.type = row.courseScheduleType;
  785. this.typeForm.assistant = [];
  786. for (let i in row.teachingTeachers) {
  787. if (row.teachingTeachers[i].teacherRole == "TEACHING") {
  788. this.typeForm.assistant.push(row.teachingTeachers[i].userId);
  789. }
  790. }
  791. this.typeForm.date = row.classDate;
  792. this.$set(
  793. this.typeForm,
  794. "startTime",
  795. row.startClassTimeStr.substring(0, 5)
  796. );
  797. this.typeForm.endTime = row.endClassTimeStr.substring(0, 5);
  798. // console.log(row.type)
  799. this.typeVisible = true;
  800. },
  801. submitResetType() {
  802. this.$refs.typeForm.validate((res) => {
  803. if (res) {
  804. let teachingTeacherIdList = this.typeForm.assistant.join(",");
  805. if (teachingTeacherIdList.length <= 0) {
  806. let teachingTeacherIdList = null;
  807. }
  808. let obj = {
  809. actualTeacherId: this.typeForm.teacher,
  810. startClassTimeStr: this.typeForm.startTime,
  811. endClassTimeStr: this.typeForm.endTime,
  812. id: this.typeForm.id,
  813. type: this.typeForm.type,
  814. teachingTeacherIdList,
  815. classDate: this.typeForm.date,
  816. };
  817. resetCourse(obj).then((res) => {
  818. if (res.code == 200) {
  819. this.$message.success("修改成功");
  820. this.getList();
  821. this.typeVisible = false;
  822. }
  823. });
  824. }
  825. });
  826. },
  827. // 清除考勤
  828. clearAttend(row) {
  829. this.$confirm("是否清除考勤记录?", "提示", {
  830. confirmButtonText: "确定",
  831. cancelButtonText: "取消",
  832. type: "warning",
  833. })
  834. .then(() => {
  835. cleanAttendance({ courseScheduleIds: row.courseScheduleId }).then(
  836. (res) => {
  837. if (res.code == 200) {
  838. this.$message.success("清除成功");
  839. this.getList();
  840. } else {
  841. this.$message.error(res.msg);
  842. }
  843. }
  844. );
  845. })
  846. .catch(() => {});
  847. },
  848. changeStartTime(val) {
  849. this.$nextTick((res) => {
  850. this.maskForm.endTime = addTimerFormMinute(
  851. this.maskForm.date,
  852. val,
  853. this.maskForm.timer
  854. );
  855. });
  856. },
  857. changeTime(val) {
  858. this.$nextTick((res) => {
  859. this.maskForm.endTime = addTimerFormMinute(
  860. this.maskForm.date,
  861. this.maskForm.startTime,
  862. val
  863. );
  864. });
  865. },
  866. onReSet() {
  867. this.$refs.searchForm.resetFields();
  868. },
  869. beginDate() {
  870. return {
  871. firstDayOfWeek: 1,
  872. disabledDate(time) {
  873. return time.getTime() + 86400000 <= new Date().getTime();
  874. //开始时间不选时,结束时间最大值小于等于当天
  875. },
  876. };
  877. },
  878. changeDate(){
  879. this.maskForm.startTime = ''
  880. }
  881. },
  882. filters: {
  883. studentCallName: (value) => {
  884. let template = {
  885. NORMAL: "到课",
  886. TRUANT: "未到",
  887. LEAVE: "请假",
  888. DROP_OUT: "退学",
  889. "": "未到",
  890. };
  891. return template[value];
  892. },
  893. },
  894. watch: {
  895. "maskForm.timer"(val) {
  896. this.maskForm.endTime = addTimerFormMinute(
  897. this.maskForm.date,
  898. this.maskForm.startTime,
  899. val
  900. );
  901. },
  902. },
  903. computed: {
  904. nowTime() {
  905. // console.log(that.maskForm.date)
  906. let str = "04:30:00";
  907. if (that.maskForm.date == dayjs(new Date()).format("YYYY-MM-DD")) {
  908. str = dayjs(new Date()).format("HH:mm:ss");
  909. }
  910. return str;
  911. },
  912. },
  913. };
  914. </script>
  915. <style lang="scss" scoped>
  916. .cl-container {
  917. .topFrom {
  918. margin: 20px 30px 0;
  919. .classlist {
  920. display: flex;
  921. flex-direction: row;
  922. justify-content: flex-start;
  923. align-items: center;
  924. ul {
  925. li {
  926. list-style: none;
  927. }
  928. }
  929. }
  930. }
  931. // .searchForm {
  932. // // margin: 0 30px;
  933. // }
  934. }
  935. .btnWraps {
  936. display: flex;
  937. flex-direction: row;
  938. justify-content: flex-start;
  939. div {
  940. margin-right: 20px;
  941. }
  942. }
  943. .maskForm {
  944. /deep/.el-input {
  945. width: 220px;
  946. }
  947. }
  948. </style>