teamCourseList.vue 32 KB

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