courseList.vue 33 KB

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