accessRecord.vue 6.1 KB

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