laboratoryList.vue 12 KB

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