info.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="container">
  3. <qiun-title-bar title="商户统计分析" />
  4. <view class="charts-box"><qiun-data-charts type="ring" canvasId="chart21" :canvas2d="isCanvas2d" :opts="{ legend: { position: 'bottom' }, title: { name: '商户数量', fontSize: 15, color: '#333' }, subtitle: { name: baseInfo.company.total, fontSize: 25, color: '#7cb5ec' }, extra: { ring: { ringWidth: 40, linearType: 'custom', centerColor: '#eee' } } }" :chartData="data1" /></view>
  5. <qiun-title-bar title="净化设施统计分析" />
  6. <view class="charts-box">
  7. <qiun-data-charts type="ring" canvasId="chart22" :canvas2d="isCanvas2d" :opts="{ legend: { position: 'bottom' }, title: { name: '净化设施数量', fontSize: 15, color: '#333' }, subtitle: { name: baseInfo.facilities.total, fontSize: 25, color: '#7cb5ec' }, extra: { ring: { ringWidth: 40, linearType: 'custom', centerColor: '#eee' } } }" :chartData="data2" />
  8. </view>
  9. <qiun-title-bar title="监控仪统计分析" />
  10. <view class="charts-box">
  11. <qiun-data-charts type="ring" canvasId="chart23" :canvas2d="isCanvas2d" :opts="{ legend: { position: 'bottom' }, title: { name: '监控仪数量', fontSize: 15, color: '#333' }, subtitle: { name: baseInfo.monitor.total, fontSize: 25, color: '#7cb5ec' }, extra: { ring: { ringWidth: 40, linearType: 'custom', centerColor: '#eee' } } }" :chartData="data3" />
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import api from "@/common/api.js";
  19. import { log } from "@/utils/base.js";
  20. export default {
  21. data() {
  22. return {
  23. baseInfo: {
  24. company: {
  25. operate: 0,
  26. rest: 0,
  27. outlet: 0,
  28. stove: 0,
  29. total: 0,
  30. },
  31. facilities: {
  32. normal: 0,
  33. rest: 0,
  34. over: 0,
  35. abnormal: 0,
  36. total: 0,
  37. },
  38. monitor: {
  39. normal: 0,
  40. abnormal: 0,
  41. total: 0,
  42. },
  43. },
  44. data1: {},
  45. data2: {},
  46. data3: {},
  47. //#ifndef MP-WEIXIN
  48. isCanvas2d: false,
  49. //#endif
  50. //#ifdef MP-WEIXIN
  51. isCanvas2d: true,
  52. //#endif
  53. };
  54. },
  55. computed: {},
  56. mounted() {
  57. this.getInfo();
  58. },
  59. methods: {
  60. getInfo() {
  61. api.getBaseInfo().then(data => {
  62. this.baseInfo = data;
  63. this.data1 = {
  64. series: [
  65. {
  66. data: [
  67. {
  68. value: this.baseInfo.company.rest,
  69. name: "休息",
  70. },
  71. {
  72. value: this.baseInfo.company.operate,
  73. name: "营业",
  74. },
  75. ],
  76. },
  77. ],
  78. };
  79. this.data2 = {
  80. series: [
  81. {
  82. data: [
  83. {
  84. value: this.baseInfo.facilities.rest,
  85. name: "休息",
  86. },
  87. {
  88. value: this.baseInfo.facilities.normal,
  89. name: "正常",
  90. },
  91. {
  92. value: this.baseInfo.facilities.over,
  93. name: "超标",
  94. },
  95. {
  96. value: this.baseInfo.facilities.abnormal,
  97. name: "异常",
  98. },
  99. ],
  100. },
  101. ],
  102. };
  103. this.data3 = {
  104. series: [
  105. {
  106. data: [
  107. {
  108. value: this.baseInfo.monitor.normal,
  109. name: "正常",
  110. },
  111. {
  112. value: this.baseInfo.monitor.abnormal,
  113. name: "停电",
  114. },
  115. ],
  116. },
  117. ],
  118. };
  119. log("BASE_INFO", this.baseInfo);
  120. });
  121. },
  122. },
  123. };
  124. </script>
  125. <style>
  126. .container {
  127. padding: 10px 0;
  128. font-size: 14px;
  129. line-height: 24px;
  130. }
  131. .charts-box {
  132. width: 100%;
  133. height: 300px;
  134. }
  135. </style>