2025-07-29 23:05:58 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="work-container">
|
|
|
|
|
|
<!-- 站点选择列表 -->
|
2025-08-15 17:41:26 +08:00
|
|
|
|
<uni-section title="业态选择" type="line" :titleFontSize="titleFontSize" class="sections-list">
|
|
|
|
|
|
<uni-row>
|
|
|
|
|
|
<uni-col :span="10" :offset='1'>
|
|
|
|
|
|
<uni-section title="业态列表" titleFontSize="14px">
|
|
|
|
|
|
<uni-data-select :clear="false" :value="siteType" :localdata="siteTypeOptions"
|
|
|
|
|
|
@change="selectedSiteType"></uni-data-select>
|
|
|
|
|
|
</uni-section>
|
|
|
|
|
|
</uni-col>
|
|
|
|
|
|
<uni-col :span="10" :offset='2'>
|
|
|
|
|
|
<uni-section title="可选清单" titleFontSize="14px">
|
|
|
|
|
|
<uni-data-select ref="siteListSelect" :clear="false" :value="siteId"
|
|
|
|
|
|
:localdata="siteType ===1 ? siteList : []" @change="selectedSite"></uni-data-select>
|
|
|
|
|
|
</uni-section>
|
|
|
|
|
|
</uni-col>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
</uni-section>
|
|
|
|
|
|
<!-- 静态信息 -->
|
|
|
|
|
|
<uni-section title="静态信息" type="line" :titleFontSize="titleFontSize" class="sections-list">
|
|
|
|
|
|
<view class="base-lists" v-for="(item,index) in singleZdInfo" :key="index+'zdBaseInfo'">
|
|
|
|
|
|
<text class="left">{{item.title}}:</text>
|
|
|
|
|
|
<text class="right">{{baseInfo[item.attr]}}</text>
|
|
|
|
|
|
</view>
|
2025-07-29 23:05:58 +08:00
|
|
|
|
</uni-section>
|
2025-08-16 19:31:59 +08:00
|
|
|
|
<!-- 工作台 -->
|
2025-08-15 17:41:26 +08:00
|
|
|
|
<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'">
|
|
|
|
|
|
<view class="grid-item-box">
|
|
|
|
|
|
<view class="icon iconfont" :class="item.icon" size="30"></view>
|
|
|
|
|
|
<text class="text">{{item.text}}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</uni-grid-item>
|
|
|
|
|
|
</uni-grid>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</uni-section>
|
2025-08-16 19:31:59 +08:00
|
|
|
|
<!-- 一周充放曲线 uchart的组件最好放在同级-->
|
|
|
|
|
|
<uni-section title="一周充放曲线" type="line" :titleFontSize="titleFontSize" class="sections-list">
|
|
|
|
|
|
<date-range-select ref="weekChartDateRangeSelect" @updateDate="updateWeekChartDate" />
|
2025-08-15 17:41:26 +08:00
|
|
|
|
<view style="width:100%;height: 250px;">
|
2025-08-16 19:31:59 +08:00
|
|
|
|
<qiun-data-charts type="line" :chartData="weekChartData" :optsWatch='false' :inScrollView="true"
|
2025-08-16 23:15:33 +08:00
|
|
|
|
:pageScrollTop="pageScrollTop" :opts="options" :ontouch="true" />
|
2025-08-16 19:31:59 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</uni-section>
|
|
|
|
|
|
<!-- 当日功率曲线 uchart的组件最好放在同级-->
|
|
|
|
|
|
<uni-section title="当日功率曲线" type="line" :titleFontSize="titleFontSize" class="sections-list">
|
|
|
|
|
|
<date-range-select ref="activeChartDateRangeSelect" @updateDate="updateActiveChartDate" />
|
|
|
|
|
|
<view style="width:100%;height: 250px;">
|
|
|
|
|
|
<qiun-data-charts type="line" :chartData="activeChartData" :optsWatch='false' :inScrollView="true"
|
2025-08-16 23:15:33 +08:00
|
|
|
|
:pageScrollTop="pageScrollTop" :opts="options" :ontouch="true" />
|
2025-08-15 17:41:26 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</uni-section>
|
2025-07-29 23:05:58 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-08-16 19:31:59 +08:00
|
|
|
|
import DateRangeSelect from './DateRangeSelect.vue'
|
2025-07-29 23:05:58 +08:00
|
|
|
|
import {
|
2025-08-15 17:41:26 +08:00
|
|
|
|
getAllSites,
|
|
|
|
|
|
getSingleSiteBaseInfo,
|
|
|
|
|
|
getSevenChargeData,
|
2025-07-29 23:05:58 +08:00
|
|
|
|
} from '@/api/ems/site.js'
|
|
|
|
|
|
export default {
|
2025-08-15 17:41:26 +08:00
|
|
|
|
components: {
|
2025-08-16 19:31:59 +08:00
|
|
|
|
DateRangeSelect
|
2025-08-15 17:41:26 +08:00
|
|
|
|
},
|
2025-07-29 23:05:58 +08:00
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2025-08-15 17:41:26 +08:00
|
|
|
|
// 图表数据
|
2025-08-16 19:31:59 +08:00
|
|
|
|
weekChartTimeRange: [],
|
|
|
|
|
|
activeChartTimeRange: [],
|
|
|
|
|
|
weekChartData: {},
|
|
|
|
|
|
activeChartData: {},
|
2025-08-15 17:41:26 +08:00
|
|
|
|
pageScrollTop: 0,
|
|
|
|
|
|
options: {
|
|
|
|
|
|
enableScroll: true,
|
|
|
|
|
|
xAxis: {
|
|
|
|
|
|
scrollShow: true,
|
|
|
|
|
|
itemCount: 7,
|
|
|
|
|
|
disableGrid: true
|
|
|
|
|
|
},
|
|
|
|
|
|
update: true,
|
|
|
|
|
|
// duration: 2,
|
|
|
|
|
|
// animation: false,
|
|
|
|
|
|
// enableScroll: true,
|
|
|
|
|
|
// padding: [10, 15, 10, 15]
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 图表数据结束
|
|
|
|
|
|
|
|
|
|
|
|
titleFontSize: '16px',
|
|
|
|
|
|
siteType: 1,
|
|
|
|
|
|
siteTypeOptions: [{
|
|
|
|
|
|
text: '储能',
|
|
|
|
|
|
value: 1,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
text: '光能',
|
|
|
|
|
|
value: 2,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
text: '岸电',
|
|
|
|
|
|
value: 3,
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
2025-07-29 23:05:58 +08:00
|
|
|
|
siteList: [],
|
|
|
|
|
|
siteId: '', //选择的站点ID
|
2025-08-15 17:41:26 +08:00
|
|
|
|
baseInfo: {}, //站点基本信息
|
|
|
|
|
|
singleZdInfo: [{
|
|
|
|
|
|
title: "电站位置",
|
|
|
|
|
|
attr: "siteAddress",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "投运时间",
|
|
|
|
|
|
attr: "runningTime",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "装机功率(MW)",
|
|
|
|
|
|
attr: "installPower",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "装机容量(MW)",
|
|
|
|
|
|
attr: "installCapacity",
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
2025-07-29 23:05:58 +08:00
|
|
|
|
gridList: [{
|
|
|
|
|
|
page: 'bmszl',
|
2025-08-07 15:19:49 +08:00
|
|
|
|
icon: 'icon-BMS',
|
2025-07-29 23:05:58 +08:00
|
|
|
|
text: 'BMS总览',
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
page: 'bmsdcc',
|
2025-08-07 15:19:49 +08:00
|
|
|
|
icon: 'icon-a-dianchicunengliangkuai',
|
2025-07-29 23:05:58 +08:00
|
|
|
|
text: 'BMS电池簇',
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
page: 'pcs',
|
2025-08-07 15:19:49 +08:00
|
|
|
|
icon: 'icon-PCS',
|
2025-07-29 23:05:58 +08:00
|
|
|
|
text: 'PCS',
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
page: 'db',
|
2025-08-07 15:19:49 +08:00
|
|
|
|
icon: 'icon-dianbiao4',
|
2025-07-29 23:05:58 +08:00
|
|
|
|
text: '电表',
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
page: 'dtdc',
|
2025-08-07 15:19:49 +08:00
|
|
|
|
icon: 'icon-dantidianchi',
|
2025-07-29 23:05:58 +08:00
|
|
|
|
text: '单体电池',
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2025-08-16 19:31:59 +08:00
|
|
|
|
// 更新一周冲放曲线时间范围 重置图表
|
|
|
|
|
|
updateWeekChartDate(data) {
|
|
|
|
|
|
this.weekChartTimeRange = data || []
|
|
|
|
|
|
this.siteId && this.getWeekChartData()
|
|
|
|
|
|
},
|
|
|
|
|
|
// 更新当日功率曲线时间范围 重置图表
|
|
|
|
|
|
updateActiveChartDate(data) {
|
|
|
|
|
|
this.weekChartTimeRange = data || []
|
|
|
|
|
|
//todo 更新当日功率曲线 接口还没定
|
|
|
|
|
|
// this.siteId && this.getWeekChartData()
|
|
|
|
|
|
},
|
2025-07-29 23:05:58 +08:00
|
|
|
|
toDetail(e) {
|
2025-08-15 17:41:26 +08:00
|
|
|
|
if (!this.siteId) return uni.showToast({
|
|
|
|
|
|
title: "请选择清单",
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
2025-07-29 23:05:58 +08:00
|
|
|
|
const {
|
|
|
|
|
|
index
|
|
|
|
|
|
} = e.detail
|
|
|
|
|
|
this.$tab.navigateTo(`/pages/work/${this.gridList[index].page}/index?siteId=${this.siteId}`)
|
|
|
|
|
|
},
|
|
|
|
|
|
selectedSite(id) {
|
2025-08-15 17:41:26 +08:00
|
|
|
|
if (id === this.siteId) return
|
2025-07-29 23:05:58 +08:00
|
|
|
|
this.siteId = id
|
2025-08-15 17:41:26 +08:00
|
|
|
|
if (this.siteType === 1) {
|
|
|
|
|
|
this.getSiteBaseInfo()
|
|
|
|
|
|
this.getWeekChartData()
|
2025-08-16 19:31:59 +08:00
|
|
|
|
//todo 更新当日功率曲线
|
2025-08-15 17:41:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
selectedSiteType(id) {
|
|
|
|
|
|
if (id === this.siteType) return
|
|
|
|
|
|
this.siteType = id
|
|
|
|
|
|
this.siteId = ''
|
|
|
|
|
|
this.baseInfo = {}
|
2025-08-16 19:31:59 +08:00
|
|
|
|
this.weekChartData = {}
|
|
|
|
|
|
this.activeChartData = {}
|
2025-08-15 17:41:26 +08:00
|
|
|
|
},
|
|
|
|
|
|
getSiteBaseInfo() {
|
|
|
|
|
|
getSingleSiteBaseInfo({
|
|
|
|
|
|
siteId: this.siteId
|
|
|
|
|
|
}).then(response => {
|
|
|
|
|
|
console.log('获取站点基本信息', response)
|
|
|
|
|
|
this.baseInfo = response?.data || {}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
getSiteList() {
|
|
|
|
|
|
getAllSites().then(response => {
|
|
|
|
|
|
const data = response?.data || []
|
|
|
|
|
|
this.siteList = data.map(item => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
text: item.siteName,
|
|
|
|
|
|
value: item.siteId,
|
|
|
|
|
|
id: item.id
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
// 设置默认展示的站点
|
|
|
|
|
|
if (data.length > 0) {
|
|
|
|
|
|
this.siteId = data[0].siteId
|
|
|
|
|
|
this.getSiteBaseInfo()
|
|
|
|
|
|
this.getWeekChartData()
|
2025-08-16 19:31:59 +08:00
|
|
|
|
//todo 更新当日功率曲线
|
2025-08-15 17:41:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
getWeekChartData() {
|
2025-08-16 19:31:59 +08:00
|
|
|
|
this.$refs.weekChartDateRangeSelect.showBtnLoading(true)
|
2025-08-15 17:41:26 +08:00
|
|
|
|
getSevenChargeData({
|
|
|
|
|
|
siteId: this.siteId,
|
2025-08-16 19:31:59 +08:00
|
|
|
|
startDate: this.weekChartTimeRange[0],
|
|
|
|
|
|
endDate: this.weekChartTimeRange[1]
|
2025-08-15 17:41:26 +08:00
|
|
|
|
}).then(response => {
|
|
|
|
|
|
console.log('一周功率曲线', response)
|
|
|
|
|
|
let data = response?.data || [],
|
|
|
|
|
|
categories = [],
|
|
|
|
|
|
chargedCap = [],
|
|
|
|
|
|
disChargedCap = []
|
|
|
|
|
|
data.forEach(item => {
|
|
|
|
|
|
categories.push(item.ammeterDate || undefined)
|
|
|
|
|
|
chargedCap.push(item.chargedCap || undefined)
|
|
|
|
|
|
disChargedCap.push(item.disChargedCap || undefined)
|
|
|
|
|
|
})
|
2025-08-16 19:31:59 +08:00
|
|
|
|
this.weekChartData = JSON.parse(JSON.stringify({
|
2025-08-15 17:41:26 +08:00
|
|
|
|
categories,
|
|
|
|
|
|
series: [{
|
|
|
|
|
|
"name": '充电量',
|
|
|
|
|
|
"data": chargedCap
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": '放电量',
|
|
|
|
|
|
"data": disChargedCap
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}))
|
2025-08-16 19:31:59 +08:00
|
|
|
|
}).finally(() => this.$refs.weekChartDateRangeSelect.showBtnLoading(false))
|
2025-07-29 23:05:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// 页面切换不会重新调用,如果希望每次切换页面都重新调接口,使用onShow
|
|
|
|
|
|
mounted() {
|
2025-08-16 19:31:59 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.$refs.weekChartDateRangeSelect.init()
|
|
|
|
|
|
this.$refs.activeChartDateRangeSelect.init()
|
|
|
|
|
|
if (this.siteType === 1) {
|
|
|
|
|
|
this.getSiteList()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2025-08-15 17:41:26 +08:00
|
|
|
|
},
|
2025-08-16 19:31:59 +08:00
|
|
|
|
// 页面滚动 设置pageScrollTop chart显示需要
|
2025-08-15 17:41:26 +08:00
|
|
|
|
onPageScroll(e) {
|
|
|
|
|
|
this.pageScrollTop = e.scrollTop
|
|
|
|
|
|
},
|
2025-07-29 23:05:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
/* #ifndef APP-NVUE */
|
|
|
|
|
|
page {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
min-height: 100%;
|
|
|
|
|
|
height: auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
view {
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
line-height: inherit;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* #endif */
|
|
|
|
|
|
|
|
|
|
|
|
.text {
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
|
margin-top: 10rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-15 17:41:26 +08:00
|
|
|
|
.sections-list:not(:first-child) {
|
|
|
|
|
|
margin-top: 40rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-29 23:05:58 +08:00
|
|
|
|
.grid-item-box {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
/* #ifndef APP-NVUE */
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
/* #endif */
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
2025-08-15 17:41:26 +08:00
|
|
|
|
padding: 30rpx 0;
|
2025-07-29 23:05:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-07 15:19:49 +08:00
|
|
|
|
.icon {
|
2025-08-15 17:41:26 +08:00
|
|
|
|
font-size: 52rpx;
|
2025-08-16 19:31:59 +08:00
|
|
|
|
color: #3a98ff;
|
2025-08-07 15:19:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-15 17:41:26 +08:00
|
|
|
|
.base-lists {
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
line-height: 40rpx;
|
|
|
|
|
|
padding: 10rpx 20rpx;
|
|
|
|
|
|
padding-left: 40rpx;
|
|
|
|
|
|
|
|
|
|
|
|
.left {
|
|
|
|
|
|
width: 220rpx;
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.right {
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-29 23:05:58 +08:00
|
|
|
|
|
|
|
|
|
|
@media screen and (min-width: 500px) {}
|
|
|
|
|
|
</style>
|