laboratoryList.vue 12 KB

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