particulars.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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-item.failCount}}人</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. if (this.type == 1) {
  66. uni.setNavigationBarTitle({
  67. title: '日汇总明细'
  68. })
  69. } else {
  70. uni.setNavigationBarTitle({
  71. title: '月汇总明细'
  72. })
  73. }
  74. this.getTime()
  75. this.getData()
  76. },
  77. onReachBottom() {
  78. if (this.list.length < this.total) {
  79. this.page++
  80. this.getData()
  81. } else {
  82. uni.showToast({
  83. title: "没有更多数据了",
  84. icon: 'none'
  85. })
  86. }
  87. },
  88. methods: {
  89. // 获取当前年 月 日
  90. getTime() {
  91. let date = new Date()
  92. let year = date.getFullYear()
  93. let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
  94. let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
  95. this.nowTime = year + "-" + month + "-" + day + " " + "00:00:00"
  96. },
  97. // 获取列表数据
  98. async getData() {
  99. let res = await this.$myRequest_clockIn({
  100. url: "/attendance/api/sign/check/in/summary",
  101. data: {
  102. name: this.searchValue,
  103. page: this.page,
  104. time: this.type == 1 ? this.nowTime_day : this.nowTime,
  105. type: this.type
  106. }
  107. })
  108. // console.log(res);
  109. if (res.code == 200) {
  110. this.list = [...this.list, ...res.data.list]
  111. this.total = res.data.total
  112. }
  113. },
  114. // 点击每一个规则回调
  115. handleLook(item) {
  116. // console.log(item);
  117. let info = JSON.stringify(item)
  118. uni.navigateTo({
  119. url: `/pagesClockIn/rulesDetail/rulesDetail?info=${info}`
  120. })
  121. },
  122. // 搜索框输入时的回调
  123. input(res) {
  124. this.list = []
  125. this.page = 1
  126. this.getData()
  127. },
  128. }
  129. }
  130. </script>
  131. <style lang="scss" scoped>
  132. .container {
  133. min-width: 100vw;
  134. min-height: 100vh;
  135. background-color: #F2F2F2;
  136. .placeholder {
  137. height: 20rpx;
  138. }
  139. .search {
  140. margin: 0 auto;
  141. width: 690rpx;
  142. height: 90rpx;
  143. border-radius: 171rpx;
  144. background-color: #fff;
  145. }
  146. .list {
  147. margin-top: 20rpx;
  148. padding-bottom: 30rpx;
  149. .box {
  150. display: flex;
  151. margin: 0 auto;
  152. margin-bottom: 20rpx;
  153. width: 690rpx;
  154. height: 130rpx;
  155. background-color: #fff;
  156. .icon {
  157. flex: 1;
  158. display: flex;
  159. justify-content: center;
  160. align-items: center;
  161. img {
  162. width: 60rpx;
  163. height: 60rpx;
  164. }
  165. }
  166. .info {
  167. flex: 6;
  168. display: flex;
  169. flex-direction: column;
  170. justify-content: space-evenly;
  171. .title {
  172. font-size: 30rpx;
  173. }
  174. .status {
  175. font-size: 24rpx;
  176. font-weight: 500;
  177. color: #A6A6A6;
  178. .right {
  179. margin-right: 20rpx;
  180. }
  181. }
  182. }
  183. .image {
  184. margin-top: -5rpx;
  185. margin-right: -5rpx;
  186. width: 83rpx;
  187. height: 83rpx;
  188. img {
  189. width: 100%;
  190. height: 100%;
  191. }
  192. }
  193. }
  194. }
  195. .list2 {
  196. margin-top: 260rpx;
  197. text-align: center;
  198. img {
  199. width: 480rpx;
  200. height: 508rpx;
  201. }
  202. .info {
  203. color: #5792F0;
  204. }
  205. }
  206. }
  207. // 解决输入框不居中问题
  208. ::v-deep .uni-searchbar {
  209. padding: 10rpx;
  210. }
  211. </style>