index.vue 7.4 KB

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