classCall.vue 17 KB

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