the_clock_record.vue 4.7 KB

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