the_clock_record.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view>
  3. <view class="uni-container">
  4. <view class="top">
  5. <view class="center">月份</view>
  6. <view @click='show=true'>{{createDate}}</view>
  7. <u-picker v-model="show" mode="time" @confirm='dateChange($event)' :params="params"></u-picker>
  8. </view>
  9. <uni-table border stripe emptyText="暂无更多数据">
  10. <!-- 表头行 -->
  11. <uni-tr>
  12. <uni-th align="center" width="50">日期</uni-th>
  13. <uni-th align="center" width="50">上班时间</uni-th>
  14. <uni-th align="center" width="50">下班时间</uni-th>
  15. </uni-tr>
  16. <!-- 表格数据行 -->
  17. <uni-tr v-for="(item, index) in tableData" :key="index">
  18. <uni-td align="center" style="height: 30px;">{{ item.createDate.split(" ")[0] }}</uni-td>
  19. <uni-td align="center">
  20. <view class="toClockDate" v-if="item.toClockDate">{{ item.toClockDate.split(" ")[1] }}</view>
  21. <view class="toClockDate" v-else-if="!item.toClockDate">
  22. <button v-if='item.approveStatus ==null && item.status == null' @click='supp(item)' class="uni-button" size="mini"
  23. type="primary" align="center" style="height: 30px;">补卡</button>
  24. <button v-if='item.approveStatus=="待人事审核"' class='listitemStatus audit Regular' size="mini"
  25. type="primary" align="center" style="height: 30px;">审核中</button>
  26. <button v-if='item.status=="补卡失败"' class='listitemStatus notPass Regular' size="mini"
  27. type="primary" align="center" style="height: 30px;">补卡失败</button>
  28. <button v-if='item.status=="补卡成功"' class='listitemStatus pass Regular' size="mini"
  29. type="primary" align="center" style="height: 30px;">补卡成功</button>
  30. </view>
  31. </uni-td>
  32. <uni-td align="center">
  33. <view class="offClockDate" v-if="item.offClockDate">{{ item.offClockDate.split(" ")[1] }}</view>
  34. <view class="offClockDate" v-else-if="!item.offClockDate">
  35. <button v-if='item.approveStatus ==null && item.status == null' @click='supp(item)' class="uni-button" size="mini"
  36. type="primary" align="center" style="height: 30px;">补卡</button>
  37. <button v-if='item.approveStatus=="待人事审核"' class='listitemStatus audit Regular' size="mini"
  38. type="primary" align="center" style="height: 30px;">审核中</button>
  39. <button v-if='item.status=="补卡失败"' class='listitemStatus notPass Regular' size="mini"
  40. type="primary" align="center" style="height: 30px;">补卡失败</button>
  41. <button v-if='item.status=="补卡成功"' class='listitemStatus pass Regular' size="mini"
  42. type="primary" align="center" style="height: 30px;">补卡成功</button>
  43. </view>
  44. </uni-td>
  45. </uni-tr>
  46. </uni-table>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. isSHowBtn: true,
  55. show: false,
  56. tableData: [],
  57. pageSize: 10,
  58. currentPage: 1,
  59. params: {
  60. year: true,
  61. month: true
  62. },
  63. isLoadMore: false,
  64. }
  65. },
  66. onPullDownRefresh() {
  67. this.getList()
  68. setTimeout(function() {
  69. uni.stopPullDownRefresh(); //关闭下拉刷新
  70. }, 1000);
  71. },
  72. onShow() {
  73. this.getList()
  74. },
  75. onLoad(options) {
  76. let _day = new Date();
  77. _day.setTime(_day.getTime());
  78. this.createDate = _day.getFullYear() + "-" + (_day.getMonth() + 1);
  79. },
  80. onReachBottom() { //上拉触底函数
  81. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  82. this.currentPage += 1
  83. }
  84. this.getData()
  85. },
  86. methods: {
  87. dateChange(e) {
  88. console.log(e)
  89. this.createDate = e.year + "-" + e.month
  90. this.getList()
  91. },
  92. getData() {
  93. this.isLoadMore = true
  94. this.$api.doRequest('get', '/clockInfo/selectClockInfo', {
  95. pageSize: this.pageSize,
  96. currentPage: this.currentPage,
  97. pcFlag: 0,
  98. compId: uni.getStorageSync('pcUserInfo').compId,
  99. commonId: uni.getStorageSync('pcUserInfo').userId,
  100. }).then(res => {
  101. if (res.data.code == 200) {
  102. this.isLoadMore = false
  103. this.tableData = this.tableData.concat(res.data.data.records)
  104. }
  105. })
  106. },
  107. getList() {
  108. this.isLoadMore = true
  109. this.$api.doRequest('get', '/clockInfo/selectClockInfo', {
  110. pageSize: this.pageSize,
  111. currentPage: this.currentPage,
  112. pcFlag: 0,
  113. yearMonth: this.createDate,
  114. compId: uni.getStorageSync('pcUserInfo').compId,
  115. commonId: uni.getStorageSync('pcUserInfo').userId,
  116. }).then(res => {
  117. if (res.data.code == 200) {
  118. this.isLoadMore = false
  119. this.tableData = res.data.data.records
  120. }
  121. })
  122. },
  123. supp(item) {
  124. uni.navigateTo({
  125. url: '/pages/clock/supp_clock' + `?id=${item.id}`,
  126. })
  127. },
  128. }
  129. }
  130. </script>
  131. <style scoped lang="scss">
  132. uni-page-body {
  133. overflow: hidden;
  134. }
  135. .uni-container {
  136. margin: 10rpx;
  137. padding: 10rpx 10rpx 300rpx 10rpx;
  138. .top {
  139. border-radius: 20rpx;
  140. background: white;
  141. padding: 20rpx;
  142. display: flex;
  143. margin-bottom: 20rpx;
  144. align-items: center;
  145. .center {
  146. margin-right: 50rpx;
  147. }
  148. }
  149. }
  150. .listitemStatus.audit {
  151. color: #ffffff;
  152. margin-top: 6rpx;
  153. }
  154. .listitemStatus.notPass {
  155. color: #ffffff;
  156. margin-top: 6rpx;
  157. }
  158. .listitemStatus.pass {
  159. color: #ffffff;
  160. margin-top: 6rpx;
  161. }
  162. .row {
  163. display: flex;
  164. justify-content: space-between;
  165. border-bottom: 1px solid #EEEEEE;
  166. padding: 21rpx 0;
  167. .right,
  168. input {
  169. font-size: 28rpx;
  170. color: #333333;
  171. }
  172. }
  173. .uni-button {
  174. margin-top: 6rpx;
  175. }
  176. </style>