Compare commits

...

29 Commits

Author SHA1 Message Date
ac7dd9dd30 重构 2026-04-01 14:28:09 +08:00
69e199e9cc 重构 2026-03-05 16:34:25 +08:00
13ee9e66cc 修改首页地图 2026-02-08 21:51:10 +08:00
fb33e5a1f6 修改首页 2026-02-08 17:26:51 +08:00
3676313439 电池簇、电池堆设备工作状态更新 2026-01-25 16:55:22 +08:00
e1eec995ca 电池簇数据同步 2026-01-23 22:33:18 +08:00
b493e331c6 电表数据同步 2026-01-23 21:46:21 +08:00
b8898311ae pcs、bmszl 设备状态枚举workStatus更新 2026-01-23 20:28:39 +08:00
5c78cbf39f 工作台跳转问题 2026-01-21 16:53:05 +08:00
b24d930f4f 所属站点 2026-01-21 16:13:13 +08:00
feaeb0c7d7 logo有背景 2026-01-21 10:23:03 +08:00
3a034b48f1 优化 2026-01-21 10:22:50 +08:00
648f031ebe 优化 2026-01-19 17:30:03 +08:00
de403e861d 优化 2026-01-16 17:54:42 +08:00
2f1e29dccd 样式优化 2026-01-15 17:51:09 +08:00
b558282529 部分样式更新 2026-01-09 19:10:32 +08:00
5e4636fd7d 枚举更新 2026-01-08 17:46:03 +08:00
26a8114840 新增生产环境baseUrl在打包项目时注意切换 2025-11-12 14:13:31 +08:00
e7bc43008f 设备状态枚举更新 2025-11-01 13:04:26 +08:00
6149cba24e pc同步 2025-10-15 18:16:56 +08:00
a8c79eef72 工单状态更新 2025-10-14 18:02:01 +08:00
fb8c8aab28 一周功率曲线横坐标展示更新 2025-09-04 16:10:44 +08:00
74b22a2ec6 图表 2025-08-17 01:13:04 +08:00
5ea121abf0 时间选择范围问题修复 2025-08-16 23:15:33 +08:00
ffefc21d96 工作台 2025-08-16 19:31:59 +08:00
76065f7287 工作台 2025-08-15 17:41:26 +08:00
84e84fca10 图标更新、我的页面更新 2025-08-07 15:19:49 +08:00
ce189108ed 单体电池 2025-08-05 17:44:20 +08:00
bc18edead5 首页滚动、单体电池滚动 2025-08-05 17:26:18 +08:00
55 changed files with 10392 additions and 7663 deletions

View File

@ -33,6 +33,14 @@ export function getAmmeterDataList(data) {
}) })
} }
//获取所有设备
export function getDeviceList(siteId) {
return request({
url: `/ems/siteConfig/getDeviceList?siteId=${siteId}`,
method: 'get'
})
}
//获取pcs头部的设备信息 //获取pcs头部的设备信息
export function getRunningHeadInfo(data) { export function getRunningHeadInfo(data) {
return request({ return request({
@ -50,40 +58,112 @@ export function getPcsDetailInfo(data) {
}) })
} }
//获取单体电池 电池堆列表数据 //获取pcs名称列表
export function getStackNameList(data) { export function getPcsNameList(siteId) {
return request({ return request({
url: `/ems/siteMonitor/getStackNameList`, //?siteId=${siteId} url: `/ems/siteMonitor/getPcsNameList?siteId=${siteId}`,
method: 'get', method: 'get'
data })
}
//获取单体电池 电池堆列表数据
export function getStackNameList(siteId) {
return request({
url: `/ems/siteMonitor/getStackNameList?siteId=${siteId}`,
method: 'get'
}) })
} }
//获取单体电池 电池簇列表数据 //获取单体电池 电池簇列表数据
export function getClusterNameList(data) { export function getClusterNameList({ stackDeviceId, siteId }) {
return request({ return request({
url: `/ems/siteMonitor/getClusterNameList`, //?stackDeviceId=${stackDeviceId}&siteId=${siteId} url: `/ems/siteMonitor/getClusterNameList?stackDeviceId=${stackDeviceId}&siteId=${siteId}`,
method: 'get', method: 'get'
data
}) })
} }
//单体电池表格数据 //单体电池表格数据
export function getClusterDataInfoList(data) { export function getClusterDataInfoList({ siteId, stackDeviceId, clusterDeviceId, batteryId, pageSize, pageNum }) {
return request({ return request({
url: `/ems/siteMonitor/getClusterDataInfoList?`, //clusterDeviceId=${clusterDeviceId}&siteId=${siteId}&stackDeviceId=${stackDeviceId}&pageSize=${pageSize}&pageNum=${pageNum} url: `/ems/siteMonitor/getClusterDataInfoList?clusterDeviceId=${clusterDeviceId}&siteId=${siteId}&stackDeviceId=${stackDeviceId}&batteryId=${batteryId}&pageSize=${pageSize}&pageNum=${pageNum}`,
method: 'get', method: 'get'
data
}) })
} }
// 单体电池图表 // 单体电池图表
export function getSingleBatteryData({ export function getSingleBatteryData({ siteId, deviceId, clusterDeviceId, startDate, endDate }) {
siteId,
deviceId,
clusterDeviceId,
startDate,
endDate
}) {
return request({ return request({
url: `/ems/siteMonitor/getSingleBatteryData?siteId=${siteId}&deviceId=${deviceId}&startDate=${startDate}&endDate=${endDate}&clusterDeviceId=${clusterDeviceId}`, url: `/ems/siteMonitor/getSingleBatteryData?siteId=${siteId}&deviceId=${deviceId}&startDate=${startDate}&endDate=${endDate}&clusterDeviceId=${clusterDeviceId}`,
method: 'get' method: 'get'
}) })
} }
//获取单个站点的基本信息
export function getSingleSiteBaseInfo(data) {
return request({
url: `/ems/siteMap/getSingleSiteBaseInfo`, //?siteId=${siteId}`,
method: 'get',
data
})
}
//单站监控 首页 总累计运行数据(基于日表)
export function getDzjkHomeTotalView(siteId) {
return request({
url: `/ems/siteMonitor/homeTotalView?siteId=${siteId}`,
method: 'get'
})
}
// 单站监控项目展示数据(字段配置 + 最新值)
export function getProjectDisplayData(siteId) {
return request({
url: `/ems/siteMonitor/getProjectDisplayData?siteId=${siteId}`,
method: 'get'
})
}
// 电价报表(收益数据)
export function getAmmeterRevenueData(params) {
return request({
url: `/ems/statsReport/getAmmeterRevenueData`,
method: 'get',
params
})
}
// 一周冲放曲线
export function getSevenChargeData(data) {
return request({
url: `/ems/siteMap/getSevenChargeData`, //?siteId=${siteId}&startDate=${startDate}&endDate=${endDate}`,
method: 'get',
data
})
}
//单站监控 首页 当日功率曲线
export function getPointData(data) {
return request({
url: `/ems/siteMonitor/getPointData`,
method: 'get',
data
})
}
// 点位配置-曲线数据(与管理端一致)
export function getPointConfigCurve(data) {
return request({
url: `/ems/pointConfig/curve`,
method: 'post',
data,
headers: {
repeatSubmit: false
}
})
}
// 获取站点包含的设备种类 用来判断单站监控设备监控的菜单栏展示
export function getSiteAllDeviceCategory(data) {
return request({
url: `/ems/siteConfig/getSiteAllDeviceCategory`,
method: 'get',
data
})
}

View File

@ -0,0 +1,69 @@
<template>
<view class="ems-site-selector">
<uni-data-picker placeholder="请选择" popup-title="业态选择" :step-searh="true" :value="siteId" :clear-icon="false"
:localdata="siteTypeOptions" :ellipsis="false" @change="handleChange">
</uni-data-picker>
</view>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
computed: {
...mapGetters(['siteId', 'siteTypeOptions'])
},
methods: {
handleChange(data) {
const valueList = data?.detail?.value || []
const siteObj = valueList[1]
if (!siteObj || siteObj.value === undefined || siteObj.value === null || siteObj.value === this.siteId) return
this.$store.dispatch('SetCurrentSiteId', siteObj.value)
this.$emit('change', siteObj.value)
}
},
created() {
this.$store.dispatch('LoadSites')
}
}
</script>
<style lang="scss" scoped>
.ems-site-selector {
.uni-data-tree {
::v-deep {
.input-value {
border: none;
padding-left: 0;
.selected-area {
width: 90%;
flex: none;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.selected-list {
color: #fff;
}
}
.text-color {
color: #fff;
font-size: 34rpx;
line-height: 36rpx;
font-weight: bolder;
}
.arrow-area {
transform: rotate(-135deg);
.input-arrow {
border-color: #fff;
}
}
}
}
}
}
</style>

View File

@ -0,0 +1,128 @@
<template>
<view class="site-switch-header">
<uni-data-picker
placeholder="请选择"
popup-title="业态选择"
:step-searh="true"
:value="siteId"
:clear-icon="false"
:localdata="siteTypeOptions"
:ellipsis="false"
@change="handleChange"
/>
<view class="info">
<view class="list">
<uni-icons type="location" color="#fff" size="20"></uni-icons>
{{ siteAddress || '-' }}
</view>
<view class="list">
<uni-icons type="calendar" color="#fff" size="20"></uni-icons>
{{ runningTime || '-' }}
</view>
</view>
</view>
</template>
<script>
export default {
props: {
siteId: {
type: [String, Number],
default: ''
},
siteTypeOptions: {
type: Array,
default: () => []
},
siteAddress: {
type: String,
default: '-'
},
runningTime: {
type: String,
default: '-'
}
},
methods: {
handleChange(data) {
this.$emit('change', data)
}
}
}
</script>
<style lang="scss" scoped>
.site-switch-header {
background: linear-gradient(to right, #547ef4, #679ff5);
padding: 30rpx 30rpx;
padding-bottom: 100rpx;
color: #fff;
.info {
color: #fff;
font-size: 26rpx;
line-height: 30rpx;
vertical-align: middle;
margin-top: 20rpx;
>.list {
display: flex;
justify-content: flex-start;
align-items: center;
&:not(:last-child) {
margin-bottom: 20rpx;
}
>.uni-icons {
margin-right: 10rpx;
}
}
}
.uni-data-tree {
::v-deep {
.uni-data-tree-dialog {
color: #333;
.selected-item,
.dialog-title {
color: #333;
}
}
.input-value {
border: none;
padding-left: 0;
.selected-area {
width: 90%;
flex: none;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.selected-list {
color: #fff;
}
}
.text-color {
color: #fff;
font-size: 34rpx;
line-height: 36rpx;
font-weight: bolder;
}
.arrow-area {
transform: rotate(-135deg);
.input-arrow {
border-color: #fff;
}
}
}
}
}
}
</style>

View File

@ -1,15 +1,19 @@
// 应用全局配置 // 应用全局配置
module.exports = { module.exports = {
baseUrl: 'http://110.40.171.179:8089', // todo 打包项目时切换baseUrl
// baseUrl: 'http://localhost:8089', // baseUrl: 'http://localhost:8089',
// 测试环境
baseUrl: 'http://110.40.171.179:8089',
// 生产环境
// baseUrl: 'http://1.15.120.242:8089',
// 应用信息 // 应用信息
appInfo: { appInfo: {
// 应用名称 // 应用名称
name: "xzzn-app", name: "上动EMS",
// 应用版本 // 应用版本
version: "1.2.0", version: "1.2.0",
// 应用logo // 应用logo
logo: "/static/logo.png", logo: "/static/logo-trans.png",
// 官方网站 // 官方网站
site_url: "http://xzzn.vip", site_url: "http://xzzn.vip",
// 政策协议 // 政策协议

1
data/ems/china.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name" : "EMS移动端", "name" : "上动EMS",
"appid" : "__UNI__B330617", "appid" : "__UNI__5FBB073",
"description" : "", "description" : "",
"versionName" : "1.2.0", "versionName" : "1.2.0",
"versionCode" : "100", "versionCode" : "100",
@ -8,6 +8,12 @@
"app-plus" : { "app-plus" : {
"usingComponents" : true, "usingComponents" : true,
"nvueCompiler" : "uni-app", "nvueCompiler" : "uni-app",
"safearea" : {
"background" : "#FFFFFF",
"top" : {
"offset" : "auto"
}
},
"splashscreen" : { "splashscreen" : {
"alwaysShowBeforeRender" : true, "alwaysShowBeforeRender" : true,
"waiting" : true, "waiting" : true,
@ -35,8 +41,24 @@
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
] ]
}, },
"ios" : {}, "ios" : {
"sdkConfigs" : {} "dSYMs" : false
},
"sdkConfigs" : {},
"icons" : {
"android" : {
"hdpi" : "static/logo.png",
"xhdpi" : "static/logo.png",
"xxhdpi" : "static/logo.png",
"xxxhdpi" : "static/logo.png"
},
"ios" : {
"appstore" : ""
}
},
"splashscreen" : {
"androidStyle" : "common"
}
} }
}, },
"quickapp" : {}, "quickapp" : {},
@ -60,10 +82,12 @@
"port" : 9090, "port" : 9090,
"https" : false "https" : false
}, },
"title" : "EMS-App", "title" : "上动EMS",
"router" : { "router" : {
"mode" : "hash", "mode" : "hash",
"base" : "./" "base" : "./"
} }
} },
"locale" : "zh-Hans",
"fallbackLocale" : "zh-Hans"
} }

View File

@ -12,8 +12,7 @@
}, { }, {
"path": "pages/index", "path": "pages/index",
"style": { "style": {
"navigationBarTitleText": "移动端框架", "navigationBarTitleText": "首页"
"navigationStyle": "custom"
} }
}, { }, {
"path": "pages/work/index", "path": "pages/work/index",
@ -71,6 +70,14 @@
"navigationBarTitleText": "浏览文本" "navigationBarTitleText": "浏览文本"
} }
}, },
{
"path": "pages/ticket/list",
"style": {
"navigationBarTitleText": "工单列表",
"navigationStyle": "custom",
"onReachBottomDistance": 100
}
},
{ {
"path": "pages/ticket/index", "path": "pages/ticket/index",
"style": { "style": {
@ -101,6 +108,12 @@
"navigationBarTitleText": "PCS" "navigationBarTitleText": "PCS"
} }
}, },
{
"path": "pages/work/yl/index",
"style": {
"navigationBarTitleText": "冷却"
}
},
{ {
"path": "pages/work/dtdc/index", "path": "pages/work/dtdc/index",
"style": { "style": {
@ -125,6 +138,11 @@
"iconPath": "static/images/tabbar/work.png", "iconPath": "static/images/tabbar/work.png",
"selectedIconPath": "static/images/tabbar/work_.png", "selectedIconPath": "static/images/tabbar/work_.png",
"text": "工作台" "text": "工作台"
}, {
"pagePath": "pages/ticket/list",
"iconPath": "static/images/tabbar/ticket.png",
"selectedIconPath": "static/images/tabbar/ticket_.png",
"text": "工单"
}, { }, {
"pagePath": "pages/mine/index", "pagePath": "pages/mine/index",
"iconPath": "static/images/tabbar/mine.png", "iconPath": "static/images/tabbar/mine.png",

View File

@ -1,184 +1,509 @@
<template> <template>
<view class="container"> <view class="home-container">
<view class="btn-list"> <site-switch-header :site-id="siteId" :site-type-options="siteTypeOptions" :site-address="baseInfo.siteAddress"
<uni-row> :running-time="baseInfo.runningTime" @change="selectedSite" />
<uni-col :span="12">
<button type="default" class="btns" :class="{'active-btn' : active === 'undone'}" <view class="base-info">
@click="changeTab('undone')">未处理</button> <view class="map-card">
</uni-col> <image v-if="mapUrl" class="site-map" :src="mapUrl" mode="aspectFill"></image>
<uni-col :span="12"> <view v-else class="map-empty">暂无站点位置</view>
<button type="default" class="btns" :class="{'active-btn' : active === 'done'}"
@click="changeTab('done')">已处理</button>
</uni-col>
</uni-row>
</view> </view>
<scroll-view class="scroll-y" :scroll-y="true" @scrolltolower="lower" scrolltoupper="upper"> <view class="total-card">
<view class="content"> <view class="total-header">
<view class="item-list" v-for="item in list" :key="item.ticketNo+'ticket'" @click="toDetail(item.id)"> <view class="title">总累计运行数据</view>
<view class="item-title" :class="item.status === 1 ? 'done' : 'undone'">工单号{{item.ticketNo}}</view> <view class="total-revenue">
<view class="item-content"> <text class="label">总收入</text>
<view class="item-info">工单标题:{{item.title}}</view> <text class="value">{{ format2(totalRevenueDisplayValue) }}</text>
<view class="item-info">问题描述:{{item.content}}</view> <text class="unit"></text>
<view class="item-info">工单状态:{{ticketStatusOptions[item.status]}}</view>
<view class="item-info">预期完成时间:{{item.expectedCompleteTime || '-'}}</view>
<view class="item-info">处理人:{{item.workName || '-'}}</view>
</view> </view>
</view> </view>
<view v-if="list.length===0" class="no-data">暂无数据</view> <uni-grid :column="2" :showBorder="false" :square="false" :highlight="false">
<uni-grid-item v-for="(item, index) in runningDataCards" :key="index + 'sjglData'">
<view class="grid-item-box">
<view class="title">{{ item.title }}</view>
<view class="text" :style="{ color: item.color }">
{{ format2(item.value) }}
</view>
</view>
</uni-grid-item>
</uni-grid>
</view>
<uni-section title="收入曲线" type="line" class="sections-list">
<view style="width:100%;height: 220px;">
<qiun-data-charts type="column" :chartData="revenueChartData" :optsWatch='true'
:inScrollView="true" :pageScrollTop="pageScrollTop" :opts="revenueOptions" :ontouch="true" />
</view>
</uni-section>
</view> </view>
</scroll-view>
</view> </view>
</template> </template>
<script> <script>
import { import {
mapState mapGetters
} from 'vuex' } from 'vuex'
import { import {
listTicket formatDate
} from 'api/ems/ticket' } from '@/utils/filters'
import {
getAllSites,
getSingleSiteBaseInfo,
getDzjkHomeTotalView,
getProjectDisplayData,
getAmmeterRevenueData
} from '@/api/ems/site.js'
import SiteSwitchHeader from '@/components/SiteSwitchHeader/index.vue'
const createSiteTypeOptions = () => ([{
text: '储能',
value: 'cn',
children: []
},
{
text: '光能',
value: 'gn',
children: []
},
{
text: '岸电',
value: 'ad',
children: []
}
])
export default { export default {
computed: { components: {
...mapState({ SiteSwitchHeader
ticketStatusOptions: (state) => state.ems.ticketStatusOptions
})
}, },
data() { data() {
return { return {
active: 'undone', pageScrollTop: 0,
total: 0, siteOptions: [],
list: [], siteTypeOptions: createSiteTypeOptions(),
pageNum: 1, siteId: '',
pageSize: 10 mapUrl: '',
baseInfo: {},
runningInfo: {},
runningDisplayData: [],
revenueChartData: {},
revenueOptions: {
padding: [10, 5, 0, 10],
dataLabel: false,
enableScroll: false,
xAxis: {
scrollShow: false,
itemCount: 5,
disableGrid: true
},
yAxis: {
disabled: false,
splitNumber: 4
},
extra: {}
},
fallbackSjglData: [{
title: "今日充电量kWh",
attr: "dayChargedCap",
color: '#4472c4'
},
{
title: "今日放电量kWh",
attr: "dayDisChargedCap",
color: '#70ad47'
},
{
title: "总充电量kWh",
attr: "totalChargedCap",
color: '#4472c4'
},
{
title: "今日实时收入(元)",
attr: "dayRevenue",
color: '#f67438'
},
{
title: "昨日充电量kWh",
attr: "yesterdayChargedCap",
color: '#4472c4'
},
{
title: "昨日放电量kWh",
attr: "yesterdayDisChargedCap",
color: '#70ad47'
},
{
title: "总放电量kWh",
attr: "totalDischargedCap",
color: '#70ad47'
},
{
title: "昨日实时收入(元)",
attr: "yesterdayRevenue",
color: '#f67438'
}
]
}
},
computed: {
...mapGetters(['belongSite', 'currentSiteId']),
totalRunningSectionData() {
return (this.runningDisplayData || []).filter(item => item.sectionName === '总累计运行数据')
},
totalRevenueDisplayItem() {
const sectionData = this.totalRunningSectionData || []
const byFieldCode = sectionData.find(item => item.fieldCode === 'totalRevenue')
if (byFieldCode) {
return byFieldCode
}
return sectionData.find(item => item.fieldName === '总收入')
},
totalRevenueDisplayValue() {
return this.totalRevenueDisplayItem ? this.totalRevenueDisplayItem.fieldValue : this.runningInfo.totalRevenue
},
runningDataCards() {
const sectionData = this.totalRunningSectionData || []
if (sectionData.length > 0) {
const revenueFieldCode = this.totalRevenueDisplayItem ? this.totalRevenueDisplayItem.fieldCode : ''
return sectionData
.filter(item => item.fieldCode !== revenueFieldCode)
.map((item, index) => ({
title: item.fieldName,
value: item.fieldValue,
color: this.getCardColor(index)
}))
}
return this.fallbackSjglData.map(item => ({
title: item.title,
value: this.runningInfo[item.attr],
color: item.color
}))
} }
}, },
methods: { methods: {
changeTab(active) { isAvailableSite(siteId) {
if (active === this.active) return const site = this.siteOptions.find(item => item.value === siteId)
this.active = active return !!(site && !site.disable)
this.reset()
this.init()
}, },
lower() { getCardColor(index) {
if (this.list.length >= this.total) { const colors = ['#4472c4', '#70ad47', '#4472c4', '#f67438', '#4472c4', '#70ad47', '#70ad47', '#f67438']
return console.log('数据已经加载完成') return colors[index % colors.length]
},
format2(value) {
const num = Number(value || 0)
return Number.isFinite(num) ? num.toFixed(2) : '0.00'
},
getLastDaysRange(days = 7) {
const end = new Date()
const start = new Date(end.getTime() - (days - 1) * 24 * 60 * 60 * 1000)
return [formatDate(start), formatDate(end)]
},
buildDateList(start, end) {
const list = []
const startTime = new Date(start).getTime()
const endTime = new Date(end).getTime()
const dayMs = 24 * 60 * 60 * 1000
for (let t = startTime; t <= endTime; t += dayMs) {
list.push(formatDate(t))
} }
this.pageNum += 1; return list
this.init().catch(() => { },
this.pageNum -= 1 selectedSite(data) {
const siteObj = (data.detail.value || [])[1]
const value = siteObj?.value
if (!value) return
if (value === this.siteId) return
this.siteId = value
this.$store.commit('SET_CURRENTSITEID', value)
this.updateSiteInfo()
},
updateSiteInfo() {
if (!this.siteId) {
this.baseInfo = {}
this.runningInfo = {}
this.runningDisplayData = []
this.revenueChartData = {}
this.mapUrl = ''
return
}
this.updateMapCenter()
this.getSiteBaseInfo()
this.getRunningInfo()
this.getRevenueChartData()
},
getSiteBaseInfo() {
return getSingleSiteBaseInfo({
siteId: this.siteId
}).then(response => {
this.baseInfo = response?.data || {}
}) })
}, },
init() { getSiteList() {
//0:'待处理', 1:'已处理', 2:'处理中' getAllSites().then(response => {
let url = `/ticket/list?pageNum=${this.pageNum}&pageSize=${this.pageSize}` const data = response?.data || []
if (this.active === 'done') { const canAccessAll = !this.belongSite || this.belongSite.length === 0 || this.belongSite.includes('all')
url += `&status=1` const siteTypeOptions = createSiteTypeOptions().map(item => ({
} else { ...item,
url += `&status=0&status=2` children: []
}))
data.forEach(item => {
if (!canAccessAll && !this.belongSite.includes(item.siteId)) return
const siteType = (item.siteType || item.type || 'cn').toString().toLowerCase()
const typeOption = siteTypeOptions.find(i => i.value === siteType) || siteTypeOptions.find(i => i.value === 'cn')
if (!typeOption) return
typeOption.children.push({
text: item.siteName,
value: item.siteId,
id: item.id,
longitude: Number(item.longitude || 0),
latitude: Number(item.latitude || 0)
})
})
this.siteTypeOptions = siteTypeOptions.filter(item => (item.children || []).length > 0)
this.siteOptions = this.siteTypeOptions.reduce((result, typeItem) => {
return result.concat(typeItem.children || [])
}, [])
const defaultSiteId = this.isAvailableSite(this.currentSiteId) ? this.currentSiteId : (this.siteOptions[0]?.value || '')
if (defaultSiteId) {
this.siteId = defaultSiteId
this.$store.commit('SET_CURRENTSITEID', defaultSiteId)
this.updateSiteInfo()
} }
uni.showLoading()
return listTicket(url).then(response => {
const data = JSON.parse(JSON.stringify(response?.rows || []))
this.list = this.list.concat(data)
this.total = response?.total || 0
}).finally(() => {
uni.hideLoading()
}) })
}, },
toDetail(id) { updateMapCenter() {
this.$tab.navigateTo(`/pages/ticket/index?id=${id}`) const site = this.siteOptions.find(item => item.value === this.siteId)
if (!site || !site.latitude || !site.longitude) {
this.mapUrl = ''
return
}
const lat = Number(site.latitude)
const lon = Number(site.longitude)
const zoom = 12
const width = 640
const height = 360
const tk = '01e99ab4472430e1c7dbfe4b5db99787'
const layers = 'vec_c,cva_c'
this.mapUrl = `https://api.tianditu.gov.cn/staticimage?center=${lon},${lat}&width=${width}&height=${height}&zoom=${zoom}&layers=${layers}&markers=${lon},${lat}&tk=${tk}`
}, },
reset() { getRunningInfo() {
this.list = [] return Promise.all([
this.total = 0 getDzjkHomeTotalView(this.siteId),
this.pageNum = 1 getProjectDisplayData(this.siteId)
]).then(([homeResponse, displayResponse]) => {
this.runningInfo = homeResponse?.data || {}
this.runningDisplayData = displayResponse?.data || []
})
},
getRevenueChartData() {
const [startTime, endTime] = this.getLastDaysRange(7)
const dateList = this.buildDateList(startTime, endTime)
const requests = [getAmmeterRevenueData({
siteId: this.siteId,
startTime,
endTime,
pageSize: 200,
pageNum: 1
}).then(response => response?.rows || [])]
Promise.all(requests).then(list => {
const rows = list[0] || []
const categories = dateList.map(day => day.slice(5))
const sumMap = {}
dateList.forEach(day => {
sumMap[day] = 0
})
rows.forEach(row => {
const day = row.dataTime || row.statisDate || row.date
if (!day) return
if (!Object.prototype.hasOwnProperty.call(sumMap, day)) {
sumMap[day] = 0
}
const value = Number(row.actualRevenue || row.revenue || 0)
sumMap[day] += Number.isFinite(value) ? value : 0
})
const series = [{
name: '收入',
data: dateList.map(day => Number((sumMap[day] || 0).toFixed(2)))
}]
const values = series[0].data
let minVal = Math.min(...values)
let maxVal = Math.max(...values)
if (!Number.isFinite(minVal)) minVal = 0
if (!Number.isFinite(maxVal)) maxVal = 0
if (minVal === maxVal) {
minVal -= 1
maxVal += 1
}
const lower = Math.min(minVal, 0)
const upper = Math.max(maxVal, 0)
const padding = Math.max((upper - lower) * 0.1, 1)
this.revenueOptions = {
...this.revenueOptions,
yAxis: {
...(this.revenueOptions.yAxis || {}),
data: [{
min: lower - padding,
max: upper + padding,
format: (val) => Number(val).toFixed(2)
}]
},
extra: {
...(this.revenueOptions.extra || {}),
markLine: {
type: 'solid',
data: [{
value: 0,
lineColor: '#ff4d4f',
showLabel: true,
labelText: '0',
labelFontColor: '#ff4d4f',
labelBgColor: '#fff1f0',
labelBgOpacity: 0.9,
labelAlign: 'left'
}]
}
}
}
this.revenueChartData = JSON.parse(JSON.stringify({
categories,
series
}))
})
} }
}, },
onShow() { watch: {
this.reset() currentSiteId(newSiteId) {
this.init() if (!newSiteId || newSiteId === this.siteId) return
if (!this.isAvailableSite(newSiteId)) return
this.siteId = newSiteId
this.updateSiteInfo()
}
},
onLoad() {
this.$nextTick(() => {
this.getSiteList()
})
},
onPageScroll(e) {
this.pageScrollTop = e.scrollTop
} }
} }
</script> </script>
<style scoped lang="scss"> <style lang="scss" scoped>
.container { /* #ifndef APP-NVUE */
position: relative; page {
display: flex;
flex-direction: column;
box-sizing: border-box;
background-color: #fff;
min-height: 100%;
height: auto;
font-size: 26rpx;
line-height: 30rpx;
} }
uni-button:after { view {
border: none; line-height: inherit;
border-radius: 0;
} }
.btn-list { /* #endif */
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 2;
.btns { .home-container {
border-radius: 0; background-color: #fff;
border: none; padding-top: 0;
border-bottom: 1px solid #eee; }
width: 100%;
text-align: center; .base-info {
font-size: 16px; margin-top: -80rpx;
line-height: 50px; border-radius: 80rpx 80rpx 0 0;
padding: 30rpx;
background-color: #fff; background-color: #fff;
&.active-btn { .map-card {
background-color: #3a98ff; border-radius: 16rpx;
color: #fff; overflow: hidden;
box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.08);
margin-top: 30rpx;
background: #f3f5f8;
.site-map {
width: 100%;
height: 220px;
}
.map-empty {
height: 220px;
display: flex;
align-items: center;
justify-content: center;
color: #8a8f98;
font-size: 24rpx;
}
}
.total-card {
margin-top: 30rpx;
border-radius: 16rpx;
box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.08);
padding: 20rpx;
.total-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.title {
font-weight: 700;
font-size: 28rpx;
}
.total-revenue {
display: flex;
align-items: baseline;
gap: 6rpx;
font-size: 22rpx;
color: #19242d;
.value {
font-size: 28rpx;
font-weight: 700;
color: #f67438;
} }
} }
} }
.scroll-y { .grid-item-box {
height: calc(100vh - var(--window-bottom) - var(--window-top)); padding-top: 6rpx;
z-index: 1; padding-bottom: 6rpx;
text-align: left;
.title {
font-size: 22rpx;
color: #666;
} }
.content { .text {
background-color: #ffffff; margin-top: 10rpx;
padding: 70px 20px 60px 20px; font-size: 26rpx;
font-weight: 600;
} }
.item-list {
border-radius: 7px;
box-shadow: 0 0 10px rgba(0, 0, 0, .1), 0 0 0 rgba(0, 0, 0, .5);
font-size: 14px;
line-height: 24px;
margin-bottom: 20px;
border: 1px solid #eee;
.item-title {
border-radius: 7px 7px 0 0;
font-size: 16px;
border-bottom: 1px solid #eee;
padding: 10px 15px;
background-color: #FC6B69;
color: #fff;
&.done {
background-color: #05AEA3;
} }
} }
.item-content { .sections-list {
padding: 15px 15px; margin-bottom: 10rpx;
.item-info { ::v-deep &>.uni-section-header {
margin-bottom: 20px; font-weight: 700;
font-size: 26rpx;
line-height: 30rpx;
} }
} }
.item-content .item-info:last-child { .sections-list:not(:first-child) {
margin-bottom: 0; margin-top: 40rpx;
} }
} }
.content .item-list:last-child {
margin-bottom: 0;
}
</style> </style>

View File

@ -3,7 +3,7 @@
<view class="logo-content align-center justify-center flex"> <view class="logo-content align-center justify-center flex">
<image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix"> <image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">
</image> </image>
<text class="title">EMS移动端登录</text> <text class="title">上动EMS登录</text>
</view> </view>
<view class="login-form-content"> <view class="login-form-content">
<view class="input-item flex align-center"> <view class="input-item flex align-center">
@ -39,8 +39,12 @@
</template> </template>
<script> <script>
import { getCodeImg } from '@/api/login' import {
import { getToken } from '@/utils/auth' getCodeImg
} from '@/api/login'
import {
getToken
} from '@/utils/auth'
export default { export default {
data() { data() {
@ -206,5 +210,4 @@
} }
} }
} }
</style> </style>

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="about-container"> <view class="about-container">
<view class="header-section text-center"> <view class="header-section text-center">
<image style="width: 150rpx;height: 150rpx;" src="/static/logo200.png" mode="widthFix"> <image style="width: 150rpx;height: 150rpx;" src="/static/logo-trans.png" mode="widthFix">
</image> </image>
<uni-title type="h2" title="EMS移动端"></uni-title> <uni-title type="h2" title="EMS移动端"></uni-title>
</view> </view>

View File

@ -123,6 +123,9 @@
}, },
loadImage: function () { loadImage: function () {
var _this = this var _this = this
uni.showLoading({
title: '图片加载中...',
})
uni.getImageInfo({ uni.getImageInfo({
src: _this.imageSrc, src: _this.imageSrc,
@ -188,7 +191,14 @@
isShowImg: true isShowImg: true
}) })
uni.hideLoading() uni.hideLoading()
} },
fail() {
uni.hideLoading()
uni.showToast({
title: '图片加载失败',
icon: 'none'
})
},
}) })
}, },
// 拖动时候触发的touchStart事件 // 拖动时候触发的touchStart事件

View File

@ -7,7 +7,8 @@
<view v-if="!avatar" class="cu-avatar xl round bg-white"> <view v-if="!avatar" class="cu-avatar xl round bg-white">
<view class="iconfont icon-people text-gray icon"></view> <view class="iconfont icon-people text-gray icon"></view>
</view> </view>
<image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix"> <image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round"
mode="widthFix">
</image> </image>
<view v-if="!name" @click="handleToLogin" class="login-tip"> <view v-if="!name" @click="handleToLogin" class="login-tip">
点击登录 点击登录
@ -27,11 +28,11 @@
<view class="content-section"> <view class="content-section">
<view class="mine-actions grid col-4 text-center"> <view class="mine-actions grid col-4 text-center">
<view class="action-item" @click="handleJiaoLiuQun"> <view class="action-item" @click="handleToEditInfo">
<view class="iconfont icon-friendfill text-pink icon"></view> <view class="iconfont icon-friendfill text-pink icon"></view>
<text class="text">交流群</text> <text class="text">个人信息</text>
</view> </view>
<view class="action-item" @click="handleBuilding"> <!-- <view class="action-item" @click="handleBuilding">
<view class="iconfont icon-service text-blue icon"></view> <view class="iconfont icon-service text-blue icon"></view>
<text class="text">在线客服</text> <text class="text">在线客服</text>
</view> </view>
@ -42,7 +43,7 @@
<view class="action-item" @click="handleBuilding"> <view class="action-item" @click="handleBuilding">
<view class="iconfont icon-dianzan text-green icon"></view> <view class="iconfont icon-dianzan text-green icon"></view>
<text class="text">点赞我们</text> <text class="text">点赞我们</text>
</view> </view> -->
</view> </view>
<view class="menu-list"> <view class="menu-list">
@ -52,7 +53,7 @@
<view>编辑资料</view> <view>编辑资料</view>
</view> </view>
</view> </view>
<view class="list-cell list-cell-arrow" @click="handleHelp"> <!-- <view class="list-cell list-cell-arrow" @click="handleHelp">
<view class="menu-item-box"> <view class="menu-item-box">
<view class="iconfont icon-help menu-icon"></view> <view class="iconfont icon-help menu-icon"></view>
<view>常见问题</view> <view>常见问题</view>
@ -63,7 +64,7 @@
<view class="iconfont icon-aixin menu-icon"></view> <view class="iconfont icon-aixin menu-icon"></view>
<view>关于我们</view> <view>关于我们</view>
</view> </view>
</view> </view> -->
<view class="list-cell list-cell-arrow" @click="handleToSetting"> <view class="list-cell list-cell-arrow" @click="handleToSetting">
<view class="menu-item-box"> <view class="menu-item-box">
<view class="iconfont icon-setting menu-icon"></view> <view class="iconfont icon-setting menu-icon"></view>

View File

@ -40,7 +40,8 @@
</uni-file-picker> </uni-file-picker>
</view> </view>
</view> </view>
<button class="button" type="primary" style="margin-top:30px;" :loading="loading" @click="submit">提交</button> <button class="submit-button" type="primary" style="margin-top:30px;" :loading="loading"
@click="submit">提交</button>
</view> </view>
</template> </template>
@ -96,7 +97,7 @@
duration: 2000 duration: 2000
}); });
uni.switchTab({ uni.switchTab({
url: '/pages/index' url: '/pages/ticket/list'
}); });
} }
}).finally(() => this.loading = false) }).finally(() => this.loading = false)
@ -142,9 +143,9 @@
}) })
}, },
}, },
mounted() { onLoad(options) {
uni.showLoading() uni.showLoading()
getTicket(this.$route.query.id).then(response => { getTicket(options.id).then(response => {
this.info = JSON.parse(JSON.stringify(response?.data || {})) this.info = JSON.parse(JSON.stringify(response?.data || {}))
const { const {
images = '' images = ''
@ -163,6 +164,7 @@
}).finally(() => { }).finally(() => {
uni.hideLoading() uni.hideLoading()
}) })
} }
} }
</script> </script>
@ -170,26 +172,43 @@
<style scoped lang="scss"> <style scoped lang="scss">
.container { .container {
background-color: #ffffff; background-color: #ffffff;
padding: 20px 20px; padding: 40rpx;
color: #19242d;
} }
.item-lists { .item-lists {
box-shadow: 0 0 10px rgba(0, 0, 0, .1), 0 0 0 rgba(0, 0, 0, .5); box-shadow: 0 0 20rpx rgba(0, 0, 0, .1), 0 0 0 rgba(0, 0, 0, .5);
border-radius: 5px; border-radius: 10rpx;
font-size: 14px; font-size: 26rpx;
line-height: 20px; line-height: 30rpx;
margin-bottom: 20px; margin-bottom: 40rpx;
.title { .title {
font-size: 16px; border-radius: 14rpx 14rpx 0 0;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
padding: 10px 15px; padding: 20rpx 30rpx;
background-color: #e4e4e4; font-weight: 700;
color: #333; position: relative;
&::after {
content: '';
display: block;
background-color: #4c7af3;
height: 30rpx;
width: 6rpx;
position: absolute;
left: 10rpx;
top: 20rpx;
}
} }
.info { .info {
padding: 10px 15px; padding: 20rpx 30rpx;
font-size: 24rpx;
} }
} }
.submit-button {
font-size: 28rpx;
}
</style> </style>

244
pages/ticket/list.vue Normal file
View File

@ -0,0 +1,244 @@
<template>
<view class="container">
<view class="status-bar"></view>
<view class="page-title">工单</view>
<view class="btn-list">
<uni-row>
<uni-col :span="12">
<button type="default" class="btns" :class="{'active-btn' : active === 'undone'}"
@click="changeTab('undone')">待处理</button>
</uni-col>
<uni-col :span="12">
<button type="default" class="btns" :class="{'active-btn' : active === 'done'}"
@click="changeTab('done')">已处理</button>
</uni-col>
</uni-row>
</view>
<view v-if="list.length===0" class="no-data">暂无数据</view>
<view class="content scroll-y" v-else>
<view class="item-list" v-for="item in list" :key="item.ticketNo+'ticket'" @click="toDetail(item.id)">
<view class="item-title" :class="item.status === 3 ? 'done' : item.status === 2 ? 'doing' : 'undone'">
工单号{{item.ticketNo}}
<view class="item-status">{{ticketStatusOptions[item.status]}}</view>
</view>
<view class="item-content">
<view class="item-info">工单标题:
<text class="info-value">{{item.title}}</text>
</view>
<view class="item-info">问题描述:
<text class="info-value">{{item.content}}</text>
</view>
<view class="item-info">预期完成时间:
<text class="info-value">{{item.expectedCompleteTime || '-'}}</text>
</view>
<view class="item-info">处理人:
<text class="info-value">
{{item.workName || '-'}}
</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from 'vuex'
import {
listTicket
} from 'api/ems/ticket'
export default {
computed: {
...mapState({
ticketStatusOptions: (state) => state.ems.ticketStatusOptions
})
},
data() {
return {
active: 'undone',
total: 0,
list: [],
pageNum: 1,
pageSize: 20
}
},
methods: {
changeTab(active) {
if (active === this.active) return
this.active = active
this.reset()
this.init()
},
init() {
//1: '待处理', 2: '处理中', 3: '已处理'
let url = `/ticket/list?pageNum=${this.pageNum}&pageSize=${this.pageSize}`
if (this.active === 'done') {
url += `&status=3`
} else {
url += `&status=1&status=2`
}
uni.showLoading()
return listTicket(url).then(response => {
const data = JSON.parse(JSON.stringify(response?.rows || []))
this.list = this.list.concat(data)
this.total = response?.total || 0
}).finally(() => {
uni.hideLoading()
})
},
toDetail(id) {
this.$tab.navigateTo(`/pages/ticket/index?id=${id}`)
},
reset() {
this.list = []
this.total = 0
this.pageNum = 1
}
},
onReachBottom() {
if (this.list.length >= this.total) {
return console.log('数据已经加载完成')
}
this.pageNum += 1;
this.init().catch(() => {
this.pageNum -= 1
})
},
onShow() {
this.reset()
this.init()
}
}
</script>
<style scoped lang="scss">
.container {
position: relative;
background-color: #f5f6f7;
.no-data {
padding-top: 180rpx;
}
}
uni-button:after {
border: none;
border-radius: 0;
}
.btn-list {
position: fixed;
top: calc(var(--status-bar-height) + 56rpx);
left: 0;
width: 100%;
z-index: 2;
padding: 20rpx 30rpx;
background: #ffffff;
.btns {
border: none;
border-radius: 40rpx;
width: 90%;
font-size: 26rpx;
line-height: 64rpx;
color: #19242d;
background: #d9e7fc;
&.active-btn {
background: #4c7af3;
color: #fff;
}
}
}
.content {
padding: 120px 30rpx 120rpx 30rpx;
z-index: 1;
}
.page-title {
position: fixed;
top: var(--status-bar-height);
left: 0;
width: 100%;
z-index: 3;
padding: 16rpx 30rpx 10rpx;
font-size: 32rpx;
font-weight: 700;
color: #19242d;
background: #ffffff;
text-align: center;
}
// 工单列表
.item-list {
color: #4b4951;
border-radius: 14rpx;
box-shadow: 0 0 20rpx rgba(0, 0, 0, .1), 0 0 0 rgba(0, 0, 0, .5);
font-size: 26rpx;
line-height: 40rpx;
margin-bottom: 30rpx;
border: 1px solid #eee;
background: #ffffff;
// 标题
.item-title {
border-radius: 14rpx 14rpx 0 0;
border-bottom: 1px solid #eee;
padding: 20rpx 30rpx;
font-weight: 700;
position: relative;
.item-status {
position: absolute;
right: 0;
top: 0;
padding: 2rpx 20rpx;
color: #ffffff;
font-size: 22rpx;
}
&.done {
.item-status {
background-color: #30be95;
}
}
&.doing {
.item-status {
background-color: #3c68e7;
}
}
&.undone {
.item-status {
background-color: #ed7876;
}
}
}
// 内容
.item-content {
padding: 20rpx 30rpx;
font-size: 24rpx;
.item-info {
margin-bottom: 20rpx;
.info-value {
padding-left: 10rpx;
}
}
}
.item-content .item-info:last-child {
margin-bottom: 0;
}
}
.content .item-list:last-child {
margin-bottom: 0;
}
</style>

View File

@ -0,0 +1,116 @@
<template>
<view class="time-range">
<uni-datetime-picker v-model="dateRange" type="daterange" :end="defaultDateRange[1]" :clear-icon="false"
rangeSeparator="至" @change="changeTime" />
<view class="btns-container">
<button size="mini" class="small" :disabled="loading" @click="reset">重置</button>
<!-- <button type="primary" class="small" size="mini" :disabled="loading" @click="search">搜索</button> -->
<button type="primary" class="large" size="mini" :disabled="loading"
@click="timeLine('before')">上一时段</button>
<button type="primary" class="large" size="mini" @click="timeLine('next')"
:disabled="loading || disabledNextBtn">下一时段</button>
</view>
</view>
</template>
<script>
import {
formatDate
} from '@/utils/filters'
export default {
computed: {
disabledNextBtn() {
return new Date(this.dateRange[1]) >= new Date(this.defaultDateRange[1])
}
},
data() {
return {
loading: false,
dateRange: [],
defaultDateRange: [],
}
},
methods: {
init(today = false) {
const now = new Date(),
formatNow = formatDate(now);
const weekAgo = formatDate(today ? new Date(now.getTime()) : new Date(now.getTime() - 7 * 24 * 60 * 60 *
1000))
this.dateRange = [weekAgo, formatNow];
this.defaultDateRange = [weekAgo, formatNow];
console.log('初始化完成', this.defaultDateRange)
this.$emit('updateDate', this.dateRange)
},
changeTime(val) {
this.dateRange = val || []
this.$emit('updateDate', this.dateRange)
},
showBtnLoading(status) {
this.loading = status
},
resetDate() {
this.dateRange = this.defaultDateRange
},
//重置 设置时间范围为初始化时间段
reset() {
this.resetDate()
this.$emit('reset')
this.$emit('updateDate', this.dateRange)
},
// 搜索
search() {
this.$emit('updateDate', this.dateRange)
},
timeLine(type) {
if (!this.dateRange || !this.dateRange[0] || !this.dateRange[1]) return
const nowStartTimes = new Date(this.dateRange[0]).getTime(),
nowEndTimes = new Date(this.dateRange[1]).getTime(),
maxTime = new Date(this.defaultDateRange[1]).getTime()
const nowDis = nowEndTimes - nowStartTimes //用户当前选择时间差 可能=0
//baseTime,maxTime 毫秒数
const baseDis = 24 * 60 * 60 * 1000
const calcDis = nowDis === 0 ? baseDis : nowDis
let start = type === 'before' ? nowStartTimes - calcDis : nowStartTimes + calcDis
if (start > maxTime) start = maxTime
let end = type === 'before' ? nowEndTimes - calcDis : nowEndTimes + calcDis
if (end > maxTime) end = maxTime
this.dateRange = [formatDate(start), formatDate(end)]
this.$emit('updateDate', this.dateRange)
},
}
}
</script>
<style lang="scss" scoped>
.time-range {
padding: 10rpx 22rpx;
.btns-container {
margin-top: 20rpx;
margin-bottom: 40rpx;
uni-button {
padding-left: 0;
padding-right: 0;
text-align: center;
font-size: 26rpx;
&:not(:last-child) {
margin-right: 20rpx;
}
}
.small {
width: 120rpx;
}
.large {
width: 160rpx;
background-color: #547ef4;
&[disabled][type=primary] {
background-color: #89a8ffe6;
}
}
}
}
</style>

View File

@ -1,69 +1,58 @@
<template> <template>
<view class="page-container"> <view class="page-container">
<uni-collapse ref="collapse" accordion v-if="list.length > 0"> <uni-collapse ref="collapse" accordion v-if="list.length > 0">
<uni-collapse-item v-for="(item,index) in list" :key="item.deviceId+'bmsdcc'" :open="index===0" <uni-collapse-item v-for="(item,index) in list" :key="item.deviceId+'bmscc'" :open="index===0"
:title="`${index+1}#${item.deviceName}`" :class="item.workStatus === '0' ? 'running' :'danger'"> class="common-collapse-item" :class="handleCardClass(item)">
<view>
<uni-group mode="card" class="work-group"> <template v-slot:title>
<uni-grid :column="3" :showBorder="false"> <view class='title-wrapper'>
<uni-grid-item> <view class="top">
<view class="status">{{CLUSTERWorkStatusOptions[item.workStatus] || '暂无数据'}}</view>
<text
class="name">{{`${item.parentDeviceName?`${item.parentDeviceName} -> ` : ''}${item.deviceName}`}}</text>
</view>
</view>
</template>
<view class='content'>
<!-- 设备状态栏 -->
<uni-group mode="card" class="status-card-group">
<view class="flex-container">
<view class="flex-lists">
<view class="grid-item-box"> <view class="grid-item-box">
<view class="title">工作状态</view> <view class="title">工作状态</view>
<text class="text status">{{workStatusOptions[item.workStatus]}}</text> <text
class="text work-status-color">{{CLUSTERWorkStatusOptions[item.workStatus] || '-'}}</text>
</view> </view>
</uni-grid-item> </view>
<uni-grid-item> <view class="flex-lists">
<view class="grid-item-box"> <view class="grid-item-box">
<view class="title">与PCS通信</view> <view class="title">与PCS通信</view>
<text <text
class="text">{{communicationStatusOptions[item.pcsCommunicationStatus]}}</text> class="text">{{communicationStatusOptions[item.pcsCommunicationStatus] || '-'}}</text>
</view> </view>
</uni-grid-item> </view>
<uni-grid-item> <view class="flex-lists">
<view class="grid-item-box"> <view class="grid-item-box">
<view class="title">与EMS通信</view> <view class="title">与EMS通信</view>
<text <text
class="text">{{communicationStatusOptions[item.emsCommunicationStatus]}}</text> class="text">{{communicationStatusOptions[item.emsCommunicationStatus] || '-'}}</text>
</view>
</view>
</view> </view>
</uni-grid-item>
</uni-grid>
</uni-group> </uni-group>
<uni-group mode="card"> <!-- 设备数据 -->
<uni-grid :column="3" :showBorder="false"> <uni-group mode="card" class="data-card-group">
<uni-grid-item v-for="(infoDataItem,infoDataIndex) in infoData" <uni-row v-for="(infoDataItem,infoDataIndex) in infoData" :key="infoDataIndex+'infoData'"
:key="infoDataIndex+'infoData'"> class="data-row">
<view class="grid-item-box"> <uni-col :span="8">
<view class="title">{{infoDataItem.label}}</view> <view class="title">{{infoDataItem.label}}</view>
<text class="text">{{item[infoDataItem.attr] | formatNumber}} </uni-col>
<uni-col :span="16">
<view class="value">{{item[infoDataItem.attr] | formatNumber}}
<text v-if="infoDataItem.unit" v-html="infoDataItem.unit"></text> <text v-if="infoDataItem.unit" v-html="infoDataItem.unit"></text>
</text>
</view> </view>
</uni-grid-item> </uni-col>
</uni-grid> </uni-row>
</uni-group>
<uni-group mode="card" style="margin-bottom: 25px;">
<uni-table border stripe emptyText="暂无数据">
<!-- 表头行 -->
<uni-tr>
<uni-th align="center">名称</uni-th>
<uni-th align="center">单体平均值</uni-th>
<uni-th align="center">单体最小值</uni-th>
<uni-th align="center">单体最小值ID</uni-th>
<uni-th align="center">单体最大值</uni-th>
<uni-th align="center">单体最大值ID</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(tableItem, tableIndex) in item.batteryDataList"
:key="tableIndex+'batteryDataList'">
<uni-td align="center"
v-html="`${tableItem.dataName}${unitObj[tableItem.dataName]}`"></uni-td>
<uni-td align="center">{{tableItem.avgData}}</uni-td>
<uni-td align="center">{{tableItem.minData}}</uni-td>
<uni-td align="center">{{tableItem.minDataID}}</uni-td>
<uni-td align="center">{{tableItem.maxData}}</uni-td>
<uni-td align="center">{{tableItem.maxDataID}}</uni-td>
</uni-tr>
</uni-table>
</uni-group> </uni-group>
</view> </view>
</uni-collapse-item> </uni-collapse-item>
@ -77,7 +66,9 @@
<script> <script>
import { import {
getBMSBatteryCluster getProjectDisplayData,
getStackNameList,
getClusterNameList
} from '@/api/ems/site.js' } from '@/api/ems/site.js'
import { import {
mapState mapState
@ -85,154 +76,233 @@
export default { export default {
computed: { computed: {
...mapState({ ...mapState({
workStatusOptions: (state) => CLUSTERWorkStatusOptions: (state) =>
state.ems.workStatusOptions, state.ems.CLUSTERWorkStatusOptions,
communicationStatusOptions: (state) => communicationStatusOptions: (state) =>
state.ems.communicationStatusOptions, state.ems.communicationStatusOptions,
}) })
}, },
data() { data() {
return { return {
unitObj: { displayData: [],
'电压': 'V', clusterDeviceList: [],
'温度': '&#8451;',
'SOC': '%'
},
list: [], list: [],
siteId: '', siteId: '',
infoData: [{ infoData: [{
label: '簇电压', label: '簇电压',
attr: 'clusterVoltage', attr: 'clusterVoltage',
unit: 'V' unit: 'V',
pointName: '簇电压'
}, },
{ {
label: '可充电量', label: '可充电量',
attr: 'chargeableCapacity', attr: 'chargeableCapacity',
unit: 'kWh' unit: 'kWh',
pointName: '可充电量'
}, },
{ {
label: '累计充电量', label: '累计充电量',
attr: 'totalChargedCapacity', attr: 'totalChargedCapacity',
unit: 'kWh' unit: 'kWh',
pointName: '累计充电量'
}, },
{ {
label: '簇电流', label: '簇电流',
attr: 'clusterCurrent', attr: 'clusterCurrent',
unit: 'A' unit: 'A',
pointName: '簇电流'
}, },
{ {
label: '可放电量', label: '可放电量',
attr: 'dischargeableCapacity', attr: 'dischargeableCapacity',
unit: 'kWh' unit: 'kWh',
pointName: '可放电量'
}, },
{ {
label: '累计放电量', label: '累计放电量',
attr: 'totalDischargedCapacity', attr: 'totalDischargedCapacity',
unit: 'kWh' unit: 'kWh',
pointName: '累计放电量'
}, },
{ {
label: 'SOH', label: 'SOH',
attr: 'soh', attr: 'soh',
unit: '%' unit: '%',
pointName: 'SOH'
}, },
{ {
label: '平均温度', label: '平均温度',
attr: 'averageTemperature', attr: 'averageTemperature',
unit: '&#8451;' unit: '&#8451;',
pointName: '平均温度'
}, },
{ {
label: '绝缘电阻', label: '绝缘电阻',
attr: 'insulationResistance', attr: 'insulationResistance',
unit: '&Omega;' unit: '&Omega;',
pointName: '绝缘电阻'
}, },
{ {
label: '当前SOC', label: '当前SOC',
attr: 'currentSoc', attr: 'currentSoc',
unit: '%' unit: '%',
pointName: '当前SOC'
}, },
] ]
} }
}, },
mounted() { methods: {
uni.showLoading() handleCardClass(item) {
this.siteId = this.$route.query.siteId || '' const {
getBMSBatteryCluster({ workStatus = ''
} = item
return !(Object.keys(this.CLUSTERWorkStatusOptions).includes(item.workStatus)) ? "timing-collapse-item" :
workStatus === '9' ? 'warning-collapse-item' : 'running-collapse-item'
},
getModuleRows(menuCode, sectionName) {
return (this.displayData || []).filter(item => item.menuCode === menuCode && item.sectionName === sectionName)
},
getFieldName(fieldCode) {
const raw = String(fieldCode || '').trim()
if (!raw) return ''
const index = raw.lastIndexOf('__')
return index >= 0 ? raw.slice(index + 2) : raw
},
getFieldRowMap(rows = [], deviceId = '') {
const map = {}
const targetDeviceId = String(deviceId || '')
rows.forEach(item => {
if (!item || !item.fieldCode) return
const itemDeviceId = String(item.deviceId || '')
if (itemDeviceId !== targetDeviceId) return
const fieldName = this.getFieldName(item.fieldCode)
map[fieldName] = item
const displayName = String(item.fieldName || '').trim()
if (displayName && !map[displayName]) {
map[displayName] = item
}
})
rows.forEach(item => {
if (!item || !item.fieldCode) return
const itemDeviceId = String(item.deviceId || '')
if (itemDeviceId !== '') return
const fieldName = this.getFieldName(item.fieldCode)
if (map[fieldName] === undefined || map[fieldName] === null || map[fieldName] === '') {
map[fieldName] = item
}
const displayName = String(item.fieldName || '').trim()
if (displayName && !map[displayName]) {
map[displayName] = item
}
})
return map
},
getFieldMap(rows = [], deviceId = '') {
const rowMap = this.getFieldRowMap(rows, deviceId)
return Object.keys(rowMap).reduce((acc, fieldName) => {
const row = rowMap[fieldName]
if (acc[fieldName] === undefined) {
acc[fieldName] = row?.fieldValue
}
return acc
}, {})
},
getLatestTime(menuCode) {
const times = (this.displayData || [])
.filter(item => item.menuCode === menuCode && item.valueTime)
.map(item => new Date(item.valueTime).getTime())
.filter(ts => !isNaN(ts))
if (times.length === 0) {
return '-'
}
const date = new Date(Math.max(...times))
const p = (n) => String(n).padStart(2, '0')
return `${date.getFullYear()}-${p(date.getMonth() + 1)}-${p(date.getDate())} ${p(date.getHours())}:${p(date.getMinutes())}:${p(date.getSeconds())}`
},
getClusterDeviceList() {
return getStackNameList(this.siteId)
.then(response => {
const stackList = response?.data || []
if (!stackList.length) {
this.clusterDeviceList = []
return
}
const requests = stackList.map(stack => {
const stackDeviceId = stack.deviceId || stack.id || ''
return getClusterNameList({
stackDeviceId,
siteId: this.siteId siteId: this.siteId
}).then(response => { })
this.list = response?.data || [] .then(clusterResponse => {
const clusterList = clusterResponse?.data || []
return clusterList.map(cluster => ({
...cluster,
parentDeviceName: stack.deviceName || stack.name || stackDeviceId || '',
}))
})
.catch(() => [])
})
return Promise.all(requests).then(results => {
this.clusterDeviceList = results.flat()
})
})
.catch(() => {
this.clusterDeviceList = []
})
},
buildList() {
const devices = (this.clusterDeviceList && this.clusterDeviceList.length > 0) ? this.clusterDeviceList : [{
deviceId: this.siteId,
deviceName: 'BMS电池簇',
parentDeviceName: ''
}]
this.list = devices.map(device => {
const deviceId = device.deviceId || device.id || this.siteId
const infoMap = this.getFieldMap(this.getModuleRows('SBJK_BMSDCC', '簇信息'), deviceId)
const statusMap = this.getFieldMap(this.getModuleRows('SBJK_BMSDCC', '状态'), deviceId)
return {
...infoMap,
workStatus: statusMap.workStatus,
pcsCommunicationStatus: statusMap.pcsCommunicationStatus,
emsCommunicationStatus: statusMap.emsCommunicationStatus,
currentSoc: infoMap.currentSoc,
siteId: this.siteId,
deviceId,
parentDeviceName: device.parentDeviceName || '',
deviceName: device.deviceName || device.name || device.deviceId || device.id || 'BMS电池簇',
dataUpdateTime: this.getLatestTime('SBJK_BMSDCC'),
alarmNum: 0,
}
})
},
updateData() {
return Promise.all([
getProjectDisplayData(this.siteId),
this.getClusterDeviceList()
]).then(([displayResponse]) => {
this.displayData = displayResponse?.data || []
this.buildList()
}).catch(() => {
this.displayData = []
this.list = []
})
},
},
onLoad(options) {
uni.showLoading()
this.siteId = options.siteId || ''
this.updateData().finally(() => {
if (this.list.length > 0) { if (this.list.length > 0) {
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
this.$refs.collapse.resize()
uni.hideLoading() uni.hideLoading()
}, 100) }, 100)
}) })
} else { return
uni.hideLoading()
} }
}).catch(() => {
uni.hideLoading() uni.hideLoading()
}) })
} }
} }
</script> </script>
<style lang="scss" scoped>
.page-container {}
.grid-item-box {
flex: 1;
// position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10px;
background-color: #fff;
.title {
font-size: 14px;
color: #666;
}
.text {
margin-top: 10px;
font-size: 16px;
font-weight: 500;
color: #666;
overflow-wrap: anywhere;
}
}
::v-deep {
.uni-collapse-item__wrap {
background-color: #eee;
}
.running {
.uni-collapse-item__title-text {
color: #05AEA3;
}
.status {
color: #05AEA3;
}
}
.danger {
.uni-collapse-item__title-text {
color: #FC6B69;
}
.status {
color: #FC6B69;
}
}
}
</style>

View File

@ -2,71 +2,56 @@
<view class="page-container"> <view class="page-container">
<uni-collapse ref="collapse" accordion v-if="list.length > 0"> <uni-collapse ref="collapse" accordion v-if="list.length > 0">
<uni-collapse-item v-for="(item,index) in list" :key="item.deviceId+'bmszl'" :open="index===0" <uni-collapse-item v-for="(item,index) in list" :key="item.deviceId+'bmszl'" :open="index===0"
:title="`${index+1}#${item.deviceName}`" :class="item.workStatus === '0' ? 'running' :'danger'"> class="common-collapse-item" :class="handleCardClass(item,index)">
<view>
<uni-group mode="card" class="work-group"> <template v-slot:title>
<uni-grid :column="3" :showBorder="false"> <view class='title-wrapper'>
<uni-grid-item> <view class="top">
<view class="status">{{STACKWorkStatusOptions[item.workStatus] || '暂无数据'}}</view>
<text class="name">{{item.deviceName}}</text>
</view>
</view>
</template>
<view class='content'>
<!-- 设备状态栏 -->
<uni-group mode="card" class="status-card-group">
<view class="flex-container">
<view class="flex-lists">
<view class="grid-item-box"> <view class="grid-item-box">
<view class="title">工作状态</view> <view class="title">工作状态</view>
<text class="text status">{{workStatusOptions[item.workStatus]}}</text> <text
class="text work-status-color">{{STACKWorkStatusOptions[item.workStatus] || '-'}}</text>
</view> </view>
</uni-grid-item> </view>
<uni-grid-item> <view class="flex-lists">
<view class="grid-item-box"> <view class="grid-item-box">
<view class="title">与PCS通信</view> <view class="title">与PCS通信</view>
<text <text
class="text">{{communicationStatusOptions[item.pcsCommunicationStatus]}}</text> class="text">{{communicationStatusOptions[item.pcsCommunicationStatus] || '-'}}</text>
</view> </view>
</uni-grid-item> </view>
<uni-grid-item> <view class="flex-lists">
<view class="grid-item-box"> <view class="grid-item-box">
<view class="title">与EMS通信</view> <view class="title">与EMS通信</view>
<text <text
class="text">{{communicationStatusOptions[item.emsCommunicationStatus]}}</text> class="text">{{communicationStatusOptions[item.emsCommunicationStatus] || '-'}}</text>
</view>
</view>
</view> </view>
</uni-grid-item>
</uni-grid>
</uni-group> </uni-group>
<uni-group mode="card"> <!-- 设备数据 -->
<uni-grid :column="3" :showBorder="false"> <uni-group mode="card" class="data-card-group">
<uni-grid-item v-for="(infoDataItem,infoDataIndex) in infoData" <uni-row v-for="(infoDataItem,infoDataIndex) in infoData" :key="infoDataIndex+'infoData'"
:key="infoDataIndex+'infoData'"> class="data-row">
<view class="grid-item-box"> <uni-col :span="8">
<view class="title">{{infoDataItem.label}}</view> <view class="title">{{infoDataItem.label}}</view>
<text class="text">{{item[infoDataItem.attr] | formatNumber}} </uni-col>
<uni-col :span="16">
<view class="value">{{item[infoDataItem.attr] | formatNumber}}
<text v-if="infoDataItem.unit" v-html="infoDataItem.unit"></text> <text v-if="infoDataItem.unit" v-html="infoDataItem.unit"></text>
</text>
</view> </view>
</uni-grid-item> </uni-col>
</uni-grid> </uni-row>
</uni-group>
<uni-group mode="card" style="margin-bottom: 25px;">
<uni-table border stripe emptyText="暂无数据">
<!-- 表头行 -->
<uni-tr>
<uni-th align="center">簇号</uni-th>
<uni-th align="center">簇电压</uni-th>
<uni-th align="center">簇电流</uni-th>
<uni-th align="center">簇SOC</uni-th>
<uni-th align="center">单体最高电压</uni-th>
<uni-th align="center">单体最低电压</uni-th>
<uni-th align="center">单体最高温度</uni-th>
<uni-th align="center">单体最低温度</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(tableItem, tableIndex) in item.batteryDataList"
:key="tableIndex+'batteryDataList'">
<uni-td align="center">{{tableItem.clusterId}}</uni-td>
<uni-td align="center">{{tableItem.clusterVoltage}}V</uni-td>
<uni-td align="center">{{tableItem.clusterCurrent}}A</uni-td>
<uni-td align="center">{{tableItem.currentSoc}}%</uni-td>
<uni-td align="center">{{tableItem.maxCellVoltage}}V</uni-td>
<uni-td align="center">{{tableItem.minCellVoltage}}V</uni-td>
<uni-td align="center">{{tableItem.maxCellTemp}}&#8451;</uni-td>
<uni-td align="center">{{tableItem.minCellTemp}}&#8451;</uni-td>
</uni-tr>
</uni-table>
</uni-group> </uni-group>
</view> </view>
</uni-collapse-item> </uni-collapse-item>
@ -80,7 +65,8 @@
<script> <script>
import { import {
getBMSOverView getProjectDisplayData,
getStackNameList
} from '@/api/ems/site.js' } from '@/api/ems/site.js'
import { import {
mapState mapState
@ -88,147 +74,185 @@
export default { export default {
computed: { computed: {
...mapState({ ...mapState({
workStatusOptions: (state) => STACKWorkStatusOptions: (state) =>
state.ems.workStatusOptions, state.ems.STACKWorkStatusOptions,
communicationStatusOptions: (state) => communicationStatusOptions: (state) =>
state.ems.communicationStatusOptions, state.ems.communicationStatusOptions,
}) })
}, },
data() { data() {
return { return {
displayData: [],
stackDeviceList: [],
list: [], list: [],
siteId: '', siteId: '',
infoData: [{ infoData: [{
label: '电池堆总电压', label: '电池堆总电压',
attr: 'stackVoltage', attr: 'stackVoltage',
unit: 'V' unit: 'V',
pointName: '电池堆电压'
}, },
{ {
label: '可充电量', label: '可充电量',
attr: 'availableChargeCapacity', attr: 'availableChargeCapacity',
unit: 'kWh' unit: 'kWh',
pointName: '可充电量'
}, },
{ {
label: '累计充电量', label: '累计充电量',
attr: 'totalChargeCapacity', attr: 'totalChargeCapacity',
unit: 'kWh' unit: 'kWh',
pointName: '累计充电量'
}, },
{ {
label: '电池堆总电流', label: '电池堆总电流',
attr: 'stackCurrent', attr: 'stackCurrent',
unit: 'A' unit: 'A',
pointName: '电池堆总电流'
}, },
{ {
label: '可放电量', label: '可放电量',
attr: 'availableDischargeCapacity', attr: 'availableDischargeCapacity',
unit: 'kWh' unit: 'kWh',
pointName: '可放电量'
}, },
{ {
label: '累计放电量', label: '累计放电量',
attr: 'totalDischargeCapacity', attr: 'totalDischargeCapacity',
unit: 'kWh' unit: 'kWh',
pointName: '累计放电量'
}, },
{ {
label: 'SOH', label: 'SOH',
attr: 'stackSoh', attr: 'stackSoh',
unit: '%' unit: '%',
pointName: 'SOH'
}, },
{ {
label: '平均温度', label: '平均温度',
attr: 'operatingTemp', attr: 'operatingTemp',
unit: '&#8451;' unit: '&#8451;',
pointName: '平均温度'
}, },
{ {
label: '绝缘电阻', label: '绝缘电阻',
attr: 'stackInsulationResistance', attr: 'stackInsulationResistance',
unit: '&Omega;' unit: '&Omega;',
pointName: '绝缘电阻'
}, },
{ {
label: '当前SOC', label: '当前SOC',
attr: 'stackSoc', attr: 'stackSoc',
unit: '%' unit: '%',
pointName: '当前SOC'
}, },
] ]
} }
}, },
mounted() { methods: {
getModuleRows(menuCode, sectionName) {
return (this.displayData || []).filter(item => item.menuCode === menuCode && item.sectionName === sectionName)
},
getFieldName(fieldCode) {
const raw = String(fieldCode || '').trim()
if (!raw) return ''
const index = raw.lastIndexOf('__')
return index >= 0 ? raw.slice(index + 2) : raw
},
isEmptyValue(value) {
return value === undefined || value === null || value === ''
},
getFieldRowMap(rows = [], deviceId = '') {
const map = {}
const targetDeviceId = String(deviceId || '')
rows.forEach(item => {
if (!item || !item.fieldCode) return
const itemDeviceId = String(item.deviceId || '')
if (itemDeviceId !== targetDeviceId) return
map[this.getFieldName(item.fieldCode)] = item
})
rows.forEach(item => {
if (!item || !item.fieldCode) return
const itemDeviceId = String(item.deviceId || '')
if (itemDeviceId !== '') return
const fieldName = this.getFieldName(item.fieldCode)
const existRow = map[fieldName]
if (!existRow || this.isEmptyValue(existRow.fieldValue)) {
map[fieldName] = item
}
})
return map
},
getFieldMap(rowMap = {}) {
const map = {}
Object.keys(rowMap || {}).forEach((fieldName) => {
map[fieldName] = rowMap[fieldName]?.fieldValue
})
return map
},
buildBaseInfoList() {
const devices = (this.stackDeviceList && this.stackDeviceList.length > 0) ? this.stackDeviceList : [{
deviceId: this.siteId,
deviceName: 'BMS总览'
}]
this.list = devices.map(device => {
const id = device.deviceId || device.id || this.siteId
const infoRowMap = this.getFieldRowMap(this.getModuleRows('SBJK_BMSZL', '堆信息'), id)
const statusRowMap = this.getFieldRowMap(this.getModuleRows('SBJK_BMSZL', '状态'), id)
const infoMap = this.getFieldMap(infoRowMap)
const statusMap = this.getFieldMap(statusRowMap)
return {
...infoMap,
workStatus: statusMap.workStatus,
pcsCommunicationStatus: statusMap.pcsCommunicationStatus,
emsCommunicationStatus: statusMap.emsCommunicationStatus,
siteId: this.siteId,
deviceId: id,
deviceName: device.deviceName || device.name || device.deviceId || device.id || 'BMS总览',
batteryDataList: []
}
})
},
handleCardClass(item) {
const {
workStatus = ''
} = item
return !Object.keys(this.STACKWorkStatusOptions).find(i => i === workStatus) ? "timing-collapse-item" :
workStatus === '9' ? 'warning-collapse-item' : 'running-collapse-item'
},
updateData() {
return Promise.all([
getProjectDisplayData(this.siteId),
getStackNameList(this.siteId)
]).then(([displayResponse, stackResponse]) => {
this.displayData = displayResponse?.data || []
this.stackDeviceList = stackResponse?.data || []
this.buildBaseInfoList()
}).catch(() => {
this.displayData = []
this.stackDeviceList = []
this.list = []
})
}
},
onLoad(options) {
uni.showLoading() uni.showLoading()
this.siteId = this.$route.query.siteId || '' this.siteId = options.siteId || ''
getBMSOverView({ this.updateData().then(() => {
siteId: this.siteId if (this.list.length === 0) {
}).then(response => { uni.hideLoading()
this.list = response?.data || [] return
if (this.list.length > 0) { }
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
this.$refs.collapse.resize() this.$refs.collapse && this.$refs.collapse.resize()
uni.hideLoading() uni.hideLoading()
}, 100) }, 100)
}) })
} else {
uni.hideLoading()
}
}).catch(() => { }).catch(() => {
uni.hideLoading() uni.hideLoading()
}) })
} }
} }
</script> </script>
<style lang="scss" scoped>
.grid-item-box {
flex: 1;
// position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10px;
background-color: #fff;
.title {
font-size: 14px;
color: #666;
}
.text {
margin-top: 10px;
font-size: 16px;
font-weight: 500;
color: #666;
overflow-wrap: anywhere;
}
}
::v-deep {
.uni-collapse-item__wrap {
background-color: #eee;
}
.running {
.uni-collapse-item__title-text {
color: #05AEA3;
}
.status {
color: #05AEA3;
}
}
.danger {
.uni-collapse-item__title-text {
color: #FC6B69;
}
.status {
color: #FC6B69;
}
}
}
</style>

View File

@ -1,101 +1,49 @@
<template> <template>
<view class="page-container"> <view class="page-container">
<uni-collapse ref="collapse"> <uni-collapse ref="collapse" accordion v-if="list.length > 0">
<!-- 总表 --> <uni-collapse-item v-for="(item,index) in list" :key="index+'dbList'" :open="index===0"
<uni-collapse-item open :class="zbInfo.emsCommunicationStatus !== '0' ? 'danger' :'running'"> class="common-collapse-item" :class="{
'timing-collapse-item':!['0','2'].includes(item.emsCommunicationStatus),
'warning-collapse-item':item.emsCommunicationStatus === '2',
'running-collapse-item':item.emsCommunicationStatus === '0'
}">
<template v-slot:title> <template v-slot:title>
<view class="title-row"> <view class='title-wrapper'>
<view class="title">{{`1#${zbInfo.deviceName || ''}`}}</view> <view class="top">
<view class="msg"> <view class="status">{{communicationStatusOptions[item.emsCommunicationStatus] || '暂无数据'}}
<view>{{communicationStatusOptions[zbInfo.emsCommunicationStatus] || ''}}</view> </view>
<view>数据更新时间{{zbInfo.dataUpdateTime || ''}}</view> <text class="name">{{item.deviceName}}</text>
</view> </view>
</view> </view>
</template> </template>
<uni-group :title=" item.category" mode="card" v-for="(item,index) in zbInfo.loadDataDetailInfo" <view class='content'>
:key="index+'zbInfo'"> <uni-group mode="card" class="data-card-group">
<uni-row> <uni-row v-for="(tempDataItem,tempDataIndex) in
(item.fieldConfigs || otherTypeMsg)" :key="tempDataIndex+'dbTempData'" class="data-row">
<uni-col :span="8"> <uni-col :span="8">
<view>/kWh</view> <view class="title">{{tempDataItem.name}}</view>
</uni-col> </uni-col>
<uni-col :span="16"> <uni-col :span="16">
<view>{{item.totalKwh}}</view> <view class="value">{{item[tempDataItem.attr] | formatNumber}}
</uni-col> <text v-if="tempDataItem.unit" v-html="tempDataItem.unit"></text>
</uni-row> </view>
<uni-row>
<uni-col :span="8">
<view>/kWh</view>
</uni-col>
<uni-col :span="16">
<view>{{item.peakKwh}}</view>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8">
<view>/kWh</view>
</uni-col>
<uni-col :span="16">
<view>{{item.highKwh}}</view>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8">
<view>/kWh</view>
</uni-col>
<uni-col :span="16">
<view>{{item.flatKwh}}</view>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8">
<view>/kWh</view>
</uni-col>
<uni-col :span="16">
<view>{{item.valleyKwh}}</view>
</uni-col> </uni-col>
</uni-row> </uni-row>
</uni-group> </uni-group>
</uni-collapse-item>
<!-- 储能表 -->
<uni-collapse-item open :class="cnbInfo.emsCommunicationStatus !== '0' ? 'danger' :'running'">
<template v-slot:title>
<view class="title-row">
<view class="title">{{`2#${cnbInfo.deviceName || ''}`}}</view>
<view class="msg">
<view>{{communicationStatusOptions[cnbInfo.emsCommunicationStatus] || ''}}</view>
<view>数据更新时间{{cnbInfo.dataUpdateTime || ''}}</view>
</view> </view>
</view>
</template>
<uni-group :title="item.category" mode="card" v-for="(item,index) in cnbInfo.meteDataDetailInfo"
:key="index+'cnbInfo'">
<uni-row>
<uni-col :span="8">
<view>有功功率</view>
</uni-col>
<uni-col :span="16">
<view>{{item.activePower}}</view>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8">
<view>无功功率</view>
</uni-col>
<uni-col :span="16">
<view>{{item.reactivePower}}</view>
</uni-col>
</uni-row>
</uni-group>
</uni-collapse-item> </uni-collapse-item>
</uni-collapse> </uni-collapse>
<view class="no-data" v-else>
暂无数据
</view>
</view> </view>
</template> </template>
<script> <script>
import { import {
getAmmeterDataList getProjectDisplayData,
getDeviceList
} from '@/api/ems/site.js' } from '@/api/ems/site.js'
import { import {
mapState mapState
@ -110,110 +58,174 @@
data() { data() {
return { return {
siteId: '', siteId: '',
zbInfo: {}, displayData: [],
cnbInfo: {}, ammeterDeviceList: [],
list: [],
otherTypeMsg: [{
name: '正向有功电能',
attr: 'forwardActive',
pointName: '正向有功电能',
unit: 'kWh'
},
{
name: '反向有功电能',
attr: 'reverseActive',
pointName: '反向有功电能',
unit: 'kWh'
},
{
name: '正向无功电能',
attr: 'forwardReactive',
pointName: '正向无功电能',
unit: 'kvarh'
},
{
name: '反向无功电能',
attr: 'reverseReactive',
pointName: '反向无功电能',
unit: 'kvarh'
},
{
name: '有功功率',
attr: 'activePower',
pointName: '总有功功率',
unit: 'kW'
},
{
name: '无功功率',
attr: 'reactivePower',
pointName: '总无功功率',
unit: 'kvar'
},
]
} }
}, },
mounted() { methods: {
getModuleRows(menuCode) {
return (this.displayData || []).filter(item => item.menuCode === menuCode)
},
getFieldName(fieldCode) {
const raw = String(fieldCode || '').trim()
if (!raw) return ''
const index = raw.lastIndexOf('__')
return index >= 0 ? raw.slice(index + 2) : raw
},
isEmptyValue(value) {
return value === undefined || value === null || value === ''
},
getFieldRowMap(rows = [], deviceId = '') {
const map = {}
const targetDeviceId = String(deviceId || '')
rows.forEach(item => {
if (!item || !item.fieldCode) return
const itemDeviceId = String(item.deviceId || '')
if (itemDeviceId !== targetDeviceId) return
map[this.getFieldName(item.fieldCode)] = item
})
rows.forEach(item => {
if (!item || !item.fieldCode) return
const itemDeviceId = String(item.deviceId || '')
if (itemDeviceId !== '') return
const fieldName = this.getFieldName(item.fieldCode)
const existRow = map[fieldName]
if (!existRow || this.isEmptyValue(existRow.fieldValue)) {
map[fieldName] = item
}
})
return map
},
getFieldConfigs(rows = []) {
const result = []
const seen = {}
(rows || []).forEach(item => {
const attr = this.getFieldName(item?.fieldCode)
const name = String(item?.fieldName || '').trim()
if (!attr || !name || seen[name]) return
const base = this.otherTypeMsg.find(i => i.attr === attr) || {}
result.push({
name,
attr,
pointName: base.pointName || name,
unit: base.unit || ''
})
seen[name] = true
})
return result.length > 0 ? result : this.otherTypeMsg
},
buildList() {
const rows = this.getModuleRows('SBJK_DB')
const fieldConfigs = this.getFieldConfigs(rows)
let devices = (this.ammeterDeviceList || []).filter(item => item.deviceCategory === 'AMMETER')
if (devices.length === 0) {
const grouped = {}
rows.forEach(item => {
const id = String(item?.deviceId || '').trim()
if (!id || grouped[id]) return
grouped[id] = {
deviceId: id,
deviceName: id
}
})
devices = Object.values(grouped)
}
if (devices.length === 0) {
devices = [{
deviceId: '',
deviceName: '电表'
}]
}
this.list = devices.map(device => {
const id = String(device.deviceId || device.id || '').trim()
const fieldRowMap = this.getFieldRowMap(rows, id)
const statusValue = fieldRowMap.communicationStatus?.fieldValue || fieldRowMap.emsCommunicationStatus?.fieldValue || ''
const values = {}
fieldConfigs.forEach(cfg => {
values[cfg.attr] = fieldRowMap[cfg.attr]?.fieldValue
})
return {
...values,
deviceId: id,
deviceName: device.deviceName || device.name || id || '电表',
emsCommunicationStatus: String(statusValue || ''),
fieldConfigs
}
})
}
},
onLoad(options) {
uni.showLoading() uni.showLoading()
this.siteId = this.$route.query.siteId || '' this.siteId = options.siteId || ''
getAmmeterDataList({ Promise.all([
siteId: this.siteId getProjectDisplayData(this.siteId),
}).then(response => { getDeviceList(this.siteId)
this.zbInfo = JSON.parse(JSON.stringify(response?.data?.ammeterLoadData || {})); ]).then(([displayResponse, deviceResponse]) => {
this.cnbInfo = JSON.parse(JSON.stringify(response?.data?.ammeterMeteData || {})); this.displayData = displayResponse?.data || []
this.ammeterDeviceList = deviceResponse?.data || []
this.buildList()
if (this.list.length > 0) {
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
this.$refs.collapse.resize() this.$refs.collapse.resize()
uni.hideLoading() uni.hideLoading()
}, 100) }, 100)
}) })
} else {
uni.hideLoading()
}
}).catch(() => { }).catch(() => {
uni.hideLoading() uni.hideLoading()
}) })
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.title-row { .unknow-bd-device {
padding: 0 15px; text-align: center;
position: relative; padding: 20rpx;
height: 50px; font-size: 28rpx;
line-height: 50rpx;
.title { background-color: #fff;
font-weight: 500; color: #000;
line-height: 50px;
}
.msg {
position: absolute;
right: 15px;
top: 50%;
transform: translateY(-50%);
text-align: right;
}
}
::v-deep {
.uni-group__title {
background-color: #959595;
.uni-group__title-text {
color: #fff;
}
}
.uni-collapse-item__wrap-content {
.uni-group--card:last-child {
margin-bottom: 25px;
}
}
// row-行样式
.uni-group__content {
padding: 10px 15px;
.uni-row {
padding: 5px 0;
}
}
// 折叠面板内容区域背景颜色
.uni-collapse-item__wrap {
background-color: #eee;
}
// 运行状态颜色区分
.running {
.uni-group__title {
background-color: #05AEA3;
}
.uni-collapse-item__title-text {
color: #05AEA3;
}
.title-row {
color: #05AEA3;
}
}
.danger {
.uni-group__title {
background-color: #FC6B69;
}
.uni-collapse-item__title-text {
color: #FC6B69;
}
.title-row {
color: #FC6B69;
}
}
} }
</style> </style>

View File

@ -1,181 +0,0 @@
<template>
<uni-popup ref="popup" type="center" @maskClick="show = false">
<view class="chart-popup">
<uni-datetime-picker v-model="range" type="daterange" start="2000-01-01" :end="end" rangeSeparator="至"
@change="changeTime" />
<view class="button-group" style="text-align: center;margin-top:20px;">
<button type="default" size="mini" @click="onReset">重置</button>
<button type="primary" size="mini" @click="onSearch" style="margin-left: 20px;">搜索</button>
</view>
<view class="chart-container">
<qiun-data-charts type="line" :reload="show" :chartData="chartsData" :canvas2d="true"
canvasId="scrollcolumnid" :optsWatch='false' :inScrollView="true" :pageScrollTop="pageScrollTop"
:opts="options" :ontouch="true" />
</view>
</view>
</uni-popup>
</template>
<script>
import {
getSingleBatteryData
} from '@/api/ems/site.js'
export default {
props: {
pageScrollTop: {
type: Number,
default: 0
}
},
data() {
return {
options: {
enableScroll: true,
xAxis: {
scrollShow: true,
itemCount: 4,
disableGrid: true
},
update: true,
duration: 0,
animation: false,
// enableScroll: true,
// padding: [10, 15, 10, 15]
},
show: false,
range: [],
end: "",
siteId: '',
deviceId: '',
clusterDeviceId: '',
dataType: '', //展示的数据类型 空值展示所有数据
loading: false,
chartsData: {},
}
},
methods: {
open({
siteId,
clusterDeviceId,
deviceId
}, dataType) {
this.$refs.popup.open()
this.loading = false
this.siteId = siteId
this.clusterDeviceId = clusterDeviceId
this.deviceId = deviceId
this.dataType = dataType
this.range = []
setTimeout(() => {
this.show = true
this.getData()
}, 300)
},
changeTime(val) {
this.range = val || []
},
onReset() {
this.range = []
this.getData()
},
onSearch() {
this.getData()
},
getData() {
if (this.loading) return
this.loading = true;
const {
siteId,
deviceId,
clusterDeviceId,
range: [startDate = '', endDate = '']
} = this;
this.chartsData?.series && (this.chartsData.series = [])
return getSingleBatteryData({
siteId,
deviceId,
clusterDeviceId,
startDate,
endDate
}).then(response => {
console.log('单体电池图表返回数据', response.data)
this.handledata(response?.data || [])
}).finally(() => {
this.loading = false;
})
},
handledata(data) {
let obj = {
voltage: '电压',
temperature: '温度',
soc: 'SOC',
soh: 'SOH',
},
categories = [],
dataTypeList = []
if (this.dataType) {
dataTypeList = [{
attr: this.dataType,
title: obj[this.dataType],
data: []
}]
} else {
dataTypeList = Object.entries(obj).map(([key, value]) => {
return {
attr: key,
title: value,
data: []
}
})
}
data.forEach(item => {
categories.push(item.dataTimestamp)
dataTypeList.forEach(i => {
i.data.push(item[i.attr] || undefined)
})
})
const series = dataTypeList.map(item => {
return {
"name": item.title,
"data": item.data
}
})
this.chartsData = JSON.parse(JSON.stringify({
categories,
series
}))
console.log('this.chartsData', this.chartsData)
}
},
mounted() {
const now = new Date(),
year = now.getFullYear(),
month = now.getMonth() + 1,
day = now.getDate()
this.end = year + '-' + month + '-' + day
}
}
</script>
<style lang="scss" scoped>
.chart-popup {
width: 360px;
background-color: #fff;
padding: 10px 15px;
.chart-container {
width: 100%;
height: 250px;
margin-top: 20px;
}
::v-deep {
uni-canvas {
height: 250px;
width: 100%;
}
}
}
</style>

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="container"> <view class="container">
<view class="search-icon" @click="openSearch"> <view class="search-icon" @click="openSearch">
<uni-icons type="search" size="40" color="#fff"></uni-icons> <uni-icons type="search" size="25" color="#fff"></uni-icons>
</view> </view>
<view class="list-container"> <view class="list-container">
<view class="no-data" v-if="list.length === 0">暂无数据</view> <view class="no-data" v-if="list.length === 0">暂无数据</view>
@ -10,7 +10,7 @@
<template v-slot:header> <template v-slot:header>
<view class="list-header"> <view class="list-header">
单体编号:{{item.deviceId}} 单体编号:{{item.deviceId}}
<button type="primary" size="mini" class="charts" @click="toDetail(item)">图表</button> <button type="primary" size="mini" class="charts-btn" @click="toDetail(item)">图表</button>
</view> </view>
</template> </template>
<template v-slot:body> <template v-slot:body>
@ -19,16 +19,17 @@
<uni-col :span="8"> <uni-col :span="8">
<view>簇号</view> <view>簇号</view>
</uni-col> </uni-col>
<uni-col :span="14"> <uni-col :span="16">
<view class="right">{{item.clusterDeviceId}}</view> <view class="right">{{item.clusterDeviceId || '-'}}</view>
</uni-col> </uni-col>
</uni-row> </uni-row>
<uni-row> <uni-row>
<uni-col :span="8"> <uni-col :span="8">
<view>电压V</view> <view>电压V</view>
</uni-col> </uni-col>
<uni-col :span="14"> <uni-col :span="16">
<view class="right color" @click="toDetail(item,'voltage')">{{item.voltage}} <view class="right color">
<text @click="toDetail(item,'voltage')">{{item.voltage | formatNumber}}</text>
</view> </view>
</uni-col> </uni-col>
</uni-row> </uni-row>
@ -36,9 +37,10 @@
<uni-col :span="8"> <uni-col :span="8">
<view>温度</view> <view>温度</view>
</uni-col> </uni-col>
<uni-col :span="14"> <uni-col :span="16">
<view class="right color" @click="toDetail(item,'temperature')"> <view class="right color">
{{item.temperature}} <text
@click="toDetail(item,'temperature')">{{item.temperature | formatNumber}}</text>
</view> </view>
</uni-col> </uni-col>
</uni-row> </uni-row>
@ -46,16 +48,20 @@
<uni-col :span="8"> <uni-col :span="8">
<view>SOC%</view> <view>SOC%</view>
</uni-col> </uni-col>
<uni-col :span="14"> <uni-col :span="16">
<view class="right color" @click="toDetail(item,'soc')">{{item.soc}}</view> <view class="right color">
<text @click="toDetail(item,'soc')">{{item.soc | formatNumber}}</text>
</view>
</uni-col> </uni-col>
</uni-row> </uni-row>
<uni-row> <uni-row>
<uni-col :span="8"> <uni-col :span="8">
<view>SOH%</view> <view>SOH%</view>
</uni-col> </uni-col>
<uni-col :span="14"> <uni-col :span="16">
<view class="right color" @click="toDetail(item,'soh')">{{item.soh}}</view> <view class="right color">
<text @click="toDetail(item,'soh')">{{item.soh | formatNumber}}</text>
</view>
</uni-col> </uni-col>
</uni-row> </uni-row>
</view> </view>
@ -63,7 +69,17 @@
</uni-list-item> </uni-list-item>
</uni-list> </uni-list>
</view> </view>
<chart ref="chart" :pageScrollTop="pageScrollTop" /> <uni-popup ref="popup" type="center" :animation="false" :mask-click="false" :is-mask-click="false"
@maskClick="maskClick">
<view class="chart-popup" v-if="showChart">
<date-range-select ref="chartDateRangeSelect" @updateDate="updateChartDate"
style="margin-bottom: 10px;" />
<view class="chart-container">
<qiun-data-charts type="area" :reload="showChart" :optsWatch='false' :opts="options"
:chartData="chartsData" :ontouch="true" :inScrollView="true" :pageScrollTop="pageScrollTop" />
</view>
</view>
</uni-popup>
<uni-popup ref="searchPopup" type="center"> <uni-popup ref="searchPopup" type="center">
<view class="uni-pa-5 search-container"> <view class="uni-pa-5 search-container">
<uni-forms ref="form"> <uni-forms ref="form">
@ -75,6 +91,9 @@
<uni-data-select :clear="false" v-model="search.clusterId" <uni-data-select :clear="false" v-model="search.clusterId"
:localdata="clusterOptions"></uni-data-select> :localdata="clusterOptions"></uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="编号">
<uni-easyinput type="text" v-model="search.batteryId" placeholder="请输入编号" />
</uni-forms-item>
</uni-forms> </uni-forms>
<view class="button-group" style="text-align: center;"> <view class="button-group" style="text-align: center;">
<button type="default" size="mini" @click="onReset">重置</button> <button type="default" size="mini" @click="onReset">重置</button>
@ -86,26 +105,19 @@
</template> </template>
<script> <script>
import Chart from './Chart.vue' import DateRangeSelect from './../DateRangeSelect.vue'
import { import {
getStackNameList, getStackNameList,
getClusterNameList, getClusterNameList,
getClusterDataInfoList, getClusterDataInfoList,
getSingleBatteryData
} from '@/api/ems/site.js' } from '@/api/ems/site.js'
import { import {
mapState mapState
} from 'vuex' } from 'vuex'
export default { export default {
components: { components: {
Chart DateRangeSelect
},
computed: {
...mapState({
workStatusOptions: (state) =>
state.ems.workStatusOptions,
communicationStatusOptions: (state) =>
state.ems.communicationStatusOptions,
})
}, },
data() { data() {
return { return {
@ -116,17 +128,160 @@
clusterOptions: [], clusterOptions: [],
search: { search: {
stackId: '', stackId: '',
clusterId: '' clusterId: '',
batteryId: ''
}, },
list: [], list: [],
siteId: '', siteId: '',
pageScrollTop: 0, pageScrollTop: 0,
// ucharts数据
showChart: false,
chartSearchData: {
},
options: {
padding: [10, 5, 0, 10],
duration: 0,
animation: false,
dataLabel: false,
enableScroll: true,
xAxis: {
scrollShow: true,
itemCount: 3,
disableGrid: true
},
extra: {
area: {
type: "curve",
opacity: 0.2,
addLine: true,
width: 2,
gradient: true,
activeType: "hollow"
}
}
},
range: [],
end: Date.now(),
loading: false,
chartsData: {},
// ucharts数据结束
} }
}, },
onPageScroll(e) { onPageScroll(e) {
this.pageScrollTop = e.scrollTop this.pageScrollTop = e.scrollTop
}, },
onReachBottom() {
if (this.list.length >= this.total) {
return console.log('数据已经加载完成')
}
this.pageNum += 1 //每次搜索从1开始搜索
this.getTableData()
},
methods: { methods: {
//ucharts方法
maskClick() {
this.showChart = false
this.$refs.popup.close()
},
chartOpen({
siteId,
clusterDeviceId,
deviceId
}, dataType) {
this.loading = false
this.chartSearchData = {
clusterDeviceId,
deviceId,
dataType
}
this.$refs.popup.open()
setTimeout(() => {
this.showChart = true
this.$nextTick(() => {
this.$refs.chartDateRangeSelect.init()
})
}, 500)
},
updateChartDate(data) {
this.range = data || []
this.getChartData()
},
getChartData() {
if (this.loading) return
this.loading = true;
const {
siteId,
chartSearchData: {
deviceId,
clusterDeviceId
},
range: [startDate = '', endDate = '']
} = this;
this.chartsData = {}
return getSingleBatteryData({
siteId,
deviceId,
clusterDeviceId,
startDate,
endDate
}).then(response => {
this.handledata(response?.data || [])
}).finally(() => {
this.loading = false;
})
},
handledata(data) {
let obj = {
voltage: '电压',
temperature: '温度',
soc: 'SOC',
soh: 'SOH',
},
categories = [],
dataTypeList = [],
{
dataType
} = this.chartSearchData
if (dataType) {
dataTypeList = [{
attr: dataType,
title: obj[dataType],
data: []
}]
} else {
dataTypeList = Object.entries(obj).map(([key, value]) => {
return {
attr: key,
title: value,
data: []
}
})
}
data.forEach(item => {
categories.push(item.dataTimestamp)
dataTypeList.forEach(i => {
i.data.push(item[i.attr] || undefined)
})
})
const series = dataTypeList.map(item => {
return {
"name": item.title,
"data": item.data
}
})
this.chartsData = JSON.parse(JSON.stringify({
categories,
series
}))
console.log('this.chartsData', this.chartsData)
},
//ucharts方法结束
openSearch() { openSearch() {
this.$refs.searchPopup.open() this.$refs.searchPopup.open()
}, },
@ -140,17 +295,13 @@
} = item, { } = item, {
siteId siteId
} = this } = this
this.$refs.chart.open({ // this.$refs.chart.open({
this.chartOpen({
siteId, siteId,
clusterDeviceId, clusterDeviceId,
deviceId deviceId
}, dataType) }, dataType)
}, },
onReachBottom() {
console.log('触底了')
this.pageNum += 1 //每次搜索从1开始搜索
this.getTableData()
},
// 搜索 // 搜索
onSearch() { onSearch() {
this.pageNum = 1 //每次搜索从1开始搜索 this.pageNum = 1 //每次搜索从1开始搜索
@ -163,7 +314,8 @@
onReset() { onReset() {
this.search = { this.search = {
stackId: '', stackId: '',
clusterId: '' clusterId: '',
batteryId: ''
} }
this.clusterOptions = [] this.clusterOptions = []
this.pageNum = 1 this.pageNum = 1
@ -178,9 +330,7 @@
} }
}, },
getStackList() { getStackList() {
getStackNameList({ getStackNameList(this.siteId).then(response => {
siteId: this.siteId
}).then(response => {
this.stackOptions = JSON.parse(JSON.stringify(response?.data || [])).map(item => { this.stackOptions = JSON.parse(JSON.stringify(response?.data || [])).map(item => {
return { return {
text: item.deviceName, text: item.deviceName,
@ -212,7 +362,8 @@
} }
const { const {
stackId: stackDeviceId, stackId: stackDeviceId,
clusterId: clusterDeviceId clusterId: clusterDeviceId,
batteryId
} = this.search } = this.search
const { const {
siteId, siteId,
@ -222,20 +373,21 @@
getClusterDataInfoList({ getClusterDataInfoList({
stackDeviceId, stackDeviceId,
clusterDeviceId, clusterDeviceId,
batteryId,
siteId, siteId,
pageNum, pageNum,
pageSize pageSize
}).then(response => { }).then(response => {
this.list = this.list.concat(response?.rows || []); this.list = this.list.concat(response?.rows?.[0]?.batteryList || []);
this.total = response?.total || 0 this.total = response?.total || 0
}).finally(() => { }).finally(() => {
uni.hideLoading() uni.hideLoading()
}) })
}, },
}, },
mounted() { onLoad(options) {
// uni.showLoading() // uni.showLoading()
this.siteId = this.$route.query.siteId || '' this.siteId = options.siteId || ''
this.getStackList() this.getStackList()
this.getTableData(true) this.getTableData(true)
} }
@ -245,21 +397,18 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.container { .container {
position: relative; position: relative;
background: #f5f5f5;
// position: fixed;
// width: 100%;
// height: 100%;
// overflow-y: auto;
.search-icon { .search-icon {
position: fixed; position: fixed;
bottom: 20px; bottom: 40rpx;
right: 20px; right: 40rpx;
z-index: 1; z-index: 1;
height: 50px; height: 60rpx;
width: 50px; width: 60rpx;
background-color: #007aff; background-color: #007aff;
border-radius: 100%; border-radius: 100%;
line-height: 50px; line-height: 60rpx;
text-align: center; text-align: center;
} }
@ -270,14 +419,26 @@
} }
.list-container { .list-container {
// z-index: 10; padding-top: 40rpx;
padding-top: 20px; padding-bottom: 100rpx;
padding-bottom: 50px; background: transparent;
background: #ffffff;
::v-deep { ::v-deep {
.uni-list {
background: transparent;
}
.uni-list-item {
padding: 10rpx 30rpx;
background-color: transparent !important;
}
.uni-list-item__container { .uni-list-item__container {
background-color: #ffffff;
padding: 0;
display: block; display: block;
border-radius: 10rpx;
box-shadow: 0 1px 16rpx 1px rgba($color: #a5a5a5, $alpha: 0.2);
} }
.uni-list--border-top, .uni-list--border-top,
@ -288,45 +449,69 @@
} }
.list-header { .list-header {
background-color: #05AEA3; border-radius: 14rpx 14rpx 0 0;
color: #fff; border-bottom: 1px solid #eee;
padding: 10px 15px; padding: 20rpx 30rpx;
border-radius: 5px 5px 0 0; font-weight: 700;
font-size: 28rpx;
position: relative; position: relative;
color: #333;
.charts { .charts-btn {
position: absolute; position: absolute;
top: 50%; top: 50%;
right: 15px; right: 20rpx;
font-size: 26rpx;
transform: translateY(-50%); transform: translateY(-50%);
// background-color: #ff7300; background-color: #4c7af3;
} }
} }
.list-body { .list-body {
padding: 10px 15px; padding: 10rpx 0;
border: 1px solid #eee;
border-top: none; >.uni-row {
border-radius: 0 0 5px 5px; font-size: 26rpx;
font-size: 14px; line-height: 36rpx;
color: #666; color: #000;
padding: 12rpx 30rpx;
.left {
color: #333;
text-align: left;
}
.right { .right {
color: #000; text-align: right;
&.color {
color: #4c7af3;
font-weight: 700;
}
}
} }
.color { }
color: #007aff;
} }
.uni-row { .chart-popup {
margin-bottom: 10px; width: 720rpx;
background-color: #fff;
padding: 20rpx 30rpx;
&:last-child { .chart-container {
margin-bottom: 0; width: 100%;
} height: 500rpx;
margin-top: 40rpx;
}
::v-deep {
uni-canvas {
height: 500rpx;
width: 100%;
} }
} }
} }
} }
</style> </style>

View File

@ -1,90 +1,477 @@
<template> <template>
<view class="work-container"> <view class="work-container">
<!-- 站点选择列表 --> <site-switch-header :site-id="siteId" :site-type-options="siteTypeOptions" :site-address="baseInfo.siteAddress"
<uni-section title="站点选择" type="line" titleFontSize='16px' class="uni-pa-5"> :running-time="baseInfo.runningTime" @change="selectedSite" />
<uni-data-select :clear="false" v-model="siteId" :localdata="siteList" <!-- 静态信息 -->
@change="selectedSite"></uni-data-select> <view class="base-info">
</uni-section> <uni-group mode="card" class="install-data">
<!-- 菜单 --> <uni-grid :column="2" :showBorder="false" :square="false" :highlight="false">
<!-- <uni-section title="工作台" type="line" titleFontSize='16px'></uni-section> --> <uni-grid-item>
<view class="grid-item-box">
<view class="title">装机功率(MWh)</view>
<view class="text">{{baseInfo.installPower | formatNumber}}</view>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box">
<view class="title">装机容量(MWh)</view>
<view class="text">{{baseInfo.installCapacity | formatNumber}}</view>
</view>
</uni-grid-item>
</uni-grid>
</uni-group>
<!-- 工作台 -->
<uni-section title="工作台" type="line" class="sections-list">
<view class="grid-body"> <view class="grid-body">
<uni-grid :column="4" :showBorder="false" @change="toDetail"> <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="grid-item-box work-box">
<uni-icons :type="item.icon" size="30"></uni-icons> <view class="icon iconfont" :class="item.icon" size="30"></view>
<text class="text">{{item.text}}</text> <text class="text">{{item.text}}</text>
</view> </view>
</uni-grid-item> </uni-grid-item>
</uni-grid> </uni-grid>
</view> </view>
</uni-section>
<!-- 一周充放曲线 uchart的组件最好放在同级-->
<uni-section title="一周充放曲线" type="line" class="sections-list">
<date-range-select ref="weekChartDateRangeSelect" @updateDate="updateWeekChartDate" />
<view style="width:100%;height: 250px;">
<qiun-data-charts type="area" :chartData="weekChartData" :optsWatch='false' :inScrollView="true"
:pageScrollTop="pageScrollTop" :opts="options" :ontouch="true" />
</view>
</uni-section>
<!-- 当日功率曲线 uchart的组件最好放在同级-->
<uni-section title="当日功率曲线" type="line" class="sections-list">
<date-range-select ref="activeChartDateRangeSelect" @updateDate="updateActiveChartDate" />
<view style="width:100%;height: 250px;">
<qiun-data-charts type="area" :chartData="activeChartData" :optsWatch='false' :inScrollView="true"
:pageScrollTop="pageScrollTop" :opts="glqxOptions" :ontouch="true" />
</view>
</uni-section>
</view>
</view> </view>
</template> </template>
<script> <script>
import { import {
getAllSites mapGetters
} from 'vuex'
import DateRangeSelect from './DateRangeSelect.vue'
import SiteSwitchHeader from '@/components/SiteSwitchHeader/index.vue'
import {
getAllSites,
getSingleSiteBaseInfo,
getProjectDisplayData,
getPointConfigCurve,
getSiteAllDeviceCategory
} from '@/api/ems/site.js' } from '@/api/ems/site.js'
const createSiteTypeOptions = () => ([{
text: '储能',
value: 'cn',
children: []
},
{
text: '光能',
value: 'gn',
children: []
},
{
text: '岸电',
value: 'ad',
children: []
}
])
export default { export default {
components: {
DateRangeSelect,
SiteSwitchHeader
},
data() { data() {
return { return {
siteList: [], // 图表数据
weekChartTimeRange: [],
activeChartTimeRange: [],
weekChartData: {},
activeChartData: {},
curveDisplayData: [],
curveDisplayLoadingPromise: null,
pageScrollTop: 0,
glqxOptions: {
padding: [10, 5, 0, 10],
dataLabel: false,
enableScroll: true,
xAxis: {
scrollShow: true,
itemCount: 3,
disableGrid: true
},
extra: {
area: {
type: "curve",
opacity: 0.2,
addLine: true,
width: 2,
gradient: true,
activeType: "hollow"
}
}
// update: true,
// duration: 2,
// animation: false,
// enableScroll: true,
// padding: [10, 15, 10, 15]
},
options: {
padding: [10, 5, 0, 10],
dataLabel: false,
enableScroll: true,
xAxis: {
scrollShow: true,
itemCount: 5,
disableGrid: true
},
extra: {
area: {
type: "curve",
opacity: 0.2,
addLine: true,
width: 2,
gradient: true,
activeType: "hollow"
}
}
// update: true,
// duration: 2,
// animation: false,
// enableScroll: true,
// padding: [10, 15, 10, 15]
},
// 图表数据结束
deviceCategoryOptions: [], //当前站点包含的设备类别
siteTypeOptions: createSiteTypeOptions(),
siteId: '', //选择的站点ID siteId: '', //选择的站点ID
baseInfo: {}, //站点基本信息
gridList: [{ gridList: [{
page: 'bmszl', page: 'bmszl',
icon: 'map-filled', icon: 'icon-BMS',
text: 'BMS总览', text: 'BMS总览',
categoryName: 'STACK'
}, },
{ {
page: 'bmsdcc', page: 'bmsdcc',
icon: 'map', icon: 'icon-a-dianchicunengliangkuai',
text: 'BMS电池簇', text: 'BMS电池簇',
categoryName: 'CLUSTER'
}, },
{ {
page: 'pcs', page: 'pcs',
icon: 'flag-filled', icon: 'icon-PCS',
text: 'PCS', text: 'PCS',
categoryName: 'PCS'
}, },
{ {
page: 'db', page: 'db',
icon: 'smallcircle', icon: 'icon-dianbiao4',
text: '电表', text: '电表',
categoryName: 'AMMETER'
},
{
page: 'yl',
icon: 'icon-gongneng-diandongji',
text: '冷却',
categoryName: 'COOLING'
}, },
{ {
page: 'dtdc', page: 'dtdc',
icon: 'smallcircle-filled', icon: 'icon-dantidianchi',
text: '单体电池', text: '单体电池',
categoryName: 'BATTERY'
} }
] ]
} }
}, },
computed: {
...mapGetters(['belongSite', 'currentSiteId']),
siteGirdList() {
return this.gridList.filter(i => this.deviceCategoryOptions.includes(i.categoryName))
}
},
methods: { methods: {
isAvailableSite(siteId) {
const allSites = this.siteTypeOptions.reduce((result, typeItem) => {
return result.concat(typeItem.children || [])
}, [])
const site = allSites.find(item => item.value === siteId)
return !!(site && !site.disable)
},
// 更新一周冲放曲线时间范围 重置图表
updateWeekChartDate(data) {
this.weekChartTimeRange = data || []
this.siteId && this.getWeekChartData()
},
// 更新当日功率曲线时间范围 重置图表
updateActiveChartDate(data) {
this.activeChartTimeRange = data || []
this.siteId && this.getGVQXData()
},
toDetail(e) { toDetail(e) {
if (!this.siteId) return uni.showToast({
title: "请选择清单",
icon: 'none'
})
const { const {
index index
} = e.detail } = e.detail
this.$tab.navigateTo(`/pages/work/${this.gridList[index].page}/index?siteId=${this.siteId}`) this.$tab.navigateTo(`/pages/work/${this.siteGirdList[index].page}/index?siteId=${this.siteId}`)
}, },
selectedSite(id) { selectedSite(data) {
this.siteId = id const siteObj = (data.detail.value || [])[1]
const value = siteObj?.value
if (!value) return
if (value === this.siteId) return
this.siteId = value
this.$store.commit('SET_CURRENTSITEID', value)
this.updateSiteInfo()
},
updateSiteInfo() {
if (!this.siteId) return
this.curveDisplayData = []
this.curveDisplayLoadingPromise = null
this.getSiteBaseInfo()
this.getWeekChartData()
this.getGVQXData()
this.getSiteDeviceCategory()
},
getFieldName(fieldCode) {
const raw = String(fieldCode || '').trim()
if (!raw) return ''
const index = raw.lastIndexOf('__')
return index >= 0 ? raw.slice(index + 2) : raw
},
normalizeDateTime(value, endOfDay) {
const raw = String(value || '').trim()
if (!raw) return ''
if (raw.includes(' ')) return raw
return `${raw} ${endOfDay ? '23:59:59' : '00:00:00'}`
},
parseToTimestamp(value) {
if (!value) return null
const timestamp = new Date(value).getTime()
return Number.isNaN(timestamp) ? null : timestamp
},
ensureCurveDisplayData() {
if (!this.siteId) return Promise.resolve([])
if (this.curveDisplayData.length > 0) return Promise.resolve(this.curveDisplayData)
if (this.curveDisplayLoadingPromise) return this.curveDisplayLoadingPromise
this.curveDisplayLoadingPromise = getProjectDisplayData(this.siteId)
.then(response => {
this.curveDisplayData = response?.data || []
return this.curveDisplayData
})
.catch(() => {
this.curveDisplayData = []
return []
})
.finally(() => {
this.curveDisplayLoadingPromise = null
})
return this.curveDisplayLoadingPromise
},
fetchCurveSeries(pointId, name, startTime, endTime) {
if (!pointId) return Promise.resolve(null)
return getPointConfigCurve({
siteId: this.siteId,
pointId,
pointType: 'data',
rangeType: 'custom',
startTime,
endTime
}).then(response => {
const list = response?.data || []
const points = list.map(item => {
const timestamp = this.parseToTimestamp(item.dataTime)
const value = Number(item.pointValue)
if (!timestamp || Number.isNaN(value)) return null
return {
timestamp,
label: item.dataTime,
value
}
}).filter(Boolean)
return {
name,
points
}
}).catch(() => null)
},
buildLineChartData(seriesList) {
const validSeries = (seriesList || []).filter(item => item && (item.points || []).length > 0)
if (validSeries.length === 0) {
return {
categories: [],
series: []
}
}
const labelByTimestamp = {}
const timestampSet = new Set()
validSeries.forEach(item => {
item.points.forEach(point => {
timestampSet.add(point.timestamp)
if (!labelByTimestamp[point.timestamp]) {
labelByTimestamp[point.timestamp] = point.label
}
})
})
const sortedTimestamps = Array.from(timestampSet).sort((a, b) => a - b)
const categories = sortedTimestamps.map(item => labelByTimestamp[item])
const series = validSeries.map(item => {
const pointMap = {}
item.points.forEach(point => {
pointMap[point.timestamp] = point.value
})
return {
name: item.name,
data: sortedTimestamps.map(timestamp => pointMap[timestamp] ?? null)
}
})
return {
categories,
series
} }
}, },
// 页面切换不会重新调用如果希望每次切换页面都重新调接口使用onShow findActiveCurveRow(sectionRows, keywords = []) {
mounted() { const keywordSet = new Set((keywords || []).map(item => String(item || '').toLowerCase()))
return (sectionRows || []).find(row => {
const fieldCode = this.getFieldName(row?.fieldCode).toLowerCase()
const fieldName = String(row?.fieldName || '').toLowerCase()
if (keywordSet.has(fieldCode) || keywordSet.has(fieldName)) return true
return Array.from(keywordSet).some(keyword => fieldCode.includes(keyword) || fieldName.includes(keyword))
})
},
getSiteList() {
getAllSites().then(response => { getAllSites().then(response => {
console.log('返回数据', response)
const data = response?.data || [] const data = response?.data || []
this.siteList = data.map(item => { const canAccessAll = !this.belongSite || this.belongSite.length === 0 || this.belongSite.includes('all')
return { const siteTypeOptions = createSiteTypeOptions().map(item => ({
...item,
children: []
}))
data.forEach(item => {
if (!canAccessAll && !this.belongSite.includes(item.siteId)) return
const siteType = (item.siteType || item.type || 'cn').toString().toLowerCase()
const typeOption = siteTypeOptions.find(i => i.value === siteType) || siteTypeOptions.find(i => i.value === 'cn')
if (!typeOption) return
typeOption.children.push({
text: item.siteName, text: item.siteName,
value: item.siteId, value: item.siteId,
id: item.id id: item.id
}
}) })
})
this.siteTypeOptions = siteTypeOptions.filter(item => (item.children || []).length > 0)
const siteChildren = this.siteTypeOptions.reduce((result, typeItem) => {
return result.concat(typeItem.children || [])
}, [])
// 设置默认展示的站点 // 设置默认展示的站点
data.length > 0 && (this.siteId = data[0].siteId) const defaultSiteId = this.isAvailableSite(this.currentSiteId) ? this.currentSiteId : (siteChildren[0]?.value || '')
}) if (defaultSiteId) {
this.siteId = defaultSiteId
this.$store.commit('SET_CURRENTSITEID', defaultSiteId)
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)
const month = time.getMonth() + 1,
day = time.getDate()
return `${month<10?'0'+month : month}/${day<10 ? '0'+day : day}`
},
getGVQXData() {
this.$refs.activeChartDateRangeSelect.showBtnLoading(true)
const startTime = this.normalizeDateTime(this.activeChartTimeRange[0], false)
const endTime = this.normalizeDateTime(this.activeChartTimeRange[1], true)
this.ensureCurveDisplayData().then(displayData => {
const sectionRows = (displayData || []).filter(item =>
item && item.sectionName === '当日功率曲线' && item.useFixedDisplay !== 1 && item.dataPoint
)
const targetRows = [{
name: '电网功率',
row: this.findActiveCurveRow(sectionRows, ['gridpower', '电网功率'])
},
{
name: '负载功率',
row: this.findActiveCurveRow(sectionRows, ['loadpower', '负载功率'])
},
{
name: '储能功率',
row: this.findActiveCurveRow(sectionRows, ['storagepower', '储能功率'])
}
].filter(item => item.row && item.row.dataPoint)
const tasks = targetRows.map(item => this.fetchCurveSeries(String(item.row.dataPoint).trim(), item.name, startTime,
endTime))
return Promise.all(tasks).then(series => {
this.activeChartData = JSON.parse(JSON.stringify(this.buildLineChartData((series || []).filter(Boolean))))
})
}).finally(() => this.$refs.activeChartDateRangeSelect.showBtnLoading(false))
},
getWeekChartData() {
this.$refs.weekChartDateRangeSelect.showBtnLoading(true)
const startTime = this.normalizeDateTime(this.weekChartTimeRange[0], false)
const endTime = this.normalizeDateTime(this.weekChartTimeRange[1], true)
this.ensureCurveDisplayData().then(displayData => {
const sectionRows = (displayData || []).filter(item =>
item && item.sectionName === '一周充放曲线' && item.useFixedDisplay !== 1 && item.dataPoint
)
const tasks = sectionRows.map(row => {
const pointId = String(row.dataPoint || '').trim()
if (!pointId) return Promise.resolve(null)
const name = row.fieldName || this.getFieldName(row.fieldCode) || pointId
return this.fetchCurveSeries(pointId, name, startTime, endTime)
})
return Promise.all(tasks).then(series => {
this.weekChartData = JSON.parse(JSON.stringify(this.buildLineChartData((series || []).filter(Boolean))))
})
}).finally(() => this.$refs.weekChartDateRangeSelect.showBtnLoading(false))
}
},
watch: {
currentSiteId(newSiteId) {
if (!newSiteId || newSiteId === this.siteId) return
if (!this.isAvailableSite(newSiteId)) return
this.siteId = newSiteId
this.updateSiteInfo()
}
},
// 页面切换不会重新调用如果希望每次切换页面都重新调接口使用onShow
onLoad() {
this.$nextTick(() => {
this.getSiteList()
this.$refs.weekChartDateRangeSelect.init()
this.$refs.activeChartDateRangeSelect.init(true)
})
},
// 页面滚动 设置pageScrollTop chart显示需要
onPageScroll(e) {
this.pageScrollTop = e.scrollTop
},
} }
</script> </script>
@ -97,10 +484,11 @@
background-color: #fff; background-color: #fff;
min-height: 100%; min-height: 100%;
height: auto; height: auto;
font-size: 26rpx;
line-height: 30rpx;
} }
view { view {
font-size: 14px;
line-height: inherit; line-height: inherit;
} }
@ -108,27 +496,107 @@
.text { .text {
text-align: center; text-align: center;
font-size: 26rpx;
margin-top: 10rpx; margin-top: 10rpx;
} }
// 基本信息
.base-info {
margin-top: -80rpx;
border-radius: 80rpx 80rpx 0 0;
padding: 30rpx;
background-color: #fff;
// 装机功率
.install-data {
.grid-item-box { .grid-item-box {
flex: 1; padding-top: 6rpx;
/* #ifndef APP-NVUE */ padding-bottom: 6rpx;
display: flex;
/* #endif */ .text {
flex-direction: column; margin-top: 20rpx;
align-items: center; color: #000;
justify-content: center; }
padding: 15px 0;
} }
.uni-margin-wrap { }
width: 690rpx;
.sections-list {
margin-bottom: 10rpx;
::v-deep &>.uni-section-header {
font-weight: 700;
font-size: 26rpx;
line-height: 30rpx;
}
}
.sections-list:not(:first-child) {
margin-top: 40rpx;
}
::v-deep {
.uni-section__content-title {
font-size: 26rpx !important;
}
.uni-select__input-box {
width: 100%; width: 100%;
;
.uni-select__input-text {
font-size: 24rpx;
}
} }
.uni-select__selector-empty,
.uni-select__selector-item {
font-size: 24rpx;
line-height: 36rpx;
padding-top: 10rpx;
padding-bottom: 10rpx;
text-align: left;
}
// .uni-date__x-input {
// height: 50rpx;
// line-height: 50rpx;
// font-size: 26rpx;
// }
}
.work-box {
.icon {
font-size: 52rpx;
color: #547ef4;
}
.text {
font-size: 26rpx;
padding-top: 10rpx;
color: #000;
}
}
.base-lists {
font-size: 24rpx;
line-height: 40rpx;
padding: 10rpx 20rpx;
padding-left: 40rpx;
.left {
width: 220rpx;
display: inline-block;
color: #666;
}
.right {
color: #333;
}
}
}
@media screen and (min-width: 500px) {} @media screen and (min-width: 500px) {}
</style> </style>

View File

@ -1,97 +1,122 @@
<template> <template>
<view class="page-container"> <view class="page-container">
<!-- 顶部6个数据 --> <!-- 顶部总览横向展示 -->
<uni-grid class="info-grid" :column="2" :showBorder="false" style="margin-bottom: 10px;"> <scroll-view class="info-overview-scroll" scroll-x>
<uni-grid-item v-for="(item,index) in runningHeadData" :key="index+'head'"> <view class="info-overview-row">
<view class="info-overview-card" v-for="(item,index) in runningHeadCards" :key="index+'head'">
<view class="grid-item-box"> <view class="grid-item-box">
<image :src="require('@/static/images/ems/pcs/'+item.img+'.jpg')" class="icon" alt="" />
<view class="title">{{item.title}}</view> <view class="title">{{item.title}}</view>
<text class="text">{{runningHeadInfo[item.attr] | formatNumber}}</text> <view class="text">{{item.value | formatNumber}}</view>
</view> </view>
</uni-grid-item> </view>
</uni-grid> </view>
</scroll-view>
<!-- 设备标签横向展示 -->
<scroll-view class="pcs-tags-scroll" scroll-x>
<view class="pcs-tags-row">
<view
class="pcs-tag-item"
:class="{ active: !selectedPcsId }"
@click="handleTagClick('')"
>
全部
</view>
<view
v-for="(item, index) in pcsDeviceList"
:key="index + 'pcsTag'"
class="pcs-tag-item"
:class="{ active: selectedPcsId === (item.deviceId || item.id || '') }"
@click="handleTagClick(item.deviceId || item.id || '')"
>
{{ item.deviceName || item.deviceId || item.id || 'PCS' }}
</view>
</view>
</scroll-view>
<uni-collapse ref="collapse" accordion v-if="filteredList.length > 0">
<uni-collapse-item v-for="(item,index) in filteredList" :key="index+'pcs'" :open="index===0"
class="common-collapse-item" :class="handleCardClass(item)">
<uni-collapse ref="collapse" accordion v-if="list.length > 0">
<uni-collapse-item v-for="(item,index) in list" :key="item.deviceId+'pcs'" :open="index===0"
:class="item.workStatus === '1' ? 'danger' : item.workStatus === '2' ? 'close' : 'running'">
<template v-slot:title> <template v-slot:title>
<view class="title-row"> <view class='title-wrapper'>
<view class="title">{{index+1}}#{{item.deviceName || ''}}</view> <view class="top">
<view class="msg"> <view class="status">{{formatDictValue((PCSWorkStatusOptions || {}), item.workStatus, '暂无数据')}}</view>
<view>{{communicationStatusOptions[item.communicationStatus] || ''}}</view> <text class="name">{{item.deviceName}}</text>
<view>数据更新时间{{item.dataUpdateTime || ''}}</view>
</view> </view>
</view> </view>
</template> </template>
<view> <view class='content'>
<uni-group mode="card"> <!-- 设备状态栏 -->
<uni-grid :column="4" :showBorder="false"> <uni-group mode="card" class="status-card-group no-wrapper-padding">
<uni-grid-item> <view class="flex-container">
<view class="flex-lists">
<view class="grid-item-box"> <view class="grid-item-box">
<view class="title">工作状态</view> <view class="title">工作状态</view>
<text class="text" <text
:class="item.workStatus === '0' ? 'status-running' : 'status-danger'">{{workStatusOptions[item.workStatus]}}</text> class="text work-status-color">{{formatDictValue((PCSWorkStatusOptions || {}), item.workStatus)}}</text>
</view> </view>
</uni-grid-item> </view>
<uni-grid-item> <view class="flex-lists">
<view class="grid-item-box"> <view class="grid-item-box">
<view class="title">并网状态</view> <view class="title">并网状态</view>
<text class="text">{{gridStatusOptions[item.gridStatus]}}</text> <text class="text">{{formatDictValue((gridStatusOptions || {}), item.gridStatus)}}</text>
</view> </view>
</uni-grid-item> </view>
<uni-grid-item> <view class="flex-lists">
<view class="grid-item-box"> <view class="grid-item-box">
<view class="title">设备状态</view> <view class="title">设备状态</view>
<text class="text" <text class="text">{{formatDictValue((deviceStatusOptions || {}), item.deviceStatus)}}</text>
:class="item.deviceStatus === '0' ? 'status-running' : 'status-danger'">{{deviceStatusOptions[item.deviceStatus]}}</text>
</view> </view>
</uni-grid-item> </view>
<uni-grid-item> <view class="flex-lists">
<view class="grid-item-box"> <view class="grid-item-box">
<view class="title">控制模式</view> <view class="title">控制模式</view>
<text class="text">{{controlModeOptions[item.controlMode]}}</text> <text class="text">{{formatDictValue((controlModeOptions || {}), item.controlMode)}}</text>
</view>
</view>
</view> </view>
</uni-grid-item>
</uni-grid>
</uni-group> </uni-group>
<!-- infoData --> <!-- 设备数据 -->
<uni-group mode="card" <uni-group mode="card" class="data-card-group"
:style="{marginBottom:!item.pcsBranchInfoList || item.pcsBranchInfoList.length === 0 ?'25px' : ''}"> :style="{marginBottom:!item.pcsBranchInfoList || item.pcsBranchInfoList.length === 0 ?'25px' : ''}">
<uni-grid :column="2" showBorder class="info-grid"> <uni-row v-for="(infoDataItem,infoDataIndex) in infoData" :key="infoDataIndex+'infoData'"
<uni-grid-item v-for="(infoDataItem,infoDataIndex) in infoData" class="data-row">
:key="infoDataIndex+'infoData'"> <uni-col :span="8">
<view class="grid-item-box">
<view class="title">{{infoDataItem.label}}</view> <view class="title">{{infoDataItem.label}}</view>
<text class="text">{{item[infoDataItem.attr] | formatNumber}} </uni-col>
<uni-col :span="16">
<view class="value">{{item[infoDataItem.attr] | formatNumber}}
<text v-if="infoDataItem.unit" v-html="infoDataItem.unit"></text> <text v-if="infoDataItem.unit" v-html="infoDataItem.unit"></text>
</text>
</view> </view>
</uni-grid-item> </uni-col>
</uni-grid> </uni-row>
</uni-group> </uni-group>
<!-- 支路 --> <!-- 支路 -->
<uni-group class="pcs-branch-group" :title="`支路${pcsBranchIndex+1}`" mode="card" <uni-group class="branch-card-group" :title="`支路${pcsBranchIndex+1}`" mode="card"
v-for="(pcsBranchItem,pcsBranchIndex) in item.pcsBranchInfoList" v-for="(pcsBranchItem,pcsBranchIndex) in item.pcsBranchInfoList"
:key="pcsBranchIndex+'pcsBranchInfoList'"> :key="pcsBranchIndex+'pcsBranchInfoList'">
<uni-grid :column="3" :showBorder="false" class="info-grid"> <view class="flex-container">
<uni-grid-item> <view class="flex-lists">
<view class="grid-item-box"> <view class="grid-item-box">
<view class="title">直流功率</view> <view class="title">直流功率</view>
<text class="text">{{pcsBranchItem.dcPower}}kW</text> <text class="text">{{pcsBranchItem.dcPower}}kW</text>
</view> </view>
</uni-grid-item> </view>
<uni-grid-item> <view class="flex-lists">
<view class="grid-item-box"> <view class="grid-item-box">
<view class="title">直流电压</view> <view class="title">直流电压</view>
<text class="text">{{pcsBranchItem.dcVoltage}}V</text> <text class="text">{{pcsBranchItem.dcVoltage}}V</text>
</view> </view>
</uni-grid-item> </view>
<uni-grid-item> <view class="flex-lists">
<view class="grid-item-box"> <view class="grid-item-box">
<view class="title">直流电流</view> <view class="title">直流电流</view>
<text class="text">{{pcsBranchItem.dcCurrent}}A</text> <text class="text">{{pcsBranchItem.dcCurrent}}A</text>
</view> </view>
</uni-grid-item> </view>
</uni-grid> </view>
</uni-group> </uni-group>
</view> </view>
</uni-collapse-item> </uni-collapse-item>
@ -105,8 +130,8 @@
<script> <script>
import { import {
getRunningHeadInfo, getProjectDisplayData,
getPcsDetailInfo getPcsNameList
} from '@/api/ems/site.js' } from '@/api/ems/site.js'
import { import {
mapState mapState
@ -114,8 +139,8 @@
export default { export default {
computed: { computed: {
...mapState({ ...mapState({
workStatusOptions: (state) => PCSWorkStatusOptions: (state) =>
state.ems.workStatusOptions, state.ems.PCSWorkStatusOptions,
communicationStatusOptions: (state) => communicationStatusOptions: (state) =>
state.ems.communicationStatusOptions, state.ems.communicationStatusOptions,
deviceStatusOptions: (state) => deviceStatusOptions: (state) =>
@ -124,129 +149,258 @@
state.ems.gridStatusOptions, state.ems.gridStatusOptions,
controlModeOptions: (state) => controlModeOptions: (state) =>
state.ems.controlModeOptions, state.ems.controlModeOptions,
}) }),
runningHeadCards() {
const sectionData = (this.runningDisplayData || []).filter(item => item.sectionName === '运行概览')
return sectionData.map((item, index) => ({
title: item.fieldName,
value: item.fieldValue,
img: this.getHeadCardImg(item, index)
}))
},
filteredList() {
if (!this.selectedPcsId) {
return this.list || []
}
return (this.list || []).filter(item => (item.deviceId || '') === this.selectedPcsId)
}
}, },
data() { data() {
return { return {
runningHeadData: [{ runningDisplayData: [],
title: '实时有功功率kW', pcsDeviceList: [],
bgColor: '#FFF2CB', selectedPcsId: '',
attr: 'totalActivePower'
}, {
title: '实时无功功率kVar',
bgColor: '#CBD6FF',
attr: 'totalReactivePower'
}, {
title: '电池堆SOC',
bgColor: '#DCCBFF',
attr: 'soc'
}, {
title: '电池堆SOH',
bgColor: '#FFD4CB',
attr: 'soh'
}, {
title: '今日充电量kWh',
bgColor: '#FFD6F8',
attr: 'dayChargedCap'
}, {
title: '今日放电量kWh',
bgColor: '#E1FFCA',
attr: 'dayDisChargedCap'
}],
runningHeadInfo: {},
list: [], list: [],
siteId: '', siteId: '',
infoData: [{ infoData: [{
label: '总交流有功电率', label: "总交流有功功率",
attr: 'totalActivePower', attr: "totalActivePower",
unit: 'kW' unit: "kW",
pointName: "总交流有功功率",
}, },
{ {
label: '总交流无功电率', label: "总交流无功功率",
attr: 'totalReactivePower', attr: "totalReactivePower",
unit: 'kVar' unit: "kVar",
pointName: "总交流无功功率",
}, },
{ {
label: '当天交流充电量', label: "当天交流充电量",
attr: 'dailyAcChargeEnergy', attr: "dailyAcChargeEnergy",
unit: 'kWh' unit: "kWh",
pointName: "当天交流充电量 (kWh)",
}, },
{ {
label: '当天交流放电量', label: "当天交流放电量",
attr: 'dailyAcDischargeEnergy', attr: "dailyAcDischargeEnergy",
unit: 'kWh' unit: "kWh",
pointName: "当天交流放电量 (kWh)",
}, },
{ {
label: '总交流视在功率', label: "A相电压",
attr: 'totalApparentPower', attr: "aPhaseVoltage",
unit: 'kVA' unit: "V",
pointName: ""
}, },
{ {
label: '总交流功率因数', label: "A相电流",
attr: 'totalPowerFactor', attr: "aPhaseCurrent",
unit: '' unit: "A",
pointName: "A相电流",
},
{
label: "B相电压",
attr: "bPhaseVoltage",
unit: "V",
pointName: ""
}, },
{ {
label: 'PCS模块温度', label: "B相电流",
attr: 'pcsModuleTemperature', attr: "bPhaseCurrent",
unit: '&#8451;' unit: "A",
pointName: "B相电流",
}, },
{ {
label: 'PCS环境温度', label: "总交流视在功率",
attr: 'pcsEnvironmentTemperature', attr: "totalApparentPower",
unit: '&#8451;' unit: "kVA",
pointName: "总交流视在功率",
}, },
{ {
label: 'A相电压', label: "总交流功率因数",
attr: 'aPhaseVoltage', attr: "totalPowerFactor",
unit: 'V' unit: "",
pointName: "总交流功率因数",
}, },
{ {
label: 'A相电流', label: "PCS模块温度",
attr: 'aPhaseCurrent', attr: "pcsModuleTemperature",
unit: 'A' unit: "&#8451;",
pointName: "",
}, },
{ {
label: 'B相电压', label: "PCS环境温度",
attr: 'bPhaseVoltage', attr: "pcsEnvironmentTemperature",
unit: 'V' unit: "&#8451;",
pointName: "",
}, },
{ {
label: 'B相电流', label: "C相电压",
attr: 'bPhaseCurrent', attr: "cPhaseVoltage",
unit: 'A' unit: "V",
pointName: ""
}, },
{ {
label: 'C相电压', label: "C相电流",
attr: 'cPhaseVoltage', attr: "cPhaseCurrent",
unit: 'V' unit: "A",
pointName: "C相电流",
}, },
{ {
label: 'C相电流', label: "交流频率",
attr: 'cPhaseCurrent', attr: "acFrequency",
unit: 'A' unit: "Hz",
pointName: "交流频率",
}, },
{
label: '交流频率',
attr: 'acFrequency',
unit: 'Hz'
}
] ]
} }
}, },
mounted() { methods: {
uni.showLoading() normalizeDictKey(value) {
this.siteId = this.$route.query.siteId || '' const raw = String(value == null ? '' : value).trim()
getRunningHeadInfo({ if (!raw) return ''
siteId: this.siteId if (/^-?\d+(\.0+)?$/.test(raw)) {
}).then(response => { return String(parseInt(raw, 10))
this.runningHeadInfo = response?.data || {} }
return raw
},
formatDictValue(options, value, emptyText = '-') {
const dict = (options && typeof options === 'object') ? options : {}
const key = this.normalizeDictKey(value)
if (!key) return emptyText
return dict[key] || key
},
normalizeDeviceId(value) {
return String(value == null ? '' : value).trim().toUpperCase()
},
getModuleRows(menuCode, sectionName) {
return (this.runningDisplayData || []).filter(item => item.menuCode === menuCode && item.sectionName === sectionName)
},
getFieldName(fieldCode) {
if (!fieldCode) {
return ''
}
const index = fieldCode.lastIndexOf('__')
return index >= 0 ? fieldCode.slice(index + 2) : fieldCode
},
getFieldRowMap(rows = [], deviceId = '') {
const map = {}
const targetDeviceId = this.normalizeDeviceId(deviceId || '')
rows.forEach(item => {
if (!item || !item.fieldCode) {
return
}
const itemDeviceId = this.normalizeDeviceId(item.deviceId || '')
if (itemDeviceId !== targetDeviceId) {
return
}
map[this.getFieldName(item.fieldCode)] = item
}) })
rows.forEach(item => {
getPcsDetailInfo({ if (!item || !item.fieldCode) {
siteId: this.siteId return
}).then(response => { }
this.list = response?.data || [] const itemDeviceId = this.normalizeDeviceId(item.deviceId || '')
if (itemDeviceId !== '') {
return
}
const fieldName = this.getFieldName(item.fieldCode)
if (map[fieldName] === undefined || map[fieldName] === null || map[fieldName] === '') {
map[fieldName] = item
}
})
return map
},
getFieldMap(rows = [], deviceId = '') {
const rowMap = this.getFieldRowMap(rows, deviceId)
return Object.keys(rowMap).reduce((acc, fieldName) => {
const row = rowMap[fieldName] || {}
acc[fieldName] = row.fieldValue
return acc
}, {})
},
getLatestTime(menuCode) {
const times = (this.runningDisplayData || [])
.filter(item => item.menuCode === menuCode && item.valueTime)
.map(item => new Date(item.valueTime).getTime())
.filter(ts => !isNaN(ts))
if (times.length === 0) {
return '-'
}
const date = new Date(Math.max(...times))
const p = (n) => String(n).padStart(2, '0')
return `${date.getFullYear()}-${p(date.getMonth() + 1)}-${p(date.getDate())} ${p(date.getHours())}:${p(date.getMinutes())}:${p(date.getSeconds())}`
},
getPcsDeviceList() {
return getPcsNameList(this.siteId).then((response) => {
this.pcsDeviceList = response?.data || []
}).catch(() => {
this.pcsDeviceList = []
})
},
buildPcsList() {
const devices = this.pcsDeviceList || []
this.list = devices.map((device) => ({
...this.getFieldMap(this.getModuleRows('SBJK_PCS', '电参量'), device.deviceId || device.id || ''),
deviceId: device.deviceId || device.id || '',
deviceName: device.deviceName || device.name || device.deviceId || device.id || 'PCS',
...this.getFieldMap(this.getModuleRows('SBJK_PCS', '状态'), device.deviceId || device.id || ''),
dataUpdateTime: this.getLatestTime('SBJK_PCS'),
alarmNum: 0,
pcsBranchInfoList: [],
}))
},
getHeadCardImg(item, index) {
const imgMap = {
totalActivePower: 'ssyggl',
totalReactivePower: 'sswggl',
soc: 'soc',
soh: 'soh',
dayChargedCap: 'jrcdl',
dayChargedCap_rt: 'jrcdl',
dayDisChargedCap: 'jrfdl',
dayDisChargedCap_rt: 'jrfdl'
}
const defaultImgs = ['ssyggl', 'sswggl', 'soc', 'soh', 'jrcdl', 'jrfdl']
return imgMap[item.fieldCode] || defaultImgs[index % defaultImgs.length]
},
handleCardClass(item) {
const workStatus = this.normalizeDictKey((item && item.workStatus) || '')
const statusOptions = (this.PCSWorkStatusOptions && typeof this.PCSWorkStatusOptions === 'object')
? this.PCSWorkStatusOptions
: {}
const hasStatus = Object.prototype.hasOwnProperty.call(statusOptions, workStatus)
return workStatus === '1' || !hasStatus
? "timing-collapse-item"
: workStatus === '2'
? 'warning-collapse-item'
: 'running-collapse-item'
},
handleTagClick(deviceId) {
this.selectedPcsId = deviceId || ''
},
},
onLoad(options) {
uni.showLoading()
this.siteId = options.siteId || ''
Promise.all([
getProjectDisplayData(this.siteId),
this.getPcsDeviceList()
]).then(([displayResponse]) => {
this.runningDisplayData = displayResponse?.data || []
this.buildPcsList()
if (this.list.length > 0) { if (this.list.length > 0) {
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
@ -263,128 +417,77 @@
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.title-row { .info-overview-scroll {
padding: 0 15px; background: #fff;
position: relative; padding: 0 20rpx;
height: 50px; white-space: nowrap;
.title {
font-weight: 500;
line-height: 50px;
} }
.msg { .info-overview-row {
position: absolute; display: inline-flex;
right: 15px; gap: 20rpx;
top: 50%; padding: 20rpx 0;
transform: translateY(-50%);
text-align: right;
} }
.info-overview-card {
width: 280rpx;
flex: 0 0 auto;
} }
.grid-item-box { .grid-item-box {
flex: 1; box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.08);
// position: relative; border-radius: 20rpx;
/* #ifndef APP-NVUE */ padding: 20rpx;
display: flex; background: #fff;
/* #endif */
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10px;
background-color: #fff;
.title {
font-size: 14px;
color: #666;
} }
.text { .grid-item-box .title {
margin-top: 10px; color: #333;
font-size: 16px; margin-top: 10rpx;
font-weight: 500;
color: #666;
overflow-wrap: anywhere;
} }
.status-danger { .grid-item-box .text {
color: #FC6B69; color: #000;
white-space: nowrap;
text-overflow: ellipsis;
width: 100%;
overflow-x: hidden;
text-align: center;
} }
.status-running { .icon {
color: #05AEA3; height: 100rpx;
width: 100rpx;
display: block;
border-radius: 20rpx;
} }
.pcs-tags-scroll {
background: #fff;
padding: 0 20rpx 20rpx;
white-space: nowrap;
} }
::v-deep { .pcs-tags-row {
.info-grid { display: inline-flex;
.uni-grid-item { gap: 16rpx;
height: 80px !important;
.grid-item-box {
padding: 0;
}
}
} }
.uni-collapse-item__wrap { .pcs-tag-item {
background-color: #eee; flex: 0 0 auto;
padding: 8rpx 22rpx;
border-radius: 999rpx;
border: 1px solid #dcdfe6;
color: #606266;
font-size: 24rpx;
line-height: 1.4;
background: #fff;
} }
.running { .pcs-tag-item.active {
.uni-collapse-item__title-text {
color: #05AEA3;
}
.title-row {
color: #05AEA3;
}
}
.danger {
.uni-collapse-item__title-text {
color: #FC6B69;
}
.title-row {
color: #FC6B69;
}
}
.close {
.uni-collapse-item__title-text {
color: #666666;
}
.title-row {
color: #666666;
}
}
// 支路样式
.pcs-branch-group {
.uni-group__title {
background-color: #959595;
.uni-group__title-text {
color: #fff; color: #fff;
} background: #007aff;
} border-color: #007aff;
.uni-group__content {
padding: 0;
}
&.uni-group--card:last-child {
margin-bottom: 25px;
}
}
} }
</style> </style>

242
pages/work/yl/index.vue Normal file
View File

@ -0,0 +1,242 @@
<template>
<view class="page-container">
<uni-collapse ref="collapse" accordion v-if="list.length > 0">
<uni-collapse-item
v-for="(item,index) in list"
:key="index + 'ylList'"
:open="index === 0"
class="common-collapse-item"
:class="handleCardClass(item)"
>
<template v-slot:title>
<view class="title-wrapper">
<view class="top">
<view class="status">{{ item.statusText }}</view>
<text class="name">{{ item.deviceName }}</text>
</view>
</view>
</template>
<view class="content">
<uni-group mode="card" class="data-card-group">
<uni-row
v-for="(field, fieldIndex) in (item.fieldConfigs || fallbackFieldConfigs)"
:key="fieldIndex + 'ylField'"
class="data-row"
>
<uni-col :span="8">
<view class="title">{{ field.name }}</view>
</uni-col>
<uni-col :span="16">
<view class="value">
{{ item[field.attr] | formatNumber }}
<text v-if="field.unit" v-html="field.unit"></text>
</view>
</uni-col>
</uni-row>
</uni-group>
</view>
</uni-collapse-item>
</uni-collapse>
<view class="no-data" v-else>
暂无数据
</view>
</view>
</template>
<script>
import {
getProjectDisplayData,
getDeviceList
} from '@/api/ems/site.js'
import {
mapState
} from 'vuex'
export default {
computed: {
...mapState({
deviceStatusOptions: (state) => state.ems.deviceStatusOptions,
}),
},
data() {
return {
siteId: '',
displayData: [],
coolingDeviceList: [],
list: [],
fallbackFieldConfigs: [{
name: '供水温度',
attr: 'gsTemp',
unit: '&#8451;'
}, {
name: '回水温度',
attr: 'hsTemp',
unit: '&#8451;'
}, {
name: '供水压力',
attr: 'gsPressure',
unit: 'MPa'
}, {
name: '回水压力',
attr: 'hsPressure',
unit: 'MPa'
}, {
name: '冷源水温度',
attr: 'lysTemp',
unit: '&#8451;'
}, {
name: 'VB01开度',
attr: 'vb01Kd',
unit: '%'
}, {
name: 'VB02开度',
attr: 'vb02Kd',
unit: '%'
}]
}
},
methods: {
normalizeDeviceId(value) {
return String(value == null ? '' : value).trim().toUpperCase()
},
getModuleRows(menuCode) {
return (this.displayData || []).filter((item) => item.menuCode === menuCode)
},
getFieldName(fieldCode) {
const raw = String(fieldCode || '').trim()
if (!raw) return ''
const index = raw.lastIndexOf('__')
return index >= 0 ? raw.slice(index + 2) : raw
},
getFieldUnit(attr) {
const field = (this.fallbackFieldConfigs || []).find((item) => item.attr === attr)
return field ? (field.unit || '') : ''
},
getFieldConfigs(rows = []) {
const result = []
const seen = {}
;(rows || []).forEach((item) => {
const attr = this.getFieldName(item?.fieldCode)
const name = String(item?.fieldName || '').trim()
if (!attr || !name || seen[name]) return
result.push({
name,
attr,
unit: this.getFieldUnit(attr),
})
seen[name] = true
})
return result.length > 0 ? result : this.fallbackFieldConfigs
},
getFieldRowMap(rows = [], deviceId = '') {
const map = {}
const targetDeviceId = this.normalizeDeviceId(deviceId || '')
rows.forEach((item) => {
if (!item || !item.fieldCode) return
const itemDeviceId = this.normalizeDeviceId(item.deviceId || '')
if (itemDeviceId !== targetDeviceId) return
map[this.getFieldName(item.fieldCode)] = item
})
rows.forEach((item) => {
if (!item || !item.fieldCode) return
const itemDeviceId = this.normalizeDeviceId(item.deviceId || '')
if (itemDeviceId !== '') return
const fieldName = this.getFieldName(item.fieldCode)
if (!map[fieldName]) {
map[fieldName] = item
}
})
return map
},
getLatestUpdateTime(rows = []) {
const times = (rows || [])
.map((item) => new Date(item?.valueTime).getTime())
.filter((ts) => !isNaN(ts))
if (times.length === 0) return '-'
const date = new Date(Math.max(...times))
const p = (n) => String(n).padStart(2, '0')
return `${date.getFullYear()}-${p(date.getMonth() + 1)}-${p(date.getDate())} ${p(date.getHours())}:${p(date.getMinutes())}:${p(date.getSeconds())}`
},
formatStatusText(statusValue) {
const key = String(statusValue == null ? '' : statusValue).trim()
if (!key) return '暂无数据'
return (this.deviceStatusOptions || {})[key] || key
},
handleCardClass(item) {
const key = String(item?.statusValue == null ? '' : item.statusValue).trim()
if (key === '1') return 'running-collapse-item'
if (key === '2') return 'warning-collapse-item'
return 'timing-collapse-item'
},
buildList() {
const rows = this.getModuleRows('SBJK_YL')
const fieldConfigs = this.getFieldConfigs(rows)
let devices = (this.coolingDeviceList || []).filter((item) => item.deviceCategory === 'COOLING')
if (devices.length === 0) {
const grouped = {}
rows.forEach((item) => {
const id = this.normalizeDeviceId(item?.deviceId || '')
if (!id || grouped[id]) return
grouped[id] = {
deviceId: id,
deviceName: item?.deviceName || id,
deviceStatus: ''
}
})
devices = Object.values(grouped)
}
if (devices.length === 0) {
devices = [{
deviceId: '',
deviceName: '冷却',
deviceStatus: ''
}]
}
this.list = devices.map((device) => {
const id = this.normalizeDeviceId(device.deviceId || device.id || '')
const fieldRowMap = this.getFieldRowMap(rows, id)
const values = {}
fieldConfigs.forEach((cfg) => {
values[cfg.attr] = fieldRowMap[cfg.attr]?.fieldValue
})
const statusField = Object.values(fieldRowMap).find((row) => String(row?.fieldName || '').includes('状态'))
const statusValue = statusField?.fieldValue || device.deviceStatus || ''
return {
...values,
deviceId: id,
deviceName: device.deviceName || device.name || id || '冷却',
statusValue: String(statusValue || ''),
statusText: this.formatStatusText(statusValue),
fieldConfigs,
dataUpdateTime: this.getLatestUpdateTime(Object.values(fieldRowMap)),
}
})
}
},
onLoad(options) {
uni.showLoading()
this.siteId = options.siteId || ''
Promise.all([
getProjectDisplayData(this.siteId),
getDeviceList(this.siteId)
]).then(([displayResponse, deviceResponse]) => {
this.displayData = displayResponse?.data || []
this.coolingDeviceList = deviceResponse?.data || []
this.buildList()
if (this.list.length > 0) {
this.$nextTick(() => {
setTimeout(() => {
this.$refs.collapse.resize()
uni.hideLoading()
}, 100)
})
} else {
uni.hideLoading()
}
}).catch(() => {
uni.hideLoading()
})
}
}
</script>

View File

@ -0,0 +1,87 @@
@font-face {
font-family: "iconfont";
/* Project id 4993552 */
src: url('@/static/font_ems/iconfont.woff2?t=1754546965003') format('woff2'),
url('@/static/font_ems/iconfont.woff?t=1754546965003') format('woff'),
url('@/static/font_ems/iconfont.ttf?t=1754546965003') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-a-dianchicunengliangkuai:before {
content: "\e7a1";
}
.icon-dianbiao:before {
content: "\eacb";
}
.icon-batterypx:before {
content: "\e610";
}
.icon-dianbiao_shiti:before {
content: "\eca1";
}
.icon-bianyaqiyunhangpingjia:before {
content: "\e600";
}
.icon-dianbiao1:before {
content: "\e602";
}
.icon-pcs:before {
content: "\e611";
}
.icon-dianbiao2:before {
content: "\e688";
}
.icon-ziyuan:before {
content: "\e866";
}
.icon-pcs1:before {
content: "\e601";
}
.icon-gongneng-diandongji:before {
content: "\e65a";
}
.icon-dianbiao3:before {
content: "\e6a7";
}
.icon-weibiaoti-1-02-02:before {
content: "\e612";
}
.icon-dianbiao4:before {
content: "\e625";
}
.icon-dantidianchi:before {
content: "\e76b";
}
.icon-BMS:before {
content: "\e63e";
}
.icon-BMStongyong:before {
content: "\e80c";
}
.icon-PCS:before {
content: "\e603";
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,135 @@
{
"id": "4993552",
"name": "EMS",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "43871958",
"name": "电池簇、能量块",
"font_class": "a-dianchicunengliangkuai",
"unicode": "e7a1",
"unicode_decimal": 59297
},
{
"icon_id": "5387412",
"name": "电表",
"font_class": "dianbiao",
"unicode": "eacb",
"unicode_decimal": 60107
},
{
"icon_id": "6141230",
"name": "battery 32 px.1",
"font_class": "batterypx",
"unicode": "e610",
"unicode_decimal": 58896
},
{
"icon_id": "6775643",
"name": "电表_实体",
"font_class": "dianbiao_shiti",
"unicode": "eca1",
"unicode_decimal": 60577
},
{
"icon_id": "6826531",
"name": "变压器运行评价",
"font_class": "bianyaqiyunhangpingjia",
"unicode": "e600",
"unicode_decimal": 58880
},
{
"icon_id": "7045021",
"name": "电表",
"font_class": "dianbiao1",
"unicode": "e602",
"unicode_decimal": 58882
},
{
"icon_id": "8057318",
"name": "pcs",
"font_class": "pcs",
"unicode": "e611",
"unicode_decimal": 58897
},
{
"icon_id": "8441718",
"name": "电表",
"font_class": "dianbiao2",
"unicode": "e688",
"unicode_decimal": 59016
},
{
"icon_id": "12293731",
"name": "资源 2",
"font_class": "ziyuan",
"unicode": "e866",
"unicode_decimal": 59494
},
{
"icon_id": "12718310",
"name": "pcs",
"font_class": "pcs1",
"unicode": "e601",
"unicode_decimal": 58881
},
{
"icon_id": "22678712",
"name": "功能-电动机",
"font_class": "gongneng-diandongji",
"unicode": "e65a",
"unicode_decimal": 58970
},
{
"icon_id": "23420639",
"name": "电表",
"font_class": "dianbiao3",
"unicode": "e6a7",
"unicode_decimal": 59047
},
{
"icon_id": "31086873",
"name": "PCS",
"font_class": "weibiaoti-1-02-02",
"unicode": "e612",
"unicode_decimal": 58898
},
{
"icon_id": "38212288",
"name": "电表",
"font_class": "dianbiao4",
"unicode": "e625",
"unicode_decimal": 58917
},
{
"icon_id": "40121596",
"name": "单体电池",
"font_class": "dantidianchi",
"unicode": "e76b",
"unicode_decimal": 59243
},
{
"icon_id": "42346006",
"name": "BMS-copy",
"font_class": "BMS",
"unicode": "e63e",
"unicode_decimal": 58942
},
{
"icon_id": "43101168",
"name": "BMS通用",
"font_class": "BMStongyong",
"unicode": "e80c",
"unicode_decimal": 59404
},
{
"icon_id": "43866831",
"name": "PCS-copy",
"font_class": "PCS",
"unicode": "e603",
"unicode_decimal": 58883
}
]
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 373 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

BIN
static/logo-trans.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

File diff suppressed because it is too large Load Diff

View File

@ -88,7 +88,15 @@
} }
} }
} }
.status-bar{
background: #fff;
width: 100%;
height: var(--status-bar-height);
position: fixed;
top:0;
left: 0;
z-index:99;
}
// 暂无数据通用样式 // 暂无数据通用样式
@ -97,6 +105,255 @@
text-align: center; text-align: center;
line-height: 100px; line-height: 100px;
height: 100px; height: 100px;
background-color: #fff; font-size: 30rpx;
font-size: 18px; background-color: transparent;
}
// 九宫格
.grid-item-box {
flex: 1;
// position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20rpx;
background-color: #fff;
.title {
font-size: 26rpx;
color: #666;
}
.text {
margin-top: 20rpx;
font-size: 32rpx;
font-weight: 500;
color: #666;
overflow-wrap: anywhere;
}
}
.flex-container{
display: flex;
.flex-lists{
flex:1;
}
}
// 设备详情页面 状态公共样式
.common-collapse-item{
.content{
background: linear-gradient(to bottom, #22bb5873, #45db7a26);
padding: 1rpx 0 1rpx 0;
}
// 标题
.title-wrapper{
// 设备状态栏
padding:20rpx 30rpx;
font-size: 28rpx;
line-height: 30rpx;
font-weight: 700;
color: #000000;
.top{
.status{
display: inline-block;
vertical-align: middle;
color:#fff;
padding:0 10rpx;
margin-right: 10rpx;
font-size: 22rpx;
line-height: 38rpx;
border-radius: 10rpx;
}
.name{
display: inline-block;
vertical-align: middle;
}
}
}
// 设备状态卡片
.status-card-group{
.uni-group__content{
padding-top:0;
padding-bottom:0;
}
// 设备状态九宫格
.grid-item-box{
background-color: transparent;
.title{
color:#333;
}
.text{
color:#000;
font-weight: bolder;
&.work-status-color{
color:#000;
}
}
}
}
// 设备数据卡片
.data-card-group{
.uni-group__content{
padding-top:0;
padding-bottom:0;
}
// 数据列表
.data-row{
font-size: 26rpx;
line-height: 36rpx;
color: #000;
padding:24rpx 0;
&:not(:last-child){
border-bottom: 1px solid #ebedf0;
}
.title{
color:#333;
text-align: left;
}
.value{
text-align: right;
}
}
}
// 子设备表格卡片
.child-card-group{
.child-table{
.uni-table-th{
color:#333;
font-size: 26rpx;
}
.uni-table-td{
color:#000;
font-size: 26rpx;
}
.table--border{
border-color:#ebedf0;
}
}
}
// 支路卡片
.branch-card-group{
.uni-group__title {
background-color: #959595;
height: 70rpx;
.uni-group__title-text {
color: #fff;
font-size:26rpx;
line-height: 30rpx;
}
}
.uni-group__content {
padding: 0;
.title{
color:#333;
}
.text{
color:#000;
font-weight: normal;
}
}
&.uni-group--card:last-child {
margin-bottom: 50rpx;
}
}
}
//运行中
.running-collapse-item{
// 标题
.title-wrapper{
.top{
.status{
background-color: #30be95;
}
}
}
.content{
background-color:rgba(69,219,122,0.15);
}
// 状态九宫格
.status-card-group{
.grid-item-box{
.text{
&.work-status-color{
color:#30be95;
}
}
}
}
//支路设备
.branch-card-group{
.uni-group__title {
background-color: #30be95;
}
}
}
//故障
.warning-collapse-item{
// 标题
.title-wrapper{
.top{
.status{
background-color: #ed7876;
}
}
}
.content{
background: rgba(245,96,78,0.15);
}
// 状态九宫格
.status-card-group{
.grid-item-box{
.text{
&.work-status-color{
color:#ed7876;
}
}
}
}
//支路设备
.branch-card-group{
.uni-group__title {
background-color: #ed7876;
}
}
}
// 停机
.timing-collapse-item{
// 标题
.title-wrapper{
.top{
.status{
background-color: #000;
}
}
}
.content{
background: rgba(140,140,140,0.15);
}
// 状态九宫格
.status-card-group{
.grid-item-box{
.text{
&.work-status-color{
color:#000;
}
}
}
}
//支路设备
.branch-card-group{
.uni-group__title {
background-color: #000;
}
}
} }

View File

@ -3,4 +3,5 @@
// color-ui // color-ui
@import "@/static/scss/colorui.css"; @import "@/static/scss/colorui.css";
// iconfont // iconfont
@import "@/static/font_ems/iconfont.css";
@import "@/static/font/iconfont.css"; @import "@/static/font/iconfont.css";

View File

@ -4,6 +4,8 @@ const getters = {
id: state => state.user.id, id: state => state.user.id,
name: state => state.user.name, name: state => state.user.name,
roles: state => state.user.roles, roles: state => state.user.roles,
permissions: state => state.user.permissions permissions: state => state.user.permissions,
belongSite: state => state.user.belongSite,
currentSiteId: state => state.user.currentSiteId
} }
export default getters export default getters

View File

@ -1,14 +1,33 @@
const ems = { const ems = {
state: { state: {
workStatusOptions: { CLUSTERWorkStatusOptions: {
'0': '正常', '0': '静置',
'1': '异常', '1': '充电',
'2': '停止' '2': '放电',
}, //工作状态 '3': '待机',
'5': '运行',
'9': "故障"
}, //电池簇工作状态
PCSWorkStatusOptions: {
'0': '运行',
'1': '停机',
'2': '故障',
'3': '待机',
'4': '充电',
'5': '放电'
}, //PCS工作状态
STACKWorkStatusOptions: {
"0": "静置",
"1": "充电",
"2": "放电",
"3": "浮充",
'4': '待机',
'5': '运行',
'9': "故障"
}, //STACKBMS总览工作状态
deviceStatusOptions: { deviceStatusOptions: {
'0': '线', '0': '线',
'1': '线', '1': '线'
'2': '维修中'
}, //设备状态 }, //设备状态
gridStatusOptions: { gridStatusOptions: {
'0': '并网', '0': '并网',
@ -49,9 +68,9 @@ const ems = {
'RTU': 'RTU' 'RTU': 'RTU'
}, //设备类型 }, //设备类型
ticketStatusOptions: { ticketStatusOptions: {
0: '待处理', 1: '待处理',
1: '处理', 2: '处理',
2: '处理' 3: '处理'
}, //工单处理状态 }, //工单处理状态
strategyStatusOptions: { strategyStatusOptions: {
'0': '未启用', '0': '未启用',
@ -62,8 +81,10 @@ const ems = {
}, //策略状态 }, //策略状态
chargeStatusOptions: { chargeStatusOptions: {
'1': '充电', '1': '充电',
'2': '待机' '2': '待机',
'3': '放电'
}, //冲放状态 }, //冲放状态
} }
} }
export default ems export default ems

109
store/modules/site.js Normal file
View File

@ -0,0 +1,109 @@
import { getAllSites } from '@/api/ems/site.js'
const createSiteTypeOptions = () => ([
{
text: '储能',
value: 'cn',
children: []
},
{
text: '光能',
value: 'gn',
children: []
},
{
text: '岸电',
value: 'ad',
children: []
}
])
const site = {
state: {
siteOptions: [],
siteTypeOptions: [],
currentSiteId: '',
loaded: false
},
mutations: {
SET_SITE_OPTIONS: (state, siteOptions) => {
state.siteOptions = siteOptions || []
},
SET_SITE_TYPE_OPTIONS: (state, siteTypeOptions) => {
state.siteTypeOptions = siteTypeOptions || createSiteTypeOptions()
},
SET_CURRENT_SITE_ID: (state, siteId) => {
state.currentSiteId = siteId || ''
},
SET_SITE_LOADED: (state, loaded) => {
state.loaded = !!loaded
}
},
actions: {
LoadSites({ state, rootState, commit }, payload = {}) {
const { force = false } = payload
if (state.loaded && !force) {
return Promise.resolve({
siteOptions: state.siteOptions,
siteTypeOptions: state.siteTypeOptions,
siteId: state.currentSiteId
})
}
return getAllSites().then(response => {
const belongSite = rootState?.user?.belongSite || []
const canAccessAll = !belongSite || belongSite.length === 0 || belongSite.includes('all')
const siteOptions = (response?.data || []).filter(item => {
const siteId = item.siteId || ''
return canAccessAll || belongSite.includes(siteId)
}).map(item => {
const siteId = item.siteId || ''
const siteType = (item.siteType || item.type || 'cn').toString().toLowerCase()
return {
text: item.siteName,
value: siteId,
id: item.id,
longitude: Number(item.longitude || 0),
latitude: Number(item.latitude || 0),
siteType
}
})
const siteTypeOptions = createSiteTypeOptions().map(typeItem => ({
...typeItem,
children: []
}))
siteOptions.forEach(item => {
const typeOption = siteTypeOptions.find(i => i.value === item.siteType) || siteTypeOptions.find(i => i.value === 'cn')
if (!typeOption) return
typeOption.children.push({
text: item.text,
value: item.value,
id: item.id
})
})
const filteredSiteTypeOptions = siteTypeOptions.filter(item => (item.children || []).length > 0)
const availableSite = siteOptions[0]
const keepCurrent = siteOptions.find(item => item.value === state.currentSiteId)
commit('SET_SITE_OPTIONS', siteOptions)
commit('SET_SITE_TYPE_OPTIONS', filteredSiteTypeOptions)
commit('SET_CURRENT_SITE_ID', keepCurrent ? keepCurrent.value : (availableSite?.value || ''))
commit('SET_SITE_LOADED', true)
return {
siteOptions,
siteTypeOptions: filteredSiteTypeOptions,
siteId: keepCurrent ? keepCurrent.value : (availableSite?.value || '')
}
})
},
SetCurrentSiteId({ commit }, siteId) {
commit('SET_CURRENT_SITE_ID', siteId)
},
ClearSiteState({ commit }) {
commit('SET_SITE_OPTIONS', [])
commit('SET_SITE_TYPE_OPTIONS', [])
commit('SET_CURRENT_SITE_ID', '')
commit('SET_SITE_LOADED', false)
}
}
}
export default site

View File

@ -1,9 +1,20 @@
import config from '@/config' import config from '@/config'
import storage from '@/utils/storage' import storage from '@/utils/storage'
import constant from '@/utils/constant' import constant from '@/utils/constant'
import { isHttp, isEmpty } from "@/utils/validate" import {
import { login, logout, getInfo } from '@/api/login' isHttp,
import { getToken, setToken, removeToken } from '@/utils/auth' isEmpty
} from "@/utils/validate"
import {
login,
logout,
getInfo
} from '@/api/login'
import {
getToken,
setToken,
removeToken
} from '@/utils/auth'
import defAva from '@/static/images/profile.jpg' import defAva from '@/static/images/profile.jpg'
const baseUrl = config.baseUrl const baseUrl = config.baseUrl
@ -15,7 +26,9 @@ const user = {
name: storage.get(constant.name), name: storage.get(constant.name),
avatar: storage.get(constant.avatar), avatar: storage.get(constant.avatar),
roles: storage.get(constant.roles), roles: storage.get(constant.roles),
permissions: storage.get(constant.permissions) permissions: storage.get(constant.permissions),
belongSite: storage.get(constant.belongSite),
currentSiteId: storage.get(constant.currentSiteId)
}, },
mutations: { mutations: {
@ -41,12 +54,22 @@ const user = {
SET_PERMISSIONS: (state, permissions) => { SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions state.permissions = permissions
storage.set(constant.permissions, permissions) storage.set(constant.permissions, permissions)
},
SET_BELONGSITE: (state, belongSite = []) => {
state.belongSite = belongSite || []
storage.set(constant.belongSite, belongSite || [])
},
SET_CURRENTSITEID: (state, currentSiteId = '') => {
state.currentSiteId = currentSiteId || ''
storage.set(constant.currentSiteId, currentSiteId || '')
} }
}, },
actions: { actions: {
// 登录 // 登录
Login({ commit }, userInfo) { Login({
commit
}, userInfo) {
const username = userInfo.username.trim() const username = userInfo.username.trim()
const password = userInfo.password const password = userInfo.password
const code = userInfo.code const code = userInfo.code
@ -63,10 +86,14 @@ const user = {
}, },
// 获取用户信息 // 获取用户信息
GetInfo({ commit, state }) { GetInfo({
commit,
state
}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo().then(res => { getInfo().then(res => {
const user = res.user const user = res.user
const belongSite = user?.belongSite ? JSON.parse(user?.belongSite) || [] : []
let avatar = user.avatar || "" let avatar = user.avatar || ""
if (!isHttp(avatar)) { if (!isHttp(avatar)) {
avatar = (isEmpty(avatar)) ? defAva : baseUrl + avatar avatar = (isEmpty(avatar)) ? defAva : baseUrl + avatar
@ -82,6 +109,7 @@ const user = {
commit('SET_ID', userid) commit('SET_ID', userid)
commit('SET_NAME', username) commit('SET_NAME', username)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
commit('SET_BELONGSITE', belongSite)
resolve(res) resolve(res)
}).catch(error => { }).catch(error => {
reject(error) reject(error)
@ -90,7 +118,10 @@ const user = {
}, },
// 退出系统 // 退出系统
LogOut({ commit, state }) { LogOut({
commit,
state
}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
logout(state.token).then(() => { logout(state.token).then(() => {
commit('SET_TOKEN', '') commit('SET_TOKEN', '')

View File

@ -638,6 +638,14 @@ export default {
methods: { methods: {
beforeInit(){ beforeInit(){
this.mixinDatacomErrorMessage = null; this.mixinDatacomErrorMessage = null;
console.log('[map-debug] beforeInit', {
echarts: this.echarts,
type: this.type,
hasEopts: !!this.eopts,
eoptsMapName: this.eopts && this.eopts.mapName,
hasGeo: !!(this.eopts && this.eopts.mapGeoJSON),
chartSeriesLen: this.chartData && this.chartData.series ? this.chartData.series.length : -1
});
if (typeof this.chartData === 'object' && this.chartData != null && this.chartData.series !== undefined && this.chartData.series.length > 0) { if (typeof this.chartData === 'object' && this.chartData != null && this.chartData.series !== undefined && this.chartData.series.length > 0) {
//拷贝一下chartData为了opts变更后统一数据来源 //拷贝一下chartData为了opts变更后统一数据来源
this.drawData = deepCloneAssign({}, this.chartData); this.drawData = deepCloneAssign({}, this.chartData);
@ -784,6 +792,14 @@ export default {
}, },
checkData(anyData) { checkData(anyData) {
let cid = this.cid let cid = this.cid
console.log('[map-debug] checkData', {
cid,
echarts: this.echarts,
type: this.type,
eoptsMapName: this.eopts && this.eopts.mapName,
hasGeo: !!(this.eopts && this.eopts.mapGeoJSON),
dataSeriesLen: anyData && anyData.series ? anyData.series.length : -1
});
//复位opts或eopts //复位opts或eopts
if(this.echarts === true){ if(this.echarts === true){
cfe.option[cid] = deepCloneAssign({}, this.eopts); cfe.option[cid] = deepCloneAssign({}, this.eopts);
@ -916,6 +932,12 @@ export default {
cfe.option[cid].tooltipFormat = this.tooltipFormat; cfe.option[cid].tooltipFormat = this.tooltipFormat;
cfe.option[cid].tooltipCustom = this.tooltipCustom; cfe.option[cid].tooltipCustom = this.tooltipCustom;
cfe.option[cid].lastDrawTime = this.lastDrawTime; cfe.option[cid].lastDrawTime = this.lastDrawTime;
console.log('[map-debug] set echartsOpts', {
cid,
type: cfe.option[cid].type,
mapName: cfe.option[cid].mapName,
hasGeo: !!cfe.option[cid].mapGeoJSON
});
this.echartsOpts = deepCloneAssign({}, cfe.option[cid]); this.echartsOpts = deepCloneAssign({}, cfe.option[cid]);
} else { } else {
cfu.option[cid].rotateLock = cfu.option[cid].rotate; cfu.option[cid].rotateLock = cfu.option[cid].rotate;
@ -1273,7 +1295,8 @@ export default {
methods: { methods: {
//==============以下是ECharts的方法==================== //==============以下是ECharts的方法====================
ecinit(newVal, oldVal, owner, instance){ ecinit(newVal, oldVal, owner, instance){
let cid = JSON.stringify(newVal.id) let cid = JSON.stringify(newVal.id || newVal.canvasId || (owner && owner.cid) || (instance && instance.cid))
console.log('[map-debug] ecinit', { cid, type: newVal.type, hasMapName: !!newVal.mapName, hasGeo: !!newVal.mapGeoJSON });
this.rid = cid this.rid = cid
that[cid] = this.$ownerInstance || instance that[cid] = this.$ownerInstance || instance
let eopts = JSON.parse(JSON.stringify(newVal)) let eopts = JSON.parse(JSON.stringify(newVal))
@ -1285,7 +1308,7 @@ export default {
cfe.option[cid] = rddeepCloneAssign({}, eopts); cfe.option[cid] = rddeepCloneAssign({}, eopts);
} }
let newData = eopts.chartData; let newData = eopts.chartData;
if(newData){ if(newData && !eopts.skipChartData){
//挂载categories和series //挂载categories和series
if(cfe.option[cid].xAxis && cfe.option[cid].xAxis.type && cfe.option[cid].xAxis.type === 'category'){ if(cfe.option[cid].xAxis && cfe.option[cid].xAxis.type && cfe.option[cid].xAxis.type === 'category'){
cfe.option[cid].xAxis.data = newData.categories cfe.option[cid].xAxis.data = newData.categories
@ -1301,9 +1324,21 @@ export default {
} }
} }
if (typeof window.echarts === 'object' && eopts.mapName && eopts.mapGeoJSON) {
try {
if (!window.echarts.getMap(eopts.mapName)) {
window.echarts.registerMap(eopts.mapName, eopts.mapGeoJSON);
}
} catch (e) {
console.log('[map-debug] registerMap error', e);
}
}
if (typeof window.echarts === 'object') { if (typeof window.echarts === 'object') {
console.log('[map-debug] echarts exists, init');
this.newEChart() this.newEChart()
}else{ }else{
console.log('[map-debug] echarts not found, load script');
const script = document.createElement('script') const script = document.createElement('script')
// #ifdef APP-VUE // #ifdef APP-VUE
script.src = './uni_modules/qiun-data-charts/static/app-plus/echarts.min.js' script.src = './uni_modules/qiun-data-charts/static/app-plus/echarts.min.js'
@ -1324,8 +1359,19 @@ export default {
}, },
newEChart(){ newEChart(){
let cid = this.rid let cid = this.rid
console.log('[map-debug] newEChart', { cid });
if (cfe.option[cid] && cfe.option[cid].mapName && cfe.option[cid].mapGeoJSON) {
try {
if (!echarts.getMap(cfe.option[cid].mapName)) {
echarts.registerMap(cfe.option[cid].mapName, cfe.option[cid].mapGeoJSON);
}
} catch (e) {
console.log('[map-debug] registerMap error in newEChart', e);
}
}
if(cfe.instance[cid] === undefined){ if(cfe.instance[cid] === undefined){
cfe.instance[cid] = echarts.init(that[cid].$el.children[0]) cfe.instance[cid] = echarts.init(that[cid].$el.children[0])
console.log('[map-debug] echarts init instance created');
//ontap开启后才触发click事件 //ontap开启后才触发click事件
if(cfe.option[cid].ontap === true){ if(cfe.option[cid].ontap === true){
cfe.instance[cid].on('click', resdata => { cfe.instance[cid].on('click', resdata => {
@ -1345,6 +1391,7 @@ export default {
} }
}, },
updataEChart(cid,option){ updataEChart(cid,option){
console.log('[map-debug] updateEChart', { cid, hasSeries: !!option.series, seriesLen: option.series ? option.series.length : 0 });
//替换option内format属性为formatter的预定义方法 //替换option内format属性为formatter的预定义方法
option = rdformatterAssign(option,cfe.formatter) option = rdformatterAssign(option,cfe.formatter)
if(option.tooltip){ if(option.tooltip){

View File

@ -146,10 +146,13 @@ class Calendar {
year: dateObj.year, year: dateObj.year,
date: i, date: i,
multiple: this.range ? checked : false, multiple: this.range ? checked : false,
beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this.multipleStatus.after), beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this
afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this.multipleStatus.after), .multipleStatus.after),
afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this
.multipleStatus.after),
month: dateObj.month, month: dateObj.month,
disable: (this.startDate && !dateCompare(this.startDate, currentDate)) || (this.endDate && !dateCompare( disable: (this.startDate && !dateCompare(this.startDate, currentDate)) || (this.endDate && !
dateCompare(
currentDate, this.endDate)), currentDate, this.endDate)),
isToday, isToday,
userChecked: false, userChecked: false,
@ -389,8 +392,8 @@ function getDefaultSecond(hideSecond) {
} }
function dateCompare(startDate, endDate) { function dateCompare(startDate, endDate) {
startDate = new Date(fixIosDateFormat(startDate)) startDate = new Date(fixIosDateFormat(startDate && typeof startDate === 'string' ? startDate.trim() : startDate))
endDate = new Date(fixIosDateFormat(endDate)) endDate = new Date(fixIosDateFormat(endDate && typeof endDate === 'string' ? endDate.trim() : endDate))
return startDate <= endDate return startDate <= endDate
} }

View File

@ -3,7 +3,8 @@ const constant = {
id: 'user_id', id: 'user_id',
name: 'user_name', name: 'user_name',
roles: 'user_roles', roles: 'user_roles',
permissions: 'user_permissions' permissions: 'user_permissions',
currentSiteId: 'current_site_id'
} }
export default constant export default constant

View File

@ -21,16 +21,25 @@ const request = config => {
config.url = url config.url = url
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const requestUrl = config.baseUrl || baseUrl + config.url
const requestMethod = (config.method || 'get').toUpperCase()
uni.request({ uni.request({
method: config.method || 'get', method: config.method || 'get',
timeout: config.timeout || timeout, timeout: config.timeout || timeout,
url: config.baseUrl || baseUrl + config.url, url: requestUrl,
data: config.data, data: config.data,
header: config.header, header: config.header,
dataType: 'json' dataType: 'json'
}).then(response => { }).then(response => {
let [error, res] = response let [error, res] = response
if (error) { if (error) {
const errorType = error?.errMsg || error?.message || 'UNKNOWN_ERROR'
console.error('[request:error]', {
url: requestUrl,
method: requestMethod,
errorType,
rawError: error
})
toast('后端接口连接异常') toast('后端接口连接异常')
reject('后端接口连接异常') reject('后端接口连接异常')
return return
@ -57,6 +66,15 @@ const request = config => {
}) })
.catch(error => { .catch(error => {
let { message } = error let { message } = error
const rawMessage = message || ''
let errorType = 'UNKNOWN_ERROR'
if (rawMessage === 'Network Error') {
errorType = 'NETWORK_ERROR'
} else if (rawMessage.includes('timeout')) {
errorType = 'TIMEOUT'
} else if (rawMessage.includes('Request failed with status code')) {
errorType = 'HTTP_STATUS_ERROR'
}
if (message === 'Network Error') { if (message === 'Network Error') {
message = '后端接口连接异常' message = '后端接口连接异常'
} else if (message.includes('timeout')) { } else if (message.includes('timeout')) {
@ -64,6 +82,13 @@ const request = config => {
} else if (message.includes('Request failed with status code')) { } else if (message.includes('Request failed with status code')) {
message = '系统接口' + message.substr(message.length - 3) + '异常' message = '系统接口' + message.substr(message.length - 3) + '异常'
} }
console.error('[request:catch]', {
url: requestUrl,
method: requestMethod,
errorType,
message: rawMessage,
rawError: error
})
toast(message) toast(message)
reject(error) reject(error)
}) })