laboratoryList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <!-- 实验室列表 -->
  2. <template>
  3. <view id="laboratoryList">
  4. <view class='top-search-value-max-box'>
  5. <view class='top-search-value-box'>
  6. <img :src="imagesUrl('commonality/icon_sys_ss@1x.png')" @click="searchValueClick()">
  7. <input class="input-box" v-model="queryParams.searchValue"
  8. maxlength="10" placeholder="搜索实验室/房间号"
  9. type="text" @confirm="searchValueClick()">
  10. <view v-if="queryParams.searchValue" class="button-box" @click="delSearchValue">清除</view>
  11. </view>
  12. </view>
  13. <view class="top-picker-max-box">
  14. <view class="top-picker-box">
  15. <picker @change="facultyChange" :value="facultyIndex" :range="facultyArray">
  16. <view class="picker-view">
  17. <view>{{!facultyIndex&&facultyIndex!=0?'二级单位':facultyArray[facultyIndex]}}</view>
  18. <img class="picker-img" :src="imagesUrl('commonality/icon_06.png')" alt="">
  19. </view>
  20. </picker>
  21. </view>
  22. <view class="top-picker-box">
  23. <picker @change="subjectChange" :value="subjectIndex" :range="subjectArray">
  24. <view class="picker-view">
  25. <view>{{!subjectIndex&&subjectIndex!=0?'分类':subjectArray[subjectIndex]}}</view>
  26. <img class="picker-img" :src="imagesUrl('commonality/icon_06.png')" alt="">
  27. </view>
  28. </picker>
  29. </view>
  30. <view class="top-picker-box">
  31. <picker @change="levelChange" :value="levelIndex" :range="levelArray">
  32. <view class="picker-view">
  33. <view>{{!levelIndex&&levelIndex!=0?'分级':levelArray[levelIndex]}}</view>
  34. <img class="picker-img" :src="imagesUrl('commonality/icon_06.png')" alt="">
  35. </view>
  36. </picker>
  37. </view>
  38. </view>
  39. <scroll-view scroll-y @scrolltolower="scrollGet" class="for-max-box">
  40. <img class="null-img" v-if="!dataList[0]" :src="imagesUrl('commonality/null-data-1.png')">
  41. <view class="for-box" v-for="(item,index) in dataList" :key="index" @click="tableButton('subDetail',item)">
  42. <view class="top-title-box">
  43. <view>
  44. {{item.subName}} {{item.roomName?'('+item.roomName+')':''}}
  45. </view>
  46. </view>
  47. <view class="bottom-text-max-box">
  48. <view class="bottom-text-box">
  49. <view v-if="item.levelName" class="lv-p" :style="'border:1rpx solid '+item.levelColor+';background:#fff;color:'+item.levelColor+';'">{{item.levelName}}</view>
  50. <view v-if="item.typeName" class="type-p">{{item.typeName}}</view>
  51. <view v-if="item.moldName" class="class-p">{{item.moldName}}</view>
  52. <view v-if="item.subArea" class="num-p">{{item.subArea}}m²</view>
  53. </view>
  54. <view class="bottom-address-box">
  55. <img :src="imagesUrl('commonality/icon_sys_dz@1x.png')">
  56. <view>{{item.deptName}}丨{{item.buildName}}-{{item.floorName}}</view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
  61. </scroll-view>
  62. <tab-bar></tab-bar>
  63. </view>
  64. </template>
  65. <script>
  66. import tabBar from '@/pages/component/tabBar.vue'
  67. import $mqtt from '@/utils/mqtt.min.js';
  68. import {
  69. config
  70. } from '@/api/request/config.js'
  71. import {
  72. systemDeptDropList,
  73. laboratoryClassTypeGetList,
  74. laboratoryClassLevelGetList,
  75. laboratoryAppletSubList,
  76. laboratoryAppletGetSubDetailInfo
  77. } from '@/pages/api/index.js'
  78. export default {
  79. components: {
  80. tabBar,
  81. },
  82. data() {
  83. return {
  84. total: 0,
  85. dataList: [],
  86. getDataType: false,
  87. //院系选择器数据
  88. facultyList: [],
  89. facultyArray: [],
  90. facultyIndex: "",
  91. //分类选择器数据
  92. subjectList: [],
  93. subjectArray: [],
  94. subjectIndex: 0,
  95. //级别选择器数据
  96. levelList: [],
  97. levelArray: [],
  98. levelIndex: 0,
  99. // 查询参数
  100. queryParams: {
  101. page: 1,
  102. pageSize: 10,
  103. searchValue:"",
  104. deptId:"",
  105. typeId:"",
  106. levelId:"",
  107. },
  108. }
  109. },
  110. onLoad() {
  111. Promise.all([
  112. this.laboratoryClassTypeGetList(),
  113. this.laboratoryClassLevelGetList()
  114. ]).then((result) => {
  115. this.systemDeptDropList();
  116. }).catch((error) => {
  117. uni.showToast({
  118. title: '数据异常,请稍候再试!',
  119. icon: "none",
  120. duration: 3000
  121. });
  122. })
  123. },
  124. onShow() {
  125. },
  126. methods: {
  127. //选择学院
  128. facultyChange: function(e) {
  129. if (this.facultyArray[0]) {
  130. this.facultyIndex = parseInt(e.target.value);
  131. this.$set(this.queryParams,'page',1);
  132. this.getList();
  133. }
  134. },
  135. //选择类型
  136. subjectChange: function(e) {
  137. if (this.subjectArray[0]) {
  138. this.subjectIndex = parseInt(e.target.value);
  139. this.$set(this.queryParams,'page',1);
  140. this.getList();
  141. }
  142. },
  143. //选择级别
  144. levelChange: function(e) {
  145. if (this.levelArray[0]) {
  146. this.levelIndex = parseInt(e.target.value);
  147. this.$set(this.queryParams,'page',1);
  148. this.getList();
  149. }
  150. },
  151. //获取院系
  152. async systemDeptDropList() {
  153. const {
  154. data
  155. } = await systemDeptDropList({
  156. deptName: '',
  157. level: 2,
  158. deptType: 1
  159. });
  160. if (data.code == 200) {
  161. let list = [];
  162. for (let i = 0; i < data.data.length; i++) {
  163. list.push(data.data[i].deptName)
  164. }
  165. if(uni.getStorageSync('subAdmin')==1){
  166. this.facultyArray.push('我的实验室')
  167. this.facultyList.push({
  168. deptName: "我的实验室",
  169. deptId: "-1"
  170. })
  171. }
  172. if(config.schoolId == uni.getStorageSync('user').position){
  173. this.facultyArray.push('全部')
  174. this.facultyList.push({
  175. deptName: "全部",
  176. deptId: ""
  177. })
  178. this.facultyArray = this.facultyArray.concat(list)
  179. this.facultyList = this.facultyArray.concat(data.data)
  180. }else{
  181. this.facultyArray.push(uni.getStorageSync('userDeptName'))
  182. this.facultyList.push({
  183. deptName: uni.getStorageSync('userDeptName'),
  184. deptId: uni.getStorageSync('userDeptId')
  185. })
  186. }
  187. if(this.facultyList[0]){
  188. this.$set(this,'facultyIndex',0);
  189. this.getList()
  190. }
  191. }
  192. },
  193. //分类下拉列表
  194. async laboratoryClassTypeGetList() {
  195. const {
  196. data
  197. } = await laboratoryClassTypeGetList();
  198. if (data.code == 200) {
  199. let list = [];
  200. for (let i = 0; i < data.data.length; i++) {
  201. list.push(data.data[i].subType)
  202. }
  203. this.subjectArray = list;
  204. list.unshift('全部分类');
  205. this.subjectList = data.data;
  206. this.subjectList.unshift({
  207. subType: "全部分类",
  208. typeId: ""
  209. })
  210. }
  211. },
  212. //分级下拉列表
  213. async laboratoryClassLevelGetList() {
  214. const {
  215. data
  216. } = await laboratoryClassLevelGetList();
  217. if (data.code == 200) {
  218. let list = [];
  219. for (let i = 0; i < data.data.length; i++) {
  220. list.push(data.data[i].titleName)
  221. }
  222. this.levelArray = list;
  223. list.unshift('全部分级');
  224. this.levelList = data.data;
  225. this.levelList.unshift({
  226. titleName: "全部分级",
  227. levelId: ""
  228. })
  229. }
  230. },
  231. //滚动加载事件
  232. scrollGet() {
  233. let self = this;
  234. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  235. this.$set(this, 'getDataType', true);
  236. } else {
  237. this.queryParams.page += 1;
  238. this.$nextTick(() => {
  239. this.getList();
  240. })
  241. }
  242. },
  243. delSearchValue(){
  244. this.$set(this.queryParams,'searchValue','')
  245. this.$set(this.queryParams,'page',1);
  246. this.$nextTick(() => {
  247. this.getList();
  248. })
  249. },
  250. searchValueClick(){
  251. if(this.facultyList[0]){
  252. this.$set(this.queryParams,'page',1);
  253. this.$nextTick(() => {
  254. this.getList();
  255. })
  256. }
  257. },
  258. //获取实验室列表
  259. async getList() {
  260. if(!this.facultyList[0]||uni.getStorageSync('userType')==2){
  261. return
  262. }
  263. let self = this;
  264. let obj = JSON.parse(JSON.stringify(this.queryParams));
  265. obj.deptId = this.facultyIndex||this.facultyIndex==0 ? this.facultyList[this.facultyIndex].deptId : '';
  266. obj.typeId = this.subjectIndex||this.subjectIndex==0 ? this.subjectList[this.subjectIndex].typeId : '';
  267. obj.levelId = this.levelIndex||this.levelIndex==0 ? this.levelList[this.levelIndex].levelId : '';
  268. const {
  269. data
  270. } = await laboratoryAppletSubList(obj);
  271. if (data.code == 200) {
  272. if(self.queryParams.page == 1){
  273. this.dataList = data.data.records;
  274. this.total = data.data.total;
  275. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  276. this.$set(this, 'getDataType', true);
  277. }
  278. }else{
  279. this.dataList = [...this.dataList, ...data.data.records]
  280. this.total = data.data.total;
  281. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  282. this.$set(this, 'getDataType', true);
  283. }
  284. }
  285. }
  286. },
  287. tableButton(type, row) {
  288. let self = this;
  289. if (type == 'subDetail') {
  290. //实验室详情
  291. this.laboratoryAppletGetSubDetailInfo(row.infoId)
  292. }
  293. },
  294. //获取实验室详情
  295. async laboratoryAppletGetSubDetailInfo(infoId) {
  296. const {
  297. data
  298. } = await laboratoryAppletGetSubDetailInfo({
  299. infoId: infoId
  300. });
  301. if (data.code == 200) {
  302. uni.navigateTo({
  303. url: '/pages_manage/views/laboratory/safetyCardScan?infoData=' + encodeURIComponent(JSON.stringify(data.data))+'&saoCode=true'
  304. // url: '/pages_manage/views/laboratory/infoPage?infoData=' + encodeURIComponent(JSON.stringify(data.data))
  305. });
  306. }
  307. },
  308. },
  309. }
  310. </script>
  311. <style lang="stylus" scoped>
  312. @import '@/api/request/imagesUrl.styl';
  313. #laboratoryList {
  314. height: 100%;
  315. display flex;
  316. flex-direction column;
  317. .top-search-value-max-box{
  318. background-color: #fff;
  319. .top-search-value-box{
  320. display: flex;
  321. border:50rpx;
  322. height:80rpx;
  323. border:1px solid #E0E0E0;
  324. border-radius:40rpx;
  325. margin: 20rpx 30rpx 10rpx;
  326. img{
  327. width:26rpx;
  328. height:26rpx;
  329. margin:27rpx 30rpx;
  330. }
  331. .input-box{
  332. height:78rpx;
  333. line-height:78rpx;
  334. flex:1;
  335. }
  336. .button-box{
  337. width:120rpx;
  338. line-height:78rpx;
  339. height:78rpx;
  340. margin-right:10rpx;
  341. text-align: center;
  342. color:#0183FA;
  343. font-size:24rpx;
  344. }
  345. }
  346. }
  347. .top-picker-max-box {
  348. display: flex;
  349. padding: 0 20rpx;
  350. background #fff;
  351. border-bottom: 1rpx solid #E0E0E0;
  352. .top-picker-box {
  353. line-height: 80rpx;
  354. height: 80rpx;
  355. .picker-view {
  356. display flex;
  357. view {
  358. display: block;
  359. overflow: hidden;
  360. text-overflow: ellipsis;
  361. white-space: nowrap;
  362. font-size: 28rpx;
  363. }
  364. .picker-img {
  365. width: 24rpx;
  366. height: 13rpx;
  367. margin-top: 36rpx;
  368. margin-left: 13rpx;
  369. }
  370. }
  371. }
  372. .top-picker-box:nth-child(1) {
  373. text-align left;
  374. width: 320rpx;
  375. .picker-view {
  376. view {
  377. max-width: 260rpx;
  378. }
  379. }
  380. }
  381. .top-picker-box:nth-child(2) {
  382. text-align left;
  383. width: 215rpx;
  384. .picker-view {
  385. view {
  386. max-width: 156rpx;
  387. }
  388. }
  389. }
  390. .top-picker-box:nth-child(3) {
  391. text-align right;
  392. width: 195rpx;
  393. .picker-view {
  394. view {
  395. flex: 1;
  396. }
  397. }
  398. }
  399. }
  400. .for-max-box {
  401. flex: 1;
  402. overflow-y scroll;
  403. .null-img {
  404. display block;
  405. width: 276rpx;
  406. height: 321rpx;
  407. position absolute;
  408. top: 200rpx;
  409. left: 274rpx;
  410. }
  411. .for-box:nth-child(1) {
  412. border-top: none;
  413. }
  414. .for-box {
  415. width:690rpx;
  416. margin:20rpx 30rpx 0;
  417. .top-title-box{
  418. height:126rpx;
  419. width:690rpx;
  420. background: url($imagesUrl+'commonality/img_sys_bg@1x.png');
  421. background-size 100%;
  422. background-repeat: no-repeat;
  423. view{
  424. height:42rpx;
  425. line-height:42rpx;
  426. font-size:30rpx;
  427. color:#333333;
  428. padding:20rpx 37rpx;
  429. display:block;
  430. overflow:hidden;
  431. text-overflow:ellipsis;
  432. white-space:nowrap;
  433. }
  434. }
  435. .bottom-text-max-box{
  436. overflow: hidden;
  437. border-radius:0 0 20rpx 20rpx;
  438. padding-bottom:26rpx;
  439. width:690rpx;
  440. background #ffffff;
  441. .bottom-text-box{
  442. padding:0 30rpx;
  443. view{
  444. margin-left:10rpx;
  445. margin-bottom:5rpx;
  446. display:inline-block;
  447. overflow: hidden;
  448. padding:0 20rpx;
  449. text-align: center;
  450. border-radius:10rpx;
  451. }
  452. .lv-p{
  453. height:38rpx;
  454. line-height:36rpx;
  455. font-size:28rpx;
  456. color: #FF0000;
  457. }
  458. .type-p,.class-p,.num-p{
  459. height:40rpx;
  460. line-height:38rpx;
  461. font-size:24rpx;
  462. color:#0183FA;
  463. background: rgba(1,131,250,0.2);
  464. }
  465. }
  466. .bottom-address-box{
  467. display: flex;
  468. padding:21rpx 30rpx 0;
  469. img{
  470. display: block;
  471. width:30rpx;
  472. height:30rpx;
  473. margin:0 15rpx 0 12rpx;
  474. }
  475. view{
  476. height:30rpx;
  477. line-height:30rpx;
  478. font-size:28rpx;
  479. display:block;
  480. overflow:hidden;
  481. text-overflow:ellipsis;
  482. white-space:nowrap;
  483. }
  484. }
  485. }
  486. }
  487. .get-data-null-p {
  488. text-align: center;
  489. height: 100rpx;
  490. line-height: 100rpx;
  491. color: #999;
  492. padding-bottom:200rpx;
  493. }
  494. }
  495. }
  496. </style>