meLaboratory.vue 9.6 KB

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