index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <!-- 进出记录详情 -->
  2. <template>
  3. <view class="record-info-page">
  4. <view class="top-button-box">
  5. <!-- <view class="sub-box">
  6. <picker class="sub-box-min-box" @change="bindPickerChange" :value="subIndex" :range="subNameList">
  7. <view class="uni-input sub-box-name">{{subNameList[subIndex]}}</view>
  8. <view class="sub-box-button">v</view>
  9. </picker>
  10. </view> -->
  11. <view class="right-time-box">
  12. <uni-section class="section-time-box" :title="'日期范围用法:' + '[' + range + ']'" type="line"></uni-section>
  13. <uni-datetime-picker v-model="range" type="daterange" @change="changeLog($event)" />
  14. </view>
  15. </view>
  16. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  17. <view class="for-box" v-for="(item,index) in dataList" :key="index">
  18. <view class="time-p">{{item.showInTime}}</view>
  19. <view class="for-min-box" v-for="(minItem,minIndex) in item.list" :key="minIndex" @click="tableButton(minItem)">
  20. <view class="top-name-box">
  21. <view class="position-left"></view>
  22. <img v-if="minItem.avatar" :src="baseUrl+minItem.avatar">
  23. <img v-else :src="imagesUrl('commonality/icon_01.png')">
  24. <view class="top-name-p">{{minItem.userName}}</view>
  25. <view class="top-type-p"
  26. :class="minItem.accessStatus==1?'colorA':(minItem.accessStatus==2?'colorB':(minItem.accessStatus==3?'colorC':''))">
  27. {{minItem.accessStatusStr}}
  28. </view>
  29. <view class="position-right"></view>
  30. </view>
  31. <view class="titme-bottom-p">签到时间:{{minItem.inTime?minItem.inTime:'-'}}</view>
  32. <view class="titme-bottom-p">离开时间:{{minItem.outTime?minItem.outTime:'-'}}</view>
  33. <view class="titme-bottom-p">停留时间:{{minItem.hoursMinutes?minItem.hoursMinutes:'-'}}</view>
  34. </view>
  35. </view>
  36. <view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
  37. </scroll-view>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. config
  43. } from '@/api/request/config.js'
  44. import {
  45. laboratoryAppletMyPassOutList
  46. } from '@/pages_student/api/index.js'
  47. export default {
  48. data() {
  49. return {
  50. baseUrl: config.base_url,
  51. range: [],
  52. subNameList: [],
  53. subList: [],
  54. subIndex: 0,
  55. // 查询参数
  56. queryParams: {
  57. page: 1,
  58. pageSize: 10,
  59. },
  60. //数据列表
  61. dataList: [],
  62. total: 0,
  63. getDataType: false,
  64. }
  65. },
  66. onLoad(option) {
  67. this.getList();
  68. },
  69. onShow() {
  70. },
  71. methods: {
  72. //选中数据
  73. tableButton(item) {
  74. if(item.accessStatus == 2){
  75. uni.navigateTo({
  76. url: '/pages_student/views/myRecord/infoPage?item=' + encodeURIComponent(JSON.stringify(item))
  77. });
  78. }
  79. },
  80. changeLog(e) {
  81. this.$set(this.queryParams,'page',1);
  82. this.$nextTick(() => {
  83. this.getList();
  84. })
  85. },
  86. bindPickerChange(e) {
  87. this.$set(this, 'subIndex', e.detail.value);
  88. this.$set(this.queryParams,'page',1);
  89. this.$nextTick(() => {
  90. this.getList();
  91. })
  92. },
  93. //滚动加载事件
  94. scrollGet() {
  95. if (this.total / this.queryParams.pageSize <= this.queryParams.page) {
  96. this.$set(this, 'getDataType', true);
  97. } else {
  98. this.queryParams.page += 1;
  99. this.$nextTick(() => {
  100. this.getList();
  101. })
  102. }
  103. },
  104. //获取数据列表
  105. async getList() {
  106. let self = this;
  107. let obj = JSON.parse(JSON.stringify(this.queryParams));
  108. console.log('this.range',this.range)
  109. console.log('this.range',this.range[0])
  110. if (this.range[0]) {
  111. obj.startTime = this.range[0] + 'T00:00:00'
  112. obj.endTime = this.range[1] + 'T23:59:59'
  113. } else {
  114. obj.startTime = '';
  115. obj.endTime = '';
  116. }
  117. const {
  118. data
  119. } = await laboratoryAppletMyPassOutList(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. .record-info-page {
  152. height: 100%;
  153. display: flex;
  154. flex-direction: column;
  155. overflow: hidden;
  156. .top-button-box {
  157. padding: 20rpx;
  158. display: flex;
  159. .sub-box {
  160. width: 250rpx;
  161. height: 70rpx;
  162. border-radius: 10rpx;
  163. margin-right: 10rpx;
  164. border: 1px solid #dedede;
  165. background-color: #fff;
  166. overflow: hidden;
  167. .sub-box-min-box {
  168. .sub-box-name {
  169. padding-left: 10rpx;
  170. line-height: 70rpx;
  171. display: inline-block;
  172. width: 200rpx;
  173. overflow: hidden
  174. }
  175. .sub-box-button {
  176. display: inline-block;
  177. line-height: 70rpx;
  178. width: 40rpx;
  179. text-align: center;
  180. color: #dedede;
  181. overflow: hidden
  182. }
  183. }
  184. }
  185. .right-time-box {
  186. flex: 1;
  187. height: 80rpx;
  188. }
  189. }
  190. .info-max-box {
  191. flex: 1;
  192. overflow-y scroll;
  193. .for-box {
  194. .time-p {
  195. margin: 0 32rpx;
  196. font-size: 30rpx;
  197. }
  198. .for-min-box {
  199. background: #fff;
  200. margin: 32rpx;
  201. padding-bottom: 30rpx;
  202. .top-name-box {
  203. position: relative;
  204. display: flex;
  205. border-bottom: 1rpx dashed #dedede;
  206. margin-bottom: 30rpx;
  207. img {
  208. width: 70rpx;
  209. height: 70rpx;
  210. border-radius: 50%;
  211. margin: 27rpx 31rpx 33rpx 31rpx;
  212. }
  213. .top-name-p {
  214. line-height: 130rpx;
  215. font-size: 28rpx;
  216. flex: 1;
  217. display: block;
  218. overflow: hidden;
  219. text-overflow: ellipsis;
  220. white-space: nowrap;
  221. }
  222. .top-type-p {
  223. line-height: 130rpx;
  224. margin-right: 40rpx;
  225. font-size: 28rpx;
  226. display: block;
  227. overflow: hidden;
  228. text-overflow: ellipsis;
  229. white-space: nowrap;
  230. }
  231. .colorA {
  232. color: #0183FA;
  233. }
  234. .colorB {
  235. color: #999999;
  236. }
  237. .colorC {
  238. color: #FA5801;
  239. }
  240. .position-left {
  241. position: absolute;
  242. left: -15rpx;
  243. top: 114rpx;
  244. width: 30rpx;
  245. height: 30rpx;
  246. background: #f5f5f5;
  247. border-radius: 15rpx;
  248. }
  249. .position-right {
  250. position: absolute;
  251. right: -15rpx;
  252. top: 114rpx;
  253. width: 30rpx;
  254. height: 30rpx;
  255. background: #f5f5f5;
  256. border-radius: 15rpx;
  257. }
  258. }
  259. .titme-bottom-p {
  260. line-height: 50rpx;
  261. font-size: 28rpx;
  262. margin: 0 32rpx;
  263. }
  264. }
  265. }
  266. .get-data-null-p {
  267. text-align: center;
  268. line-height: 40rpx;
  269. padding-bottom: 40px;
  270. color: #999;
  271. }
  272. }
  273. }
  274. </style>