sickNote.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view>
  3. <u-navbar title="请假"></u-navbar>
  4. <view class="main">
  5. <view class="sick-note" v-for="(item,index) in leaveList" :key="index" @click="toLeaveDetails(item)">
  6. <view class="head">
  7. <view class="name">
  8. {{item.studentName}}的请假条
  9. </view>
  10. <view class="state1" v-if="item.status == 0">
  11. 待处理
  12. </view>
  13. <view class="state2" v-if="item.status == 1">
  14. 已审核
  15. </view>
  16. <view class="state3" v-if="item.status == -1">
  17. 已取消
  18. </view>
  19. </view>
  20. <view class="infos">
  21. <view class="class">
  22. {{item.className}}
  23. </view>
  24. <view class="date">
  25. {{getFormatDate(item.createTime)}}
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="bottom">
  31. <button @click="toLeave">请假</button>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import * as sickNoteApi from '@/apis/youth/sickNote.js'
  37. export default {
  38. data() {
  39. return {
  40. leaveList: [],
  41. pageNum: 1,
  42. pageSize: 10,
  43. recordsTotal: 0,
  44. years: '',
  45. studentId: ''
  46. }
  47. },
  48. onShow() {
  49. if (this.carhelp.getNsStudentId()) {
  50. this.studentId = this.carhelp.getNsStudentId().studentId;
  51. this.getLeaveList(true);
  52. }
  53. },
  54. onReachBottom() {
  55. if (this.leaveList.length < this.recordsTotal) {
  56. this.myLoadmore();
  57. }
  58. },
  59. methods: {
  60. getFormatDate(val) {
  61. let date = new Date(val);
  62. let myyear = date.getFullYear();
  63. let mymonth = date.getMonth() + 1;
  64. let myweekday = date.getDate();
  65. let hour = date.getHours();
  66. let minute = date.getMinutes();
  67. let second = date.getSeconds();
  68. if (mymonth < 10) {
  69. mymonth = '0' + mymonth;
  70. }
  71. if (myweekday < 10) {
  72. myweekday = '0' + myweekday;
  73. }
  74. if(hour < 10) {
  75. hour = '0' + hour;
  76. }
  77. if(minute < 10) {
  78. minute = '0' + minute;
  79. }
  80. if(second < 10) {
  81. second = '0' + second;
  82. }
  83. return (myyear + '-' + mymonth + '-' + myweekday + ' ' + hour + ':' + minute + ':' + second);
  84. },
  85. toLeaveDetails(item) {
  86. uni.navigateTo({
  87. url: '/pages/youth/sickNote/leaveDetails?id=' + item.leaveId
  88. })
  89. },
  90. toLeave() {
  91. uni.navigateTo({
  92. url: '/pages/youth/sickNote/leave'
  93. })
  94. },
  95. myLoadmore() {
  96. this.pageNum += 1;
  97. this.getLeaveList()
  98. },
  99. getLeaveList(bl) {
  100. uni.showLoading({
  101. title: "加载中",
  102. mask: true,
  103. })
  104. if (bl) {
  105. this.leaveList = [];
  106. this.pageNum = 1;
  107. }
  108. sickNoteApi.loadStudentLeaveLog({
  109. studentId: this.studentId,
  110. yyyyMM: this.years,
  111. pageNum: this.pageNum,
  112. pageSize: this.pageSize
  113. }).then((res) => {
  114. uni.hideLoading();
  115. this.leaveList = [
  116. ...this.leaveList,
  117. ...res.data.data
  118. ];
  119. this.recordsTotal = res.data.recordsTotal;
  120. }).catch(error => {
  121. uni.showToast({
  122. title: error,
  123. icon: "none"
  124. })
  125. })
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. .main {
  132. padding: 12px;
  133. .sick-note {
  134. padding: 16px 12px;
  135. border-radius: 12px;
  136. background-color: #fff;
  137. margin-bottom: 12px;
  138. .head {
  139. display: flex;
  140. justify-content: space-between;
  141. align-items: center;
  142. .name {
  143. color: rgba(51, 51, 51, 1);
  144. font-size: 16px;
  145. }
  146. .state1 {
  147. line-height: 24px;
  148. border-radius: 50px;
  149. background-color: rgba(255, 255, 255, 1);
  150. color: rgba(22, 119, 255, 1);
  151. font-size: 12px;
  152. text-align: center;
  153. border: 1px solid 1px solid rgba(22, 119, 255, 1);
  154. padding: 0 16rpx;
  155. }
  156. .state2 {
  157. line-height: 24px;
  158. border-radius: 50px;
  159. background-color: rgba(255, 255, 255, 1);
  160. color: rgba(0, 187, 170, 1);
  161. font-size: 12px;
  162. text-align: center;
  163. border: 1px solid rgba(0, 187, 170, 1);
  164. padding: 0 16rpx;
  165. }
  166. .state3 {
  167. line-height: 24px;
  168. border-radius: 50px;
  169. background-color: rgba(255, 255, 255, 1);
  170. color: rgba(153, 153, 153, 1);
  171. font-size: 12px;
  172. text-align: center;
  173. border: 1px solid 1px solid rgba(153, 153, 153, 1);
  174. padding: 0 16rpx;
  175. }
  176. .checked {
  177. border: 1px solid rgba(204, 204, 204, 1);
  178. color: rgba(119, 119, 119, 1);
  179. }
  180. }
  181. .infos {
  182. display: flex;
  183. justify-content: space-between;
  184. align-items: center;
  185. margin-top: 8px;
  186. .class {
  187. color: rgba(51, 51, 51, 1);
  188. }
  189. .date {
  190. color: rgba(119, 119, 119, 1);
  191. }
  192. }
  193. }
  194. }
  195. .bottom {
  196. padding: 10px 16px;
  197. background-color: #fff;
  198. position: fixed;
  199. left: 0;
  200. right: 0;
  201. bottom: 0;
  202. button {
  203. border-radius: 50px;
  204. background-color: rgba(13, 186, 199, 1);
  205. color: rgba(255, 255, 255, 1);
  206. font-size: 16px;
  207. line-height: 40px;
  208. }
  209. }
  210. </style>