daYiReservation.vue 14 KB

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