labPage.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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 type="line" :opts="opts" :echartsH5="true" :chartData="chartData" :canvas2d="true" :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. legend: {
  102. show: true,
  103. fontColor: '#fff',
  104. position: 'top',
  105. fontSize: 8,
  106. margin: 10,
  107. },
  108. extra: {
  109. tooltip: {
  110. legendShape: 'circle',
  111. },
  112. },
  113. xAxis: {
  114. disableGrid: true,
  115. scrollShow: true,
  116. itemCount: 4,
  117. fontColor: '#fff',
  118. },
  119. yAxis: {
  120. gridType: "dash",
  121. dashLength: 2,
  122. data: [{
  123. axisLine: false,
  124. fontColor: '#fff',
  125. }]
  126. },
  127. },
  128. chartData: {},
  129. column: [{
  130. name: 'deptSortName',
  131. label: '学院单位',
  132. fixed: true,
  133. width: 80,
  134. align: 'center',
  135. },
  136. {
  137. name: 'labCount',
  138. label: '实验人数',
  139. fixed: true,
  140. width: 80,
  141. align: 'center',
  142. },
  143. {
  144. name: 'dutyCount',
  145. label: '值班人数',
  146. align: 'center',
  147. },
  148. {
  149. name: 'checkCount',
  150. label: '检查次数',
  151. align: 'center',
  152. },
  153. {
  154. name: 'overdueDevice',
  155. label: '超期设备',
  156. align: 'center',
  157. },
  158. ],
  159. dataList: [],
  160. total: 0,
  161. labTotal: 0,
  162. useTotal: 0,
  163. availableTotal: 0,
  164. exceptionalTotal: 0,
  165. }
  166. },
  167. created() {
  168. this.dateIndex = new Date().getDay() - 1;
  169. console.log(this.dateIndex)
  170. },
  171. beforeMount() {
  172. },
  173. mounted() {
  174. this.reportAppStatisticsLabNumberPeople();
  175. this.reportAppStatisticsLabStateStatistics();
  176. this.getList();
  177. },
  178. methods: {
  179. dateClick(index) {
  180. //this.dateIndex = index;
  181. },
  182. //实验室使用、空闲、异常数量
  183. async reportAppStatisticsLabNumberPeople() {
  184. let self = this;
  185. const {
  186. data
  187. } = await reportAppStatisticsLabNumberPeople();
  188. if (data.code == 200) {
  189. let date = [];
  190. let list = []; //实验人数
  191. let list2 = []; //值日人数
  192. let list3 = []; //检查次数
  193. let list4 = []; //超期设备数
  194. date = data.data.dateList
  195. data.data.experimentList.forEach(function(item) {
  196. list.push(item.num)
  197. })
  198. data.data.dutyList.forEach(function(item) {
  199. list2.push(item.num)
  200. })
  201. data.data.checkList.forEach(function(item) {
  202. list3.push(item.num)
  203. })
  204. data.data.deviceList.forEach(function(item) {
  205. list4.push(item.num)
  206. })
  207. let res = {
  208. categories: date,
  209. series: [{
  210. name: "实验人数",
  211. data: list
  212. },
  213. {
  214. name: "值日人数",
  215. data: list2
  216. },
  217. {
  218. name: "检查次数",
  219. data: list3
  220. },
  221. {
  222. name: "超期设备数",
  223. data: list4
  224. }
  225. ]
  226. };
  227. this.chartData = JSON.parse(JSON.stringify(res));
  228. }
  229. },
  230. //实验室使用、空闲、异常数量
  231. async reportAppStatisticsLabStateStatistics() {
  232. let self = this;
  233. const {
  234. data
  235. } = await reportAppStatisticsLabStateStatistics();
  236. if (data.code == 200) {
  237. this.$set(this, 'labTotal', data.data.labTotal)
  238. this.$set(this, 'useTotal', data.data.useTotal)
  239. this.$set(this, 'availableTotal', data.data.availableTotal)
  240. this.$set(this, 'exceptionalTotal', data.data.exceptionalTotal)
  241. }
  242. },
  243. async getList() {
  244. let self = this;
  245. const {
  246. data
  247. } = await reportAppStatisticsPersonDeviceSafety();
  248. if (data.code == 200) {
  249. this.dataList = data.data;
  250. }
  251. },
  252. },
  253. }
  254. </script>
  255. <style lang="stylus" scoped>
  256. .labPage {
  257. height: 100%;
  258. width: 100%;
  259. background: #363744;
  260. padding: 20rpx 30rpx 36rpx;
  261. box-sizing: border-box;
  262. .chart {
  263. width: 690rpx;
  264. height: 640rpx;
  265. background: #3E414F;
  266. border-radius: 20rpx 20rpx 20rpx 20rpx;
  267. padding: 34rpx 30rpx 26rpx;
  268. box-sizing: border-box;
  269. .chart-t {
  270. display: flex;
  271. justify-content: space-between;
  272. .chart-t-li {
  273. width: 76rpx;
  274. height: 100rpx;
  275. .chart-t-li-t {
  276. font-weight: 400;
  277. font-size: 30rpx;
  278. line-height: 42rpx;
  279. text-align: center;
  280. margin-top: 8rpx;
  281. }
  282. .chart-t-li-b {
  283. font-weight: 400;
  284. font-size: 28rpx;
  285. line-height: 39rpx;
  286. text-align: center;
  287. margin-top: 4rpx;
  288. }
  289. }
  290. .color-A {
  291. background: #0183FA;
  292. border-radius: 10rpx 10rpx 10rpx 10rpx;
  293. .chart-t-li-t {
  294. color: #FFFFFF;
  295. }
  296. .chart-t-li-b {
  297. color: #FFFFFF;
  298. }
  299. }
  300. .color-B {
  301. background: none;
  302. .chart-t-li-t {
  303. color: #FFFFFF;
  304. }
  305. .chart-t-li-b {
  306. color: #FFFFFF;
  307. }
  308. }
  309. }
  310. .chart-b {
  311. width: 632rpx;
  312. height: 444rpx;
  313. /* margin-top: 34rpx; */
  314. }
  315. }
  316. .statistics {
  317. width: 690rpx;
  318. height: 241rpx;
  319. background: #3E414F;
  320. border-radius: 20rpx 20rpx 20rpx 20rpx;
  321. margin-top: 20rpx;
  322. .statistics-t {
  323. height: 100rpx;
  324. display: flex;
  325. justify-content: space-between;
  326. align-items: center;
  327. border-bottom: 1rpx solid #52545F;
  328. padding: 0 42rpx 0 38rpx;
  329. box-sizing: border-box;
  330. .statistics-t-l {
  331. font-weight: 400;
  332. font-size: 32rpx;
  333. color: #FFFFFF;
  334. line-height: 45rpx;
  335. }
  336. .statistics-t-r {
  337. font-weight: 400;
  338. font-size: 36rpx;
  339. color: #FFFFFF;
  340. line-height: 50rpx;
  341. }
  342. }
  343. .statistics-b {
  344. display: flex;
  345. justify-content: space-between;
  346. align-items: center;
  347. .statistics-b-li {
  348. flex: 1;
  349. text-align: center;
  350. .statistics-b-li-t {
  351. font-weight: 400;
  352. font-size: 36rpx;
  353. line-height: 50rpx;
  354. margin-top: 28rpx;
  355. }
  356. .statistics-b-li-b {
  357. font-weight: 400;
  358. font-size: 28rpx;
  359. color: #FFFFFF;
  360. line-height: 39rpx;
  361. margin-top: 9rpx;
  362. }
  363. }
  364. .line {
  365. width: 2rpx;
  366. height: 30rpx;
  367. background: #D8D8D8;
  368. }
  369. .color-A {
  370. color: #FF8C00;
  371. }
  372. .color-B {
  373. color: #26C736;
  374. }
  375. .color-C {
  376. color: #FF0000;
  377. }
  378. }
  379. }
  380. .table {
  381. width: 690rpx;
  382. margin-top: 20rpx;
  383. border-radius: 20rpx 20rpx 0 0;
  384. overflow: hidden;
  385. }
  386. }
  387. </style>