光伏功能逻辑代码及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

@ -34,42 +34,29 @@
<view class="content-box">
<view class="box">
<Section :title="$t('homePage.home.stationTopo')" />
<cixi v-if="topologyType === 0" ref="tuopu" />
<kejiyuan v-else-if="topologyType === 2" ref="tuopu" />
<lingchao v-else-if="topologyType === 3" ref="tuopu" />
<jingke v-else-if="topologyType === 4" ref="tuopu" />
<weishanhu v-else-if="topologyType === 5" ref="tuopu" />
<zhongzihuanbao v-else-if="topologyType === 6" ref="tuopu" />
<sanmenxia v-else-if="topologyType === 7" ref="tuopu" />
<second v-else-if="topologyType === 8" ref="tuopu" />
<fire v-else-if="topologyType === 9" ref="tuopu" />
<runda100 v-else-if="topologyType === 10" ref="tuopu" />
<runda230 v-else-if="topologyType === 11" ref="tuopu" />
<runda215 v-else-if="topologyType === 12" ref="tuopu" />
<third v-else-if="topologyType === 13" ref="tuopu" />
<mdPviese v-else-if="topologyType === 14" ref="tuopu" />
<ceshi-t v-else-if="topologyType === 1" />
<standard v-else ref="tuopu" />
</view>
<view class="box">
<Section title="测试01" />
<view class="marginT20" >
<web-view :src="src" :fullscreen="false"></web-view>
<view v-if="componentsLoaded">
<cixi v-if="topologyType === 0" ref="tuopu" />
<kejiyuan v-else-if="topologyType === 2" ref="tuopu" />
<lingchao v-else-if="topologyType === 3" ref="tuopu" />
<jingke v-else-if="topologyType === 4" ref="tuopu" />
<weishanhu v-else-if="topologyType === 5" ref="tuopu" />
<zhongzihuanbao v-else-if="topologyType === 6" ref="tuopu" />
<sanmenxia v-else-if="topologyType === 7" ref="tuopu" />
<second v-else-if="topologyType === 8" ref="tuopu" />
<fire v-else-if="topologyType === 9" ref="tuopu" />
<runda100 v-else-if="topologyType === 10" ref="tuopu" />
<runda230 v-else-if="topologyType === 11" ref="tuopu" />
<runda215 v-else-if="topologyType === 12" ref="tuopu" />
<third v-else-if="topologyType === 13" ref="tuopu" />
<mdPviese v-else-if="topologyType === 14" ref="tuopu" />
<pv2first v-else-if="topologyType === 1 && inverterFlag === 1 && pvTopologyType === 2" ref="tuopu" />
<standard v-else ref="tuopu" />
</view>
<!-- 加载中占位可选 -->
<view v-else class="loading-tip">
<zero-loading v-if="tuopoloading"></zero-loading>
</view>
</view>
<!-- <view class="box">
<Section title="测试02" />
<view class="marginT20">
<ceshi-l />
</view>
</view>
<view class="box">
<Section title="测试03" />
当前组件有数据处理示例
<view class="marginT20">
<ceshi-s />
</view>
</view> -->
<view v-if="topologyType === 9" class="box">
<Section :title="$t('homePage.home.deviceMonitor')" />
<devicemonitoring ref="deviceFire" />
@ -85,7 +72,7 @@
<view slot="right" style="flex: 1">
<view class="top-right-box">
<view class="top-right-item" :class="{ active: activeTime === 'day' }"
@click="changeTime('day')">{{this.$t('homePage.home.sevenDay')}}
@click="changeTime('day')">{{this.$t('homePage.home.sevenDaycom')}}
</view>
<view class="top-right-item" :class="{ active: activeTime === 'month' }"
@click="changeTime('month')">{{this.$t('homePage.home.monthDay')}}
@ -100,15 +87,15 @@
</view>
<view class="box">
<Section :title="$t('homePage.home.stationData')" />
<Section :title="$t('homePage.home.stationDatacom')" />
<wshStationData v-if="topologyType === 5" />
<zzhbStationData v-else-if="topologyType === 6" />
<commonStationData v-else />
</view>
<view class="box" v-if="topologyType === 1">
<view class="box" v-if="inverterFlag === 1">
<Section :title="$t('homePage.home.pvKpi')" />
<view class="">
<my-grid imgHeight="40rpx" imgWidth="40rpx" :list="lightArr" />
<my-grid :loading="loading" :col="language !== 'zh_CN'? 2:3" imgHeight="40rpx" imgWidth="40rpx" :list="lightArr"/>
</view>
</view>
<view class="box" v-if="topologyType === 1">
@ -116,12 +103,12 @@
<environmentalControlPosition v-if="rightCenter === 'dispositionRightCenter'" />
<environmentalControl v-else />
</view>
<view class="box">
<!-- <view class="box" v-if="inverterFlag === 1">
<Section :title="$t('homePage.home.socialContribution')" />
<view class="">
<my-grid :col="3" imgHeight="72rpx" imgWidth="82rpx" :list="society" />
</view>
</view>
</view> -->
</view>
@ -138,6 +125,9 @@
import ceshiT from './components/topology/ceshiT.vue'
import ceshiL from './components/topology/ceshiL.vue'
import ceshiS from './components/topology/ceshiS.vue'
import pv2first from './components/topology/pv2first.vue'
import weishanhu from './components/topology/weishanhu.vue'
import sanmenxia from './components/topology/sanmenxia.vue'
import lingchao from './components/topology/lingchao.vue'
@ -166,6 +156,7 @@
ceshiT,
ceshiL,
ceshiS,
pv2first,
myGrid,
stationDropdow,
Section,
@ -212,6 +203,13 @@
timer: null,
tuopuTimer: null,
rightCenter: null,
componentsLoaded: false,
tuopoloading:false,
topCenterPvArr:[
{name:'pv1AndStorage_261',value:1},
{name:'pv2AndStorage_261',value:2}
],
pvTopologyType:0,
society: [{
label: this.$t('homePage.home.saveStandardCoal'),
value: '15.00',
@ -228,29 +226,14 @@
image: require('@/static/aidex/images/ll03.png'),
},
],
lightArr: [{
label: this.$t('homePage.home.totalCapacity') + '(kW)',
value: '100.00',
image: require('@/static/aidex/images/ll05.png'),
},
{
label: this.$t('homePage.home.currentPower') + '(kW)',
value: '47.00',
image: require('@/static/aidex/images/ll06.png'),
},
{
label: this.$t('homePage.home.dailyPowerGeneration') + '(kWh)',
value: '85.00',
image: require('@/static/aidex/images/ll07.png'),
showMark: true
},
{
label: this.$t('homePage.home.cumulativePowerGeneration') + '(kWh)',
value: '496.00',
image: require('@/static/aidex/images/ll07.png'),
showMark: true
},
]
panelData: {
pvCurrentPower: 0, // 对应 lightArr[0].value
dailyReleaseElec: 0, // 对应 lightArr[1].value
totalReleaseElec: 0, // 对应 lightArr[2].value
todayIncone: 0, // 对应 lightArr[3].value
totalIncome: 0, // 对应 lightArr[4].value
pvPower: 0 // 对应 lightArr[5].value
}
};
},
computed: {
@ -262,7 +245,44 @@
},
language() {
return this.vuex_language
}
},
inverterFlag(){
return this.vuex_inverterFlag;
},
lightArr() {
return [
{
label: this.$t('homePage.home.currentPower') + '(kW)',
value: this.panelData.pvCurrentPower,
image: require('@/static/aidex/images/ll06.png')
},
{
label: this.$t('homePage.home.dailyPowerGeneration') + '(kWh)',
value: this.panelData.dailyReleaseElec,
image: require('@/static/aidex/images/ll07.png')
},
{
label: this.$t('homePage.home.cumulativePowerGeneration') + '(kWh)',
value: this.panelData.totalReleaseElec,
image: require('@/static/aidex/images/ll07.png')
},
{
label: this.$t('homePage.home.todayEarning'),
value: this.panelData.todayIncone,
image: require('@/static/aidex/images/yxts.png')
},
{
label: this.$t('homePage.home.totalRevenue'),
value: this.panelData.totalIncome,
image: require('@/static/aidex/images/yxts.png')
},
{
label: this.$t('homePage.home.ratedPower'),
value: this.panelData.pvPower,
image: require('@/static/aidex/images/ll06.png')
}
];
}
},
onHide() {
if (this.timer) {
@ -274,29 +294,30 @@
},
watch: {
currentStation: {
handler(val) {
if (val && val.id) {
this.stationId = val.id
this.userId = this.userData.userId
console.log('拓扑图',val)
this.topologyType = val.topologyType
this.getComponents()
this.$nextTick(() => {
if (this.$refs.tuopu) {
this.$refs.tuopu.getData(val.id)
}
if (this.$refs.deviceFire) {
this.$refs.deviceFire.getData(this.stationId)
}
})
}
},
deep: true,
immediate: true,
},
handler(val) {
if (val && val.id) {
this.stationId = val.id
this.userId = this.userData.userId
this.topologyType = val.topologyType
// 重置加载状态,避免复用旧状态
this.componentsLoaded = false
this.tuopoloading = true
this.getComponents().then(() => {
this.GetPcsTotalData();
this.$nextTick(() => {
if (this.$refs.tuopu) {
this.$refs.tuopu.getData(val.id)
}
if (this.$refs.deviceFire) {
this.$refs.deviceFire.getData(this.stationId)
}
});
});
}
},
deep: true,
immediate: true,
}
},
created() {
@ -317,25 +338,27 @@
})
},
onShow() {
this.getComponents()
this.getMessage()
if (this.$refs.runChart && this.stationId) {
this.$refs.runChart.getData()
}
if (this.$refs.dischargeChart && this.stationId) {
this.$refs.dischargeChart.getData()
}
this.$nextTick(() => {
if (this.$refs.tuopu) {
// 重置加载状态
this.componentsLoaded = false
this.tuopoloading = true
this.getComponents().then(() => {
this.getMessage()
if (this.$refs.runChart && this.stationId) {
this.$refs.runChart.getData()
}
if (this.$refs.dischargeChart && this.stationId) {
this.$refs.dischargeChart.getData()
}
this.$nextTick(() => {
if (this.$refs.tuopu) {
this.$refs.tuopu.changeEnglish()
this.$refs.tuopu.getData(this.stationId)
}
if (this.$refs.deviceFire) {
}
if (this.$refs.deviceFire) {
this.$refs.deviceFire.getData(this.stationId)
}
})
}
})
});
this.timer = setInterval(() => {
this.getMessage()
}, 5000)
@ -352,13 +375,39 @@
},
methods: {
async GetPcsTotalData() {
let self = this;
return new Promise((resolve, reject) => {
self.$u.api.homePageData
.GetPcsTotalData({
stationId: this.stationId,
})
.then((res) => {
this.panelData = Object.assign(this.panelData, res.data);
resolve(res);
})
.catch((err) => {
reject("错误");
});
});
},
async getComponents() {
const {
data
} = await this.$u.api.homePageData.GetHomePageComponents(this.stationId)
if (data && data.length > 0) {
this.rightCenter = data[0]?.rightCenter
}
try {
const { data } = await this.$u.api.homePageData.GetHomePageComponents(this.stationId);
if (data && data.length > 0) {
this.rightCenter = data[0]?.rightCenter;
const matchedItem = this.topCenterPvArr.find(item => item.name === data[0]?.topCenter);
this.pvTopologyType = matchedItem ? matchedItem.value : this.pvTopologyType;
}
// 接口完成标记加载状态为true
this.componentsLoaded = true
this.tuopoloading = false
} catch (e) {
console.error('获取组件配置失败:', e);
// 即使接口失败,也标记完成,避免组件一直不渲染
this.componentsLoaded = true
this.tuopoloading = false
}
},
openTimer() {
@ -524,7 +573,12 @@
margin: 20rpx;
margin-top: 30rpx;
box-shadow: 0px 4rpx 16rpx rgba(0, 0, 0, 0.08);
.loading-tip {
width: 650rpx;
height: 710rpx;
position: relative;
}
.top-right-box {
display: flex;
flex-direction: row;