meLaboratory.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  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?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. </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].subType)
  159. }
  160. this.subjectArray = list;
  161. list.unshift('全部分类');
  162. this.subjectList = data.data;
  163. this.subjectList.unshift({
  164. subType: "全部分类",
  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].titleName)
  178. }
  179. this.levelArray = list;
  180. list.unshift('全部分类');
  181. this.levelList = data.data;
  182. this.levelList.unshift({
  183. titleName: "全部分类",
  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. url: '/pages_manage/views/laboratory/safetyCardScan?infoData=' + encodeURIComponent(JSON.stringify(data.data))+'&saoCode=true'
  244. });
  245. }
  246. },
  247. },
  248. }
  249. </script>
  250. <style lang="stylus" scoped>
  251. #meLaboratory {
  252. height: 100%;
  253. display flex;
  254. flex-direction column;
  255. .top-picker-max-box {
  256. display: flex;
  257. padding: 0 20rpx;
  258. background #fff;
  259. border-bottom: 1rpx solid #E0E0E0;
  260. .top-picker-box {
  261. line-height: 80rpx;
  262. height: 80rpx;
  263. .picker-view {
  264. display flex;
  265. view {
  266. display: block;
  267. overflow: hidden;
  268. text-overflow: ellipsis;
  269. white-space: nowrap;
  270. font-size: 28rpx;
  271. }
  272. .picker-img {
  273. width: 24rpx;
  274. height: 13rpx;
  275. margin-top: 36rpx;
  276. margin-left: 13rpx;
  277. }
  278. }
  279. }
  280. .top-picker-box:nth-child(1) {
  281. text-align left;
  282. width: 320rpx;
  283. .picker-view {
  284. view {
  285. max-width: 260rpx;
  286. }
  287. }
  288. }
  289. .top-picker-box:nth-child(2) {
  290. text-align left;
  291. width: 215rpx;
  292. .picker-view {
  293. view {
  294. max-width: 156rpx;
  295. }
  296. }
  297. }
  298. .top-picker-box:nth-child(3) {
  299. text-align right;
  300. width: 195rpx;
  301. .picker-view {
  302. view {
  303. flex: 1;
  304. }
  305. }
  306. }
  307. }
  308. .for-max-box {
  309. flex: 1;
  310. overflow-y scroll;
  311. .null-img {
  312. display block;
  313. width: 276rpx;
  314. height: 321rpx;
  315. position absolute;
  316. top: 200rpx;
  317. left: 274rpx;
  318. }
  319. .for-box:nth-child(1) {
  320. border-top: none;
  321. }
  322. .for-box {
  323. border-top: 4rpx solid #dedede;
  324. overflow hidden;
  325. background #ffffff;
  326. margin-bottom: 20rpx;
  327. .title-box {
  328. margin: 20rpx 20rpx 0;
  329. display flex;
  330. view:nth-child(1) {
  331. height: 40rpx;
  332. line-height: 40rpx;
  333. font-size: 20rpx;
  334. border-radius: 10rpx;
  335. padding: 0 20rpx;
  336. color: #fff;
  337. margin-right: 20rpx;
  338. }
  339. view:nth-child(2) {
  340. line-height: 42rpx;
  341. font-size: 30rpx;
  342. color: #333;
  343. max-width: 600rpx;
  344. flex: 1;
  345. }
  346. img {
  347. width: 12rpx;
  348. height: 20rpx;
  349. margin-top: 11rpx;
  350. }
  351. .colorA {
  352. background: #aa2315;
  353. }
  354. .colorB {
  355. background: #ff9b09;
  356. }
  357. .colorC {
  358. background: #3ea3e9;
  359. }
  360. .colorD {
  361. background: #3ea34c;
  362. }
  363. }
  364. .address-box {
  365. margin: 20rpx 20rpx;
  366. font-size: 26rpx;
  367. color: #999999;
  368. span {
  369. margin-right: 60rpx;
  370. }
  371. }
  372. .address-box-two {
  373. display flex;
  374. margin: 0 20rpx 20rpx 20rpx;
  375. img {
  376. width: 28rpx;
  377. height: 30rpx;
  378. margin-right: 18rpx;
  379. }
  380. view {
  381. line-height: 30rpx;
  382. font-size: 24rpx;
  383. color: #999999;
  384. }
  385. }
  386. /*安全报警*/
  387. .for-img-box {
  388. border-top: 1rpx solid #e0e0e0;
  389. margin: 0 20rpx;
  390. .for-img-min-box {
  391. display flex img {
  392. width: 30rpx;
  393. height: 27rpx;
  394. margin-top: 24rpx;
  395. margin-right: 10rpx;
  396. }
  397. view {
  398. line-height: 74rpx;
  399. text-align center;
  400. font-size: 28rpx;
  401. color: #EE3A3A;
  402. }
  403. }
  404. }
  405. .button-view {
  406. margin: 0 20rpx;
  407. border-top: 1rpx dashed #e0e0e0;
  408. line-height: 90rpx;
  409. text-align: center;
  410. font-size: 26rpx;
  411. color: #333;
  412. }
  413. }
  414. .get-data-null-p {
  415. text-align: center;
  416. line-height: 40rpx;
  417. padding-bottom: 40px;
  418. color: #999;
  419. }
  420. }
  421. }
  422. </style>