teamCourseList.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>课表列表
  5. </h2>
  6. <div class="m-core">
  7. <!-- 搜索类型 -->
  8. <save-form :inline="true"
  9. class="searchForm"
  10. @submit="search"
  11. @reset="reset"
  12. ref="searchForm"
  13. :model.sync="searchForm">
  14. <el-form-item>
  15. <el-input v-model.trim="searchForm.search"
  16. clearable
  17. placeholder="课程(组)编号/课程名称" />
  18. </el-form-item>
  19. <el-form-item>
  20. <el-select v-model.trim="searchForm.schoolId"
  21. clearable
  22. filterable
  23. placeholder="请选择教学点">
  24. <el-option v-for="(item, index) in selects.schools"
  25. :key="index"
  26. :value="item.id"
  27. :label="item.name"></el-option>
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item>
  31. <el-select v-model.trim="searchForm.teacherIdList"
  32. clearable
  33. filterable
  34. placeholder="请选择老师">
  35. <el-option v-for="(item, index) in selects.teachers"
  36. :key="index"
  37. :value="item.id"
  38. :label="item.realName"></el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item>
  42. <el-select class="multiple"
  43. v-model.trim="searchForm.organIdList"
  44. filterable
  45. clearable
  46. placeholder="请选择分部">
  47. <el-option v-for="(item,index) in selects.branchs"
  48. :key="index"
  49. :label="item.name"
  50. :value="item.id"></el-option>
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item>
  54. <el-select v-model.trim="searchForm.groupType"
  55. clearable
  56. filterable
  57. placeholder="课程组类型">
  58. <el-option v-for="(item, index) in courseListType"
  59. :key="index"
  60. :value="item.value"
  61. :label="item.label"></el-option>
  62. </el-select>
  63. </el-form-item>
  64. <el-form-item>
  65. <el-select v-model.trim="searchForm.courseType"
  66. clearable
  67. filterable
  68. placeholder="课程类型">
  69. <el-option v-for="(item, index) in courseType"
  70. :key="index"
  71. :value="item.value"
  72. :label="item.label"></el-option>
  73. </el-select>
  74. </el-form-item>
  75. <el-form-item>
  76. <el-select v-model.trim="searchForm.teachMode"
  77. clearable
  78. filterable
  79. placeholder="教学模式">
  80. <el-option label="线上课"
  81. value="ONLINE"></el-option>
  82. <el-option label="线下课"
  83. value="OFFLINE"></el-option>
  84. </el-select>
  85. </el-form-item>
  86. <el-form-item>
  87. <el-select v-model.trim="searchForm.courseStatus"
  88. clearable
  89. filterable
  90. placeholder="课程状态">
  91. <el-option label="未开始"
  92. value="NOT_START"></el-option>
  93. <el-option label="进行中"
  94. value="UNDERWAY"></el-option>
  95. <el-option label="已结束"
  96. value="OVER"></el-option>
  97. </el-select>
  98. </el-form-item>
  99. <el-form-item>
  100. <el-select v-model.trim="searchForm.mergeCourseType"
  101. clearable
  102. filterable
  103. placeholder="合并课程类型">
  104. <el-option v-for="(item, index) in mergeCourseTypeOptions"
  105. :key="index"
  106. :value="item.value"
  107. :label="item.label"></el-option>
  108. </el-select>
  109. </el-form-item>
  110. <el-form-item>
  111. <el-select v-model.trim="searchForm.teachType"
  112. clearable
  113. filterable
  114. placeholder="老师类型">
  115. <el-option v-for="item in workTypeOptions" :key="item.label" :label="item.label" :value="item.value"></el-option>
  116. </el-select>
  117. </el-form-item>
  118. <el-form-item>
  119. <el-select v-model.trim="searchForm.isCallNames"
  120. clearable
  121. filterable
  122. placeholder="是否点名">
  123. <el-option label="是"
  124. value="1"></el-option>
  125. <el-option label="否"
  126. value="0"></el-option>
  127. </el-select>
  128. </el-form-item>
  129. <el-form-item>
  130. <el-date-picker v-model.trim="searchForm.timer"
  131. type="daterange"
  132. value-format="yyyy-MM-dd"
  133. range-separator="至"
  134. start-placeholder="上课开始日期"
  135. end-placeholder="上课结束日期"
  136. :picker-options="{
  137. firstDayOfWeek: 1
  138. }"></el-date-picker>
  139. </el-form-item>
  140. <el-form-item>
  141. <el-date-picker v-model.trim="searchForm.creatTimer"
  142. type="daterange"
  143. value-format="yyyy-MM-dd"
  144. range-separator="至"
  145. start-placeholder="创建开始日期"
  146. end-placeholder="创建结束日期"
  147. :picker-options="{
  148. firstDayOfWeek: 1
  149. }"></el-date-picker>
  150. </el-form-item>
  151. <el-row type="flex" justify="space-around">
  152. <el-col>
  153. <el-button
  154. native-type="submit"
  155. type="primary"
  156. >搜索</el-button>
  157. <el-button
  158. native-type="reset"
  159. type="danger"
  160. >重置</el-button>
  161. <el-button
  162. v-permission="'export/superFindCourseSchedules'"
  163. @click="onCourseExport"
  164. type="primary"
  165. >导出课表</el-button>
  166. </el-col>
  167. </el-row>
  168. </save-form>
  169. <div class="btnWraps"></div>
  170. <!-- 列表 -->
  171. <div class="tableWrap" style="margin-top: 20px">
  172. <el-table :data="tableList"
  173. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  174. <el-table-column align="center"
  175. prop="organName"
  176. label="分部名称"></el-table-column>
  177. <el-table-column align="center"
  178. width="130px"
  179. prop="musicGroupId"
  180. label="乐团/课程组编号">
  181. <template slot-scope="scope">
  182. <copy-text>{{scope.row.musicGroupId}}</copy-text>
  183. </template>
  184. </el-table-column>
  185. <el-table-column align="center"
  186. prop="id"
  187. width="100px"
  188. label="课程编号">
  189. <template slot-scope="scope">
  190. <copy-text>{{scope.row.id}}</copy-text>
  191. </template>
  192. </el-table-column>
  193. <el-table-column align="center"
  194. width="200px"
  195. label="上课时间">
  196. <template slot-scope="scope">{{ scope.row.startClassTime ? scope.row.startClassTime.substr(0, 16) : '' }}-{{ scope.row.endClassTime ? scope.row.endClassTime.substr(11,5) : ''}}</template>
  197. </el-table-column>
  198. <el-table-column align="center"
  199. prop="subjectName"
  200. label="声部"></el-table-column>
  201. <el-table-column prop="name"
  202. width="150px"
  203. label="课程名称">
  204. <template slot-scope="scope">
  205. <copy-text>{{scope.row.name}}</copy-text>
  206. </template>
  207. </el-table-column>
  208. <el-table-column align="center"
  209. width="150px"
  210. label="课程类型">
  211. <template slot-scope="scope">
  212. <div>{{ scope.row.type | coursesType}}</div>
  213. </template>
  214. </el-table-column>
  215. <el-table-column align="center"
  216. label="教学模式">
  217. <template slot-scope="scope">
  218. <div>{{ scope.row.teachMode | teachMode}}</div>
  219. </template>
  220. </el-table-column>
  221. <el-table-column align="center"
  222. prop="teacherName"
  223. width="110"
  224. label="主教老师"></el-table-column>
  225. <el-table-column align="center"
  226. prop="schoolName"
  227. label="教学点">
  228. <template slot-scope="scope">
  229. <div>{{scope.row.schoolName?scope.row.schoolName:'网络教室'}}</div>
  230. </template>
  231. </el-table-column>
  232. <el-table-column align="center"
  233. prop="courseScheduleStatus"
  234. label="课程状态">
  235. <template slot-scope="scope">
  236. <div>{{ scope.row.status | coursesStatus }}</div>
  237. </template>
  238. </el-table-column>
  239. <el-table-column align="center"
  240. label="考勤申诉">
  241. <template slot-scope="scope">
  242. <div>{{ scope.row.isComplaints==1?'是':'否'}}</div>
  243. </template>
  244. </el-table-column>
  245. <el-table-column align="center"
  246. prop="isLock"
  247. label="是否冻结">
  248. <template slot-scope="scope">{{ scope.row.isLock ? '是' : '否' }}</template>
  249. </el-table-column>
  250. <el-table-column align="center"
  251. prop="newCourseId"
  252. label="合并类型"
  253. width="130px">
  254. <template slot-scope="scope">
  255. {{ scope.row.newCourseId > 0 && scope.row.newCourseId == scope.row.id ? '合并课' : null }}
  256. {{ scope.row.newCourseId > 0 && scope.row.newCourseId != scope.row.id ? '被合并课' : null }}
  257. </template>
  258. </el-table-column>
  259. <el-table-column align="center"
  260. prop="isCallNames"
  261. label="是否点名"
  262. fixed="right">
  263. <template slot-scope="scope">{{ scope.row.isCallNames ? '是' : '否' }}</template>
  264. </el-table-column>
  265. <el-table-column align="center"
  266. label="详情"
  267. fixed="right"
  268. width="220px">
  269. <template slot-scope="scope">
  270. <div>
  271. <el-button type="text"
  272. @click="removeCourse(scope.row)"
  273. v-permission="'courseSchedule/batchDelete?page=teamCourseList'">删除</el-button>
  274. <el-button type="text"
  275. v-if="permission('teamCourseList/details')"
  276. @click="lookDetail(scope.row)">详情</el-button>
  277. <el-button type="text"
  278. v-if="permission('courseSchedule/classStartDateAdjust?hight') && (!scope.row.isLock || scope.row.newCourseId > 0)"
  279. @click="resetClass(scope.row)">调整</el-button>
  280. <el-button type="text" @click="common(scope.row)" v-if="scope.row.newCourseId > 0">
  281. 合并课
  282. </el-button>
  283. <el-button type="text"
  284. @click="addCompound(scope.row)"
  285. v-if="(scope.row.groupType=='MUSIC'&&scope.row.type!='MUSIC_NETWORK'&&scope.row.type!='HIGH_ONLINE'&&scope.row.status=='NOT_START'&&!isAddCom(scope.row)&&permission('courseSchedule/courseMerge')&&scope.row.newCourseId <= 0&&!scope.row.beMerged)">添加合课</el-button>
  286. <el-button type="text"
  287. v-if="isAddCom(scope.row)&&permission('courseSchedule/courseMerge')"
  288. @click="cancleCompound(scope.row)">取消合课</el-button>
  289. <el-button type="text"
  290. v-if="
  291. scope.row.status=='OVER'
  292. &&
  293. !scope.row.isSettlement
  294. &&permission('courseSchedule/cleanAttendance')"
  295. @click="clearAttend(scope.row)">清除考勤</el-button>
  296. </div>
  297. </template>
  298. </el-table-column>
  299. </el-table>
  300. <pagination :total.sync="rules.total"
  301. :page.sync="rules.page"
  302. :limit.sync="rules.limit"
  303. :page-sizes="rules.page_size"
  304. @pagination="getList"
  305. sync />
  306. </div>
  307. </div>
  308. <el-dialog title="课表详情"
  309. :visible.sync="classVisible"
  310. width="1000px">
  311. <el-form :model="maskForm"
  312. :inline="true">
  313. <el-form-item label="老师姓名">
  314. <!-- <el-input v-model.trim="maskForm.teacherName"
  315. disabled></el-input>-->
  316. <div class="inputStyle">{{maskForm.teacherName}}</div>
  317. </el-form-item>
  318. <el-form-item label="课程模式">
  319. <!-- <el-input :value="maskForm.teachMode | teachMode"
  320. disabled></el-input>-->
  321. <div class="inputStyle">{{maskForm.teachMode| teachMode}}</div>
  322. <!-- <span>{{maskForm.teachMode }}</span> -->
  323. </el-form-item>
  324. <el-form-item label="课程类型">
  325. <!-- <el-input :value="maskForm.type |classType"
  326. disabled></el-input>-->
  327. <div class="inputStyle">{{maskForm.type|coursesType}}</div>
  328. </el-form-item>
  329. <!-- courseScheduleStatus -->
  330. <el-form-item label="课程状态">
  331. <!-- <el-input :value="maskForm.type |classType"
  332. disabled></el-input>-->
  333. <div class="inputStyle">{{maskForm.status | coursesStatus}}</div>
  334. </el-form-item>
  335. <!-- <el-form-item label="签到时间">
  336. <div class="inputStyle">{{maskForm.signInTime | dateForMinFormat}}</div>
  337. </el-form-item>
  338. <el-form-item label="签退时间">
  339. <div class="inputStyle">{{maskForm.signOutTime | dateForMinFormat}}</div>
  340. </el-form-item> -->
  341. <el-form-item label="是否点名">
  342. <!-- <el-input :value="maskForm.isCallNames | isCall"
  343. disabled></el-input>-->
  344. <div class="inputStyle">{{maskForm.isCallNames | isCall}}</div>
  345. </el-form-item>
  346. <!-- <el-form-item label="签到状态">
  347. <div class="inputStyle"
  348. :class="maskForm.isSignIn==1?'':'red'">{{ maskForm.isSignIn | attendanceType}}</div>
  349. </el-form-item>
  350. <el-form-item label="签退状态">
  351. <div class="inputStyle"
  352. :class="maskForm.isSignIn==1?'':'red'">{{ maskForm.isSignOut | attendanceOutType}}</div>
  353. </el-form-item> -->
  354. <el-form-item label="上课时间">
  355. {{ maskForm.startClassTime ? maskForm.startClassTime.substr(0, 16) : '' }}-{{ maskForm.endClassTime ? maskForm.endClassTime.substr(11,5) : ''}}
  356. </el-form-item>
  357. <el-form-item label="上课时长">
  358. <div class="inputStyle"
  359. :class=" (maskForm.attendClassTime <= 120)?'':'red'">{{ (maskForm.attendClassTime>=0?maskForm.attendClassTime:0)}}分钟 <el-tooltip placement="top"
  360. popper-class="mTooltip">
  361. <div slot="content">
  362. 学员和老师同时在教室里的时长。
  363. </div>
  364. <!-- <img :src="imageIcon" class="micon el-tooltip" style="width:8px height:8px" alt /> -->
  365. <i class="el-icon-question micon el-tooltip"
  366. style="font-size: 18px; color: #F56C6C"
  367. v-permission="'export/teacherSalary'"></i>
  368. </el-tooltip>
  369. </div>
  370. </el-form-item>
  371. <el-form-item v-if="maskForm.school" label="教学点">
  372. {{ maskForm.school.name }}
  373. <el-tooltip content="查看教学点" :open-delay=".5">
  374. <i @click="openLocation(maskForm.school)" class="el-icon-map-location" style="cursor: pointer;"></i>
  375. </el-tooltip>
  376. </el-form-item>
  377. </el-form>
  378. <!-- v-if="maskForm.status != 'NOT_START'" -->
  379. <el-tabs v-model.trim="activeName"
  380. type="card"
  381. @tab-click="handleClick">
  382. <el-tab-pane label="学员列表"
  383. name="first">
  384. <div v-if="activeName == 'first'">
  385. <!-- studentRollCall -->
  386. <studentRollCall :courseScheduleId="maskForm.id"></studentRollCall>
  387. </div>
  388. </el-tab-pane>
  389. <!-- <el-tab-pane label="GPS定位"
  390. v-if="maskForm.teachMode == 'OFFLINE'"
  391. name="second">
  392. <div v-if="activeName == 'second'">
  393. <gpsLoction :courseScheduleId="maskForm.id"></gpsLoction>
  394. </div>
  395. </el-tab-pane> -->
  396. <el-tab-pane label="老师列表"
  397. name="second">
  398. <div v-if="activeName == 'second'">
  399. <teacherList :courseScheduleId="maskForm.id"
  400. :teachMode='maskForm.teachMode'></teacherList>
  401. </div>
  402. </el-tab-pane>
  403. <!-- v-if="maskForm.teachMode != 'OFFLINE'" -->
  404. <el-tab-pane label="作业"
  405. name="third">
  406. <div v-if="activeName == 'third'">
  407. <studentWork :courseScheduleId="maskForm.id"></studentWork>
  408. </div>
  409. </el-tab-pane>
  410. <!-- v-if="maskForm.type == 'VIP' || maskForm.type == 'PRACTICE'" -->
  411. <el-tab-pane label="评论"
  412. name="four">
  413. <div v-if="activeName == 'four'">
  414. <courseEvaluate :courseScheduleId="maskForm.id"></courseEvaluate>
  415. </div>
  416. </el-tab-pane>
  417. <el-tab-pane label="调整记录"
  418. v-if="permission('courseSchedule/queryCourseAdjustDetail')"
  419. name="five">
  420. <div v-if="activeName == 'five'">
  421. <infoMsg :courseScheduleId="maskForm.id"></infoMsg>
  422. </div>
  423. </el-tab-pane>
  424. <!-- infoMsg -->
  425. </el-tabs>
  426. </el-dialog>
  427. <el-dialog :visible.sync="show"
  428. width="400px">
  429. <resetClass :show="show"
  430. v-if="show"
  431. @closeReset='closeReset'
  432. @getList='getList'
  433. :id='id' />
  434. </el-dialog>
  435. <el-dialog title="查看教学点" :visible.sync="locationVisible">
  436. <school-location v-if="maskForm.school" :longitudeLatitude="maskForm.school.longitudeLatitude" :address="maskForm.school.address"/>
  437. </el-dialog>
  438. <addCompound :compoundList='compoundList' v-if="permission('courseSchedule/courseMerge')"
  439. @clearCom='clearCom'
  440. @getList='getList'
  441. @cancleCompound='cancleCompound' />
  442. </div>
  443. </template>
  444. <script>
  445. import pagination from "@/components/Pagination/index";
  446. import {
  447. getTeacher,
  448. getMusicGroupAllClass,
  449. superFindCourseSchedules,
  450. getEmployeeOrgan,
  451. cleanAttendance
  452. } from "@/api/buildTeam";
  453. import { bathDelete } from "@/api/vipSeting"
  454. import { workType, mergeCourseType } from '@/constant'
  455. import { objectToOptions, getTimes } from '@/utils'
  456. import { getTeacherPersonalAttendanceDetail } from "@/api/teacherManager";
  457. import { getSchool } from "@/api/systemManage";
  458. import { courseType, courseListType } from "@/utils/searchArray";
  459. import studentRollCall from "./componentCourse/studentRollCall";
  460. import gpsLoction from "./componentCourse/gpsLocation";
  461. import studentWork from "./componentCourse/studentWork";
  462. import courseEvaluate from "./componentCourse/courseEvaluate";
  463. import { permission } from "@/utils/directivePage";
  464. import axios from "axios";
  465. import { getToken } from "@/utils/auth";
  466. import load from "@/utils/loading";
  467. import SchoolLocation from './components/modals/school-location'
  468. import resetClass from './componentCourse/resetClass'
  469. import teacherList from './componentCourse/teacherList'
  470. import addCompound from './componentCourse/addCompound'
  471. import infoMsg from './componentCourse/infoMsg'
  472. let nowTime = new Date();
  473. nowTime =
  474. nowTime.getFullYear() +
  475. "-" +
  476. (nowTime.getMonth() + 1) +
  477. "-" +
  478. nowTime.getDate();
  479. const initSearch = {
  480. teachMode: null, // 教学模式
  481. organIdList: null,
  482. courseStatus: null,
  483. courseType: null,
  484. timer: [nowTime, nowTime], // 时间
  485. class: null,
  486. teachType: null,
  487. mergeCourseType: null,
  488. isCallNames: null, // 是否点名
  489. search: null, // 乐团名称 编号 vip课名称
  490. teacherIdList: null, // 老师编号
  491. schoolId: null, // 教学点编号
  492. creatTimer: []
  493. }
  494. export default {
  495. data () {
  496. return {
  497. classVisible: false,
  498. timerVisible: false,
  499. courseVisible: false,
  500. locationVisible: false,
  501. courseType: courseType,
  502. mergeCourseType,
  503. courseListType: courseListType,
  504. searchForm: {...initSearch},
  505. tableList: [],
  506. searchLsit: [],
  507. organList: [],
  508. rules: {
  509. // 分页规则
  510. limit: 10, // 限制显示条数
  511. page: 1, // 当前页
  512. total: 0, // 总条数
  513. page_size: [10, 20, 40, 50] // 选择限制显示条数
  514. },
  515. teacherList: [],
  516. schoolList: [],
  517. maskForm: {},
  518. activeName: "first",
  519. id: null,
  520. show: false,
  521. compoundList: []
  522. };
  523. },
  524. components: {
  525. pagination,
  526. studentRollCall,
  527. gpsLoction,
  528. studentWork,
  529. courseEvaluate,
  530. resetClass,
  531. teacherList,
  532. addCompound,
  533. infoMsg,
  534. SchoolLocation
  535. },
  536. activated () {
  537. this.init();
  538. },
  539. computed: {
  540. workTypeOptions() {
  541. return objectToOptions(workType)
  542. },
  543. mergeCourseTypeOptions() {
  544. return objectToOptions(mergeCourseType)
  545. }
  546. },
  547. mounted () {
  548. this.$store.dispatch('setBranchs')
  549. this.$store.dispatch('setTeachers')
  550. this.$store.dispatch('setSchools')
  551. this.init();
  552. },
  553. methods: {
  554. init () {
  555. this.getList();
  556. },
  557. permission (str, parent) {
  558. return permission(str, parent);
  559. },
  560. async removeCourse(row) {
  561. console.log({...row})
  562. try {
  563. await this.$confirm('是否确认删除此数据?', '提示', {
  564. type: 'warning'
  565. })
  566. bathDelete({ courseScheduleIds: row.id }).then(res => {
  567. if (res.code == 200) {
  568. this.$message.success("删除成功");
  569. this.getList();
  570. }
  571. })
  572. } catch (error) {}
  573. },
  574. reset() {
  575. this.searchForm = {...initSearch}
  576. this.search()
  577. },
  578. search () {
  579. this.rules.page = 1;
  580. this.$refs.searchForm.save(this.searchForm)
  581. this.getList();
  582. },
  583. common(row) {
  584. this.searchForm = {
  585. ...initSearch,
  586. timer: [],
  587. search: row.newCourseId,
  588. }
  589. this.search()
  590. },
  591. getSearchForm() {
  592. let searchForm = this.searchForm;
  593. if (!searchForm.timer || searchForm.timer.length <= 0) {
  594. searchForm.timer = [];
  595. // this.$message.error("请选择时间段");
  596. // return;
  597. }
  598. if (!searchForm.creatTimer || searchForm.creatTimer.length <= 0) {
  599. searchForm.creatTimer = []
  600. }
  601. let count = 0
  602. for (let item in searchForm) {
  603. if (searchForm[item] && !Array.isArray(searchForm[item])) {
  604. count++
  605. } else if (Array.isArray(searchForm[item]) && searchForm[item].length > 0) {
  606. count++
  607. }
  608. }
  609. if (count <= 0) {
  610. this.$message.error('请至少选择一个搜索条件')
  611. return
  612. }
  613. const { creatTimer, timer, ...rest } = searchForm
  614. return {
  615. ...rest,
  616. page: this.rules.page,
  617. rows: this.rules.limit,
  618. ...getTimes(creatTimer, ['createStartDate', 'createEndDate']),
  619. ...getTimes(timer, ['startTime', 'endTime']),
  620. }
  621. },
  622. openLocation(school) {
  623. this.locationVisible = true
  624. },
  625. onCourseExport () {
  626. // 课表导出
  627. let url = "/api-web/export/superFindCourseSchedules";
  628. const options = {
  629. method: "get",
  630. headers: {
  631. Authorization: getToken()
  632. },
  633. params: this.getSearchForm(),
  634. url,
  635. responseType: "blob"
  636. };
  637. this.$confirm("您确定导出报表", "提示", {
  638. confirmButtonText: "确定",
  639. cancelButtonText: "取消",
  640. type: "warning"
  641. })
  642. .then(() => {
  643. load.startLoading();
  644. axios(options)
  645. .then(res => {
  646. let blob = new Blob([res.data], {
  647. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  648. type: "application/vnd.ms-excel;charset=utf-8"
  649. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  650. });
  651. let text = new Response(blob).text();
  652. text.then(res => {
  653. // 判断是否报错
  654. if (res.indexOf("code") != -1) {
  655. let json = JSON.parse(res);
  656. this.$message.error(json.msg);
  657. } else {
  658. let objectUrl = URL.createObjectURL(blob);
  659. let link = document.createElement("a");
  660. let fname = "课表列表" + new Date().getTime() + '.xls'; //下载文件的名字
  661. link.href = objectUrl;
  662. link.setAttribute("download", fname);
  663. document.body.appendChild(link);
  664. link.click();
  665. }
  666. });
  667. load.endLoading();
  668. })
  669. .catch(error => {
  670. this.$message.error("导出数据失败,请联系管理员");
  671. load.endLoading();
  672. });
  673. })
  674. .catch(() => { });
  675. },
  676. getList () {
  677. superFindCourseSchedules(this.getSearchForm()).then(res => {
  678. if (res.code == 200) {
  679. this.tableList = res.data.rows;
  680. this.rules.total = res.data.total;
  681. }
  682. });
  683. },
  684. lookDetail (row) {
  685. // this.maskForm = row;
  686. // 发请求 获取详情 row.id
  687. this.maskForm = row;
  688. this.activeName = "first";
  689. this.classVisible = true;
  690. getTeacherPersonalAttendanceDetail({ courseScheduleId: row.id }).then(res => {
  691. if (res.code == 200) {
  692. this.maskForm = { ...this.maskForm, ...res.data };
  693. this.maskForm.id = row.id;
  694. this.activeName = "first";
  695. this.classVisible = true;
  696. }
  697. })
  698. },
  699. handleClick (tab, event) {
  700. // console.log(tab, event);
  701. },
  702. resetClass (row) {
  703. console.log(row)
  704. this.id = row.id
  705. this.show = true
  706. },
  707. closeReset () {
  708. this.show = false
  709. },
  710. clearAttend (row) {
  711. this.$confirm("是否清除考勤记录?", "提示", {
  712. confirmButtonText: "确定",
  713. cancelButtonText: "取消",
  714. type: "warning"
  715. })
  716. .then(() => {
  717. cleanAttendance({ courseScheduleIds: row.id }).then(
  718. res => {
  719. if (res.code == 200) {
  720. this.$message.success("清除成功");
  721. this.getList();
  722. } else {
  723. this.$message.error(res.msg);
  724. }
  725. }
  726. );
  727. })
  728. .catch(() => { });
  729. },
  730. addCompound (row) {
  731. this.compoundList.push(row)
  732. this.compoundList = [...new Set(this.compoundList)]
  733. },
  734. isAddCom (row) {
  735. let flag = false
  736. this.compoundList.forEach(com => {
  737. if (com.id == row.id) {
  738. flag = true
  739. }
  740. })
  741. return flag
  742. },
  743. cancleCompound (row) {
  744. let indexNum = null
  745. this.compoundList.forEach((com, index) => {
  746. if (com.id == row.id) {
  747. indexNum = index
  748. }
  749. })
  750. if (indexNum + '') {
  751. this.compoundList.splice(indexNum, 1)
  752. }
  753. },
  754. clearCom () {
  755. this.compoundList = []
  756. }
  757. },
  758. filters: {
  759. isCall (val) {
  760. if (val == 0) {
  761. return "未点名";
  762. } else if (val == 1) {
  763. return "已点名";
  764. }
  765. }
  766. },
  767. watch: {
  768. classVisible (val) {
  769. if (!val) {
  770. this.activeName = null;
  771. }
  772. }
  773. }
  774. };
  775. </script>
  776. <style lang="scss" scoped>
  777. .visible {
  778. visibility: hidden;
  779. }
  780. .cl-container {
  781. .topFrom {
  782. margin: 20px 30px 0;
  783. .classlist {
  784. display: flex;
  785. flex-direction: row;
  786. justify-content: flex-start;
  787. align-items: center;
  788. ul {
  789. li {
  790. list-style: none;
  791. }
  792. }
  793. }
  794. }
  795. .searchForm {
  796. margin: 0 30px;
  797. }
  798. }
  799. .btnWraps {
  800. display: flex;
  801. flex-direction: row;
  802. justify-content: flex-start;
  803. div {
  804. margin-right: 20px;
  805. }
  806. }
  807. .inputStyle {
  808. width: 180px;
  809. }
  810. .red {
  811. color: red;
  812. }
  813. .exportBtn {
  814. background: #13817a;
  815. }
  816. </style>