daYiReservation.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. <!-- 数据看板-大仪预约 -->
  2. <template>
  3. <view class="daYiReservation">
  4. <view class="chart">
  5. <view class="chart-t">
  6. <viwe class="chart-t-l">
  7. <text>设备总数:</text>
  8. <text>{{deviceTotal}}</text>
  9. </viwe>
  10. </view>
  11. <view class="chart-b">
  12. <qiun-data-charts type="ring" :opts="opts" :echartsH5="true" :canvas2d="true" :chartData="chartData" />
  13. </view>
  14. </view>
  15. <view class="small-title">
  16. <view class="small-title-l">预约使用排行TOP10</view>
  17. <viwe class="chart-tab-tow">
  18. <view class="chart-tab-li" :class="chartTabIndexTow==index?'tab-A':'tab-B'"
  19. v-for="(item,index) in chartTabListTow" :key="index" @click="chartTabClickTow(index)">{{item}}
  20. </view>
  21. </viwe>
  22. </view>
  23. <!-- -->
  24. <view class="table">
  25. <uni-card>
  26. <view style="height: 200px">
  27. <zb-table :columns="column" :stripe="false" :border="false" :data="dataList"></zb-table>
  28. </view>
  29. </uni-card>
  30. </view>
  31. <!-- -->
  32. <view class="small-title">
  33. <view class="small-title-l">大仪预约排行</view>
  34. </view>
  35. <view class="table-tow">
  36. <uni-card>
  37. <view style="height: 200px">
  38. <zb-table :columns="column2" :stripe="false" :border="false" :data="dataList2"></zb-table>
  39. </view>
  40. </uni-card>
  41. </view>
  42. <view class="small-title">
  43. <view class="small-title-l">隐患实验室统计</view>
  44. <viwe class="chart-tab-tow">
  45. <view class="chart-tab-li" :class="chartTabIndexThree==index?'tab-A':'tab-B'"
  46. v-for="(item,index) in chartTabListThree" :key="index" @click="chartTabClickThree(index)">{{item}}
  47. </view>
  48. </viwe>
  49. </view>
  50. <view class="chart-tow">
  51. <view class="chart-tow-b">
  52. <qiun-data-charts type="radar" :opts="optsTow" :echartsH5="true" :canvas2d="true" :chartData="chartDataTow" />
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import {
  59. config
  60. } from '@/api/request/config.js'
  61. import {
  62. reportAppletReportBsEquipStatusList,
  63. reportAppletReportApiEquipRankTopList,
  64. reportAppletReportBsEquipAppointTopList,
  65. reportAppletReportBsEquipDangerList,
  66. } from '@/pages/api/index.js'
  67. export default {
  68. name: "daYiReservation",
  69. components: {
  70. },
  71. data() {
  72. return {
  73. opts: {
  74. rotate: false,
  75. rotateLock: false,
  76. color: ["#10C139", "#FF8400", "#0183FA", "#EE6666", "#73C0DE", "#3CA272", ],
  77. padding: [5, 65, 5, 5],
  78. dataLabel: true,
  79. enableScroll: false,
  80. legend: {
  81. show: true,
  82. position: "right",
  83. fontColor: '#fff',
  84. },
  85. title: {
  86. name: "",
  87. },
  88. subtitle: {
  89. name: "",
  90. },
  91. extra: {
  92. ring: {
  93. ringWidth: 15,
  94. centerColor: '#3E414F',
  95. activeOpacity: 0.5,
  96. activeRadius: 20,
  97. offsetAngle: 0,
  98. labelWidth: 15,
  99. border: true,
  100. borderWidth: 3,
  101. borderColor: "#3E414F"
  102. }
  103. }
  104. },
  105. chartData: {},
  106. optsTow: {
  107. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
  108. "#ea7ccc"
  109. ],
  110. padding: [5, 5, 5, 5],
  111. dataLabel: false,
  112. enableScroll: false,
  113. legend: {
  114. show: false,
  115. position: "right",
  116. lineHeight: 25
  117. },
  118. extra: {
  119. radar: {
  120. gridType: "radar",
  121. gridColor: "#CCCCCC",
  122. gridCount: 3,
  123. opacity: 0.2,
  124. max: 200,
  125. labelShow: true,
  126. border: true,
  127. labelColor: '#fff',
  128. }
  129. }
  130. },
  131. chartDataTow: {},
  132. chartTabList: ['日', '月', '年'],
  133. chartTabIndex: 0,
  134. chartTabListTow: ['按资费', '按机时', '按样品'],
  135. chartTabIndexTow: 0,
  136. chartTabListThree: ['年度', '季度', '月度'],
  137. chartTabIndexThree: 0,
  138. // 查询参数
  139. queryParams: {
  140. page: 1,
  141. pageSize: 10,
  142. },
  143. column: [{
  144. type: 'index',
  145. label: '排行',
  146. fixed: true,
  147. width: 60,
  148. align: 'center',
  149. },
  150. {
  151. name: 'deviceName',
  152. label: '设备名称',
  153. fixed: true,
  154. width: 80,
  155. align: 'center',
  156. },
  157. {
  158. name: 'useTimeStr',
  159. label: '使用机时',
  160. align: 'center',
  161. },
  162. {
  163. name: 'appointFee',
  164. label: '使用费用',
  165. align: 'center',
  166. },
  167. {
  168. name: 'testSample',
  169. label: '测试样品',
  170. align: 'center',
  171. },
  172. ],
  173. column2: [{
  174. type: 'index',
  175. label: '排行',
  176. fixed: true,
  177. width: 60,
  178. align: 'center',
  179. },
  180. {
  181. name: 'deviceName',
  182. label: '设备名称',
  183. fixed: true,
  184. width: 80,
  185. align: 'center',
  186. },
  187. {
  188. name: 'orderDuration',
  189. label: '预约时长',
  190. align: 'center',
  191. },
  192. {
  193. name: 'orderNum',
  194. label: '预约次数',
  195. align: 'center',
  196. },
  197. ],
  198. dataList: [],
  199. dataList2: [],
  200. total: 0,
  201. type:1,//type为1 按费用,2.按照机时,3.按照样品
  202. deviceTotal:0,
  203. statisticsType:1,//1.年度2.季度3.月度
  204. }
  205. },
  206. created() {
  207. },
  208. beforeMount() {
  209. },
  210. mounted() {
  211. this.reportAppletReportBsEquipStatusList()
  212. this.reportAppletReportApiEquipRankTopList()
  213. this.reportAppletReportBsEquipAppointTopList()
  214. this.reportAppletReportBsEquipDangerList()
  215. //this.getServerDataTow()
  216. },
  217. methods: {
  218. //隐患统计
  219. async reportAppletReportBsEquipDangerList() {
  220. let self = this;
  221. const {
  222. data
  223. } = await reportAppletReportBsEquipDangerList({dangerType:'3',statisticsType:this.statisticsType});
  224. if (data.code == 200) {
  225. let list=[];
  226. let list2=[];
  227. data.data.subjectList.forEach(function(item,index){
  228. if(index<5){
  229. list.push(item.subjectName)
  230. list2.push(item.dangerNum)
  231. }
  232. })
  233. let res = {
  234. categories: list,
  235. series: [{
  236. name: "",
  237. data: list2
  238. },
  239. ]
  240. };
  241. this.chartDataTow = JSON.parse(JSON.stringify(res));
  242. }
  243. },
  244. //设备总数
  245. async reportAppletReportBsEquipStatusList() {
  246. let self = this;
  247. const {
  248. data
  249. } = await reportAppletReportBsEquipStatusList();
  250. if (data.code == 200) {
  251. let list=[];
  252. data.data.forEach(function(item,index){
  253. if(index<6){
  254. list.push({
  255. "name": item.name,
  256. "value":item.value,
  257. "labelShow": false,
  258. })
  259. self.deviceTotal+=item.value
  260. }
  261. })
  262. let res = {
  263. series: [{
  264. data: list
  265. }]
  266. };
  267. this.chartData = JSON.parse(JSON.stringify(res));
  268. }
  269. },
  270. //预约使用排行
  271. async reportAppletReportApiEquipRankTopList() {
  272. let self = this;
  273. const {
  274. data
  275. } = await reportAppletReportApiEquipRankTopList({type:this.type});
  276. if (data.code == 200) {
  277. this.$set(this,'dataList',data.data)
  278. }
  279. },
  280. //大仪预约排行
  281. async reportAppletReportBsEquipAppointTopList() {
  282. let self = this;
  283. const {
  284. data
  285. } = await reportAppletReportBsEquipAppointTopList();
  286. if (data.code == 200) {
  287. this.$set(this,'dataList2',data.data)
  288. }
  289. },
  290. getServerDataTow() {
  291. //模拟从服务器获取数据时的延时
  292. setTimeout(() => {
  293. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  294. let res = {
  295. categories: ["测定仪", "色谱仪", "分析仪", "光度计", "离子色谱仪"],
  296. series: [{
  297. name: "",
  298. data: [90, 110, 165, 195, 187]
  299. },
  300. ]
  301. };
  302. this.chartDataTow = JSON.parse(JSON.stringify(res));
  303. }, 500);
  304. },
  305. chartTabClick(index) {
  306. this.chartTabIndex = index;
  307. },
  308. chartTabClickTow(index) {
  309. this.chartTabIndexTow = index;
  310. this.type = index+1;
  311. this.reportAppletReportApiEquipRankTopList();
  312. },
  313. chartTabClickThree(index) {
  314. this.chartTabIndexThree = index;
  315. this.statisticsType = index+1;
  316. this.reportAppletReportBsEquipDangerList();
  317. },
  318. },
  319. }
  320. </script>
  321. <style lang="stylus" scoped>
  322. .daYiReservation {
  323. height: 100%;
  324. width: 100%;
  325. background: #363744;
  326. padding: 20rpx 0rpx 0;
  327. box-sizing: border-box;
  328. .chart {
  329. width: 690rpx;
  330. height: 380rpx;
  331. background: #3E414F;
  332. border-radius: 20rpx 20rpx 20rpx 20rpx;
  333. overflow: hidden;
  334. margin: 0 30rpx;
  335. .chart-t {
  336. display: flex;
  337. justify-content: space-between;
  338. align-items: center;
  339. height: 50rpx;
  340. margin-top: 30rpx;
  341. padding: 0 24rpx 0 42rpx;
  342. box-sizing: border-box;
  343. .chart-t-l {
  344. >text {
  345. font-weight: 400;
  346. font-size: 30rpx;
  347. color: #FFFFFF;
  348. line-height: 42rpx;
  349. }
  350. >text:nth-of-type(1) {
  351. color: #FFFFFF;
  352. }
  353. >text:nth-of-type(2) {
  354. color: #0183FA;
  355. }
  356. }
  357. .chart-tab {
  358. width: 120rpx;
  359. height: 50rpx;
  360. border-radius: 10rpx;
  361. overflow: hidden;
  362. border: 1rpx solid #52545F;
  363. display: flex;
  364. justify-content: flex-start;
  365. .chart-tab-li {
  366. width: 60rpx;
  367. font-weight: 400;
  368. font-size: 28rpx;
  369. color: #999999;
  370. line-height: 50rpx;
  371. text-align: center;
  372. }
  373. .chart-tab-li:nth-of-type(1) {
  374. border-right: 1rpx solid #52545F;
  375. }
  376. .chart-tab-li:nth-of-type(2) {
  377. border-right: 1rpx solid #52545F;
  378. }
  379. .tab-A {
  380. color: #FFFFFF;
  381. background: #0183FA;
  382. }
  383. .tab-B {
  384. color: #999999;
  385. background: none;
  386. }
  387. }
  388. }
  389. .chart-b {
  390. width: 690rpx;
  391. height: 300rpx;
  392. }
  393. }
  394. .statistics {
  395. width: 750rpx;
  396. height: 120rpx;
  397. background: #3E414F;
  398. margin-top: 20rpx;
  399. .statistics-b {
  400. display: flex;
  401. justify-content: space-between;
  402. align-items: center;
  403. .statistics-b-li {
  404. flex: 1;
  405. text-align: center;
  406. .statistics-b-li-t {
  407. margin-top: 10rpx;
  408. >text {
  409. font-weight: 400;
  410. font-size: 36rpx;
  411. line-height: 50rpx;
  412. }
  413. >text:nth-of-type(1) {
  414. font-size: 36rpx;
  415. }
  416. >text:nth-of-type(2) {
  417. font-size: 24rpx;
  418. }
  419. }
  420. .statistics-b-li-b {
  421. font-weight: 400;
  422. font-size: 24rpx;
  423. color: #FFFFFF;
  424. line-height: 34rpx;
  425. margin-top: 9rpx;
  426. }
  427. }
  428. .line {
  429. width: 2rpx;
  430. height: 30rpx;
  431. background: #D8D8D8;
  432. }
  433. }
  434. .color-A {
  435. color: #0183FA;
  436. }
  437. .color-B {
  438. color: #05FFE6;
  439. }
  440. .color-C {
  441. color: #FFAA00;
  442. }
  443. }
  444. .small-title {
  445. width: 690rpx;
  446. height: 50rpx;
  447. display: flex;
  448. justify-content: space-between;
  449. align-items: center;
  450. margin: 24rpx 30rpx;
  451. .small-title-l {
  452. font-weight: 400;
  453. font-size: 32rpx;
  454. color: #FFFFFF;
  455. line-height: 45rpx;
  456. }
  457. .chart-tab-tow {
  458. width: 300rpx;
  459. height: 50rpx;
  460. border-radius: 25rpx;
  461. overflow: hidden;
  462. border: 1rpx solid #52545F;
  463. display: flex;
  464. justify-content: flex-start;
  465. .chart-tab-li {
  466. width: 100rpx;
  467. font-weight: 400;
  468. font-size: 28rpx;
  469. color: #999999;
  470. line-height: 50rpx;
  471. text-align: center;
  472. }
  473. .chart-tab-li:nth-of-type(1) {
  474. border-right: 1rpx solid #52545F;
  475. }
  476. .chart-tab-li:nth-of-type(2) {
  477. border-right: 1rpx solid #52545F;
  478. }
  479. .tab-A {
  480. color: #FFFFFF;
  481. background: #0183FA;
  482. }
  483. .tab-B {
  484. color: #999999;
  485. background: none;
  486. }
  487. }
  488. }
  489. .table {
  490. width: 690rpx;
  491. margin-top: 20rpx;
  492. border-radius: 20rpx 20rpx 0 0;
  493. overflow: hidden;
  494. margin-left: 30rpx;
  495. }
  496. .sortOne {
  497. display: inline-block;
  498. width: 40rpx;
  499. height: 40rpx;
  500. padding: 4rpx;
  501. box-sizing: border-box;
  502. background: rgba(255, 0, 0, 0.2);
  503. font-weight: 400;
  504. font-size: 28rpx;
  505. color: #FF0000;
  506. line-height: 40rpx;
  507. text-align: center;
  508. border-radius: 20rpx;
  509. }
  510. .sortTow {
  511. display: inline-block;
  512. width: 40rpx;
  513. height: 40rpx;
  514. padding: 4rpx;
  515. box-sizing: border-box;
  516. background: rgba(255, 153, 0, 0.2);
  517. font-weight: 400;
  518. font-size: 28rpx;
  519. color: #FF9900;
  520. line-height: 40rpx;
  521. text-align: center;
  522. border-radius: 20rpx;
  523. }
  524. .sortThree {
  525. display: inline-block;
  526. width: 40rpx;
  527. height: 40rpx;
  528. padding: 4rpx;
  529. box-sizing: border-box;
  530. background: rgba(255, 242, 0, 0.2);
  531. font-weight: 400;
  532. font-size: 28rpx;
  533. color: #FFF200;
  534. line-height: 40rpx;
  535. text-align: center;
  536. border-radius: 20rpx;
  537. }
  538. .sortFive {
  539. display: inline-block;
  540. width: 40rpx;
  541. height: 40rpx;
  542. padding: 4rpx;
  543. box-sizing: border-box;
  544. background: rgba(1, 131, 250, 0.2);
  545. font-weight: 400;
  546. font-size: 28rpx;
  547. color: #0183FA;
  548. line-height: 40rpx;
  549. text-align: center;
  550. border-radius: 20rpx;
  551. }
  552. .table-tow {
  553. width: 690rpx;
  554. margin-top: 20rpx;
  555. border-radius: 20rpx 20rpx 0 0;
  556. overflow: hidden;
  557. margin-left: 30rpx;
  558. }
  559. .small-title-tow {
  560. width: 750rpx;
  561. height: 80rpx;
  562. background: #3E414F;
  563. display: flex;
  564. justify-content: space-between;
  565. align-items: center;
  566. padding: 0 20rpx 0 30rpx;
  567. box-sizing: border-box;
  568. margin-top: 2rpx;
  569. .small-title-tow-l {
  570. flex: 1;
  571. font-weight: 400;
  572. font-size: 30rpx;
  573. color: #FFFFFF;
  574. line-height: 42rpx;
  575. overflow: hidden;
  576. text-overflow: ellipsis;
  577. white-space: nowrap;
  578. }
  579. .small-title-tow-r {
  580. width: 14rpx;
  581. height: 8rpx;
  582. }
  583. }
  584. .chart-tow {
  585. width: 690rpx;
  586. height: 480rpx;
  587. background: #3E414F;
  588. border-radius: 20rpx 20rpx 20rpx 30rpx;
  589. margin: 26rpx 30rpx 0;
  590. .chart-tow-b {
  591. width: 690rpx;
  592. height: 480rpx;
  593. }
  594. }
  595. }
  596. </style>