cagePosition.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. <!-- 数据看板-笼位预约 -->
  2. <template>
  3. <view class="cagePosition">
  4. <view class="total-box">
  5. <view>笼位总数</view>
  6. <view>{{totalCageNum}}</view>
  7. </view>
  8. <view class="chart">
  9. <view class="chart-t">
  10. <img :src="imagesUrl('dataBoard/loudong@2x.png')">
  11. {{subName}}
  12. </view>
  13. <view class="chart-b">
  14. <view class="chart-b-li">
  15. <view class="chart-b-li-l">
  16. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts" :chartData="chartData0" />
  17. </view>
  18. <view class="chart-b-li-r">
  19. <text>{{dataList[0].cageNum}}</text>
  20. <!-- <text>{{dataList[0].appointNum}}%</text> -->
  21. </view>
  22. </view>
  23. <view class="chart-b-li">
  24. <view class="chart-b-li-l">
  25. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts2" :chartData="chartData1" />
  26. </view>
  27. <view class="chart-b-li-r">
  28. <text>{{dataList[0].freeNum}}</text>
  29. <text>{{dataList[0].freeRate}}%</text>
  30. </view>
  31. </view>
  32. <view class="chart-b-li">
  33. <view class="chart-b-li-l">
  34. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts3" :chartData="chartData2" />
  35. </view>
  36. <view class="chart-b-li-r">
  37. <text>{{dataList[0].appointNum}}</text>
  38. <text>{{dataList[0].appointRate}}%</text>
  39. </view>
  40. </view>
  41. <view class="chart-b-li">
  42. <view class="chart-b-li-l">
  43. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts4" :chartData="chartData3" />
  44. </view>
  45. <view class="chart-b-li-r">
  46. <text>{{dataList[0].lockedNum}}</text>
  47. <text>{{dataList[0].lockedRate}}%</text>
  48. </view>
  49. </view>
  50. <view class="chart-b-li">
  51. <view class="chart-b-li-l">
  52. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts5" :chartData="chartData4" />
  53. </view>
  54. <view class="chart-b-li-r">
  55. <text>{{dataList[0].killNum}}</text>
  56. <text>{{dataList[0].killRate}}%</text>
  57. </view>
  58. </view>
  59. <view class="chart-b-li">
  60. <view class="chart-b-li-l">
  61. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts6" :chartData="chartData5" />
  62. </view>
  63. <view class="chart-b-li-r">
  64. <text>{{dataList[0].repairNum}}</text>
  65. <text>{{dataList[0].repairRate}}%</text>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="chart">
  71. <view class="chart-t">
  72. <img :src="imagesUrl('dataBoard/loudong@2x.png')">
  73. {{subNameTow}}
  74. </view>
  75. <view class="chart-b">
  76. <view class="chart-b-li">
  77. <view class="chart-b-li-l">
  78. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts" :chartData="chartDataTow0" />
  79. </view>
  80. <view class="chart-b-li-r">
  81. <text>{{dataList[1].cageNum}}</text>
  82. <!-- <text>{{dataList[1].appointNum}}%</text> -->
  83. </view>
  84. </view>
  85. <view class="chart-b-li">
  86. <view class="chart-b-li-l">
  87. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts2" :chartData="chartDataTow1" />
  88. </view>
  89. <view class="chart-b-li-r">
  90. <text>{{dataList[1].freeNum}}</text>
  91. <text>{{dataList[1].freeRate}}%</text>
  92. </view>
  93. </view>
  94. <view class="chart-b-li">
  95. <view class="chart-b-li-l">
  96. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts3" :chartData="chartDataTow2" />
  97. </view>
  98. <view class="chart-b-li-r">
  99. <text>{{dataList[1].appointNum}}</text>
  100. <text>{{dataList[1].appointRate}}%</text>
  101. </view>
  102. </view>
  103. <view class="chart-b-li">
  104. <view class="chart-b-li-l">
  105. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts4" :chartData="chartDataTow3" />
  106. </view>
  107. <view class="chart-b-li-r">
  108. <text>{{dataList[1].lockedNum}}</text>
  109. <text>{{dataList[1].lockedRate}}%</text>
  110. </view>
  111. </view>
  112. <view class="chart-b-li">
  113. <view class="chart-b-li-l">
  114. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts5" :chartData="chartDataTow4" />
  115. </view>
  116. <view class="chart-b-li-r">
  117. <text>{{dataList[1].killNum}}</text>
  118. <text>{{dataList[1].killRate}}%</text>
  119. </view>
  120. </view>
  121. <view class="chart-b-li">
  122. <view class="chart-b-li-l">
  123. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts6" :chartData="chartDataTow5" />
  124. </view>
  125. <view class="chart-b-li-r">
  126. <text>{{dataList[1].repairNum}}</text>
  127. <text>{{dataList[1].repairRate}}%</text>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. <view class="small-title">
  133. <view class="small-title-l">隐患实验室统计</view>
  134. <viwe class="chart-tab-tow">
  135. <view class="chart-tab-li" :class="chartTabIndexThree==index?'tab-A':'tab-B'"
  136. v-for="(item,index) in chartTabListThree" :key="index" @click="chartTabClickThree(index)">{{item}}
  137. </view>
  138. </viwe>
  139. </view>
  140. <view class="chart-tow">
  141. <view class="chart-tow-b">
  142. <qiun-data-charts :canvas2d="true" :tapLegend="false" :tooltipShow="false"
  143. type="bar" :opts="optsTow" :echartsH5="true" :chartData="chartDataThree" />
  144. </view>
  145. </view>
  146. </view>
  147. </template>
  148. <script>
  149. import {
  150. config
  151. } from '@/api/request/config.js'
  152. import {
  153. reportAppletReportBsEquipDangerList,
  154. reportAppletReportApiCageRateCageRateList
  155. } from '@/pages/api/index.js'
  156. export default {
  157. name: "cagePosition",
  158. components: {
  159. },
  160. data() {
  161. return {
  162. opts: {
  163. title: {
  164. name: "总数",
  165. fontSize: 10,
  166. color: "#0183FA"
  167. },
  168. subtitle: {
  169. name: "",
  170. },
  171. extra: {
  172. arcbar: {
  173. width: 6,
  174. direction:"ccw",
  175. startAngle: 1.5,
  176. endAngle: 1.51,
  177. gap: 2,
  178. backgroundColor: "#373745",
  179. // linearType:"custom",
  180. // customColor:["#0183FA"],
  181. }
  182. }
  183. },
  184. opts2: {
  185. title: {
  186. name: "空闲",
  187. fontSize: 10,
  188. color: "#16BF32"
  189. },
  190. subtitle: {
  191. name: "",
  192. },
  193. extra: {
  194. arcbar: {
  195. width: 6,
  196. direction:"ccw",
  197. startAngle: 1.5,
  198. endAngle: 1.51,
  199. gap: 2,
  200. backgroundColor: "#373745",
  201. // linearType:"custom",
  202. // customColor:["#16BF32"],
  203. }
  204. }
  205. },
  206. opts3: {
  207. title: {
  208. name: "预约",
  209. fontSize: 10,
  210. color: "#03D8D0"
  211. },
  212. subtitle: {
  213. name: "",
  214. },
  215. extra: {
  216. arcbar: {
  217. width: 6,
  218. direction:"ccw",
  219. startAngle: 1.5,
  220. endAngle: 1.51,
  221. gap: 2,
  222. backgroundColor: "#373745",
  223. // linearType:"custom",
  224. // customColor:["#03D8D0"],
  225. }
  226. }
  227. },
  228. opts4: {
  229. title: {
  230. name: "锁定",
  231. fontSize: 10,
  232. color: "#FF4800"
  233. },
  234. subtitle: {
  235. name: "",
  236. },
  237. extra: {
  238. arcbar: {
  239. width: 6,
  240. direction:"ccw",
  241. startAngle: 1.5,
  242. endAngle: 1.51,
  243. gap: 2,
  244. backgroundColor: "#373745",
  245. // linearType:"custom",
  246. // customColor:["#FF4800"],
  247. }
  248. }
  249. },
  250. opts5: {
  251. title: {
  252. name: "消杀",
  253. fontSize: 10,
  254. color: "#FF5F5F"
  255. },
  256. subtitle: {
  257. name: "",
  258. },
  259. extra: {
  260. arcbar: {
  261. width: 6,
  262. direction:"ccw",
  263. startAngle: 1.5,
  264. endAngle: 1.51,
  265. gap: 2,
  266. backgroundColor: "#373745",
  267. // linearType:"custom",
  268. // customColor:["#FF5F5F"],
  269. }
  270. }
  271. },
  272. opts6: {
  273. title: {
  274. name: "维修",
  275. fontSize: 10,
  276. color: "#FF8C00"
  277. },
  278. subtitle: {
  279. name: "",
  280. },
  281. extra: {
  282. arcbar: {
  283. width: 6,
  284. direction:"ccw",
  285. startAngle: 1.5,
  286. endAngle: 1.51,
  287. gap: 2,
  288. backgroundColor: "#373745",
  289. // linearType:"custom",
  290. // customColor:["#FF8C00"],
  291. }
  292. }
  293. },
  294. chartData0: {},
  295. chartData1: {},
  296. chartData2: {},
  297. chartData3: {},
  298. chartData4: {},
  299. chartData5: {},
  300. subName:'',
  301. chartDataTow0: {},
  302. chartDataTow1: {},
  303. chartDataTow2: {},
  304. chartDataTow3: {},
  305. chartDataTow4: {},
  306. chartDataTow5: {},
  307. subNameTow:'',
  308. //笼位总数
  309. totalCageNum:"",
  310. statisticsType:"1",
  311. optsTow: {
  312. rotate: false,
  313. rotateLock: false,
  314. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"],
  315. padding: [15, 20, 15, 15],
  316. dataLabel: true,
  317. enableScroll: false,
  318. fontColor:'#ffffff',
  319. legend: {
  320. show:false,
  321. },
  322. xAxis: {
  323. disabled: true,
  324. disableGrid: true,
  325. axisLine: false,
  326. fontColor: '#fff',
  327. },
  328. yAxis: {},
  329. extra: {
  330. bar: {
  331. type: "group",
  332. width: 15,
  333. meterBorde: 1,
  334. meterFillColor: "#FFFFFF",
  335. activeBgColor: "#000000",
  336. activeBgOpacity: 0.08,
  337. linearType: "custom",
  338. barBorderCircle: true,
  339. seriesGap: 2,
  340. categoryGap: 2
  341. }
  342. }
  343. },
  344. chartDataThree: {},
  345. chartTabList: ['日', '月', '年'],
  346. chartTabIndex: 0,
  347. chartTabListTow: ['按资费', '按机时', '按样品'],
  348. chartTabIndexTow: 0,
  349. chartTabListThree: ['年度', '季度', '月度'],
  350. chartTabIndexThree: 0,
  351. type: 1, //1年2季度3月度
  352. totalAppointNum: 0,
  353. dataList:[],
  354. }
  355. },
  356. created() {
  357. },
  358. beforeMount() {
  359. },
  360. mounted() {
  361. this.reportAppletReportApiCageRateCageRateList()
  362. this.reportAppletReportBsEquipDangerList()
  363. },
  364. methods: {
  365. //笼位A-B楼
  366. async reportAppletReportApiCageRateCageRateList() {
  367. let self = this;
  368. const {
  369. data
  370. } = await reportAppletReportApiCageRateCageRateList();
  371. if (data.code == 200) {
  372. self.totalCageNum=data.data.totalCageNum;
  373. self.dataList=data.data.reportBsCageRateList;
  374. let nameList=['总数','空闲','预约','锁定','消杀','维修']
  375. // let colorList=['#B5DEFC','#9FF7B2','#B5F2F0','#FFBCA2','#FC9893','#FFDCB5']
  376. let colorList=['#0183FA','#16BF32','#03D8D0','#FF4800','#FF5F5F','#FF8C00']
  377. let numList=[
  378. // data.data.reportBsCageRateList[0].appointNum/100,
  379. 1,
  380. data.data.reportBsCageRateList[0].freeNum/100,
  381. data.data.reportBsCageRateList[0].appointNum/100,
  382. data.data.reportBsCageRateList[0].lockedNum/100,
  383. data.data.reportBsCageRateList[0].killNum/100,
  384. data.data.reportBsCageRateList[0].repairNum/100,
  385. ]
  386. this.subName=data.data.reportBsCageRateList[0].buildName;
  387. let numListTow=[
  388. // data.data.reportBsCageRateList[1].appointNum/100,
  389. 1,
  390. data.data.reportBsCageRateList[1].freeNum/100,
  391. data.data.reportBsCageRateList[1].appointNum/100,
  392. data.data.reportBsCageRateList[1].lockedNum/100,
  393. data.data.reportBsCageRateList[1].killNum/100,
  394. data.data.reportBsCageRateList[1].repairNum/100,
  395. ]
  396. this.subNameTow=data.data.reportBsCageRateList[1].buildName;
  397. for(let i=0;i<6;i++){
  398. let res = {
  399. series: [{
  400. name: nameList[i],
  401. color: colorList[i],
  402. data: numList[i],
  403. }]
  404. };
  405. const propertyName = `chartData${i}`;
  406. this[propertyName] = JSON.parse(JSON.stringify(res));
  407. let res2 = {
  408. series: [{
  409. name: nameList[i],
  410. color: colorList[i],
  411. data: numListTow[i],
  412. }]
  413. };
  414. const propertyNameTow = `chartDataTow${i}`;
  415. this[propertyNameTow] = JSON.parse(JSON.stringify(res2));
  416. }
  417. }
  418. },
  419. async reportAppletReportBsEquipDangerList() {
  420. let self = this;
  421. const {
  422. data
  423. } = await reportAppletReportBsEquipDangerList({
  424. dangerType: '2',
  425. statisticsType: this.statisticsType
  426. });
  427. if (data.code == 200) {
  428. let categories = [];
  429. let list = [];
  430. data.data.subjectList.forEach((item, index)=>{
  431. if (index < 5) {
  432. if (item.subjectName.length > 6) {
  433. item.subjectName = item.subjectName.slice(0, 6) + '...';
  434. }
  435. categories.push(item.subjectName)
  436. list.push(item.dangerNum)
  437. }
  438. })
  439. let res = {};
  440. if(categories[0]){
  441. res = {
  442. categories: categories,
  443. series: [{
  444. name: "",
  445. data: list
  446. }]
  447. };
  448. }else{
  449. res = {
  450. categories: ['无数据'],
  451. series: [{
  452. name: "",
  453. data: [0]
  454. }]
  455. };
  456. }
  457. self.$set(this,'chartDataThree',res);
  458. }
  459. },
  460. chartTabClick(index) {
  461. this.chartTabIndex = index;
  462. },
  463. chartTabClickTow(index) {
  464. this.chartTabIndexTow = index;
  465. },
  466. chartTabClickThree(index) {
  467. this.chartTabIndexThree = index;
  468. this.statisticsType = index + 1;
  469. this.reportAppletReportBsEquipDangerList();
  470. },
  471. },
  472. }
  473. </script>
  474. <style lang="stylus" scoped>
  475. .cagePosition {
  476. height: 100%;
  477. width: 100%;
  478. background: #363744;
  479. padding: 20rpx 0rpx 0;
  480. box-sizing: border-box;
  481. .total-box{
  482. display: flex;
  483. padding:0 35rpx;
  484. height:60rpx;
  485. view{
  486. line-height:60rpx;
  487. font-size:32rpx;
  488. flex:1;
  489. }
  490. view:nth-child(1){
  491. color:#fff;
  492. }
  493. view:nth-child(2){
  494. color:#0183FA;
  495. text-align: right;
  496. }
  497. }
  498. .chart {
  499. width: 690rpx;
  500. height: 360rpx;
  501. background: #3E414F;
  502. border-radius: 20rpx 20rpx 20rpx 20rpx;
  503. overflow: hidden;
  504. margin: 20rpx 30rpx 0;
  505. padding: 23rpx 40rpx 0;
  506. box-sizing: border-box;
  507. .chart-t {
  508. width: 100%;
  509. display: flex;
  510. justify-content: flex-start;
  511. align-items: center;
  512. font-size: 30rpx;
  513. color: #FFFFFF;
  514. line-height: 42rpx;
  515. text-align: left;
  516. padding-bottom:15rpx;
  517. >img {
  518. width: 40rpx;
  519. height: 34rpx;
  520. margin-right: 14rpx;
  521. }
  522. }
  523. .chart-b {
  524. display: flex;
  525. justify-content: space-between;
  526. flex-wrap: wrap;
  527. align-items: center;
  528. .chart-b-li {
  529. width: 180rpx;
  530. display: flex;
  531. justify-content: flex-start;
  532. align-items: center;
  533. margin-bottom: 34rpx;
  534. .chart-b-li-l {
  535. width: 100rpx;
  536. height: 100rpx;
  537. margin-right: 17rpx;
  538. }
  539. .chart-b-li-r {
  540. >text {
  541. display: block;
  542. font-size: 28rpx;
  543. color: #FFFFFF;
  544. line-height: 40rpx;
  545. text-align: left;
  546. }
  547. }
  548. }
  549. }
  550. }
  551. .small-title {
  552. width: 690rpx;
  553. height: 50rpx;
  554. display: flex;
  555. justify-content: space-between;
  556. align-items: center;
  557. margin: 24rpx 30rpx;
  558. .small-title-l {
  559. font-weight: 400;
  560. font-size: 32rpx;
  561. color: #FFFFFF;
  562. line-height: 45rpx;
  563. }
  564. .chart-tab-tow {
  565. width: 300rpx;
  566. height: 50rpx;
  567. border-radius: 25rpx;
  568. overflow: hidden;
  569. border: 1rpx solid #52545F;
  570. display: flex;
  571. justify-content: flex-start;
  572. .chart-tab-li {
  573. width: 100rpx;
  574. font-weight: 400;
  575. font-size: 28rpx;
  576. color: #999999;
  577. line-height: 50rpx;
  578. text-align: center;
  579. }
  580. .chart-tab-li:nth-of-type(1) {
  581. border-right: 1rpx solid #52545F;
  582. }
  583. .chart-tab-li:nth-of-type(2) {
  584. border-right: 1rpx solid #52545F;
  585. }
  586. .tab-A {
  587. color: #FFFFFF;
  588. background: #0183FA;
  589. }
  590. .tab-B {
  591. color: #999999;
  592. background: none;
  593. }
  594. }
  595. }
  596. .small-title-tow {
  597. width: 750rpx;
  598. height: 80rpx;
  599. background: #3E414F;
  600. display: flex;
  601. justify-content: space-between;
  602. align-items: center;
  603. padding: 0 20rpx 0 30rpx;
  604. box-sizing: border-box;
  605. margin-top: 2rpx;
  606. .small-title-tow-l {
  607. flex: 1;
  608. font-weight: 400;
  609. font-size: 30rpx;
  610. color: #FFFFFF;
  611. line-height: 42rpx;
  612. overflow: hidden;
  613. text-overflow: ellipsis;
  614. white-space: nowrap;
  615. }
  616. .small-title-tow-r {
  617. width: 14rpx;
  618. height: 8rpx;
  619. }
  620. }
  621. .chart-tow {
  622. width: 690rpx;
  623. height: 480rpx;
  624. background: #3E414F;
  625. border-radius: 20rpx 20rpx 20rpx 30rpx;
  626. margin: 26rpx 30rpx 0;
  627. .chart-tow-b {
  628. width: 690rpx;
  629. height: 480rpx;
  630. }
  631. }
  632. }
  633. </style>