index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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. height: 70rpx;
  188. border-radius: 10rpx;
  189. margin-right: 10rpx;
  190. border: 1px solid #dedede;
  191. background-color: #fff;
  192. overflow: hidden;
  193. .sub-box-min-box {
  194. .sub-box-name {
  195. padding-left: 10rpx;
  196. line-height: 70rpx;
  197. display: inline-block;
  198. width: 200rpx;
  199. overflow: hidden
  200. }
  201. .sub-box-button {
  202. display: inline-block;
  203. line-height: 70rpx;
  204. width: 40rpx;
  205. text-align: center;
  206. color: #dedede;
  207. overflow: hidden
  208. }
  209. }
  210. }
  211. .right-time-box {
  212. flex: 1;
  213. height: 70rpx;
  214. }
  215. }
  216. .info-max-box {
  217. flex: 1;
  218. overflow-y scroll;
  219. .for-box {
  220. .time-p {
  221. margin: 0 32rpx;
  222. font-size: 30rpx;
  223. }
  224. .for-min-box {
  225. background: #fff;
  226. margin: 32rpx;
  227. padding-bottom: 30rpx;
  228. .top-name-box {
  229. position: relative;
  230. display: flex;
  231. border-bottom: 1rpx dashed #dedede;
  232. margin-bottom: 30rpx;
  233. img {
  234. width: 70rpx;
  235. height: 70rpx;
  236. border-radius: 50%;
  237. margin: 27rpx 31rpx 33rpx 31rpx;
  238. }
  239. .top-name-p {
  240. line-height: 130rpx;
  241. font-size: 28rpx;
  242. flex: 1;
  243. display: block;
  244. overflow: hidden;
  245. text-overflow: ellipsis;
  246. white-space: nowrap;
  247. }
  248. .top-type-p {
  249. line-height: 130rpx;
  250. margin-right: 40rpx;
  251. font-size: 28rpx;
  252. display: block;
  253. overflow: hidden;
  254. text-overflow: ellipsis;
  255. white-space: nowrap;
  256. }
  257. .colorA {
  258. color: #0183FA;
  259. }
  260. .colorB {
  261. color: #999999;
  262. }
  263. .colorC {
  264. color: #FA5801;
  265. }
  266. .position-left {
  267. position: absolute;
  268. left: -15rpx;
  269. top: 114rpx;
  270. width: 30rpx;
  271. height: 30rpx;
  272. background: #f5f5f5;
  273. border-radius: 15rpx;
  274. }
  275. .position-right {
  276. position: absolute;
  277. right: -15rpx;
  278. top: 114rpx;
  279. width: 30rpx;
  280. height: 30rpx;
  281. background: #f5f5f5;
  282. border-radius: 15rpx;
  283. }
  284. }
  285. .titme-bottom-p {
  286. line-height: 50rpx;
  287. font-size: 28rpx;
  288. margin: 0 32rpx;
  289. }
  290. }
  291. }
  292. .get-data-null-p {
  293. text-align: center;
  294. line-height: 40rpx;
  295. padding-bottom: 40px;
  296. color: #999;
  297. }
  298. }
  299. }
  300. </style>