smodule24.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <div class="module-main">
  3. <div class="module-box">
  4. <div class="header">
  5. <div class="rhombus" />
  6. <span class="title">科室产废量分析TOP5</span>
  7. </div>
  8. <echarts v-if="!loading" :data="echartdata" class="echarts" />
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. import Vue from 'vue';
  14. import Component from 'vue-class-component';
  15. import Echarts from '@/common/components/echarts.vue';
  16. import api from '../../api';
  17. @Component({
  18. components: {
  19. Echarts,
  20. },
  21. props: {
  22. data: {
  23. type: Object,
  24. default: null,
  25. },
  26. },
  27. })
  28. export default class Smodule24 extends Vue {
  29. config = {
  30. }
  31. loading = true;
  32. echartdata = {
  33. color: ['#B24038', '#FFF000', '#709FA6', '#C8856B', '#FF69B4'], // , '#7D9D85'
  34. legend: {
  35. data: [],
  36. textStyle: {
  37. color: '#88B1D0',
  38. fontSize: 10,
  39. },
  40. },
  41. xAxis: [
  42. {
  43. type: 'category',
  44. data: [],
  45. rotate: 45,
  46. axisLabel: {
  47. textStyle: {
  48. color: '#fff',
  49. },
  50. },
  51. splitLine: {
  52. show: false, // 去掉网格线
  53. },
  54. splitArea: {
  55. show: false,
  56. },
  57. },
  58. ],
  59. yAxis: [
  60. {
  61. type: 'value',
  62. interval: 50,
  63. axisLabel: {
  64. textStyle: {
  65. color: '#fff',
  66. },
  67. },
  68. splitLine: {
  69. show: false, // 去掉网格线
  70. },
  71. splitArea: {
  72. show: false,
  73. },
  74. },
  75. ],
  76. series: [
  77. ],
  78. };
  79. created() {
  80. this.getDeviceList();
  81. setInterval(() => {
  82. this.getDeviceList();
  83. }, 5000 * 60);
  84. }
  85. getDeviceList() {
  86. api.getDeviceList().then((res) => {
  87. this.echartdata.legend.data = res.data.title1;
  88. this.echartdata.xAxis[0].data = res.data.title;
  89. const lists = res.data.list;
  90. const series = [];
  91. lists.forEach((e) => {
  92. series.push(
  93. {
  94. name: e.title,
  95. type: 'line',
  96. data: e.list,
  97. },
  98. );
  99. });
  100. this.echartdata.series = series;
  101. this.loading = false;
  102. }).catch(() => { }).finally(() => {
  103. this.loading = false;
  104. });
  105. }
  106. }
  107. </script>
  108. <style scoped lang="scss">
  109. .module-box {
  110. width: 100%;
  111. height: 100%;
  112. position: relative;
  113. }
  114. .module-box .header {
  115. width: 97%;
  116. height: 40px;
  117. line-height: 40px;
  118. padding-left: 3%;
  119. }
  120. .module-box .header .rhombus {
  121. width: 14px;
  122. height: 14px;
  123. background: #2D59BC;
  124. display: inline-block;
  125. clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  126. }
  127. .module-box .header .title {
  128. color: #FFFFFF;
  129. font-size: 15px;
  130. font-weight: 500;
  131. margin-left: 2%;
  132. }
  133. .module-box .echarts {
  134. width: 100%;
  135. height: auto;
  136. position: absolute;
  137. top: 40px;
  138. left: 0;
  139. right: 0;
  140. bottom: 0;
  141. }
  142. </style>