particulars.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="container">
  3. <!-- 顶部搜索框区域 -->
  4. <view class="search">
  5. <uni-search-bar bgColor="#fff" placeholder="请输入打卡规则名称" cancelButton="none" v-model="searchValue"
  6. @input="input">
  7. </uni-search-bar>
  8. </view>
  9. <!-- 规则列表区域 -->
  10. <view class="list" v-if="list.length">
  11. <!-- 每一个规则区域 -->
  12. <view class="box" v-for="(item,index) in list" :key="index" @click="handleLook">
  13. <view class="icon">
  14. <img src="./imgs/rule.png">
  15. </view>
  16. <view class="info">
  17. <view class="title">
  18. {{item.name}}
  19. </view>
  20. <view class="status">
  21. <span class="right">全勤:{{item.peopleTotal}}人</span>
  22. <span>异常:{{item.failCount}}人</span>
  23. </view>
  24. </view>
  25. <!-- 右上角图标区域 -->
  26. <view class="image">
  27. <img v-if="item.failCount==0" src="./imgs/finished.png">
  28. <img v-else src="./imgs/unfinished.png">
  29. </view>
  30. </view>
  31. </view>
  32. <view class="list2" v-else>
  33. <img src="../../static/nodata.png">
  34. <view class="info">
  35. 暂无数据
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. page: 1,
  45. total: 0,
  46. // 当前时间
  47. nowTime: "",
  48. searchValue: "",
  49. list: []
  50. }
  51. },
  52. onLoad() {
  53. this.getTime()
  54. this.getData()
  55. },
  56. onReachBottom() {
  57. if (this.list.length < this.total) {
  58. this.page++
  59. this.getData()
  60. } else {
  61. uni.showToast({
  62. title: "没有更多数据了",
  63. icon: 'none'
  64. })
  65. }
  66. },
  67. methods: {
  68. // 获取当前年 月 日
  69. getTime() {
  70. let date = new Date()
  71. let year = date.getFullYear()
  72. let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
  73. let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
  74. this.nowTime = year + "-" + month + "-" + day + " " + "00:00:00"
  75. },
  76. // 获取列表数据
  77. async getData() {
  78. let res = await this.$myRequest({
  79. url: "/attendance/api/sign/check/in/summary",
  80. data: {
  81. name: this.searchValue,
  82. page: this.page,
  83. time: this.nowTime,
  84. type: 1
  85. }
  86. })
  87. // console.log(res);
  88. if (res.code == 200) {
  89. this.list = [...this.list, ...res.data.list]
  90. this.total = res.data.total
  91. }
  92. },
  93. // 点击每一个规则回调
  94. handleLook() {
  95. uni.navigateTo({
  96. url: "/pages/rulesDetail/rulesDetail"
  97. })
  98. },
  99. // 搜索框输入时的回调
  100. input(res) {
  101. this.list = []
  102. this.page = 1
  103. this.getData()
  104. },
  105. }
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. .container {
  110. padding-top: 20rpx;
  111. .search {
  112. margin: 0 auto;
  113. width: 690rpx;
  114. height: 90rpx;
  115. border-radius: 171rpx;
  116. background-color: #fff;
  117. }
  118. .list {
  119. margin-top: 20rpx;
  120. padding-bottom: 30rpx;
  121. .box {
  122. display: flex;
  123. margin: 0 auto;
  124. margin-bottom: 20rpx;
  125. width: 690rpx;
  126. height: 130rpx;
  127. background-color: #fff;
  128. .icon {
  129. flex: 1;
  130. display: flex;
  131. justify-content: center;
  132. align-items: center;
  133. img {
  134. width: 60rpx;
  135. height: 60rpx;
  136. }
  137. }
  138. .info {
  139. flex: 6;
  140. display: flex;
  141. flex-direction: column;
  142. justify-content: space-evenly;
  143. .title {
  144. font-size: 30rpx;
  145. }
  146. .status {
  147. font-size: 24rpx;
  148. font-weight: 500;
  149. color: #A6A6A6;
  150. .right {
  151. margin-right: 20rpx;
  152. }
  153. }
  154. }
  155. .image {
  156. margin-top: -5rpx;
  157. margin-right: -5rpx;
  158. width: 83rpx;
  159. height: 83rpx;
  160. img {
  161. width: 100%;
  162. height: 100%;
  163. }
  164. }
  165. }
  166. }
  167. .list2 {
  168. margin-top: 260rpx;
  169. text-align: center;
  170. img {
  171. width: 480rpx;
  172. height: 508rpx;
  173. }
  174. .info {
  175. color: #5792F0;
  176. }
  177. }
  178. }
  179. // 解决输入框不居中问题
  180. ::v-deep .uni-searchbar {
  181. padding: 10rpx;
  182. }
  183. </style>