光伏功能逻辑代码及BUG修改
This commit is contained in:
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user