daYiReservation.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  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 :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 :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: 'orderDuration',
  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.appointFee = '¥'+item.appointFee
  313. })
  314. this.$set(this, 'dataList', data.data)
  315. }
  316. },
  317. //大仪预约排行
  318. async reportAppletReportBsEquipAppointTopList() {
  319. let self = this;
  320. const {
  321. data
  322. } = await reportAppletReportBsEquipAppointTopList();
  323. if (data.code == 200) {
  324. data.data.forEach((item)=>{
  325. item.orderDuration = item.orderDuration+'';
  326. if (item.orderDuration.indexOf('.') != -1){
  327. item.orderDuration = item.orderDuration.replace(".", "时");
  328. item.orderDuration = item.orderDuration+"'";
  329. }else{
  330. item.orderDuration = item.orderDuration+"时";
  331. }
  332. })
  333. this.$set(this, 'dataList2', data.data)
  334. }
  335. },
  336. getServerDataTow() {
  337. //模拟从服务器获取数据时的延时
  338. setTimeout(() => {
  339. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  340. let res = {
  341. categories: ["测定仪", "色谱仪", "分析仪", "光度计", "离子色谱仪"],
  342. series: [{
  343. name: "",
  344. data: [90, 110, 165, 195, 187]
  345. }, ]
  346. };
  347. this.chartDataTow = JSON.parse(JSON.stringify(res));
  348. }, 500);
  349. },
  350. chartTabClick(index) {
  351. this.chartTabIndex = index;
  352. },
  353. chartTabClickTow(index) {
  354. this.chartTabIndexTow = index;
  355. this.type = index + 1;
  356. this.reportAppletReportApiEquipRankTopList();
  357. },
  358. chartTabClickThree(index) {
  359. this.chartTabIndexThree = index;
  360. this.statisticsType = index + 1;
  361. this.reportAppletReportBsEquipDangerList();
  362. },
  363. },
  364. }
  365. </script>
  366. <style lang="stylus" scoped>
  367. .daYiReservation {
  368. height: 100%;
  369. width: 100%;
  370. background: #363744;
  371. padding: 20rpx 0rpx 0;
  372. box-sizing: border-box;
  373. .chart {
  374. width: 690rpx;
  375. height: 380rpx;
  376. background: #3E414F;
  377. border-radius: 20rpx 20rpx 20rpx 20rpx;
  378. overflow: hidden;
  379. margin: 0 30rpx;
  380. .chart-t {
  381. display: flex;
  382. justify-content: space-between;
  383. align-items: center;
  384. height: 50rpx;
  385. margin-top: 30rpx;
  386. padding: 0 24rpx 0 42rpx;
  387. box-sizing: border-box;
  388. .chart-t-l {
  389. >text {
  390. font-weight: 400;
  391. font-size: 30rpx;
  392. color: #FFFFFF;
  393. line-height: 42rpx;
  394. }
  395. >text:nth-of-type(1) {
  396. color: #FFFFFF;
  397. }
  398. >text:nth-of-type(2) {
  399. color: #0183FA;
  400. }
  401. }
  402. .chart-tab {
  403. width: 120rpx;
  404. height: 50rpx;
  405. border-radius: 10rpx;
  406. overflow: hidden;
  407. border: 1rpx solid #52545F;
  408. display: flex;
  409. justify-content: flex-start;
  410. .chart-tab-li {
  411. width: 60rpx;
  412. font-weight: 400;
  413. font-size: 28rpx;
  414. color: #999999;
  415. line-height: 50rpx;
  416. text-align: center;
  417. }
  418. .chart-tab-li:nth-of-type(1) {
  419. border-right: 1rpx solid #52545F;
  420. }
  421. .chart-tab-li:nth-of-type(2) {
  422. border-right: 1rpx solid #52545F;
  423. }
  424. .tab-A {
  425. color: #FFFFFF;
  426. background: #0183FA;
  427. }
  428. .tab-B {
  429. color: #999999;
  430. background: none;
  431. }
  432. }
  433. }
  434. .chart-b {
  435. width: 690rpx;
  436. height: 300rpx;
  437. }
  438. }
  439. .statistics {
  440. width: 750rpx;
  441. height: 120rpx;
  442. background: #3E414F;
  443. margin-top: 20rpx;
  444. .statistics-b {
  445. display: flex;
  446. justify-content: space-between;
  447. align-items: center;
  448. .statistics-b-li {
  449. flex: 1;
  450. text-align: center;
  451. .statistics-b-li-t {
  452. margin-top: 10rpx;
  453. >text {
  454. font-weight: 400;
  455. font-size: 36rpx;
  456. line-height: 50rpx;
  457. }
  458. >text:nth-of-type(1) {
  459. font-size: 36rpx;
  460. }
  461. >text:nth-of-type(2) {
  462. font-size: 24rpx;
  463. }
  464. }
  465. .statistics-b-li-b {
  466. font-weight: 400;
  467. font-size: 24rpx;
  468. color: #FFFFFF;
  469. line-height: 34rpx;
  470. margin-top: 9rpx;
  471. }
  472. }
  473. .line {
  474. width: 2rpx;
  475. height: 30rpx;
  476. background: #D8D8D8;
  477. }
  478. }
  479. .color-A {
  480. color: #0183FA;
  481. }
  482. .color-B {
  483. color: #05FFE6;
  484. }
  485. .color-C {
  486. color: #FFAA00;
  487. }
  488. }
  489. .small-title {
  490. width: 690rpx;
  491. height: 50rpx;
  492. display: flex;
  493. justify-content: space-between;
  494. align-items: center;
  495. margin: 24rpx 30rpx;
  496. .small-title-l {
  497. font-weight: 400;
  498. font-size: 32rpx;
  499. color: #FFFFFF;
  500. line-height: 45rpx;
  501. }
  502. .chart-tab-tow {
  503. width: 300rpx;
  504. height: 50rpx;
  505. border-radius: 25rpx;
  506. overflow: hidden;
  507. border: 1rpx solid #52545F;
  508. display: flex;
  509. justify-content: flex-start;
  510. .chart-tab-li {
  511. width: 100rpx;
  512. font-weight: 400;
  513. font-size: 28rpx;
  514. color: #999999;
  515. line-height: 50rpx;
  516. text-align: center;
  517. }
  518. .chart-tab-li:nth-of-type(1) {
  519. border-right: 1rpx solid #52545F;
  520. }
  521. .chart-tab-li:nth-of-type(2) {
  522. border-right: 1rpx solid #52545F;
  523. }
  524. .tab-A {
  525. color: #FFFFFF;
  526. background: #0183FA;
  527. }
  528. .tab-B {
  529. color: #999999;
  530. background: none;
  531. }
  532. }
  533. }
  534. .table {
  535. width: 690rpx;
  536. margin-top: 20rpx;
  537. border-radius: 20rpx 20rpx 0 0;
  538. overflow: hidden;
  539. margin-left: 30rpx;
  540. }
  541. .sortOne {
  542. display: inline-block;
  543. width: 40rpx;
  544. height: 40rpx;
  545. padding: 4rpx;
  546. box-sizing: border-box;
  547. background: rgba(255, 0, 0, 0.2);
  548. font-weight: 400;
  549. font-size: 28rpx;
  550. color: #FF0000;
  551. line-height: 40rpx;
  552. text-align: center;
  553. border-radius: 20rpx;
  554. }
  555. .sortTow {
  556. display: inline-block;
  557. width: 40rpx;
  558. height: 40rpx;
  559. padding: 4rpx;
  560. box-sizing: border-box;
  561. background: rgba(255, 153, 0, 0.2);
  562. font-weight: 400;
  563. font-size: 28rpx;
  564. color: #FF9900;
  565. line-height: 40rpx;
  566. text-align: center;
  567. border-radius: 20rpx;
  568. }
  569. .sortThree {
  570. display: inline-block;
  571. width: 40rpx;
  572. height: 40rpx;
  573. padding: 4rpx;
  574. box-sizing: border-box;
  575. background: rgba(255, 242, 0, 0.2);
  576. font-weight: 400;
  577. font-size: 28rpx;
  578. color: #FFF200;
  579. line-height: 40rpx;
  580. text-align: center;
  581. border-radius: 20rpx;
  582. }
  583. .sortFive {
  584. display: inline-block;
  585. width: 40rpx;
  586. height: 40rpx;
  587. padding: 4rpx;
  588. box-sizing: border-box;
  589. background: rgba(1, 131, 250, 0.2);
  590. font-weight: 400;
  591. font-size: 28rpx;
  592. color: #0183FA;
  593. line-height: 40rpx;
  594. text-align: center;
  595. border-radius: 20rpx;
  596. }
  597. .table-tow {
  598. width: 690rpx;
  599. margin-top: 20rpx;
  600. border-radius: 20rpx 20rpx 0 0;
  601. overflow: hidden;
  602. margin-left: 30rpx;
  603. }
  604. .small-title-tow {
  605. width: 750rpx;
  606. height: 80rpx;
  607. background: #3E414F;
  608. display: flex;
  609. justify-content: space-between;
  610. align-items: center;
  611. padding: 0 20rpx 0 30rpx;
  612. box-sizing: border-box;
  613. margin-top: 2rpx;
  614. .small-title-tow-l {
  615. flex: 1;
  616. font-weight: 400;
  617. font-size: 30rpx;
  618. color: #FFFFFF;
  619. line-height: 42rpx;
  620. overflow: hidden;
  621. text-overflow: ellipsis;
  622. white-space: nowrap;
  623. }
  624. .small-title-tow-r {
  625. width: 14rpx;
  626. height: 8rpx;
  627. }
  628. }
  629. .chart-tow {
  630. width: 690rpx;
  631. height: 480rpx;
  632. background: #3E414F;
  633. border-radius: 20rpx 20rpx 20rpx 30rpx;
  634. margin: 26rpx 30rpx 0;
  635. .chart-tow-b {
  636. width: 690rpx;
  637. height: 480rpx;
  638. }
  639. }
  640. }
  641. </style>