accessRecord.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <!-- 进出记录 -->
  2. <template>
  3. <view class="accessRecord">
  4. <view class="title">
  5. <view v-for="(item,index) in statisticsData" :key="index">
  6. <view>{{item.num}}</view>
  7. <view>{{item.name}}</view>
  8. </view>
  9. </view>
  10. <scroll-view scroll-y @scrolltolower="scrollGet"
  11. style="padding-bottom:20rpx;flex:1;overflow-y: scroll;">
  12. <view class="list" v-for="(item,index) in dataList" :key="index">
  13. <view class="list-t">{{item.showInTime}}</view>
  14. <view class="list-b" v-for="(item2,index2) in item.list" :key="index2">
  15. <view class="list-b-t">
  16. <img v-if="item2.avatar" :src="baseUrl+item2.avatar">
  17. <img v-else :src="imagesUrl('commonality/icon_01.png')">
  18. <view>{{item2.userName}}</view>
  19. <view>{{item2.phone}}</view>
  20. <view
  21. :class="item2.accessStatus==1?'color-A':(item2.accessStatus==2?'color-B':(item2.accessStatus==3?'color-C':''))">
  22. {{item2.accessStatusStr}}
  23. </view>
  24. </view>
  25. <img class="list-b-img" :src="imagesUrl('commonality/for_min_bg.png')">
  26. <view class="list-b-b">
  27. <view>签到时间:{{item2.inTime?item2.inTime:'-'}}</view>
  28. <view>离开时间:{{item2.outTime?item2.outTime:'-'}}</view>
  29. <view>停留时间:{{item2.hoursMinutes?item2.hoursMinutes:'-'}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. </scroll-view>
  34. <view v-if="!dataList[0]" style="text-align: center;line-height:300rpx;color:#999;">暂无数据</view>
  35. </view>
  36. </template>
  37. <script>
  38. import {
  39. config
  40. } from '@/api/request/config.js'
  41. import {
  42. laboratoryAppletPassOutList,
  43. laboratoryAppletPassOutCount
  44. } from '@/pages_basics/api/index.js'
  45. export default {
  46. name: "accessRecord",
  47. props: {
  48. subjectData: {},
  49. },
  50. data() {
  51. return {
  52. baseUrl: config.base_url,
  53. statisticsData: [{
  54. name: '当前实验人数',
  55. num: '0'
  56. },
  57. {
  58. name: '今日累计人次',
  59. num: '0'
  60. },
  61. {
  62. name: '当月累计人次',
  63. num: '0'
  64. },
  65. ],
  66. newData: {
  67. },
  68. dataList: [],
  69. // 查询参数
  70. queryParams: {
  71. page: 1,
  72. pageSize: 10,
  73. subId: '',
  74. },
  75. total: 0,
  76. getDataType: false,
  77. }
  78. },
  79. created() {
  80. },
  81. beforeMount() {
  82. uni.$on('onReachBottom', () => { // 监听上拉加载
  83. console.log("到达底部,onReachBottom")
  84. this.scrollGet();
  85. })
  86. uni.$on('onPullDownRefresh', () => { // 监听下拉刷新
  87. console.log("进行了上拉刷新,onPullDownRefresh")
  88. })
  89. },
  90. mounted() {
  91. this.$set(this.queryParams, 'subId', this.subjectData.subId);
  92. this.laboratoryAppletPassOutCount();
  93. this.getList();
  94. },
  95. methods: {
  96. //滚动加载事件
  97. scrollGet() {
  98. if (this.total / this.queryParams.pageSize <= this.queryParams.page) {
  99. this.$set(this, 'getDataType', true);
  100. } else {
  101. this.queryParams.page += 1;
  102. this.$nextTick(() => {
  103. this.getList();
  104. })
  105. }
  106. },
  107. async laboratoryAppletPassOutCount() {
  108. let self = this;
  109. const {
  110. data
  111. } = await laboratoryAppletPassOutCount({subId:this.queryParams.subId});
  112. if (data.code == 200) {
  113. this.statisticsData[0].num = data.data.experimenters
  114. this.statisticsData[1].num = data.data.numberPeople
  115. this.statisticsData[2].num = data.data.monthNumberPeople
  116. }
  117. },
  118. async getList() {
  119. let self = this;
  120. let obj = JSON.parse(JSON.stringify(this.queryParams));
  121. const {
  122. data
  123. } = await laboratoryAppletPassOutList(obj);
  124. if (data.code == 200) {
  125. let list = [];
  126. if (this.queryParams.page != 1) {
  127. list = JSON.parse(JSON.stringify(this.dataList));
  128. }
  129. data.data.records.forEach((item) => {
  130. let num = 0;
  131. list.forEach((minItem) => {
  132. if (item.showInTime == minItem.showInTime) {
  133. num++
  134. minItem.list.push(item)
  135. }
  136. })
  137. if (num == 0) {
  138. list.push({
  139. showInTime: item.showInTime,
  140. list: [item]
  141. })
  142. }
  143. })
  144. this.$set(this, 'dataList', list);
  145. this.$set(this, 'total', data.data.total);
  146. if (data.data.total / this.queryParams.pageSize <= this.queryParams.page) {
  147. this.$set(this, 'getDataType', true);
  148. }
  149. }
  150. },
  151. },
  152. }
  153. </script>
  154. <style lang="stylus" scoped>
  155. .accessRecord {
  156. flex:1;
  157. display: flex;
  158. flex-direction: column;
  159. overflow: hidden;
  160. width: 750rpx;
  161. .title {
  162. width: 750rpx;
  163. height: 160rpx;
  164. background: #fff;
  165. display: flex;
  166. justify-content: space-between;
  167. padding: 0 20rpx;
  168. box-sizing: border-box;
  169. >view {
  170. flex: 1;
  171. >view:nth-of-type(1) {
  172. font-family: PingFang SC;
  173. font-weight: 500;
  174. font-size: 36rpx;
  175. color: #0183FA;
  176. line-height: 30rpx;
  177. text-align: center;
  178. margin: 30rpx 0 34rpx 0;
  179. }
  180. >view:nth-of-type(2) {
  181. font-family: PingFang SC;
  182. font-weight: 500;
  183. font-size: 30rpx;
  184. color: #222222;
  185. line-height: 30rpx;
  186. text-align: center;
  187. border-right: 1rpx solid #E0E0E0;
  188. }
  189. }
  190. >view:last-child {
  191. >view:nth-of-type(2) {
  192. border-right: none;
  193. }
  194. }
  195. }
  196. .list {
  197. padding: 0 20rpx;
  198. box-sizing: border-box;
  199. .list-t {
  200. height: 80rpx;
  201. font-family: PingFang SC;
  202. font-weight: 500;
  203. font-size: 32rpx;
  204. color: #222222;
  205. line-height: 80rpx;
  206. }
  207. .list-b {
  208. margin-bottom: 20rpx;
  209. .list-b-t {
  210. background: #FFFFFF;
  211. border-radius: 20rpx 20rpx 0 0;
  212. display: flex;
  213. justify-content: flex-start;
  214. align-items: center;
  215. padding: 30rpx 26rpx 16rpx 30rpx;
  216. box-sizing: border-box;
  217. >img {
  218. width: 70rpx;
  219. height: 70rpx;
  220. border-radius: 35rpx;
  221. }
  222. >view:nth-of-type(1) {
  223. font-family: PingFang SC;
  224. font-weight: 500;
  225. font-size: 28rpx;
  226. color: #333333;
  227. line-height: 30rpx;
  228. margin-left: 22rpx;
  229. }
  230. >view:nth-of-type(2) {
  231. font-family: PingFang SC;
  232. font-weight: 500;
  233. font-size: 28rpx;
  234. color: #333333;
  235. line-height: 30rpx;
  236. margin-left: 44rpx;
  237. }
  238. >view:nth-of-type(3) {
  239. font-family: PingFang SC;
  240. font-weight: 500;
  241. font-size: 28rpx;
  242. line-height: 30rpx;
  243. flex: 1;
  244. text-align: right;
  245. }
  246. .color-A {
  247. color: #0183FA;
  248. }
  249. .color-B {
  250. color: #999999;
  251. }
  252. .color-C {
  253. color: #FFAE00;
  254. }
  255. }
  256. .list-b-img {
  257. width: 710rpx;
  258. height: 32rpx;
  259. }
  260. .list-b-b {
  261. background: #FFFFFF;
  262. border-radius: 0 0 20rpx 20rpx;
  263. padding-top: 32rpx;
  264. box-sizing: border-box;
  265. overflow: hidden;
  266. >view {
  267. margin: 0 0 26rpx 20rpx;
  268. }
  269. }
  270. }
  271. }
  272. }
  273. </style>