laboratoryList.vue 12 KB

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