index.vue 7.4 KB

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