光伏功能逻辑代码及BUG修改

This commit is contained in:
huangjp
2025-12-26 11:26:40 +08:00
parent b3608320a8
commit cbb1d7a8a9
27 changed files with 1839 additions and 543 deletions

View File

@ -6,8 +6,15 @@
<script>
export default {
props: {
time: {
type: String,
default: "",
},
},
data() {
return {
stationId:'',
chartData: {},
//您可以通过修改 config-ucharts.js 文件中下标为 ['column'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。
opts: {
@ -23,10 +30,10 @@
disableGrid: true,
rotateLabel: true,
rotateAngle: 30,
titleOffsetY: 20,
titleOffsetX: 5,
marginTop: 5
marginTop: 5,
labelCount: 7
},
yAxis: {
data: [{
@ -44,32 +51,53 @@
};
},
created() {
console.log("runChart onReady");
this.getServerData();
this.GetPvMonthData();
},
computed: {
currentStation() {
return this.vuex_currentStation;
},
},
watch: {
currentStation: {
handler(val) {
this.stationId = val.id;
},
deep: true,
immediate: true,
},
},
methods: {
getServerData() {
let _this = this;
//模拟从服务器获取数据时的延时
setTimeout(() => {
//模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
let res = {
categories: ["2025-10-17", "2025-10-18", "2025-10-19", "2025-10-20", "2025-10-21",
"2025-10-22"
],
series: [
{
name:this.$t('homePage.home.powerGeneration'),
textColor: "#FFFFFF",
data: [18, 27, 21, 24, 6, 28]
}
]
};
this.chartData = JSON.parse(JSON.stringify(res));
}, 500);
},
async GetPvMonthData(){
try {
const res = await this.$u.api.enrnings.GetPvMonthData({
stationId: this.stationId,
time: this.time,
});
let resdata = {
categories:[],
series:[{
name:this.$t('homePage.home.powerGeneration'),
textColor: "#FFFFFF",
data: []
}]
}
if (res.data.length) {
res.data.forEach((el) => {
resdata.categories.push(el.date)
resdata.series[0].data.push(el.powerGenerate)
});
console.log(JSON.parse(JSON.stringify(resdata)));
this.chartData = JSON.parse(JSON.stringify(resdata));
} else {
this.chargeArr = [];
}
} catch (e) {
//TODO handle the exception
} finally {
this.loading = false;
}
}
}
};
</script>

View File

@ -27,42 +27,57 @@
</view>
</view>
<view class="power-generation">
<Section :title="$t('homePage.earning.changeDischargePro')" />
<Section :title="$t('homePage.home.powerGenerationStatus')" />
<view class="power-generation-detail">
<view class="value-box">
<view class="icon zjry"> </view>
<view class="title">
{{ $t("homePage.earning.capacity") }}
</view>
<view class="value">
{{ totalData.capacity | isNull }}
</view>
<view class="unit"> kWh </view>
</view>
<view class="value-box">
<view class="icon byzc"> </view>
<view class="title">
{{ $t("homePage.earning.monthTotalCharge") }}
</view>
<view class="value">
{{ totalData.totalChargeElec | isNull }}
</view>
<view class="unit"> kWh </view>
</view>
<view class="value-box">
<view class="icon zjry">
<view class="value-box">
<view class="icon byzf"> </view>
<view class="title">
{{ $t("homePage.earning.monthTotalDischarge") }}
</view>
<view class="value">
{{ totalData.totalDischargeElec | isNull }}
</view>
<view class="unit"> kWh </view>
</view>
</view>
<view class="title">
{{ $t('homePage.home.currentMonthlyPowerGeneration') }}
</view>
<view class="value">
{{ totalData.monthReleaseElec | isNull }}
</view>
<view class="unit">
kWh
</view>
</view>
<view class="value-box">
<view class="value-box">
<view class="icon byzc">
</view>
<view class="title">
{{ $t('homePage.home.cumulativePowerGeneration') }}
</view>
<view class="value">
{{ totalData.totalReleaseElec | isNull }}
</view>
<view class="unit">
kWh
</view>
</view>
<view class="value-box">
<view class="icon byzf">
</view>
<view class="title">
{{ $t('homePage.home.ratedPowernokw') }}
</view>
<view class="value">
{{ totalData.pvPower | isNull }}
</view>
<view class="unit">
kW
</view>
</view>
<!-- <view class="value-box">
<view class="icon yxtzhl"> </view>
<view class="title">
{{ $t("homePage.earning.monthEff") }}
@ -101,13 +116,13 @@
{{ totalData.totalConvRate | isNull }}
</view>
<view class="unit"> % </view>
</view>
</view> -->
</view>
</view>
<view class="month-power">
<Section :title="$t('homePage.home.projectMonthlyPower')" />
<view class="power-generation-detail">
<run-chart />
<run-chart :time="time" />
</view>
</view>
<view class="month-power">
@ -120,19 +135,17 @@
<view class="power-detail">
<view class="left-value">
<view class="value">
{{ totalData.totalChargePrice | isNull }}
{{ totalData.monthIncone | isNull }}
</view>
<view class="title">
{{ $t("homePage.home.enmonthTotalChargePrice") }}
{{ $t("homePage.home.monthlyIncome") }}
</view>
</view>
<view class="right-value t-fdzl"> </view>
</view>
<view
class="power-detail"
style="margin: 0 !important; padding-bottom: 0 !important"
>
<!-- <view class="power-detail"
style="margin: 0 !important; padding-bottom: 0 !important" >
<view class="left-value">
<view class="value">
{{ totalData.totalDisChargePrice | isNull }}
@ -142,22 +155,32 @@
</view>
</view>
<view class="right-value t-swdl"> </view>
</view>
</view> -->
</view>
<view class="right">
<view class="value-box">
<view class="value">
<view class="left">
<view class="power-detail">
<view class="left-value">
<view class="value">
{{ totalData.income | isNull }}
</view>
<view class="title">
{{ $t("homePage.home.totalRevenue") }}
</view>
</view>
<!-- <view class="right-value t-fdzl"> </view> -->
<view class="right-value bg"> </view>
<!-- <view class="value">
{{ totalData.income | isNull }}
</view>
<view class="title">
{{ $t("homePage.home.enearnings") }}
{{ $t("homePage.home.totalRevenue") }}
</view>
<view class="bg"> </view>
<view class="bg"> </view> -->
</view>
</view>
</view>
</view>
<view class="report-detail">
<!-- <view class="report-detail">
<Section
:title="$t('homePage.earning.earningsDetail')"
style="margin-bottom: 30rpx"
@ -224,7 +247,7 @@
{{ $t("homePage.earning.noDisChargeData") }}
</view>
</view>
</view>
</view> -->
<u-picker
v-model="TimeShow"
@ -430,7 +453,7 @@ export default {
}
.power-generation {
height: 760rpx;
height: 380rpx;
background-color: #ffffff;
box-shadow: 0px 4rpx 16rpx rgba(0, 0, 0, 0.1);
margin-left: 30rpx;
@ -643,9 +666,6 @@ export default {
.left {
width: 50%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 20rpx;
padding-top: 0rpx;
padding-bottom: 0rpx;
@ -654,9 +674,8 @@ export default {
.power-detail {
background-color: rgba(254, 131, 15, 0.05);
width: 100%;
height: 180rpx;
height: 100%;
border-radius: 8rpx;
margin-bottom: 22rpx;
display: flex;
align-items: center;
justify-content: space-between;
@ -685,6 +704,13 @@ export default {
right: 20rpx;
}
.bg {
width: 194rpx;
height: 188rpx;
background-image: url("/static/aidex/images/total-sy.png");
background-size: 100% 100%;
}
.t-fdzl {
width: 121rpx;
height: 119rpx;