classCall.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  1. <template>
  2. <view>
  3. <u-navbar title="班级点名"></u-navbar>
  4. <view class="main">
  5. <view class="position">
  6. <view class="infos">
  7. <view class="class">
  8. {{classList.className}}
  9. </view>
  10. <view class="item">
  11. <view class="title">
  12. 上课时间:
  13. </view>
  14. <view class="value">
  15. {{scheduleSheet.courseDate}} {{scheduleSheet.coursePeriods}}
  16. </view>
  17. </view>
  18. <view class="item">
  19. <view class="title">
  20. 上课教室:
  21. </view>
  22. <view class="value">
  23. {{classRoom.name}}
  24. </view>
  25. </view>
  26. <view class="item">
  27. <view class="title">
  28. 授课老师:
  29. </view>
  30. <view class="value">
  31. {{employee.employeeName}}
  32. </view>
  33. </view>
  34. <view class="item">
  35. <view class="title">
  36. 学员总数:
  37. </view>
  38. <view class="value">
  39. {{studentList.length+stopStudentList.length}}人
  40. </view>
  41. </view>
  42. </view>
  43. <view class="tabs">
  44. <u-tabs bar-width="80" inactive-color="#777777" active-color="#4F3C27" :list="list" :is-scroll="false"
  45. :current="current" @change="change"></u-tabs>
  46. </view>
  47. </view>
  48. <view class="details">
  49. <view class="item" v-for="(item,index) in rollCallList" :key="index">
  50. <label class="radio" >
  51. <radio value="" /><text></text>
  52. </label>
  53. <view class="picture">
  54. <u-avatar class="avatar" mode="square"
  55. :src="item.headPhoto != null ? item.headPhoto : '../../assets/img/head.png'" size="112">
  56. </u-avatar>
  57. </view>
  58. <view class="info">
  59. <view class="name-tel">
  60. <view class="name">
  61. {{item.studentName}}
  62. </view>
  63. <view class="tel">
  64. <view class="img">
  65. <img src="../../../assets/img/riLine-smartphone-line@1x.png" alt="">
  66. </view>
  67. <view>
  68. {{item.firstContactPhone != null ? item.firstContactPhone : item.secondContactPhone}}
  69. </view>
  70. </view>
  71. </view>
  72. <view class="else">
  73. <view class="remain">
  74. <view>剩余课时</view>
  75. <view class="num" v-if="item.courseAmountList != null">{{item.courseAmountList[0]}}</view>
  76. </view>
  77. <view class="leaved">
  78. </view>
  79. </view>
  80. </view>
  81. <view class="state" @click="showStudent(item)">
  82. <view class="text" v-if="item.rollCallResult == '1'">到课</view>
  83. <view class="text" v-if="item.rollCallResult == '2'">请假</view>
  84. <view class="text" v-if="item.rollCallResult == '3'">旷课</view>
  85. <view class="text" v-if="item.rollCallResult == '4'">补课</view>
  86. <view class="text" v-if="item.rollCallResult == '5'">停课</view>
  87. <view class="text" v-if="item.rollCallResult == '6'">缺课</view>
  88. <view class="icon">
  89. <u-icon name="arrow-right" color="#cccccc"></u-icon>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. <u-picker mode="selector" v-model="show" :default-selector="[0]" :range="selectorObj" range-key="cateName"
  96. @confirm="confirm"></u-picker>
  97. <!-- 底部 -->
  98. <view class="bottom">
  99. <view class="sign-result">
  100. <view class="title">
  101. 签到结果
  102. </view>
  103. <view class="result">
  104. <view class="itemClass leave" @click="qbStudent">
  105. 全部<text>{{studentList.length + stopStudentList.length}}</text>
  106. </view>
  107. <view class="itemClass arrive" @click="dkStudent">
  108. 到课<text>{{dkNum}}</text>
  109. </view>
  110. <view class="itemClass arrive" @click="qjStudent">
  111. 请假<text>{{qjNum}}</text>
  112. </view>
  113. <!-- <view class="itemClass leave" @click="qkStudent">
  114. 缺课<text>{{qkNum}}</text>
  115. </view> -->
  116. <!-- <view class="itemClass truant">
  117. 旷课<text>{{scheduleSheet.kkNum!=null?scheduleSheet.kkNum:'0'}}</text>
  118. </view> -->
  119. <!-- <view class="itemClass make-up">
  120. 补课<text>{{scheduleSheet.bkNum!=null?scheduleSheet.bkNum:'0'}}</text>
  121. </view> -->
  122. <view class="itemClass stop">
  123. 停课<text>{{tkNum}}</text>
  124. </view>
  125. </view>
  126. </view>
  127. <view class="set-btn">
  128. <!-- 全选 -->
  129. <label class="radio">
  130. <radio value="" /><text>全选</text>
  131. </label>
  132. <view class="set">
  133. <view class="set-text">批量点名</view>
  134. <view class="choose" @click="show = true">
  135. <view class="text">
  136. {{resultName}}
  137. </view>
  138. <view class="icon">
  139. <u-icon size="28" color="#cccccc" name="arrow-right"></u-icon>
  140. </view>
  141. </view>
  142. </view>
  143. <view class="btn">
  144. <button @click="save()">保存</button>
  145. </view>
  146. </view>
  147. </view>
  148. <view>
  149. <u-toast ref="uToast" />
  150. </view>
  151. </view>
  152. </template>
  153. <script>
  154. import * as callNamesApi from '@/apis/teacher/callNames.js'
  155. export default {
  156. data() {
  157. return {
  158. isCancel: false,
  159. resultName: '请选择',
  160. resultId: '',
  161. studentId: '',
  162. studentResult: '',
  163. classList: {},
  164. classRoom: {},
  165. employee: {},
  166. scheduleSheet: {},
  167. studentList: [],
  168. sheetId: '',
  169. show: false,
  170. selectorObj: [{
  171. cateName: '到课',
  172. id: '1'
  173. },
  174. {
  175. cateName: '请假',
  176. id: '2'
  177. },
  178. {
  179. cateName: '取消点名',
  180. id: ''
  181. },
  182. // {
  183. // cateName: '缺课',
  184. // id: '6'
  185. // },
  186. // {
  187. // cateName: '旷课',
  188. // id: '3'
  189. // },
  190. // {
  191. // cateName: '补课',
  192. // id: '4'
  193. // }
  194. ],
  195. list: [
  196. {name: '正常'},
  197. {name: '停课'}
  198. ],
  199. current: 0,
  200. leaveStudentList: [],
  201. stopStudentList: [],
  202. lackStudentList: [],
  203. rollCallList: [],
  204. dkNum: 0,
  205. qkNum: 0,
  206. qjNum: 0,
  207. tkNum: 0,
  208. rollCallListAll: []
  209. }
  210. },
  211. onLoad(op) {
  212. if (op.id) {
  213. this.sheetId = op.id;
  214. this.getRollCallDetail();
  215. }
  216. },
  217. methods: {
  218. qbStudent() {
  219. this.rollCallList = this.studentList;
  220. },
  221. dkStudent() {
  222. var list = [];
  223. for (var i = 0; i < this.studentList.length; i++) {
  224. if(this.studentList[i].rollCallResult == '1') {
  225. list.push(this.studentList[i]);
  226. }
  227. }
  228. this.rollCallList = list;
  229. },
  230. qjStudent() {
  231. var list = [];
  232. for (var i = 0; i < this.studentList.length; i++) {
  233. if(this.studentList[i].rollCallResult == '2') {
  234. list.push(this.studentList[i]);
  235. }
  236. }
  237. this.rollCallList = list;
  238. },
  239. // qkStudent() {
  240. // var list = [];
  241. // for (var i = 0; i < this.studentList.length; i++) {
  242. // if(this.studentList[i].rollCallResult == '6') {
  243. // list.push(this.studentList[i]);
  244. // }
  245. // }
  246. // this.rollCallList = list;
  247. // },
  248. getRollCallSignIn() {
  249. uni.showLoading({
  250. title: "加载中",
  251. mask: true,
  252. })
  253. callNamesApi.rollCallSignIn(this.sheetId, this.rollCallListAll).then((response) => {
  254. uni.hideLoading();
  255. this.rollCallListAll = [];
  256. this.resultName = '请选择';
  257. this.isCancel = true;
  258. if(response.message != '') {
  259. this.$refs.uToast.show({
  260. title: response.message+'课程为0或已经停课,不能点名!',
  261. type: 'warning ',
  262. position: 'top',
  263. duration: 5000
  264. })
  265. }
  266. this.getRollCallDetail();
  267. }).catch(error => {
  268. this.rollCallListAll = [];
  269. if(error != null) {
  270. this.$refs.uToast.show({
  271. title: error,
  272. type: 'warning ',
  273. position: 'top',
  274. duration: 5000
  275. })
  276. }
  277. this.getRollCallDetail();
  278. })
  279. },
  280. getRollCallDetail() {
  281. this.studentList = [];
  282. uni.showLoading({
  283. title: "加载中",
  284. mask: true,
  285. })
  286. callNamesApi.loadRollcallData({
  287. sheetId: this.sheetId
  288. }).then((response) => {
  289. uni.hideLoading();
  290. this.classList = response.data.class;
  291. this.classRoom = response.data.classRoom;
  292. this.employee = response.data.employee;
  293. this.scheduleSheet = response.data.scheduleSheet;
  294. this.studentList = response.data.studentList;
  295. for (var c = 0; c < this.studentList.length; c++) {
  296. var key = "checked";
  297. var value = false;
  298. this.studentList[c][key] = value;
  299. }
  300. this.rollCallList = this.studentList;
  301. this.stopStudentList = response.data.stopStudentList;
  302. for (var n = 0; n < this.stopStudentList.length; n++) {
  303. if(this.stopStudentList[n].rollCallResult == null) {
  304. this.stopStudentList[n].rollCallResult = '5';
  305. }
  306. }
  307. this.list[0].name = '正常' + this.studentList.length;
  308. this.list[1].name = '停课' + this.stopStudentList.length;
  309. this.dkNum = 0;
  310. this.qjNum = 0;
  311. // this.qkNum = 0;
  312. this.tkNum = this.stopStudentList.length;
  313. for (var i = 0; i < this.studentList.length; i++) {
  314. if(this.studentList[i].rollCallResult == '1') {
  315. this.dkNum += 1;
  316. }
  317. if(this.studentList[i].rollCallResult == '2') {
  318. this.qjNum += 1;
  319. }
  320. // if(this.studentList[i].rollCallResult == '6') {
  321. // this.qkNum += 1;
  322. // }
  323. }
  324. }).catch(error => {
  325. uni.showToast({
  326. title: error,
  327. icon: "none"
  328. })
  329. })
  330. },
  331. save() {
  332. if(this.current == 0) {
  333. if(this.resultName != '请选择') {
  334. for (var i = 0; i < this.rollCallList.length; i++) {
  335. if(this.rollCallList[i].rollCallResult == null && !this.isCancel) {
  336. this.rollCallList[i].rollCallResult = this.resultId;
  337. }
  338. }
  339. // console.log(this.rollCallList)
  340. this.rollCallListAll = this.rollCallList.concat(this.stopStudentList);
  341. }
  342. }
  343. if(this.current == 1) {
  344. if(this.resultName != '请选择') {
  345. for (var i = 0; i < this.studentList.length; i++) {
  346. if(this.studentList[i].rollCallResult == null && !this.isCancel) {
  347. this.studentList[i].rollCallResult = this.resultId;
  348. }
  349. }
  350. this.rollCallListAll = this.rollCallList.concat(this.studentList);
  351. }
  352. }
  353. this.getRollCallSignIn();
  354. },
  355. showStudent(item) {
  356. this.show = true;
  357. this.studentId = item.studentId;
  358. },
  359. confirm(obj) {
  360. if (!this.studentId) {
  361. this.resultName = this.selectorObj[obj[0]].cateName;
  362. this.resultId = this.selectorObj[obj[0]].id;
  363. for (var i = 0; i < this.rollCallList.length; i++) {
  364. this.rollCallList[i].rollCallResult = this.selectorObj[obj[0]].id;
  365. }
  366. console.log(this.rollCallList)
  367. } else {
  368. for (var m = 0; m < this.rollCallListAll.length; m++) {
  369. if (this.studentId == this.rollCallListAll[m].studentId) {
  370. this.rollCallListAll.splice(this.rollCallListAll.indexOf(this.rollCallListAll[m]), 1);
  371. }
  372. }
  373. for (var n = 0; n < this.rollCallList.length; n++) {
  374. if (this.studentId == this.rollCallList[n].studentId) {
  375. this.rollCallList[n].rollCallResult = this.selectorObj[obj[0]].id;
  376. this.rollCallListAll.push(this.rollCallList[n])
  377. }
  378. }
  379. console.log(this.rollCallList)
  380. this.studentId = '';
  381. }
  382. },
  383. change(index) {
  384. this.current = index;
  385. if(index == 1) {
  386. this.rollCallList = this.stopStudentList;
  387. } else {
  388. this.rollCallList = this.studentList;
  389. }
  390. }
  391. }
  392. }
  393. </script>
  394. <style lang="scss" scoped>
  395. page{
  396. padding-bottom: 200px;
  397. }
  398. .main {
  399. background: linear-gradient(180deg, rgba(13, 186, 199, 1) 0%, rgba(244, 246, 246, 1) 100%);
  400. .position{
  401. background-color: rgba(13, 186, 199, 1);
  402. position: fixed;
  403. top: 88rpx;
  404. left: 0;
  405. right: 0;
  406. z-index: 999;
  407. }
  408. .infos {
  409. color: #fff;
  410. padding: 32rpx;
  411. .class {
  412. color: rgba(255, 255, 255, 1);
  413. font-size: 48rpx;
  414. font-weight: bold;
  415. margin-bottom: 16rpx;
  416. }
  417. .item {
  418. display: flex;
  419. margin-top: 16rpx;
  420. .value {
  421. margin-left: 8rpx;
  422. }
  423. }
  424. }
  425. .tabs {
  426. border-radius: 16px 16px 0px 0px;
  427. background-color: rgba(255, 255, 255, 1);
  428. height: 88rpx;
  429. padding: 0 170rpx;
  430. }
  431. .details {
  432. background-color: #fff;
  433. margin-top: 424rpx;
  434. .item {
  435. padding: 24rpx 32rpx;
  436. display: flex;
  437. border-top: 1px solid rgba(229, 231, 234, 1);
  438. .picture {
  439. width: 112rpx;
  440. height: 112rpx;
  441. img {
  442. width: 100%;
  443. height: 100%;
  444. }
  445. }
  446. .info {
  447. margin-left: 24rpx;
  448. display: flex;
  449. flex-direction: column;
  450. justify-content: space-around;
  451. .name-tel {
  452. display: flex;
  453. align-items: center;
  454. .name {
  455. color: rgba(51, 51, 51, 1);
  456. font-size: 18px;
  457. font-weight: bold
  458. }
  459. .tel {
  460. color: rgba(119, 119, 119, 1);
  461. display: flex;
  462. align-items: center;
  463. line-height: 32rpx;
  464. margin-left: 24rpx;
  465. .img {
  466. width: 32rpx;
  467. height: 32rpx;
  468. margin-right: 8rpx;
  469. img {
  470. width: 100%;
  471. height: 100%;
  472. }
  473. }
  474. }
  475. }
  476. .else {
  477. display: flex;
  478. align-items: center;
  479. .remain,
  480. .leaved {
  481. display: flex;
  482. color: rgba(119, 119, 119, 1);
  483. align-items: center;
  484. margin-right: 24rpx;
  485. .num {
  486. width: 50rpx;
  487. height: 32rpx;
  488. line-height: 32rpx;
  489. border-radius: 4px;
  490. background-color: rgba(153, 153, 153, 1);
  491. color: rgba(255, 255, 255, 1);
  492. font-size: 24rpx;
  493. text-align: center;
  494. margin-left: 8rpx;
  495. }
  496. }
  497. }
  498. }
  499. .state {
  500. display: flex;
  501. align-items: end;
  502. margin-left: auto;
  503. .text {
  504. color: rgba(51, 51, 51, 1);
  505. }
  506. .icon {
  507. margin-left: 8rpx;
  508. }
  509. }
  510. }
  511. }
  512. }
  513. // 单选框
  514. /deep/.radio{
  515. display: flex ;
  516. align-items: center;
  517. }
  518. /deep/.uni-radio-input{
  519. width: 32rpx;
  520. height: 32rpx;
  521. }
  522. /deep/.u-cell_title {
  523. color: rgba(119, 119, 119, 1);
  524. }
  525. /deep/.u-cell__value {
  526. color: #333333;
  527. }
  528. .teacher {
  529. /deep/.u-cell__value {
  530. color: #00BAC8;
  531. }
  532. }
  533. .student-details {
  534. padding: 12px 16px;
  535. background-color: #fff;
  536. display: flex;
  537. position: relative;
  538. border-bottom: 1px solid rgba(229, 231, 234, 1);
  539. ;
  540. .photo {
  541. width: 56px;
  542. height: 56px;
  543. border-radius: 4px;
  544. overflow: hidden;
  545. margin-right: 11px;
  546. img {
  547. width: 100%;
  548. height: 100%;
  549. }
  550. }
  551. .details {
  552. display: flex;
  553. flex-direction: column;
  554. justify-content: space-around;
  555. .name-tel {
  556. display: flex;
  557. .name {
  558. margin-right: 12px;
  559. color: rgba(51, 51, 51, 1);
  560. font-size: 18px;
  561. }
  562. .tel {
  563. color: rgba(119, 119, 119, 1);
  564. display: flex;
  565. align-items: center;
  566. }
  567. }
  568. .class-leave {
  569. color: rgba(119, 119, 119, 1);
  570. display: flex;
  571. .class {
  572. margin-right: 12px;
  573. line-height: 14px;
  574. display: flex;
  575. align-items: center;
  576. }
  577. .leave {
  578. display: flex;
  579. align-items: center;
  580. }
  581. text {
  582. display: inline-block;
  583. width: 16px;
  584. height: 16px;
  585. line-height: 16px;
  586. border-radius: 4px;
  587. background-color: rgba(153, 153, 153, 1);
  588. color: rgba(255, 255, 255, 1);
  589. font-size: 12px;
  590. text-align: center;
  591. margin-left: 4px;
  592. }
  593. }
  594. }
  595. .to-class {
  596. color: #333333;
  597. position: absolute;
  598. bottom: 34rpx;
  599. right: 24rpx;
  600. }
  601. }
  602. // 底部
  603. .bottom {
  604. padding: 12px 16px;
  605. background-color: #fff;
  606. position: fixed;
  607. bottom: 0;
  608. left: 0;
  609. right: 0;
  610. .sign-result {
  611. display: flex;
  612. justify-content: space-between;
  613. padding-bottom: 22rpx;
  614. border-bottom: 2rpx solid rgba(229, 231, 234, 1);
  615. .title {
  616. color: rgba(119, 119, 119, 1);
  617. line-height: 40rpx;
  618. }
  619. .result {
  620. display: flex;
  621. justify-content: space-between;
  622. .itemClass {
  623. font-size: 32rpx;
  624. display: flex;
  625. align-items: center;
  626. margin-left: 24rpx;
  627. text {
  628. display: inline-block;
  629. width: 40rpx;
  630. height: 40rpx;
  631. line-height: 40rpx;
  632. border-radius: 8rpx;
  633. background-color: rgba(22, 132, 252, 1);
  634. color: rgba(255, 255, 255, 1);
  635. font-size: 24rpx;
  636. text-align: center;
  637. margin-left: 6rpx;
  638. }
  639. }
  640. .arrive {
  641. color: rgba(22, 132, 252, 1);
  642. }
  643. .leave {
  644. color: rgba(129, 97, 255, 1);
  645. text {
  646. background-color: rgba(129, 97, 255, 1);
  647. }
  648. }
  649. .truant {
  650. color: rgba(255, 61, 0, 1);
  651. text {
  652. background-color: rgba(255, 61, 0, 1);
  653. }
  654. }
  655. .make-up {
  656. color: rgba(0, 187, 170, 1);
  657. text {
  658. background-color: rgba(0, 187, 170, 1);
  659. }
  660. }
  661. .stop {
  662. color: rgba(238, 49, 56, 1);
  663. text {
  664. background-color: rgba(238, 49, 56, 1);
  665. ;
  666. }
  667. }
  668. }
  669. }
  670. .set-btn {
  671. display: flex;
  672. margin-top: 20rpx;
  673. .set {
  674. display: flex;
  675. align-items: center;
  676. margin-left: auto;
  677. .set-text {
  678. color: rgba(51, 51, 51, 1);
  679. }
  680. .choose {
  681. margin-left: 34rpx;
  682. display: flex;
  683. align-items: center;
  684. height: 20px;
  685. .text {
  686. color: rgba(13, 186, 199, 1);
  687. font-weight: bold;
  688. }
  689. .icon {
  690. margin-left: 8rpx;
  691. }
  692. }
  693. }
  694. .btn {
  695. width: 200rpx;
  696. margin-left: 16rpx;
  697. }
  698. button {
  699. border-radius: 50px;
  700. background-color: rgba(13, 186, 199, 1);
  701. color: rgba(255, 255, 255, 1);
  702. font-size: 16px;
  703. height: 80rpx;
  704. line-height: 80rpx;
  705. }
  706. }
  707. }
  708. </style>