laboratoryList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  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="@/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].typeName)
  193. }
  194. this.subjectArray = list;
  195. list.unshift('全部分类');
  196. this.subjectList = data.data;
  197. this.subjectList.unshift({
  198. typeName: "全部分类",
  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].levelName)
  212. }
  213. this.levelArray = list;
  214. list.unshift('全部分类');
  215. this.levelList = data.data;
  216. this.levelList.unshift({
  217. levelName: "全部分类",
  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/infoPage?infoData=' + encodeURIComponent(JSON.stringify(data.data))
  290. });
  291. }
  292. },
  293. },
  294. }
  295. </script>
  296. <style lang="stylus" scoped>
  297. #laboratoryList {
  298. height: 100%;
  299. display flex;
  300. flex-direction column;
  301. .top-search-value-max-box{
  302. background-color: #fff;
  303. .top-search-value-box{
  304. display: flex;
  305. border:50rpx;
  306. height:80rpx;
  307. border:1px solid #E0E0E0;
  308. border-radius:40rpx;
  309. margin: 20rpx 30rpx 10rpx;
  310. img{
  311. width:26rpx;
  312. height:26rpx;
  313. margin:27rpx 30rpx;
  314. }
  315. .input-box{
  316. height:78rpx;
  317. line-height:78rpx;
  318. flex:1;
  319. }
  320. .button-box{
  321. width:120rpx;
  322. line-height:78rpx;
  323. height:78rpx;
  324. margin-right:10rpx;
  325. text-align: center;
  326. color:#0183FA;
  327. font-size:24rpx;
  328. }
  329. }
  330. }
  331. .top-picker-max-box {
  332. display: flex;
  333. padding: 0 20rpx;
  334. background #fff;
  335. border-bottom: 1rpx solid #E0E0E0;
  336. .top-picker-box {
  337. line-height: 80rpx;
  338. height: 80rpx;
  339. .picker-view {
  340. display flex;
  341. view {
  342. display: block;
  343. overflow: hidden;
  344. text-overflow: ellipsis;
  345. white-space: nowrap;
  346. font-size: 28rpx;
  347. }
  348. .picker-img {
  349. width: 24rpx;
  350. height: 13rpx;
  351. margin-top: 36rpx;
  352. margin-left: 13rpx;
  353. }
  354. }
  355. }
  356. .top-picker-box:nth-child(1) {
  357. text-align left;
  358. width: 320rpx;
  359. .picker-view {
  360. view {
  361. max-width: 260rpx;
  362. }
  363. }
  364. }
  365. .top-picker-box:nth-child(2) {
  366. text-align left;
  367. width: 215rpx;
  368. .picker-view {
  369. view {
  370. max-width: 156rpx;
  371. }
  372. }
  373. }
  374. .top-picker-box:nth-child(3) {
  375. text-align right;
  376. width: 195rpx;
  377. .picker-view {
  378. view {
  379. flex: 1;
  380. }
  381. }
  382. }
  383. }
  384. .for-max-box {
  385. flex: 1;
  386. overflow-y scroll;
  387. .null-img {
  388. display block;
  389. width: 276rpx;
  390. height: 321rpx;
  391. position absolute;
  392. top: 200rpx;
  393. left: 274rpx;
  394. }
  395. .for-box:nth-child(1) {
  396. border-top: none;
  397. }
  398. .for-box {
  399. width:690rpx;
  400. margin:20rpx 30rpx 0;
  401. .top-title-box{
  402. height:126rpx;
  403. width:690rpx;
  404. background: url("@/pages/images/newImage/img_sys_bg@1x.png");
  405. background-size 100%;
  406. background-repeat: no-repeat;
  407. view{
  408. height:42rpx;
  409. line-height:42rpx;
  410. font-size:30rpx;
  411. color:#333333;
  412. padding:20rpx 37rpx;
  413. display:block;
  414. overflow:hidden;
  415. text-overflow:ellipsis;
  416. white-space:nowrap;
  417. }
  418. }
  419. .bottom-text-max-box{
  420. overflow: hidden;
  421. border-radius:0 0 20rpx 20rpx;
  422. padding-bottom:26rpx;
  423. width:690rpx;
  424. background #ffffff;
  425. .bottom-text-box{
  426. padding:0 30rpx;
  427. view{
  428. margin-left:10rpx;
  429. margin-bottom:5rpx;
  430. display:inline-block;
  431. overflow: hidden;
  432. padding:0 20rpx;
  433. text-align: center;
  434. border-radius:10rpx;
  435. }
  436. .lv-p{
  437. height:38rpx;
  438. line-height:36rpx;
  439. font-size:28rpx;
  440. color: #FF0000;
  441. }
  442. .type-p,.class-p,.num-p{
  443. height:40rpx;
  444. line-height:38rpx;
  445. font-size:24rpx;
  446. color:#0183FA;
  447. background: rgba(1,131,250,0.2);
  448. }
  449. }
  450. .bottom-address-box{
  451. display: flex;
  452. padding:21rpx 30rpx 0;
  453. img{
  454. display: block;
  455. width:30rpx;
  456. height:30rpx;
  457. margin:0 15rpx 0 12rpx;
  458. }
  459. view{
  460. height:30rpx;
  461. line-height:30rpx;
  462. font-size:28rpx;
  463. display:block;
  464. overflow:hidden;
  465. text-overflow:ellipsis;
  466. white-space:nowrap;
  467. }
  468. }
  469. }
  470. }
  471. .get-data-null-p {
  472. text-align: center;
  473. height: 100rpx;
  474. line-height: 100rpx;
  475. color: #999;
  476. padding-bottom:200rpx;
  477. }
  478. }
  479. }
  480. </style>