accessRecord.vue 6.2 KB

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