leaveApproval.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. position:fixed;
  132. top: 88rpx;
  133. left: 0;
  134. right: 0;
  135. z-index: 999;
  136. ::v-deep.u-tab-bar{
  137. background-color:#B5D0F4 !important;
  138. bottom: -6rpx;
  139. }
  140. }
  141. .content{
  142. margin-top: 112rpx;
  143. }
  144. .item{
  145. background-color: #fff;
  146. border-radius: 24px;
  147. margin: 24rpx 32rpx;
  148. padding: 32rpx 24rpx;
  149. .head{
  150. display: flex;
  151. justify-content: space-between;
  152. align-items: center;
  153. .title{
  154. color: rgba(51, 51, 51, 1);
  155. font-size: 32rpx;
  156. font-weight: bold;
  157. }
  158. .state1{
  159. width: 120rpx;
  160. line-height: 48rpx;
  161. color: rgba(22, 119, 255, 1);
  162. font-size: 12px;
  163. text-align: center;
  164. font-family: Arial;
  165. border: 1px solid rgba(22, 119, 255, 1);
  166. border-radius: 100rpx;
  167. }
  168. .state2{
  169. width: 120rpx;
  170. line-height: 48rpx;
  171. color: rgba(0, 187, 170, 1);
  172. font-size: 12px;
  173. text-align: center;
  174. font-family: Arial;
  175. border: 1px solid rgba(0, 187, 170, 1);
  176. border-radius: 100rpx;
  177. }
  178. }
  179. .bottom{
  180. margin-top: 16rpx;
  181. display: flex;
  182. justify-content: space-between;
  183. align-items: center;
  184. .class{
  185. color: rgba(51, 51, 51, 1);
  186. }
  187. .time{
  188. color: rgba(119, 119, 119, 1);
  189. }
  190. }
  191. }
  192. </style>