laboratoryList.vue 10 KB

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