laboratoryList.vue 12 KB

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