accessRecord.vue 6.4 KB

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