the_clock_record.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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. createDate:'',
  65. createDate1:'',
  66. }
  67. },
  68. onPullDownRefresh() {
  69. this.getList()
  70. setTimeout(function() {
  71. uni.stopPullDownRefresh(); //关闭下拉刷新
  72. }, 1000);
  73. },
  74. onShow() {
  75. this.getList()
  76. },
  77. onLoad(options) {
  78. let _day = new Date();
  79. _day.setTime(_day.getTime());
  80. this.createDate = _day.getFullYear() + "." + (_day.getMonth() + 1);
  81. this.createDate1 = _day.getFullYear() + "-" + (_day.getMonth() + 1);
  82. },
  83. onReachBottom() { //上拉触底函数
  84. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  85. this.currentPage += 1
  86. }
  87. this.getData()
  88. },
  89. methods: {
  90. dateChange(e) {
  91. console.log(e)
  92. this.createDate = e.year + "." + e.month
  93. this.createDate1 = e.year + "-" + e.month
  94. this.getList()
  95. },
  96. getData() {
  97. this.isLoadMore = true
  98. this.$api.doRequest('get', '/clockInfo/selectClockInfo', {
  99. pageSize: this.pageSize,
  100. currentPage: this.currentPage,
  101. pcFlag: 0,
  102. compId: uni.getStorageSync('pcUserInfo').compId,
  103. commonId: uni.getStorageSync('pcUserInfo').userId,
  104. }).then(res => {
  105. if (res.data.code == 200) {
  106. this.isLoadMore = false
  107. this.tableData = this.tableData.concat(res.data.data.records)
  108. }
  109. })
  110. },
  111. getList() {
  112. this.isLoadMore = true
  113. this.$api.doRequest('get', '/clockInfo/selectClockInfo', {
  114. pageSize: this.pageSize,
  115. currentPage: this.currentPage,
  116. pcFlag: 0,
  117. yearMonth: this.createDate1,
  118. compId: uni.getStorageSync('pcUserInfo').compId,
  119. commonId: uni.getStorageSync('pcUserInfo').userId,
  120. }).then(res => {
  121. if (res.data.code == 200) {
  122. this.isLoadMore = false
  123. this.tableData = res.data.data.records
  124. }
  125. })
  126. },
  127. supp(item) {
  128. uni.navigateTo({
  129. url: '/pages/clock/supp_clock' + `?id=${item.id}`,
  130. })
  131. },
  132. }
  133. }
  134. </script>
  135. <style scoped lang="scss">
  136. uni-page-body {
  137. overflow: hidden;
  138. }
  139. .uni-container {
  140. margin: 10rpx;
  141. padding: 10rpx 10rpx 300rpx 10rpx;
  142. .top {
  143. border-radius: 20rpx;
  144. background: white;
  145. padding: 20rpx;
  146. display: flex;
  147. margin-bottom: 20rpx;
  148. align-items: center;
  149. .center {
  150. margin-right: 50rpx;
  151. }
  152. }
  153. }
  154. .listitemStatus.audit {
  155. color: #ffffff;
  156. margin-top: 6rpx;
  157. }
  158. .listitemStatus.notPass {
  159. color: #ffffff;
  160. margin-top: 6rpx;
  161. }
  162. .listitemStatus.pass {
  163. color: #ffffff;
  164. margin-top: 6rpx;
  165. }
  166. .row {
  167. display: flex;
  168. justify-content: space-between;
  169. border-bottom: 1px solid #EEEEEE;
  170. padding: 21rpx 0;
  171. .right,
  172. input {
  173. font-size: 28rpx;
  174. color: #333333;
  175. }
  176. }
  177. .uni-button {
  178. margin-top: 6rpx;
  179. }
  180. </style>