2025-06-24 19:52:11 +08:00
|
|
|
<template>
|
2025-09-27 17:26:08 +08:00
|
|
|
<el-card
|
|
|
|
|
shadow="always"
|
|
|
|
|
class="common-card-container time-range-card"
|
|
|
|
|
style="margin-top: 20px"
|
|
|
|
|
>
|
2025-09-22 17:57:30 +08:00
|
|
|
<div slot="header" class="time-range-header">
|
|
|
|
|
<span class="card-title">功率曲线</span>
|
2025-09-27 17:26:08 +08:00
|
|
|
<date-range-select
|
|
|
|
|
ref="dateRangeSelect"
|
|
|
|
|
@reset="resetTime"
|
|
|
|
|
@updateDate="updateDate"
|
|
|
|
|
/>
|
2025-06-24 19:52:11 +08:00
|
|
|
</div>
|
2025-09-22 17:57:30 +08:00
|
|
|
<div class="card-main" v-loading="loading">
|
2025-09-27 17:26:08 +08:00
|
|
|
<div id="glqxEchart" style="height: 310px"></div>
|
2025-06-24 19:52:11 +08:00
|
|
|
</div>
|
2025-09-22 17:57:30 +08:00
|
|
|
</el-card>
|
2025-06-24 19:52:11 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-09-27 17:26:08 +08:00
|
|
|
import * as echarts from "echarts";
|
2025-06-24 19:52:11 +08:00
|
|
|
import resize from "@/mixins/ems/resize";
|
2025-07-09 23:52:19 +08:00
|
|
|
import getQuerySiteId from "@/mixins/ems/getQuerySiteId";
|
2025-09-27 17:26:08 +08:00
|
|
|
import { getPcsNameList, getPowerData } from "@/api/ems/dzjk";
|
|
|
|
|
import { formatDate } from "@/filters/ems";
|
2025-09-22 17:57:30 +08:00
|
|
|
import DateRangeSelect from "@/components/Ems/DateRangeSelect/index.vue";
|
2025-06-24 19:52:11 +08:00
|
|
|
export default {
|
2025-09-27 17:26:08 +08:00
|
|
|
name: "DzjkTjbbGlqx",
|
|
|
|
|
components: { DateRangeSelect },
|
|
|
|
|
mixins: [resize, getQuerySiteId],
|
2025-06-24 19:52:11 +08:00
|
|
|
data() {
|
|
|
|
|
return {
|
2025-09-27 17:26:08 +08:00
|
|
|
pickerOptions: {
|
2025-06-24 19:52:11 +08:00
|
|
|
disabledDate(time) {
|
|
|
|
|
return time.getTime() > Date.now();
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-09-27 17:26:08 +08:00
|
|
|
dateRange: [],
|
|
|
|
|
loading: false,
|
|
|
|
|
dateRangeInit: true,
|
|
|
|
|
};
|
2025-06-24 19:52:11 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
2025-09-22 17:57:30 +08:00
|
|
|
// 更新时间范围 重置图表
|
2025-09-27 17:26:08 +08:00
|
|
|
updateDate(data) {
|
|
|
|
|
this.dateRange = data || [];
|
|
|
|
|
this.getData();
|
2025-06-24 19:52:11 +08:00
|
|
|
},
|
2025-09-27 17:26:08 +08:00
|
|
|
resetTime() {
|
|
|
|
|
this.dateRangeInit = true;
|
2025-09-26 14:47:45 +08:00
|
|
|
},
|
2025-09-27 17:26:08 +08:00
|
|
|
getData() {
|
|
|
|
|
const { siteId } = this;
|
|
|
|
|
let [start = "", end = ""] = this.dateRange || [];
|
2025-06-24 19:52:11 +08:00
|
|
|
//接口调用完成之后 设置图表、结束loading
|
2025-09-27 17:26:08 +08:00
|
|
|
this.loading = true;
|
|
|
|
|
if (this.dateRangeInit) {
|
|
|
|
|
start = "";
|
|
|
|
|
end = "";
|
|
|
|
|
this.dateRangeInit = false;
|
2025-09-25 17:30:16 +08:00
|
|
|
}
|
2025-09-27 17:26:08 +08:00
|
|
|
getPowerData({
|
|
|
|
|
siteId,
|
|
|
|
|
startDate: formatDate(start),
|
|
|
|
|
endDate: formatDate(end),
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
this.setOption(response?.data || []);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
2025-06-24 19:52:11 +08:00
|
|
|
},
|
2025-07-09 23:52:19 +08:00
|
|
|
setOption(data) {
|
2025-09-27 17:26:08 +08:00
|
|
|
const source = [["日期", "电网功率", "负载功率", "储能功率", "光伏功率"]];
|
|
|
|
|
data.forEach((item) => {
|
|
|
|
|
source.push([
|
|
|
|
|
item.statisDate,
|
|
|
|
|
item.gridPower,
|
|
|
|
|
item.loadPower,
|
|
|
|
|
item.storagePower,
|
|
|
|
|
item.pvPower,
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
this.chart.setOption(
|
|
|
|
|
{
|
|
|
|
|
grid: {
|
|
|
|
|
containLabel: true,
|
|
|
|
|
},
|
|
|
|
|
legend: {
|
|
|
|
|
left: "center",
|
|
|
|
|
bottom: "15",
|
|
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
trigger: "axis",
|
|
|
|
|
axisPointer: {
|
|
|
|
|
// 坐标轴指示器,坐标轴触发有效
|
|
|
|
|
type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
|
|
|
|
|
},
|
2025-09-14 23:33:53 +08:00
|
|
|
},
|
2025-09-27 17:26:08 +08:00
|
|
|
textStyle: {
|
|
|
|
|
color: "#333333",
|
2025-09-14 23:33:53 +08:00
|
|
|
},
|
2025-09-27 17:26:08 +08:00
|
|
|
xAxis: {
|
|
|
|
|
type: "category",
|
2025-09-14 23:33:53 +08:00
|
|
|
},
|
2025-09-27 17:26:08 +08:00
|
|
|
yAxis: {
|
|
|
|
|
type: "value",
|
|
|
|
|
},
|
|
|
|
|
dataset: { source },
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
type: "line",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: "line",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: "line",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: "line",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
true
|
|
|
|
|
);
|
2025-06-24 19:52:11 +08:00
|
|
|
},
|
|
|
|
|
initChart() {
|
2025-09-27 17:26:08 +08:00
|
|
|
if (this.chart) return;
|
|
|
|
|
this.chart = echarts.init(document.querySelector("#glqxEchart"));
|
|
|
|
|
},
|
|
|
|
|
init() {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.dateRangeInit = true;
|
|
|
|
|
this.initChart();
|
|
|
|
|
this.$refs.dateRangeSelect.init();
|
|
|
|
|
});
|
2025-07-09 23:52:19 +08:00
|
|
|
},
|
2025-06-24 19:52:11 +08:00
|
|
|
},
|
2025-09-26 14:47:45 +08:00
|
|
|
|
2025-06-24 19:52:11 +08:00
|
|
|
beforeDestroy() {
|
|
|
|
|
if (!this.chart) {
|
2025-09-27 17:26:08 +08:00
|
|
|
return;
|
2025-06-24 19:52:11 +08:00
|
|
|
}
|
2025-09-27 17:26:08 +08:00
|
|
|
this.chart.dispose();
|
|
|
|
|
this.chart = null;
|
2025-06-24 19:52:11 +08:00
|
|
|
},
|
2025-09-27 17:26:08 +08:00
|
|
|
};
|
2025-06-24 19:52:11 +08:00
|
|
|
</script>
|