This commit is contained in:
白菜
2025-10-15 18:16:56 +08:00
parent a8c79eef72
commit 6149cba24e
8 changed files with 430 additions and 189 deletions

View File

@ -28,7 +28,7 @@
<uni-section title="工作台" type="line" :titleFontSize="titleFontSize" class="sections-list">
<view class="grid-body">
<uni-grid :column="4" :showBorder="false" @change="toDetail">
<uni-grid-item v-for="(item,index) in gridList" :index="index" :key="index+'work'">
<uni-grid-item v-for="(item,index) in siteGirdList" :index="index" :key="index+'work'">
<view class="grid-item-box">
<view class="icon iconfont" :class="item.icon" size="30"></view>
<text class="text">{{item.text}}</text>
@ -50,7 +50,7 @@
<date-range-select ref="activeChartDateRangeSelect" @updateDate="updateActiveChartDate" />
<view style="width:100%;height: 250px;">
<qiun-data-charts type="line" :chartData="activeChartData" :optsWatch='false' :inScrollView="true"
:pageScrollTop="pageScrollTop" :opts="options" :ontouch="true" />
:pageScrollTop="pageScrollTop" :opts="glqxOptions" :ontouch="true" />
</view>
</uni-section>
</view>
@ -62,6 +62,8 @@
getAllSites,
getSingleSiteBaseInfo,
getSevenChargeData,
getPointData,
getSiteAllDeviceCategory
} from '@/api/ems/site.js'
export default {
components: {
@ -75,6 +77,20 @@
weekChartData: {},
activeChartData: {},
pageScrollTop: 0,
glqxOptions: {
dataLabel: false,
enableScroll: true,
xAxis: {
scrollShow: true,
itemCount: 3,
disableGrid: true
},
// update: true,
// duration: 2,
// animation: false,
// enableScroll: true,
// padding: [10, 15, 10, 15]
},
options: {
dataLabel: false,
enableScroll: true,
@ -89,9 +105,8 @@
// enableScroll: true,
// padding: [10, 15, 10, 15]
},
// 图表数据结束
deviceCategoryOptions: [], //当前站点包含的设备类别
titleFontSize: '16px',
siteType: 1,
siteTypeOptions: [{
@ -131,30 +146,40 @@
page: 'bmszl',
icon: 'icon-BMS',
text: 'BMS总览',
categoryName: 'STACK'
},
{
page: 'bmsdcc',
icon: 'icon-a-dianchicunengliangkuai',
text: 'BMS电池簇',
categoryName: 'CLUSTER'
},
{
page: 'pcs',
icon: 'icon-PCS',
text: 'PCS',
categoryName: 'PCS'
},
{
page: 'db',
icon: 'icon-dianbiao4',
text: '电表',
categoryName: 'AMMETER'
},
{
page: 'dtdc',
icon: 'icon-dantidianchi',
text: '单体电池',
categoryName: 'BATTERY'
}
]
}
},
computed: {
siteGirdList() {
return this.gridList.filter(i => this.deviceCategoryOptions.includes(i.categoryName))
}
},
methods: {
// 更新一周冲放曲线时间范围 重置图表
updateWeekChartDate(data) {
@ -163,9 +188,8 @@
},
// 更新当日功率曲线时间范围 重置图表
updateActiveChartDate(data) {
this.weekChartTimeRange = data || []
//todo 更新当日功率曲线 接口还没定
// this.siteId && this.getWeekChartData()
this.activeChartTimeRange = data || []
this.siteId && this.getGVQXData()
},
toDetail(e) {
if (!this.siteId) return uni.showToast({
@ -181,11 +205,16 @@
if (id === this.siteId) return
this.siteId = id
if (this.siteType === 1) {
this.getSiteBaseInfo()
this.getWeekChartData()
//todo 更新当日功率曲线
this.updateSiteInfo()
}
},
updateSiteInfo() {
if (!this.siteId) return
this.getSiteBaseInfo()
this.getWeekChartData()
this.getGVQXData()
this.getSiteDeviceCategory()
},
selectedSiteType(id) {
if (id === this.siteType) return
this.siteType = id
@ -194,14 +223,6 @@
this.weekChartData = {}
this.activeChartData = {}
},
getSiteBaseInfo() {
getSingleSiteBaseInfo({
siteId: this.siteId
}).then(response => {
console.log('获取站点基本信息', response)
this.baseInfo = response?.data || {}
})
},
getSiteList() {
getAllSites().then(response => {
const data = response?.data || []
@ -215,12 +236,25 @@
// 设置默认展示的站点
if (data.length > 0) {
this.siteId = data[0].siteId
this.getSiteBaseInfo()
this.getWeekChartData()
//todo 更新当日功率曲线
this.updateSiteInfo()
}
})
},
getSiteBaseInfo() {
getSingleSiteBaseInfo({
siteId: this.siteId
}).then(response => {
console.log('获取站点基本信息', response)
this.baseInfo = response?.data || {}
})
},
getSiteDeviceCategory() {
getSiteAllDeviceCategory({
siteId: this.siteId
}).then(response => {
this.deviceCategoryOptions = response?.data || []
})
},
handleDate(date) {
if (!date) return date
const time = new Date(date)
@ -228,6 +262,64 @@
day = time.getDate()
return `${month<10?'0'+month : month}/${day<10 ? '0'+day : day}`
},
getGVQXData() {
this.$refs.activeChartDateRangeSelect.showBtnLoading(true)
getPointData({
siteId: this.siteId,
startDate: this.activeChartTimeRange[0],
endDate: this.activeChartTimeRange[1]
}).then(response => {
console.log('当日功率曲线', response)
let data = response?.data || [],
categories = [],
source = [{
name: '电网功率',
attr: 'gridPower',
data: []
},
{
name: '负载功率',
attr: 'loadPower',
data: []
},
{
name: '储能功率',
attr: 'storagePower',
data: []
},
{
name: '光伏功率',
attr: 'pvPower',
data: []
},
{
name: 'soc平均值',
attr: 'avgSoc',
data: []
},
{
name: 'soh平均值',
attr: 'avgSoh',
data: []
},
{
name: '电池平均温度平均值平均值',
attr: 'avgTemp',
data: []
},
]
data.forEach((item) => {
categories.push(item.statisDate || undefined)
source.forEach(i => i.data.push(item[i.attr]))
})
this.activeChartData = JSON.parse(JSON.stringify({
categories,
series: source
}))
}).finally(() => this.$refs.activeChartDateRangeSelect.showBtnLoading(false))
},
getWeekChartData() {
this.$refs.weekChartDateRangeSelect.showBtnLoading(true)
getSevenChargeData({
@ -264,7 +356,7 @@
mounted() {
this.$nextTick(() => {
this.$refs.weekChartDateRangeSelect.init()
this.$refs.activeChartDateRangeSelect.init()
this.$refs.activeChartDateRangeSelect.init(true)
if (this.siteType === 1) {
this.getSiteList()
}