teamCourseList.vue 36 KB

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