leaveApproval.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view>
  3. <u-navbar title="请假审批"></u-navbar>
  4. <view class="tabs">
  5. <u-tabs bar-width="80" inactive-color="#777777" active-color="#4F3C27" :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
  6. </view>
  7. <view class="content">
  8. <view class="item" v-for="(item,index) in leaveList" :key="index"
  9. @click="gotoUrl('pages/teacher/leaveApproval/leaveDetails?id='+item.leaveId)">
  10. <view class="head">
  11. <view class="title">
  12. {{item.studentName}}的请假条
  13. </view>
  14. <view class="state1" v-if="item.status == 0">
  15. 待处理
  16. </view>
  17. <view class="state2" v-if="item.status == 1">
  18. 已审核
  19. </view>
  20. </view>
  21. <view class="bottom">
  22. <view class="class">
  23. {{item.className}}
  24. </view>
  25. <view class="time">
  26. {{getFormatDate(item.createTime)}}
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <u-divider v-if="leaveList.length == recordsTotal && recordsTotal != 0" style="margin-top: 10px">没有更多了</u-divider>
  32. </view>
  33. </template>
  34. <script>
  35. import * as leaveApprovalApi from '@/apis/teacher/leaveApproval.js'
  36. export default {
  37. data() {
  38. return {
  39. leaveList: [],
  40. auditedIf: 0,
  41. years: '',
  42. pageNum: 1,
  43. pageSize: 5,
  44. recordsTotal: 0,
  45. list: [{
  46. name: '待处理'
  47. }, {
  48. name: '已处理'
  49. }],
  50. current: 0
  51. }
  52. },
  53. onShow() {
  54. this.getLoadLeaveLogForAudit(true);
  55. },
  56. onReachBottom() {
  57. if (this.reCoursesList.length < this.recordsTotal) {
  58. this.myLoadmore();
  59. }
  60. },
  61. methods: {
  62. myLoadmore() {
  63. this.pageNum += 1;
  64. this.getLoadLeaveLogForAudit();
  65. },
  66. getLoadLeaveLogForAudit(bl) {
  67. uni.showLoading({
  68. title: "加载中",
  69. mask: true,
  70. })
  71. if (bl) {
  72. this.leaveList = [];
  73. this.pageNum = 1;
  74. }
  75. leaveApprovalApi.loadLeaveLogForAudit({
  76. auditedIf: this.auditedIf,
  77. yyyyMM: this.years,
  78. pageNum: this.pageNum,
  79. pageSize: this.pageSize
  80. }).then((res) => {
  81. uni.hideLoading();
  82. this.leaveList = [
  83. ...this.leaveList,
  84. ...res.data.data
  85. ];
  86. this.recordsTotal = res.data.recordsTotal;
  87. }).catch(error => {
  88. uni.showToast({
  89. title: error,
  90. icon: "none"
  91. })
  92. })
  93. },
  94. change(index) {
  95. this.current = index;
  96. this.auditedIf = index;
  97. this.getLoadLeaveLogForAudit(true);
  98. },
  99. getFormatDate(val) {
  100. let date = new Date(val);
  101. let myyear = date.getFullYear();
  102. let mymonth = date.getMonth() + 1;
  103. let myweekday = date.getDate();
  104. let hour = date.getHours();
  105. let minute = date.getMinutes();
  106. let second = date.getSeconds();
  107. if (mymonth < 10) {
  108. mymonth = '0' + mymonth;
  109. }
  110. if (myweekday < 10) {
  111. myweekday = '0' + myweekday;
  112. }
  113. if(hour < 10) {
  114. hour = '0' + hour;
  115. }
  116. if(minute < 10) {
  117. minute = '0' + minute;
  118. }
  119. if(second < 10) {
  120. second = '0' + second;
  121. }
  122. return (myyear + '-' + mymonth + '-' + myweekday + ' ' + hour + ':' + minute + ':' + second);
  123. },
  124. }
  125. }
  126. </script>
  127. <style lang="scss" scoped>
  128. .tabs{
  129. padding: 0 170rpx;
  130. background-color: #fff;
  131. /deep/.u-tab-bar{
  132. background-color:#B5D0F4 !important;
  133. bottom: -6rpx;
  134. }
  135. }
  136. .item{
  137. background-color: #fff;
  138. border-radius: 24px;
  139. margin: 24rpx 32rpx;
  140. padding: 32rpx 24rpx;
  141. .head{
  142. display: flex;
  143. justify-content: space-between;
  144. align-items: center;
  145. .title{
  146. color: rgba(51, 51, 51, 1);
  147. font-size: 32rpx;
  148. font-weight: bold;
  149. }
  150. .state1{
  151. width: 120rpx;
  152. line-height: 48rpx;
  153. color: rgba(22, 119, 255, 1);
  154. font-size: 12px;
  155. text-align: center;
  156. font-family: Arial;
  157. border: 1px solid rgba(22, 119, 255, 1);
  158. border-radius: 100rpx;
  159. }
  160. .state2{
  161. width: 120rpx;
  162. line-height: 48rpx;
  163. color: rgba(0, 187, 170, 1);
  164. font-size: 12px;
  165. text-align: center;
  166. font-family: Arial;
  167. border: 1px solid rgba(0, 187, 170, 1);
  168. border-radius: 100rpx;
  169. }
  170. }
  171. .bottom{
  172. margin-top: 16rpx;
  173. display: flex;
  174. justify-content: space-between;
  175. align-items: center;
  176. .class{
  177. color: rgba(51, 51, 51, 1);
  178. }
  179. .time{
  180. color: rgba(119, 119, 119, 1);
  181. }
  182. }
  183. }
  184. </style>