meLaboratory.vue 10 KB

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