particulars.vue 4.3 KB

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