wind.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <div class="wind-body">
  3. <div class="table-wrapper">
  4. <el-table :data="tableData" size="mini" stripe width="100%" height="100%">
  5. <el-table-column
  6. v-for="(item, index) in tableHead"
  7. :label="item.label"
  8. :prop="item.prop"
  9. :key="index"
  10. header-align="center"
  11. :align="index == 0 ? 'center' : 'right'"
  12. show-overflow-tooltip
  13. >
  14. <template #default="{ row }">
  15. <span
  16. style="cursor: pointer"
  17. v-if="item.prop == 'name'"
  18. @click.stop="rowClick(row, false)"
  19. >{{ row[item.prop] }}
  20. </span>
  21. <span v-else>{{ row[item.prop] }}</span>
  22. </template>
  23. </el-table-column>
  24. </el-table>
  25. </div>
  26. <div
  27. class="chart-wrapper"
  28. v-loading="chartLoading"
  29. element-loading-text="加载中..."
  30. element-loading-background="rgba(4, 12, 11, 0.8)"
  31. >
  32. <div class="left-chart">
  33. <lineCharts
  34. :unit="'m/s'"
  35. :windCurveValues="lineChart"
  36. :CurveTitle="chartName + '实时风速'"
  37. width="100%"
  38. :color="'#05bb4c'"
  39. height="100%"
  40. chartId="wind-fs"
  41. />
  42. </div>
  43. <div class="right-chart">
  44. <radarChart width="100%" height="100%" :list="radarChart" />
  45. </div>
  46. </div>
  47. </div>
  48. </template>
  49. <script>
  50. import lineCharts from "@/views/economicsOperation/stationAnalyse/windAndPhotovoltaic/components/lineCharts.vue";
  51. import radarChart from "@/views/economicsOperation/stationAnalyse/windAndPhotovoltaic/components/radar-chart.vue";
  52. import dayjs from "dayjs";
  53. import {
  54. getWindAnalysis,
  55. getWindAnalysisChart,
  56. getWindAnalysisRadarChart,
  57. } from "@/api/monthlyPerformanceAnalysis.js";
  58. export default {
  59. name: "Wind", //风资源分析
  60. components: { lineCharts, radarChart },
  61. props: {
  62. date: {
  63. type: String,
  64. },
  65. },
  66. data() {
  67. return {
  68. chartLoading: false,
  69. tableData: [],
  70. tableHead: [
  71. { prop: "name", label: "场站名称" },
  72. { prop: "pjfs", label: "平均风速(m/s)" },
  73. { prop: "zdfs", label: "最大风速(m/s)" },
  74. { prop: "zxfs", label: "最小风速(m/s)" },
  75. { prop: "pjfx", label: "平均风向" },
  76. ],
  77. chartName: "",
  78. lineChart: [],
  79. radarChart: [],
  80. };
  81. },
  82. created() {
  83. this.getData(true);
  84. },
  85. methods: {
  86. rowClick(row, flag) {
  87. console.log(row, flag);
  88. if (flag) {
  89. this.chartLoading = false;
  90. } else {
  91. this.chartLoading = true;
  92. }
  93. if (Object.keys(row).length) {
  94. this.chartName = row.name;
  95. this.getLineChart(row.wpid);
  96. this.getRadarChart(row.wpid);
  97. }
  98. },
  99. getData(val) {
  100. this.BASE.showLoading();
  101. getWindAnalysis(this.date).then((res) => {
  102. if (res.code == 200) {
  103. this.tableData = res.data ? res.data : [];
  104. this.rowClick(this.tableData[0] || {}, val);
  105. }
  106. });
  107. },
  108. getLineChart(wpid) {
  109. getWindAnalysisChart({ Data: this.date, wpid }).then((res) => {
  110. if (res.code == 200) {
  111. this.lineChart = res.data
  112. ? res.data.map((item) => {
  113. return {
  114. dateTime: dayjs(item.time).format("MM-DD HH:mm"),
  115. value: item.value6,
  116. };
  117. })
  118. : [];
  119. }
  120. this.chartLoading = false;
  121. this.BASE.closeLoading();
  122. });
  123. },
  124. getRadarChart(wpid) {
  125. getWindAnalysisRadarChart({ Data: this.date, wpid }).then((res) => {
  126. if (res.code == 200) {
  127. this.radarChart =
  128. res.data && res.data[0].count ? res.data[0].count : [];
  129. }
  130. // this.chartLoading = false;
  131. // this.BASE.closeLoading();
  132. });
  133. },
  134. },
  135. };
  136. </script>
  137. <style lang="less" scoped>
  138. .wind-body {
  139. height: 100%;
  140. width: 100%;
  141. display: flex;
  142. flex-direction: column;
  143. .table-wrapper {
  144. height: calc(100% - 390px - 20px);
  145. width: 100%;
  146. margin-bottom: 20px;
  147. }
  148. .chart-wrapper {
  149. height: 390px;
  150. display: flex;
  151. width: 100%;
  152. .left-chart {
  153. width: 65%;
  154. height: 100%;
  155. }
  156. .right-chart {
  157. width: 34%;
  158. height: 100%;
  159. }
  160. }
  161. }
  162. </style>