accessQualification.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <!-- 准入资格证书 -->
  2. <template>
  3. <view id="accessQualification">
  4. <view class="top-picker-max-box">
  5. <input class="top-picker-input-box" type="text"
  6. v-model="queryParams.searchValue" placeholder="申请人/实验室名称/房间号" maxlength="20">
  7. <picker class="top-picker-right-box" @change="buttonChange"
  8. :range-key="'name'" :value="id" :range="buttonArray">
  9. <view>{{buttonArray[buttonArrayIndex].name}}</view>
  10. </picker>
  11. <view class="top-picker-left-box" @click="getButton()">搜索</view>
  12. </view>
  13. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  14. <view class="for-big-box" v-for="(item,index) in dataList" :key="index">
  15. <view class="for-time-p">{{item.titleCreatTime}}</view>
  16. <img class="for-back-img" :src="imagesUrl('commonality/for_min_bg.png')">
  17. <view class="for-list-box" @click="goPageInfo(minItem)" v-for="(minItem,indexTwo) in item.subList"
  18. :key="indexTwo">
  19. <view class="min-for-box-one">
  20. <view
  21. :class="minItem.auditStatus==1?'titleType1':(minItem.auditStatus==0?'titleType2':(minItem.auditStatus==2?'titleType3':''))">
  22. {{minItem.auditStatus==1?'未通过':(minItem.auditStatus==0?'待审核':(minItem.auditStatus==2?'已通过':''))}}
  23. </view>
  24. <view>{{minItem.subName}}{{minItem.roomNum?'('+minItem.roomNum+')':''}}</view>
  25. </view>
  26. <view class="min-for-box-two">
  27. <view></view>
  28. <view>申请人:{{minItem.userName}}</view>
  29. <view>{{minItem.creatTime}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="get-null-box" v-if="getData.nullDataType">暂无更多数据</view>
  34. </scroll-view>
  35. <view class="tip">请联系管理员开通<text>白名单</text>来获取实验室准入资格</view>
  36. </view>
  37. </template>
  38. <script>
  39. import {
  40. parseTime
  41. } from '@/component/public.js'
  42. import {
  43. laboratoryAppletAuditListByApply
  44. } from '@/pages_manage/api/index.js'
  45. export default {
  46. data() {
  47. return {
  48. //选项
  49. buttonArray: [{
  50. name: "全部",
  51. id: ""
  52. },
  53. {
  54. name: "待审核",
  55. id: "0"
  56. },
  57. {
  58. name: "已通过",
  59. id: "2"
  60. },
  61. {
  62. name: "未通过",
  63. id: "1"
  64. },
  65. ],
  66. buttonArrayIndex: 0,
  67. auditStatus: "",
  68. //列表请求参数
  69. queryParams: {
  70. searchValue:'',
  71. page: 1,
  72. pageSize: 20,
  73. },
  74. total: 0,
  75. dataList: [],
  76. }
  77. },
  78. onLoad() {
  79. },
  80. onShow() {
  81. this.clearData();
  82. this.getList();
  83. },
  84. mounted() {
  85. },
  86. methods: {
  87. getButton(){
  88. this.clearData();
  89. this.getList();
  90. },
  91. //清除
  92. clearData() {
  93. this.dataList = [];
  94. this.queryParams.page = 1;
  95. },
  96. //去详情页
  97. goPageInfo(item) {
  98. uni.navigateTo({
  99. url: '/pages_manage/views/accessQualification/accessQualificationInfo?item=' + encodeURIComponent(
  100. JSON.stringify(item))
  101. })
  102. },
  103. //滚动事件
  104. scrollGet() {
  105. let self = this;
  106. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  107. console.log('没有更多数据!')
  108. } else {
  109. setTimeout(function() {
  110. self.queryParams.page += 1;
  111. self.getList();
  112. }, 1000)
  113. }
  114. },
  115. //选择
  116. buttonChange(e) {
  117. // this.clearData()
  118. this.buttonArrayIndex = e.detail.value;
  119. this.$set(this, 'auditStatus', this.buttonArray[this.buttonArrayIndex].id);
  120. // this.getList();
  121. },
  122. //获取列表数据
  123. async getList() {
  124. let self = this;
  125. this.$set(this.queryParams, 'auditStatus', this.auditStatus)
  126. const {
  127. data
  128. } = await laboratoryAppletAuditListByApply(this.queryParams);
  129. if (data.code == 200) {
  130. //定义一个空数组
  131. let newArr = [];
  132. if(data.data.records){
  133. //通过forEach循环数组
  134. data.data.records.forEach((item, i) => {
  135. item.creatTime = parseTime(item.creatTime, "{h}:{i}")
  136. let index = -1;
  137. //然后在跑到这里筛选 根据不同的时间放置不同的数组 some()用来查找数组中是否存在某个值 如果存在 就return true
  138. let isExists = newArr.some((newItem, j) => {
  139. if (item.titleCreatTime == newItem.titleCreatTime) {
  140. index = j;
  141. return true;
  142. }
  143. })
  144. //代码是先跑这里的if条件判读
  145. if (!isExists) {
  146. newArr.push({
  147. titleCreatTime: item.titleCreatTime,
  148. subList: [item]
  149. })
  150. } else {
  151. newArr[index].subList.push(item);
  152. }
  153. })
  154. }
  155. this.dataList = [...this.dataList, ...newArr]
  156. this.total = data.data.total;
  157. }
  158. },
  159. }
  160. }
  161. </script>
  162. <style lang="stylus" scoped>
  163. #accessQualification {
  164. height: 100%;
  165. display flex;
  166. flex-direction column;
  167. .top-picker-max-box {
  168. height: 100rpx;
  169. display flex;
  170. height: 150rpx;
  171. background #fff;
  172. overflow hidden;
  173. margin-bottom: 15rpx;
  174. .top-picker-left-box {
  175. margin-top: 34rpx;
  176. line-height: 84rpx;
  177. height:84rpx;
  178. text-align: center;
  179. width: 120rpx;
  180. border-radius:6rpx;
  181. background-color: #0183fa;
  182. color:#fff;
  183. margin-left:20rpx;
  184. }
  185. .top-picker-input-box {
  186. margin-top: 34rpx;
  187. width: 350rpx;
  188. height: 82rpx;
  189. border: 1rpx solid #A2A2A2;
  190. line-height: 82rpx;
  191. border-radius: 6rpx;
  192. margin-left:30rpx;
  193. padding:0 20rpx;
  194. view {
  195. padding: 0 20rpx;
  196. color: #999999;
  197. }
  198. }
  199. .top-picker-right-box {
  200. margin-top: 34rpx;
  201. width: 140rpx;
  202. height: 82rpx;
  203. border: 1rpx solid #A2A2A2;
  204. line-height: 82rpx;
  205. border-radius: 6rpx;
  206. margin-left:20rpx;
  207. view {
  208. padding: 0 20rpx;
  209. color: #999999;
  210. }
  211. }
  212. }
  213. .top-max-box {
  214. height: 100rpx;
  215. display flex;
  216. background #fff;
  217. margin-bottom: 20rpx;
  218. .top-button-box {
  219. width: 200rpx;
  220. padding-top: 3rpx;
  221. view:nth-child(1) {
  222. font-size: 30rpx;
  223. text-align center;
  224. color: #333;
  225. line-height: 95rpx;
  226. }
  227. view:nth-child(2) {
  228. width: 100rpx;
  229. height: 5rpx;
  230. margin: 0 auto;
  231. }
  232. .colorA {
  233. color: #0183FA !important;
  234. }
  235. .backA {
  236. background: #0183FA;
  237. }
  238. }
  239. }
  240. .info-max-box {
  241. flex: 1;
  242. overflow: scroll;
  243. .for-big-box:last-child {
  244. margin-bottom: 180rpx;
  245. }
  246. .for-big-box {
  247. margin: 0 20rpx 20rpx;
  248. overflow hidden;
  249. border-radius: 20rpx;
  250. // border-bottom-left-radius :20rpx;
  251. // border-bottom-right-radius :20rpx;
  252. background #fff;
  253. .for-time-p {
  254. background #fff;
  255. line-height: 57rpx;
  256. font-size: 30rpx;
  257. padding: 14rpx 22rpx 0;
  258. // border-top-left-radius:20rpx;
  259. // border-top-right-radius:20rpx;
  260. }
  261. .for-back-img {
  262. height: 30rpx;
  263. width: 710rpx;
  264. }
  265. .for-list-box:nth-child(3) {
  266. border: none;
  267. }
  268. .for-list-box {
  269. border-top: 1rpx solid #E0E0E0;
  270. margin: 0 24rpx;
  271. padding: 20rpx 0;
  272. .min-for-box-one {
  273. display: flex;
  274. view {
  275. height: 36rpx;
  276. line-height: 36rpx;
  277. margin: 10rpx 0;
  278. }
  279. view:nth-child(1) {
  280. width: 100rpx;
  281. margin-right: 20rpx;
  282. line-height: 36rpx;
  283. text-align center;
  284. font-size: 20rpx;
  285. }
  286. view:nth-child(2) {
  287. flex: 1;
  288. font-size: 28rpx;
  289. }
  290. .titleType1 {
  291. border-radius: 6rpx;
  292. color: #FF5555;
  293. background rgba(255, 85, 85, 0.2)
  294. }
  295. .titleType2 {
  296. border-radius: 6rpx;
  297. color: #F6A71D;
  298. background rgba(246, 167, 29, 0.2)
  299. }
  300. .titleType3 {
  301. border-radius: 6rpx;
  302. color: #30A23D;
  303. background rgba(48, 162, 61, 0.2)
  304. }
  305. }
  306. .min-for-box-two {
  307. display: flex;
  308. view {
  309. height: 36rpx;
  310. line-height: 36rpx;
  311. margin: 10rpx 0;
  312. }
  313. view:nth-child(1) {
  314. width: 100rpx;
  315. margin-right: 20rpx;
  316. line-height: 36rpx;
  317. text-align center;
  318. font-size: 20rpx;
  319. }
  320. view:nth-child(2) {
  321. flex: 1;
  322. font-size: 26rpx;
  323. }
  324. view:nth-child(3) {
  325. font-size: 26rpx;
  326. }
  327. }
  328. }
  329. }
  330. .get-null-box {
  331. height: 100rpx;
  332. line-height: 100rpx;
  333. color: #999;
  334. text-align center;
  335. }
  336. }
  337. .bottom-button-box {
  338. border-radius: 20rpx;
  339. margin: 20rpx 50rpx;
  340. width: 650rpx;
  341. height: 100rpx;
  342. line-height: 100rpx;
  343. background: #0183FA;
  344. font-size: 30rpx;
  345. color: #FFFFFF;
  346. text-align center;
  347. }
  348. .tip {
  349. width: 750rpx;
  350. height: 100rpx;
  351. line-height: 100rpx;
  352. border-top: 1rpx solid #e0e0e0;
  353. background: #fff;
  354. font-size: 30rpx;
  355. color: #333;
  356. text-align center;
  357. >text {
  358. color: red;
  359. }
  360. }
  361. }
  362. </style>