index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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.subName}}{{minItem.roomNum?'('+minItem.roomNum+')':''}}</view>
  32. <view class="titme-bottom-p">签到时间:{{minItem.inTime?minItem.inTime:'-'}}</view>
  33. <view class="titme-bottom-p">离开时间:{{minItem.outTime?minItem.outTime:'-'}}</view>
  34. <view class="titme-bottom-p">停留时间:{{minItem.hoursMinutes?minItem.hoursMinutes:'-'}}</view>
  35. </view>
  36. </view>
  37. <view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
  38. </scroll-view>
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. config
  44. } from '@/api/request/config.js'
  45. import {
  46. laboratoryAppletSignSubList,
  47. laboratoryAppletPassOutList
  48. } from '@/pages_basics/api/index.js'
  49. export default {
  50. data() {
  51. return {
  52. baseUrl: config.base_url,
  53. range: [],
  54. subNameList: [],
  55. subList: [],
  56. subIndex: 0,
  57. // 查询参数
  58. queryParams: {
  59. page: 1,
  60. pageSize: 10,
  61. },
  62. //数据列表
  63. dataList: [],
  64. total: 0,
  65. getDataType: false,
  66. }
  67. },
  68. onLoad(option) {
  69. this.laboratoryAppletSignSubList();
  70. this.getList();
  71. },
  72. onShow() {
  73. },
  74. methods: {
  75. //选中数据
  76. tableButton(item) {
  77. if(item.accessStatus == 2){
  78. uni.navigateTo({
  79. url: '/pages_basics/views/record/infoPage?item=' + encodeURIComponent(JSON.stringify(item)) //安全警报
  80. });
  81. }
  82. },
  83. changeLog(e) {
  84. this.$set(this.queryParams,'page',1);
  85. this.$nextTick(() => {
  86. this.getList();
  87. })
  88. },
  89. bindPickerChange(e) {
  90. this.$set(this, 'subIndex', e.detail.value);
  91. this.$set(this.queryParams,'page',1);
  92. this.$nextTick(() => {
  93. this.getList();
  94. })
  95. },
  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. //获取数据列表
  108. async getList() {
  109. let self = this;
  110. let obj = JSON.parse(JSON.stringify(this.queryParams));
  111. obj.subId = this.subIndex == 0 ? '' : this.subList[this.subIndex].subId;
  112. if (this.range[0]) {
  113. obj.startTime = this.range[0] + 'T00:00:00'
  114. obj.endTime = this.range[1] + 'T23:59:59'
  115. } else {
  116. obj.startTime = '';
  117. obj.endTime = '';
  118. }
  119. const {
  120. data
  121. } = await laboratoryAppletPassOutList(obj);
  122. if (data.code == 200) {
  123. let list = [];
  124. if(this.queryParams.page != 1){
  125. list = JSON.parse(JSON.stringify(this.dataList));
  126. }
  127. data.data.records.forEach((item) => {
  128. let num = 0;
  129. list.forEach((minItem) => {
  130. if (item.showInTime == minItem.showInTime) {
  131. num++
  132. minItem.list.push(item)
  133. }
  134. })
  135. if (num == 0) {
  136. list.push({
  137. showInTime: item.showInTime,
  138. list: [item]
  139. })
  140. }
  141. })
  142. this.$set(this, 'dataList', list);
  143. this.$set(this, 'total', data.data.total);
  144. if (data.data.total / this.queryParams.pageSize <= this.queryParams.page) {
  145. this.$set(this, 'getDataType', true);
  146. }
  147. }
  148. },
  149. //查询实验室
  150. async laboratoryAppletSignSubList() {
  151. let self = this;
  152. const {
  153. data
  154. } = await laboratoryAppletSignSubList();
  155. if (data.code == 200) {
  156. let nameList = ['全部'];
  157. let list = [{
  158. subName: '全部',
  159. subId: ''
  160. }];
  161. data.data.forEach((item) => {
  162. nameList.push(item.subName)
  163. list.push({
  164. subName: item.subName,
  165. subId: item.subId,
  166. })
  167. })
  168. this.$set(this, 'subNameList', nameList);
  169. this.$set(this, 'subList', list);
  170. this.$set(this, 'subIndex', 0);
  171. }
  172. },
  173. }
  174. }
  175. </script>
  176. <style lang="stylus" scoped>
  177. .record-info-page {
  178. height: 100%;
  179. display: flex;
  180. flex-direction: column;
  181. overflow: hidden;
  182. .top-button-box {
  183. padding: 20rpx;
  184. display: flex;
  185. .sub-box {
  186. width: 250rpx;
  187. // #ifdef WEB
  188. height: 62rpx;
  189. // #endif
  190. // #ifdef MP-WEIXIN
  191. height: 70rpx;
  192. // #endif
  193. border-radius: 10rpx;
  194. margin-right: 10rpx;
  195. border: 1px solid #dedede;
  196. background-color: #fff;
  197. overflow: hidden;
  198. .sub-box-min-box {
  199. .sub-box-name {
  200. padding-left: 10rpx;
  201. // #ifdef WEB
  202. height: 62rpx;
  203. line-height:58rpx;
  204. // #endif
  205. // #ifdef MP-WEIXIN
  206. height: 70rpx;
  207. line-height:70rpx;
  208. // #endif
  209. display: inline-block;
  210. width: 200rpx;
  211. overflow: hidden
  212. }
  213. .sub-box-button {
  214. display: inline-block;
  215. // #ifdef WEB
  216. height: 62rpx;
  217. line-height:58rpx;
  218. // #endif
  219. // #ifdef MP-WEIXIN
  220. height: 70rpx;
  221. line-height:70rpx;
  222. // #endif
  223. width: 40rpx;
  224. text-align: center;
  225. color: #dedede;
  226. overflow: hidden
  227. }
  228. }
  229. }
  230. .right-time-box {
  231. flex: 1;
  232. height: 70rpx;
  233. }
  234. }
  235. .info-max-box {
  236. flex: 1;
  237. overflow-y scroll;
  238. .for-box {
  239. .time-p {
  240. margin: 0 32rpx;
  241. font-size: 30rpx;
  242. }
  243. .for-min-box {
  244. background: #fff;
  245. margin: 32rpx;
  246. padding-bottom: 30rpx;
  247. .top-name-box {
  248. position: relative;
  249. display: flex;
  250. border-bottom: 1rpx dashed #dedede;
  251. margin-bottom: 30rpx;
  252. img {
  253. width: 70rpx;
  254. height: 70rpx;
  255. border-radius: 50%;
  256. margin: 27rpx 31rpx 33rpx 31rpx;
  257. }
  258. .top-name-p {
  259. line-height: 130rpx;
  260. font-size: 28rpx;
  261. flex: 1;
  262. display: block;
  263. overflow: hidden;
  264. text-overflow: ellipsis;
  265. white-space: nowrap;
  266. }
  267. .top-type-p {
  268. line-height: 130rpx;
  269. margin-right: 40rpx;
  270. font-size: 28rpx;
  271. display: block;
  272. overflow: hidden;
  273. text-overflow: ellipsis;
  274. white-space: nowrap;
  275. }
  276. .colorA {
  277. color: #0183FA;
  278. }
  279. .colorB {
  280. color: #999999;
  281. }
  282. .colorC {
  283. color: #FA5801;
  284. }
  285. .position-left {
  286. position: absolute;
  287. left: -15rpx;
  288. top: 114rpx;
  289. width: 30rpx;
  290. height: 30rpx;
  291. background: #f5f5f5;
  292. border-radius: 15rpx;
  293. }
  294. .position-right {
  295. position: absolute;
  296. right: -15rpx;
  297. top: 114rpx;
  298. width: 30rpx;
  299. height: 30rpx;
  300. background: #f5f5f5;
  301. border-radius: 15rpx;
  302. }
  303. }
  304. .titme-bottom-p {
  305. line-height: 50rpx;
  306. font-size: 28rpx;
  307. margin: 0 32rpx;
  308. }
  309. }
  310. }
  311. .get-data-null-p {
  312. text-align: center;
  313. line-height: 40rpx;
  314. padding-bottom: 40px;
  315. color: #999;
  316. }
  317. }
  318. }
  319. </style>