bottomEnergy.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <div id="bottomLeft">
  3. <div class="bg-color-black">
  4. <div class="d-flex pt-2 pl-2">
  5. <span style="color:#5cd9e8">
  6. <icon name="chart-bar"></icon>
  7. </span>
  8. <div class="d-flex">
  9. <span class="fs-xl text mx-2">近30天能源消耗</span>
  10. </div>
  11. </div>
  12. <div>
  13. <!--渐变折线图-->
  14. <div id="monthEnergyChart" :style="{height:height,width:width}"></div>
  15. </div>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. import valveChart from "../dashboard/ValveChart";
  21. require('echarts/theme/macarons') // echarts theme
  22. import resize from "../dashboard/mixins/resize";
  23. const animationDuration = 6000
  24. export default {
  25. mixins: [resize],
  26. props: {
  27. monthData: {},
  28. width: {
  29. type: String,
  30. default: '100%'
  31. },
  32. height: {
  33. type: String,
  34. default: '1.7rem'
  35. }
  36. },
  37. data() {
  38. return {
  39. /*config: {
  40. header: ["", "BCC", "SUB", "EU", "PGU/AEU"],
  41. data: [
  42. ["SS(HS)自产", "509", "132", "376", "1"],
  43. ["HHP", "46", "46", "", ""],
  44. ["HS", "-36", "161", "85", "41"],
  45. ["MS", "-44", "", "-69", "25"],
  46. ["LS", "-16", "", "-11", "-5"],
  47. ["TOTAL", "-49", "", "5", ""],
  48. ["总消耗", "459", "", "381", "62"]
  49. /!*["TOTAL", "-49", "<span class='colorRed'>28</span>"],
  50. ["总消耗", "459", "<span class='colorRed'>27</span>"]*!/
  51. ],
  52. rowNum: 6, //表格行数
  53. headerHeight: 35,
  54. headerBGC: "#0f1325", //表头
  55. oddRowBGC: "#0f1325", //奇数行
  56. evenRowBGC: "#171c33", //偶数行
  57. columnWidth: [110, 70, 70, 70, 90],
  58. align: ["center", "center", "center", "center", "center"]
  59. }*/
  60. chart: null
  61. };
  62. },
  63. components: {
  64. valveChart
  65. },
  66. mounted() {
  67. this.initChart()
  68. },
  69. methods: {
  70. beforeDestroy() {
  71. if (!this.chart) {
  72. return
  73. }
  74. this.chart.dispose()
  75. this.chart = null
  76. },
  77. initChart() {
  78. // 基于准备好的dom,初始化echarts实例
  79. this.chart = this.echarts.init(document.getElementById('monthEnergyChart'))
  80. this.chart.setOption({
  81. /* 周围边距 */
  82. grid: {
  83. left: '3%',
  84. right: '3%',
  85. bottom: '1%',
  86. top: '13%',
  87. containLabel: true
  88. },
  89. xAxis: {
  90. type: 'category',
  91. data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31']
  92. },
  93. yAxis: {
  94. type: 'value'
  95. },
  96. series: [
  97. {
  98. data: [150, 230, 224, 218, 135, 147, 260, 150, 230, 224, 218, 135, 147, 260, 150, 230, 224, 218, 135, 147, 260, 150, 230, 224, 218, 135, 147, 260, 23, 147, 123],
  99. type: 'line',
  100. itemStyle: {
  101. color: 'rgb(78,109,60)'
  102. },
  103. symbol: "none",
  104. areaStyle: {
  105. color: new this.echarts.graphic.LinearGradient(0, 0, 0, 1, [
  106. {
  107. offset: 0,
  108. color: 'rgb(207,243,68)'
  109. },
  110. {
  111. offset: 1,
  112. color: 'rgb(119,189,74)'
  113. }
  114. ])
  115. },
  116. }
  117. ]
  118. })
  119. }
  120. }
  121. };
  122. </script>
  123. <style lang="scss">
  124. #bottomLeft {
  125. padding: 0.2rem 0.2rem 0;
  126. height: 2.9rem;
  127. min-width: 3.75rem;
  128. border-radius: 0.0625rem;
  129. .bg-color-black {
  130. height: 2rem;
  131. border-radius: 0.125rem;
  132. }
  133. .text {
  134. color: #c3cbde;
  135. }
  136. .chart-box {
  137. margin-top: 0.2rem;
  138. width: 2.125rem;
  139. height: 2.125rem;
  140. .active-ring-name {
  141. padding-top: 0.125rem;
  142. }
  143. }
  144. }
  145. </style>