123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <template>
- <div class="wind-body">
- <div class="table-wrapper">
- <el-table :data="tableData" size="mini" stripe width="100%" height="100%">
- <el-table-column
- v-for="(item, index) in tableHead"
- :label="item.label"
- :prop="item.prop"
- :key="index"
- header-align="center"
- :align="index == 0 ? 'center' : 'right'"
- show-overflow-tooltip
- >
- <template #default="{ row }">
- <span
- style="cursor: pointer"
- v-if="item.prop == 'name'"
- @click.stop="rowClick(row, false)"
- >{{ row[item.prop] }}
- </span>
- <span v-else>{{ row[item.prop] }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div
- class="chart-wrapper"
- v-loading="chartLoading"
- element-loading-text="加载中..."
- element-loading-background="rgba(4, 12, 11, 0.8)"
- >
- <div class="left-chart">
- <lineCharts
- :unit="'m/s'"
- :windCurveValues="lineChart"
- :CurveTitle="chartName + '实时风速'"
- width="100%"
- :color="'#05bb4c'"
- height="100%"
- chartId="wind-fs"
- />
- </div>
- <div class="right-chart">
- <radarChart width="100%" height="100%" :list="radarChart" />
- </div>
- </div>
- </div>
- </template>
- <script>
- import lineCharts from "@/views/economicsOperation/stationAnalyse/windAndPhotovoltaic/components/lineCharts.vue";
- import radarChart from "@/views/economicsOperation/stationAnalyse/windAndPhotovoltaic/components/radar-chart.vue";
- import dayjs from "dayjs";
- import {
- getWindAnalysis,
- getWindAnalysisChart,
- getWindAnalysisRadarChart,
- } from "@/api/monthlyPerformanceAnalysis.js";
- export default {
- name: "Wind", //风资源分析
- components: { lineCharts, radarChart },
- props: {
- date: {
- type: String,
- },
- },
- data() {
- return {
- chartLoading: false,
- tableData: [],
- tableHead: [
- { prop: "name", label: "场站名称" },
- { prop: "pjfs", label: "平均风速(m/s)" },
- { prop: "zdfs", label: "最大风速(m/s)" },
- { prop: "zxfs", label: "最小风速(m/s)" },
- { prop: "pjfx", label: "平均风向" },
- ],
- chartName: "",
- lineChart: [],
- radarChart: [],
- };
- },
- created() {
- this.getData(true);
- },
- methods: {
- rowClick(row, flag) {
- console.log(row, flag);
- if (flag) {
- this.chartLoading = false;
- } else {
- this.chartLoading = true;
- }
- if (Object.keys(row).length) {
- this.chartName = row.name;
- this.getLineChart(row.wpid);
- this.getRadarChart(row.wpid);
- }
- },
- getData(val) {
- this.BASE.showLoading();
- getWindAnalysis(this.date).then((res) => {
- if (res.code == 200) {
- this.tableData = res.data ? res.data : [];
- this.rowClick(this.tableData[0] || {}, val);
- }
- });
- },
- getLineChart(wpid) {
- getWindAnalysisChart({ Data: this.date, wpid }).then((res) => {
- if (res.code == 200) {
- this.lineChart = res.data
- ? res.data.map((item) => {
- return {
- dateTime: dayjs(item.time).format("MM-DD HH:mm"),
- value: item.value6,
- };
- })
- : [];
- }
- this.chartLoading = false;
- this.BASE.closeLoading();
- });
- },
- getRadarChart(wpid) {
- getWindAnalysisRadarChart({ Data: this.date, wpid }).then((res) => {
- if (res.code == 200) {
- this.radarChart =
- res.data && res.data[0].count ? res.data[0].count : [];
- }
- // this.chartLoading = false;
- // this.BASE.closeLoading();
- });
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .wind-body {
- height: 100%;
- width: 100%;
- display: flex;
- flex-direction: column;
- .table-wrapper {
- height: calc(100% - 390px - 20px);
- width: 100%;
- margin-bottom: 20px;
- }
- .chart-wrapper {
- height: 390px;
- display: flex;
- width: 100%;
- .left-chart {
- width: 65%;
- height: 100%;
- }
- .right-chart {
- width: 34%;
- height: 100%;
- }
- }
- }
- </style>
|