daYiReservation.vue 14 KB

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