report.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <!-- -->
  2. <template>
  3. <div class="static_info report">
  4. <div class="chart-template">
  5. <div ref="otherchart"></div>
  6. </div>
  7. </div>
  8. </template>
  9. <script>
  10. import "./board.scss";
  11. import {
  12. orgInfo,
  13. currentMonthVisitInfo,
  14. orgSecurityInfo,
  15. } from "@/api/board/cockpit.js";
  16. import * as echarts from "echarts";
  17. export default {
  18. props: {
  19. rateData: {
  20. type: Object,
  21. isRequired: true,
  22. },
  23. },
  24. data() {
  25. return {
  26. data: {
  27. org: [],
  28. visit: [],
  29. rateData: null,
  30. },
  31. };
  32. },
  33. components: {},
  34. computed: {},
  35. watch: {
  36. rateData: {
  37. deep: true,
  38. handler(val) {
  39. this.rateData=val;
  40. this.initOtherMap();
  41. },
  42. },
  43. },
  44. created() {
  45. // this.types = types;
  46. // this.maxDisplay = 16;
  47. // this.refreshTime = 1 * 10 * 1000;
  48. // this.isMouseOver = false;
  49. },
  50. async mounted() {
  51. window.addEventListener("resize", this.windowResize);
  52. },
  53. beforeDestroy() {
  54. // this.timer && clearInterval(this.timer);
  55. // this.timer = null;
  56. window.removeEventListener("resize", this.windowResize);
  57. },
  58. methods: {
  59. // handleClick() {
  60. // this.getData();
  61. // },
  62. handleMouseEnter() {
  63. this.isMouseOver = true;
  64. },
  65. handleMouseLeave() {
  66. this.isMouseOver = false;
  67. },
  68. initOtherMap() {
  69. this.otherChart && this.otherChart.dispose();
  70. let c = this.$refs["otherchart"];
  71. // 基于准备好的dom,初始化echarts实例
  72. this.otherChart = echarts.init(
  73. c
  74. // document.getElementById("commAlarmEvent_Chart")
  75. );
  76. // 指定图表的配置项和数据
  77. var option = {
  78. // color: ["#82D5AE"],
  79. tooltip: {
  80. trigger: "axis",
  81. confine: true,
  82. axisPointer: {
  83. type: "shadow",
  84. },
  85. // formatter: "完成率:{c}%",
  86. },
  87. legend: {
  88. show: false,
  89. textStyle: {
  90. color: "rgb(245, 245, 245)",
  91. },
  92. },
  93. color: ["#5470c6", "#91cc75", "#ee6666"],
  94. series:
  95. {
  96. name: "自检",
  97. type: "pie",
  98. center: ["50%", "50%"],
  99. label: {
  100. // show:false,
  101. color: "#fff",
  102. formatter: (p) => {
  103. return `${p.name}\r\n(${p.value} ; ${p.percent==undefined?0:p.percent}%)`;
  104. },
  105. },
  106. labelLine: {
  107. // smooth:true
  108. length: 5,
  109. length2: 5,
  110. },
  111. data: [
  112. {
  113. name: "已检",
  114. value: this.rateData.doNums,
  115. },
  116. {
  117. name: "未检",
  118. value: this.rateData.unDoNums,
  119. },
  120. ],
  121. },
  122. };
  123. if (option && typeof option === "object") {
  124. this.otherChart.setOption(option);
  125. }
  126. },
  127. windowResize() {
  128. this.orgChart && this.orgChart.resize();
  129. },
  130. },
  131. };
  132. </script>
  133. <style lang="scss" scoped>
  134. .report {
  135. background-image: linear-gradient(
  136. to right,
  137. rgba(27, 33, 57, 0.8) 0%,
  138. rgba(32, 49, 99, 0.6) 50%,
  139. rgba(27, 33, 57, 0.8) 100%
  140. );
  141. margin-top: 15px;
  142. width: calc(100% - 0px);
  143. margin-left: 1px;
  144. border-top: 3px ;
  145. border-image: linear-gradient(
  146. to right,
  147. rgba(27, 33, 57, 0.8) 20%,
  148. rgba(101, 219, 229, 1) 50%,
  149. rgba(27, 33, 57, 0.8) 80%
  150. )
  151. 3;
  152. }
  153. .static_info {
  154. height: calc(100%);
  155. width: 100%;
  156. display: flex;
  157. flex-direction: row;
  158. margin-top: 5px;
  159. & > div {
  160. height: 100%;
  161. width: 100%;
  162. }
  163. }
  164. </style>