the_clock_record.vue 5.5 KB

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