dataBoard.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <!-- 数据看板-首页 -->
  2. <template>
  3. <view class="dataBoard">
  4. <nav-bar :title="title" style="position: absolute; z-index: 1000;"></nav-bar>
  5. <view class="header">
  6. <img class="header-bg" src="@/pages/images/dataBoard/dataBoard-icon1.png">
  7. <view class="header-t">
  8. <img class="header-t-l" src="@/pages/images/icon_aqbj.png">
  9. <view class="header-t-r">管理面板</view>
  10. </view>
  11. <view class="header-b">
  12. <view class="header-b-li">
  13. <view class="header-b-li-t color-A">999</view>
  14. <view class="header-b-li-b">今日访问人数</view>
  15. </view>
  16. <view class="line"></view>
  17. <view class="header-b-li">
  18. <view class="header-b-li-t color-B">165</view>
  19. <view class="header-b-li-b">今日实验人数</view>
  20. </view>
  21. <view class="line"></view>
  22. <view class="header-b-li">
  23. <view class="header-b-li-t color-C">39</view>
  24. <view class="header-b-li-b">今日值日人数</view>
  25. </view>
  26. <view class="line"></view>
  27. <view class="header-b-li">
  28. <view class="header-b-li-t color-D">562</view>
  29. <view class="header-b-li-b">今日检查次数</view>
  30. </view>
  31. </view>
  32. </view>
  33. <scroll-view scroll-x @scrolltolower="scrollGet">
  34. <view class="tabTitle_tow">
  35. <view class="tabTitle_tow_li" @tap="tabClickTow(item,index)" :key="index"
  36. v-for="(item,index) in tabTextTow">
  37. <view :class="{on:curTabTow==index}" class="tabTitle_tow_text">{{item}}</view>
  38. <view :class="{on:curTabTow==index}" class="tabTitle_tow_across"></view>
  39. </view>
  40. </view>
  41. </scroll-view>
  42. <lab-page v-if="pageType==1"></lab-page>
  43. <hazard-sources v-if="pageType==2"></hazard-sources>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. navBar
  49. } from '@/pages/component/navbar.vue'
  50. import {labPage} from '@/pages/views/dataBoard/labPage.vue'
  51. import {hazardSources} from '@/pages/views/dataBoard/hazardSources.vue'
  52. import {
  53. config
  54. } from '@/api/request/config.js'
  55. import {
  56. } from '@/pages_basics/api/index.js'
  57. export default {
  58. name: "dataBoard",
  59. components: {
  60. navBar,
  61. labPage,
  62. hazardSources,
  63. },
  64. data() {
  65. return {
  66. pageType:2,
  67. navHeight: uni.getStorageSync('navHeight'),
  68. title: '实验室安全智能监测与控制系统',
  69. baseUrl: config.base_url,
  70. // 查询参数
  71. queryParams: {
  72. page: 1,
  73. pageSize: 10,
  74. },
  75. dataList: [],
  76. total: 0,
  77. tabTextTow: ['实验室','危险源','危化品','安全隐患','预警处置','设备管控','大仪预约','笼位预约','资源预约'],
  78. curTabTow: 0,
  79. }
  80. },
  81. created() {
  82. },
  83. beforeMount() {
  84. },
  85. mounted() {},
  86. methods: {
  87. //滚动加载事件
  88. scrollGet() {
  89. if (this.total / this.queryParams.pageSize <= this.queryParams.page) {
  90. this.$set(this, 'getDataType', true);
  91. } else {
  92. this.queryParams.page += 1;
  93. this.$nextTick(() => {
  94. this.getList();
  95. })
  96. }
  97. },
  98. //顶部tab点击
  99. tabClickTow(item, index) {
  100. this.curTabTow = index;
  101. },
  102. async getList() {
  103. let self = this;
  104. let obj = JSON.parse(JSON.stringify(this.queryParams));
  105. const {
  106. data
  107. } = await laboratoryAppletPassOutList(obj);
  108. if (data.code == 200) {
  109. let list = [];
  110. if (this.queryParams.page != 1) {
  111. list = JSON.parse(JSON.stringify(this.dataList));
  112. }
  113. data.data.records.forEach((item) => {
  114. let num = 0;
  115. list.forEach((minItem) => {
  116. if (item.showInTime == minItem.showInTime) {
  117. num++
  118. minItem.list.push(item)
  119. }
  120. })
  121. if (num == 0) {
  122. list.push({
  123. showInTime: item.showInTime,
  124. list: [item]
  125. })
  126. }
  127. })
  128. this.$set(this, 'dataList', list);
  129. this.$set(this, 'total', data.data.total);
  130. if (data.data.total / this.queryParams.pageSize <= this.queryParams.page) {
  131. this.$set(this, 'getDataType', true);
  132. }
  133. }
  134. },
  135. },
  136. }
  137. </script>
  138. <style lang="stylus" scoped>
  139. .dataBoard {
  140. height: 100%;
  141. width: 100%;
  142. background: #363744;
  143. .header {
  144. width: 750rpx;
  145. height: 476rpx;
  146. position: relative;
  147. .header-bg {
  148. width: 750rpx;
  149. height: 476rpx;
  150. position: absolute;
  151. left: 0;
  152. top: 0;
  153. z-index: 100;
  154. }
  155. .header-t {
  156. width: 100%;
  157. height: 50rpx;
  158. position: absolute;
  159. left: 0;
  160. top: 154rpx;
  161. z-index: 200;
  162. .header-t-l {
  163. width: 300rpx;
  164. height: 50rpx;
  165. position: absolute;
  166. left: 30rpx;
  167. top: 0;
  168. }
  169. .header-t-r {
  170. position: absolute;
  171. right: 0;
  172. top: 0;
  173. font-weight: 400;
  174. font-size: 28rpx;
  175. color: #FFFFFF;
  176. line-height: 50rpx;
  177. text-align: left;
  178. width: 160rpx;
  179. height: 50rpx;
  180. background: rgba(54, 55, 68, 0.6);
  181. padding-left: 24rpx;
  182. border-radius: 24rpx 0 0 24rpx;
  183. }
  184. }
  185. .header-b {
  186. position: absolute;
  187. left: 30rpx;
  188. top: 302rpx;
  189. z-index: 200;
  190. width: 689rpx;
  191. height: 150rpx;
  192. background: rgba(62, 65, 79, 0.4);
  193. border-radius: 20rpx 20rpx 20rpx 20rpx;
  194. display: flex;
  195. justify-content: space-between;
  196. align-items: center;
  197. .header-b-li {
  198. flex: 1;
  199. text-align: center;
  200. .header-b-li-t {
  201. font-weight: 400;
  202. font-size: 36rpx;
  203. line-height: 50rpx;
  204. margin-top: 32rpx;
  205. margin-bottom: 9rpx;
  206. }
  207. .header-b-li-b {
  208. font-weight: 400;
  209. font-size: 24rpx;
  210. color: #FFFFFF;
  211. line-height: 34rpx;
  212. }
  213. }
  214. .line {
  215. width: 2rpx;
  216. height: 30rpx;
  217. background: #D8D8D8;
  218. }
  219. .color-A {
  220. color: #0183FA;
  221. }
  222. .color-B {
  223. color: #2EA805;
  224. }
  225. .color-C {
  226. color: #00FFE5;
  227. }
  228. .color-D {
  229. color: #FF8C00;
  230. }
  231. }
  232. }
  233. .tabTitle_tow {
  234. height: 80rpx;
  235. white-space: nowrap;
  236. display: inline-flex;
  237. background: #3E414F;
  238. .tabTitle_tow_li {
  239. position: relative;
  240. width: 152rpx;
  241. height: 80rpx;
  242. text-align center;
  243. padding-top: 18rpx;
  244. box-sizing: border-box;
  245. .tabTitle_tow_text {
  246. display: inline-block;
  247. font-size: 32rpx;
  248. font-family: PingFang SC;
  249. font-weight: 500;
  250. color: #FFFFFF;
  251. line-height: 46rpx;
  252. position: relative;
  253. &.on {
  254. color: #0183FA;
  255. }
  256. }
  257. .tabTitle_tow_across {
  258. width: 50rpx;
  259. height: 4rpx;
  260. background: #0183FA;
  261. border-radius: 2rpx;
  262. margin-left: 33%;
  263. margin-top: 16rpx;
  264. display none;
  265. &.on {
  266. display block;
  267. }
  268. }
  269. }
  270. }
  271. }
  272. </style>