cagePosition.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  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="@/pages/images/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="@/pages/images/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[0].cageNum}}</text>
  82. <!-- <text>{{dataList[0].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[0].freeNum}}</text>
  91. <text>{{dataList[0].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[0].appointNum}}</text>
  100. <text>{{dataList[0].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[0].lockedNum}}</text>
  109. <text>{{dataList[0].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[0].killNum}}</text>
  118. <text>{{dataList[0].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[0].repairNum}}</text>
  127. <text>{{dataList[0].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. boundaryGap: "justify",
  324. disableGrid: false,
  325. min: 0,
  326. axisLine: false,
  327. max: 40
  328. },
  329. yAxis: {},
  330. extra: {
  331. bar: {
  332. type: "group",
  333. width: 15,
  334. meterBorde: 1,
  335. meterFillColor: "#FFFFFF",
  336. activeBgColor: "#000000",
  337. activeBgOpacity: 0.08,
  338. linearType: "custom",
  339. barBorderCircle: true,
  340. seriesGap: 2,
  341. categoryGap: 2
  342. }
  343. }
  344. },
  345. chartDataThree: {},
  346. chartTabList: ['日', '月', '年'],
  347. chartTabIndex: 0,
  348. chartTabListTow: ['按资费', '按机时', '按样品'],
  349. chartTabIndexTow: 0,
  350. chartTabListThree: ['年度', '季度', '月度'],
  351. chartTabIndexThree: 0,
  352. type: 1, //1年2季度3月度
  353. totalAppointNum: 0,
  354. dataList:[],
  355. }
  356. },
  357. created() {
  358. },
  359. beforeMount() {
  360. },
  361. mounted() {
  362. this.reportAppletReportApiCageRateCageRateList()
  363. this.reportAppletReportBsEquipDangerList()
  364. },
  365. methods: {
  366. //笼位A-B楼
  367. async reportAppletReportApiCageRateCageRateList() {
  368. let self = this;
  369. const {
  370. data
  371. } = await reportAppletReportApiCageRateCageRateList();
  372. if (data.code == 200) {
  373. self.totalCageNum=data.data.totalCageNum;
  374. self.dataList=data.data.reportBsCageRateList;
  375. let nameList=['总数','空闲','预约','锁定','消杀','维修']
  376. // let colorList=['#B5DEFC','#9FF7B2','#B5F2F0','#FFBCA2','#FC9893','#FFDCB5']
  377. let colorList=['#0183FA','#16BF32','#03D8D0','#FF4800','#FF5F5F','#FF8C00']
  378. let numList=[
  379. // data.data.reportBsCageRateList[0].appointNum/100,
  380. 1,
  381. data.data.reportBsCageRateList[0].freeNum/100,
  382. data.data.reportBsCageRateList[0].appointNum/100,
  383. data.data.reportBsCageRateList[0].lockedNum/100,
  384. data.data.reportBsCageRateList[0].killNum/100,
  385. data.data.reportBsCageRateList[0].repairNum/100,
  386. ]
  387. this.subName=data.data.reportBsCageRateList[0].buildName;
  388. let numListTow=[
  389. // data.data.reportBsCageRateList[1].appointNum/100,
  390. 1,
  391. data.data.reportBsCageRateList[1].freeNum/100,
  392. data.data.reportBsCageRateList[1].appointNum/100,
  393. data.data.reportBsCageRateList[1].lockedNum/100,
  394. data.data.reportBsCageRateList[1].killNum/100,
  395. data.data.reportBsCageRateList[1].repairNum/100,
  396. ]
  397. this.subNameTow=data.data.reportBsCageRateList[1].buildName;
  398. for(let i=0;i<6;i++){
  399. let res = {
  400. series: [{
  401. name: nameList[i],
  402. color: colorList[i],
  403. data: numList[i],
  404. }]
  405. };
  406. const propertyName = `chartData${i}`;
  407. this[propertyName] = JSON.parse(JSON.stringify(res));
  408. let res2 = {
  409. series: [{
  410. name: nameList[i],
  411. color: colorList[i],
  412. data: numListTow[i],
  413. }]
  414. };
  415. const propertyNameTow = `chartDataTow${i}`;
  416. this[propertyNameTow] = JSON.parse(JSON.stringify(res2));
  417. }
  418. }
  419. },
  420. async reportAppletReportBsEquipDangerList() {
  421. let self = this;
  422. const {
  423. data
  424. } = await reportAppletReportBsEquipDangerList({
  425. dangerType: '2',
  426. statisticsType: this.statisticsType
  427. });
  428. if (data.code == 200) {
  429. let categories = [];
  430. let list = [];
  431. data.data.subjectList.forEach((item, index)=>{
  432. if (index < 5) {
  433. if (item.subjectName.length > 6) {
  434. item.subjectName = item.subjectName.slice(0, 6) + '...';
  435. }
  436. categories.push(item.subjectName)
  437. list.push(item.dangerNum)
  438. }
  439. })
  440. let res = {};
  441. if(categories[0]){
  442. res = {
  443. categories: categories,
  444. series: [{
  445. name: "",
  446. data: list
  447. }]
  448. };
  449. }else{
  450. res = {
  451. categories: ['无数据'],
  452. series: [{
  453. name: "",
  454. data: [0]
  455. }]
  456. };
  457. }
  458. self.$set(this,'chartDataThree',res);
  459. }
  460. },
  461. chartTabClick(index) {
  462. this.chartTabIndex = index;
  463. },
  464. chartTabClickTow(index) {
  465. this.chartTabIndexTow = index;
  466. },
  467. chartTabClickThree(index) {
  468. this.chartTabIndexThree = index;
  469. this.statisticsType = index + 1;
  470. this.reportAppletReportBsEquipDangerList();
  471. },
  472. },
  473. }
  474. </script>
  475. <style lang="stylus" scoped>
  476. .cagePosition {
  477. height: 100%;
  478. width: 100%;
  479. background: #363744;
  480. padding: 20rpx 0rpx 0;
  481. box-sizing: border-box;
  482. .total-box{
  483. display: flex;
  484. padding:0 35rpx;
  485. height:60rpx;
  486. view{
  487. line-height:60rpx;
  488. font-size:32rpx;
  489. flex:1;
  490. }
  491. view:nth-child(1){
  492. color:#fff;
  493. }
  494. view:nth-child(2){
  495. color:#0183FA;
  496. text-align: right;
  497. }
  498. }
  499. .chart {
  500. width: 690rpx;
  501. height: 360rpx;
  502. background: #3E414F;
  503. border-radius: 20rpx 20rpx 20rpx 20rpx;
  504. overflow: hidden;
  505. margin: 20rpx 30rpx 0;
  506. padding: 23rpx 40rpx 0;
  507. box-sizing: border-box;
  508. .chart-t {
  509. width: 100%;
  510. display: flex;
  511. justify-content: flex-start;
  512. align-items: center;
  513. font-size: 30rpx;
  514. color: #FFFFFF;
  515. line-height: 42rpx;
  516. text-align: left;
  517. padding-bottom:15rpx;
  518. >img {
  519. width: 40rpx;
  520. height: 34rpx;
  521. margin-right: 14rpx;
  522. }
  523. }
  524. .chart-b {
  525. display: flex;
  526. justify-content: space-between;
  527. flex-wrap: wrap;
  528. align-items: center;
  529. .chart-b-li {
  530. width: 180rpx;
  531. display: flex;
  532. justify-content: flex-start;
  533. align-items: center;
  534. margin-bottom: 34rpx;
  535. .chart-b-li-l {
  536. width: 100rpx;
  537. height: 100rpx;
  538. margin-right: 17rpx;
  539. }
  540. .chart-b-li-r {
  541. >text {
  542. display: block;
  543. font-size: 28rpx;
  544. color: #FFFFFF;
  545. line-height: 40rpx;
  546. text-align: left;
  547. }
  548. }
  549. }
  550. }
  551. }
  552. .small-title {
  553. width: 690rpx;
  554. height: 50rpx;
  555. display: flex;
  556. justify-content: space-between;
  557. align-items: center;
  558. margin: 24rpx 30rpx;
  559. .small-title-l {
  560. font-weight: 400;
  561. font-size: 32rpx;
  562. color: #FFFFFF;
  563. line-height: 45rpx;
  564. }
  565. .chart-tab-tow {
  566. width: 300rpx;
  567. height: 50rpx;
  568. border-radius: 25rpx;
  569. overflow: hidden;
  570. border: 1rpx solid #52545F;
  571. display: flex;
  572. justify-content: flex-start;
  573. .chart-tab-li {
  574. width: 100rpx;
  575. font-weight: 400;
  576. font-size: 28rpx;
  577. color: #999999;
  578. line-height: 50rpx;
  579. text-align: center;
  580. }
  581. .chart-tab-li:nth-of-type(1) {
  582. border-right: 1rpx solid #52545F;
  583. }
  584. .chart-tab-li:nth-of-type(2) {
  585. border-right: 1rpx solid #52545F;
  586. }
  587. .tab-A {
  588. color: #FFFFFF;
  589. background: #0183FA;
  590. }
  591. .tab-B {
  592. color: #999999;
  593. background: none;
  594. }
  595. }
  596. }
  597. .small-title-tow {
  598. width: 750rpx;
  599. height: 80rpx;
  600. background: #3E414F;
  601. display: flex;
  602. justify-content: space-between;
  603. align-items: center;
  604. padding: 0 20rpx 0 30rpx;
  605. box-sizing: border-box;
  606. margin-top: 2rpx;
  607. .small-title-tow-l {
  608. flex: 1;
  609. font-weight: 400;
  610. font-size: 30rpx;
  611. color: #FFFFFF;
  612. line-height: 42rpx;
  613. overflow: hidden;
  614. text-overflow: ellipsis;
  615. white-space: nowrap;
  616. }
  617. .small-title-tow-r {
  618. width: 14rpx;
  619. height: 8rpx;
  620. }
  621. }
  622. .chart-tow {
  623. width: 690rpx;
  624. height: 480rpx;
  625. background: #3E414F;
  626. border-radius: 20rpx 20rpx 20rpx 30rpx;
  627. margin: 26rpx 30rpx 0;
  628. .chart-tow-b {
  629. width: 690rpx;
  630. height: 480rpx;
  631. }
  632. }
  633. }
  634. </style>