labPage.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <!-- 数据看板-首页 -->
  2. <template>
  3. <view class="labPage">
  4. <view class="chart">
  5. <!-- <view class="chart-t">
  6. <view class="chart-t-li" @click="dateClick(index)" :class="dateIndex==index?'color-A':'color-B'"
  7. v-for="(item,index) in dateList">
  8. <view class="chart-t-li-t">{{item.num}}</view>
  9. <view class="chart-t-li-b">{{item.letterNUm}}</view>
  10. </view>
  11. </view> -->
  12. <view class="chart-b">
  13. <qiun-data-charts :canvas2d="true" :background="'rgba(0,0,1,0)'" type="line" :opts="opts" :echartsH5="true" :chartData="chartData" :ontouch="true" />
  14. </view>
  15. </view>
  16. <view class="statistics">
  17. <view class="statistics-t">
  18. <view class="statistics-t-l">实验室总数:</view>
  19. <view class="statistics-t-r">{{labTotal}} 间</view>
  20. </view>
  21. <view class="statistics-b">
  22. <view class="statistics-b-li">
  23. <view class="statistics-b-li-t color-A">{{useTotal}} 间</view>
  24. <view class="statistics-b-li-b">使用</view>
  25. </view>
  26. <view class="line"></view>
  27. <view class="statistics-b-li">
  28. <view class="statistics-b-li-t color-B">{{availableTotal}} 间</view>
  29. <view class="statistics-b-li-b">空闲</view>
  30. </view>
  31. <view class="line"></view>
  32. <view class="statistics-b-li">
  33. <view class="statistics-b-li-t color-C">{{exceptionalTotal}} 间</view>
  34. <view class="statistics-b-li-b">异常</view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="table">
  39. <uni-card>
  40. <view style="height: 200px">
  41. <zb-table :columns="column" :stripe="false" :border="false" :data="dataList"></zb-table>
  42. </view>
  43. </uni-card>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. config
  50. } from '@/api/request/config.js'
  51. import {
  52. reportAppStatisticsLabStateStatistics,
  53. reportAppStatisticsLabNumberPeople,
  54. reportAppStatisticsPersonDeviceSafety,
  55. } from '@/pages/api/index.js'
  56. export default {
  57. name: "labPage",
  58. components: {
  59. },
  60. data() {
  61. return {
  62. dateList: [{
  63. num: '1',
  64. letterNUm: 'Mon',
  65. },
  66. {
  67. num: '2',
  68. letterNUm: 'Tue',
  69. },
  70. {
  71. num: '3',
  72. letterNUm: 'Wed',
  73. },
  74. {
  75. num: '4',
  76. letterNUm: 'Thur',
  77. },
  78. {
  79. num: '5',
  80. letterNUm: 'Fri',
  81. },
  82. {
  83. num: '6',
  84. letterNUm: 'Sat',
  85. },
  86. {
  87. num: '7',
  88. letterNUm: 'Sun',
  89. },
  90. ],
  91. dateIndex: 0,
  92. // 查询参数
  93. queryParams: {
  94. page: 1,
  95. pageSize: 10,
  96. },
  97. opts: {
  98. color: ["#0183FA", "#16BF32", "#FF8C00", "#FF0000", ],
  99. padding: [0, 0, 0, 0],
  100. enableScroll: true,
  101. touchMoveLimit:24,
  102. legend: {
  103. show: true,
  104. fontColor: '#fff',
  105. position: 'top',
  106. fontSize: 8,
  107. margin: 10,
  108. },
  109. extra: {
  110. tooltip: {
  111. legendShape: 'circle',
  112. },
  113. },
  114. xAxis: {
  115. disableGrid: true,
  116. scrollShow: true,
  117. itemCount: 4,
  118. fontColor: '#fff',
  119. },
  120. yAxis: {
  121. gridType: "dash",
  122. dashLength: 2,
  123. data: [{
  124. axisLine: false,
  125. fontColor: '#fff',
  126. }]
  127. },
  128. },
  129. chartData: {},
  130. column: [{
  131. name: 'deptSortName',
  132. label: '学院单位',
  133. fixed: true,
  134. width: 80,
  135. align: 'center',
  136. },
  137. {
  138. name: 'labCount',
  139. label: '实验人数',
  140. fixed: true,
  141. width: 80,
  142. align: 'center',
  143. },
  144. {
  145. name: 'dutyCount',
  146. label: '值班人数',
  147. align: 'center',
  148. },
  149. {
  150. name: 'checkCount',
  151. label: '检查次数',
  152. align: 'center',
  153. },
  154. {
  155. name: 'overdueDevice',
  156. label: '超期设备',
  157. align: 'center',
  158. },
  159. ],
  160. dataList: [],
  161. total: 0,
  162. labTotal: 0,
  163. useTotal: 0,
  164. availableTotal: 0,
  165. exceptionalTotal: 0,
  166. }
  167. },
  168. created() {
  169. this.dateIndex = new Date().getDay() - 1;
  170. console.log(this.dateIndex)
  171. },
  172. beforeMount() {
  173. },
  174. mounted() {
  175. this.reportAppStatisticsLabNumberPeople();
  176. this.reportAppStatisticsLabStateStatistics();
  177. this.getList();
  178. },
  179. methods: {
  180. dateClick(index) {
  181. //this.dateIndex = index;
  182. },
  183. //实验室使用、空闲、异常数量
  184. async reportAppStatisticsLabNumberPeople() {
  185. let self = this;
  186. const {
  187. data
  188. } = await reportAppStatisticsLabNumberPeople();
  189. if (data.code == 200) {
  190. let date = [];
  191. let list = []; //实验人数
  192. let list2 = []; //值日人数
  193. let list3 = []; //检查次数
  194. let list4 = []; //超期设备数
  195. date = data.data.dateList
  196. // 实验人数
  197. data.data.experimentList.forEach(function(item) {
  198. list.push(item.num)
  199. })
  200. // 值班
  201. data.data.dutyList.forEach(function(item) {
  202. list2.push(item.num)
  203. })
  204. // 检查
  205. data.data.checkList.forEach(function(item) {
  206. list3.push(item.num)
  207. })
  208. // 超期设备
  209. // data.data.deviceList.forEach(function(item) {
  210. // list4.push(item.num)
  211. // })
  212. let res = {
  213. categories: date,
  214. series: [{
  215. name: "实验人数",
  216. data: list
  217. },
  218. {
  219. name: "值日人数",
  220. data: list2
  221. },
  222. {
  223. name: "检查次数",
  224. data: list3
  225. },
  226. // {
  227. // name: "超期设备数",
  228. // data: list4
  229. // }
  230. ]
  231. };
  232. this.chartData = JSON.parse(JSON.stringify(res));
  233. }
  234. },
  235. //实验室使用、空闲、异常数量
  236. async reportAppStatisticsLabStateStatistics() {
  237. let self = this;
  238. const {
  239. data
  240. } = await reportAppStatisticsLabStateStatistics();
  241. if (data.code == 200) {
  242. this.$set(this, 'labTotal', data.data.labTotal)
  243. this.$set(this, 'useTotal', data.data.useTotal)
  244. this.$set(this, 'availableTotal', data.data.availableTotal)
  245. this.$set(this, 'exceptionalTotal', data.data.exceptionalTotal)
  246. }
  247. },
  248. async getList() {
  249. let self = this;
  250. const {
  251. data
  252. } = await reportAppStatisticsPersonDeviceSafety();
  253. if (data.code == 200) {
  254. this.dataList = data.data;
  255. }
  256. },
  257. },
  258. }
  259. </script>
  260. <style lang="stylus" scoped>
  261. .labPage {
  262. height: 100%;
  263. width: 100%;
  264. background: #363744;
  265. padding: 20rpx 30rpx 36rpx;
  266. box-sizing: border-box;
  267. .chart {
  268. width: 690rpx;
  269. height: 640rpx;
  270. background: #3E414F;
  271. border-radius: 20rpx 20rpx 20rpx 20rpx;
  272. padding: 34rpx 30rpx 26rpx;
  273. box-sizing: border-box;
  274. .chart-t {
  275. display: flex;
  276. justify-content: space-between;
  277. .chart-t-li {
  278. width: 76rpx;
  279. height: 100rpx;
  280. .chart-t-li-t {
  281. font-weight: 400;
  282. font-size: 30rpx;
  283. line-height: 42rpx;
  284. text-align: center;
  285. margin-top: 8rpx;
  286. }
  287. .chart-t-li-b {
  288. font-weight: 400;
  289. font-size: 28rpx;
  290. line-height: 39rpx;
  291. text-align: center;
  292. margin-top: 4rpx;
  293. }
  294. }
  295. .color-A {
  296. background: #0183FA;
  297. border-radius: 10rpx 10rpx 10rpx 10rpx;
  298. .chart-t-li-t {
  299. color: #FFFFFF;
  300. }
  301. .chart-t-li-b {
  302. color: #FFFFFF;
  303. }
  304. }
  305. .color-B {
  306. background: none;
  307. .chart-t-li-t {
  308. color: #FFFFFF;
  309. }
  310. .chart-t-li-b {
  311. color: #FFFFFF;
  312. }
  313. }
  314. }
  315. .chart-b {
  316. width: 632rpx;
  317. height: 444rpx;
  318. /* margin-top: 34rpx; */
  319. }
  320. }
  321. .statistics {
  322. width: 690rpx;
  323. height: 241rpx;
  324. background: #3E414F;
  325. border-radius: 20rpx 20rpx 20rpx 20rpx;
  326. margin-top: 20rpx;
  327. .statistics-t {
  328. height: 100rpx;
  329. display: flex;
  330. justify-content: space-between;
  331. align-items: center;
  332. border-bottom: 1rpx solid #52545F;
  333. padding: 0 42rpx 0 38rpx;
  334. box-sizing: border-box;
  335. .statistics-t-l {
  336. font-weight: 400;
  337. font-size: 32rpx;
  338. color: #FFFFFF;
  339. line-height: 45rpx;
  340. }
  341. .statistics-t-r {
  342. font-weight: 400;
  343. font-size: 36rpx;
  344. color: #FFFFFF;
  345. line-height: 50rpx;
  346. }
  347. }
  348. .statistics-b {
  349. display: flex;
  350. justify-content: space-between;
  351. align-items: center;
  352. .statistics-b-li {
  353. flex: 1;
  354. text-align: center;
  355. .statistics-b-li-t {
  356. font-weight: 400;
  357. font-size: 36rpx;
  358. line-height: 50rpx;
  359. margin-top: 28rpx;
  360. }
  361. .statistics-b-li-b {
  362. font-weight: 400;
  363. font-size: 28rpx;
  364. color: #FFFFFF;
  365. line-height: 39rpx;
  366. margin-top: 9rpx;
  367. }
  368. }
  369. .line {
  370. width: 2rpx;
  371. height: 30rpx;
  372. background: #D8D8D8;
  373. }
  374. .color-A {
  375. color: #FF8C00;
  376. }
  377. .color-B {
  378. color: #26C736;
  379. }
  380. .color-C {
  381. color: #FF0000;
  382. }
  383. }
  384. }
  385. .table {
  386. width: 690rpx;
  387. margin-top: 20rpx;
  388. border-radius: 20rpx 20rpx 0 0;
  389. overflow: hidden;
  390. }
  391. }
  392. </style>