the_clock_record.vue 5.9 KB

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