Compare commits
10 Commits
5c78cbf39f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 629047fa06 | |||
| ac7dd9dd30 | |||
| 69e199e9cc | |||
| 7191f3cf36 | |||
| 13ee9e66cc | |||
| fb33e5a1f6 | |||
| 3676313439 | |||
| e1eec995ca | |||
| b493e331c6 | |||
| b8898311ae |
203
api/ems/site.js
203
api/ems/site.js
@ -24,14 +24,22 @@ export function getBMSBatteryCluster(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取电表数据
|
//获取电表数据
|
||||||
export function getAmmeterDataList(data) {
|
export function getAmmeterDataList(data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/ems/siteMonitor/getAmmeterDataList`, //?siteId=${siteId}
|
url: `/ems/siteMonitor/getAmmeterDataList`, //?siteId=${siteId}
|
||||||
method: 'get',
|
method: 'get',
|
||||||
data
|
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) {
|
||||||
@ -41,80 +49,121 @@ export function getRunningHeadInfo(data) {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//获取pcs列表
|
//获取pcs列表
|
||||||
export function getPcsDetailInfo(data) {
|
export function getPcsDetailInfo(data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/ems/siteMonitor/getPcsDetailInfo`, //?siteId=${siteId}
|
url: `/ems/siteMonitor/getPcsDetailInfo`, //?siteId=${siteId}
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取pcs名称列表
|
||||||
|
export function getPcsNameList(siteId) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/siteMonitor/getPcsNameList?siteId=${siteId}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取单体电池 电池堆列表数据
|
||||||
|
export function getStackNameList(siteId) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/siteMonitor/getStackNameList?siteId=${siteId}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//获取单体电池 电池簇列表数据
|
||||||
|
export function getClusterNameList({ stackDeviceId, siteId }) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/siteMonitor/getClusterNameList?stackDeviceId=${stackDeviceId}&siteId=${siteId}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//单体电池表格数据
|
||||||
|
export function getClusterDataInfoList({ siteId, stackDeviceId, clusterDeviceId, batteryId, pageSize, pageNum }) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/siteMonitor/getClusterDataInfoList?clusterDeviceId=${clusterDeviceId}&siteId=${siteId}&stackDeviceId=${stackDeviceId}&batteryId=${batteryId}&pageSize=${pageSize}&pageNum=${pageNum}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 单体电池图表
|
||||||
|
export function getSingleBatteryData({ siteId, deviceId, clusterDeviceId, startDate, endDate }) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/siteMonitor/getSingleBatteryData?siteId=${siteId}&deviceId=${deviceId}&startDate=${startDate}&endDate=${endDate}&clusterDeviceId=${clusterDeviceId}`,
|
||||||
|
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
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取单体电池 电池堆列表数据
|
//单站监控 首页 当日功率曲线
|
||||||
export function getStackNameList(data) {
|
export function getPointData(data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/ems/siteMonitor/getStackNameList`, //?siteId=${siteId}
|
url: `/ems/siteMonitor/getPointData`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//获取单体电池 电池簇列表数据
|
|
||||||
export function getClusterNameList(data) {
|
// 点位配置-曲线数据(与管理端一致)
|
||||||
return request({
|
export function getPointConfigCurve(data) {
|
||||||
url: `/ems/siteMonitor/getClusterNameList`, //?stackDeviceId=${stackDeviceId}&siteId=${siteId}
|
return request({
|
||||||
method: 'get',
|
url: `/ems/pointConfig/curve`,
|
||||||
data
|
method: 'post',
|
||||||
})
|
data,
|
||||||
}
|
headers: {
|
||||||
//单体电池表格数据
|
repeatSubmit: false
|
||||||
export function getClusterDataInfoList(data) {
|
}
|
||||||
return request({
|
})
|
||||||
url: `/ems/siteMonitor/getClusterDataInfoList?`, //clusterDeviceId=${clusterDeviceId}&siteId=${siteId}&stackDeviceId=${stackDeviceId}&pageSize=${pageSize}&pageNum=${pageNum}
|
}
|
||||||
method: 'get',
|
|
||||||
data
|
// 获取站点包含的设备种类 用来判断单站监控设备监控的菜单栏展示
|
||||||
})
|
export function getSiteAllDeviceCategory(data) {
|
||||||
}
|
return request({
|
||||||
// 单体电池图表
|
|
||||||
export function getSingleBatteryData(data) {
|
|
||||||
return request({
|
|
||||||
url: `/ems/siteMonitor/getSingleBatteryData`, //?siteId=${siteId}&deviceId=${deviceId}&startDate=${startDate}&endDate=${endDate}&clusterDeviceId=${clusterDeviceId}`,
|
|
||||||
method: 'get',
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取单个站点的基本信息
|
|
||||||
export function getSingleSiteBaseInfo(data) {
|
|
||||||
return request({
|
|
||||||
url: `/ems/siteMap/getSingleSiteBaseInfo`, //?siteId=${siteId}`,
|
|
||||||
method: 'get',
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 一周冲放曲线
|
|
||||||
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 getSiteAllDeviceCategory(data) {
|
|
||||||
return request({
|
|
||||||
url: `/ems/siteConfig/getSiteAllDeviceCategory`,
|
url: `/ems/siteConfig/getSiteAllDeviceCategory`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
69
components/SiteSelector/index.vue
Normal file
69
components/SiteSelector/index.vue
Normal 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>
|
||||||
128
components/SiteSwitchHeader/index.vue
Normal file
128
components/SiteSwitchHeader/index.vue
Normal 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>
|
||||||
@ -1,10 +1,11 @@
|
|||||||
// 应用全局配置
|
// 应用全局配置
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// todo 打包项目时切换baseUrl
|
// todo 打包项目时切换baseUrl
|
||||||
|
// baseUrl: 'http://localhost:8089',
|
||||||
// 测试环境
|
// 测试环境
|
||||||
// baseUrl: 'http://110.40.171.179:8089',
|
baseUrl: 'http://110.40.171.179:8089',
|
||||||
// 生产环境
|
// 生产环境
|
||||||
baseUrl: 'http://1.15.120.242:8089',
|
// baseUrl: 'http://1.15.120.242:8089',
|
||||||
// 应用信息
|
// 应用信息
|
||||||
appInfo: {
|
appInfo: {
|
||||||
// 应用名称
|
// 应用名称
|
||||||
|
|||||||
1
data/ems/china.json
Normal file
1
data/ems/china.json
Normal file
File diff suppressed because one or more lines are too long
@ -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",
|
||||||
|
|||||||
85
pages.json
85
pages.json
@ -9,15 +9,13 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "注册"
|
"navigationBarTitleText": "注册"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"path": "pages/index",
|
"path": "pages/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "工单列表",
|
"navigationBarTitleText": "首页"
|
||||||
"navigationStyle": "custom",
|
}
|
||||||
"onReachBottomDistance": 100
|
}, {
|
||||||
}
|
"path": "pages/work/index",
|
||||||
}, {
|
|
||||||
"path": "pages/work/index",
|
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "工作台"
|
"navigationBarTitleText": "工作台"
|
||||||
}
|
}
|
||||||
@ -71,11 +69,19 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "浏览文本"
|
"navigationBarTitleText": "浏览文本"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/ticket/index",
|
"path": "pages/ticket/list",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "工单详情"
|
"navigationBarTitleText": "工单列表",
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"onReachBottomDistance": 100
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/ticket/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "工单详情"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -96,17 +102,23 @@
|
|||||||
"navigationBarTitleText": "电表"
|
"navigationBarTitleText": "电表"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/work/pcs/index",
|
"path": "pages/work/pcs/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "PCS"
|
"navigationBarTitleText": "PCS"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/work/dtdc/index",
|
"path": "pages/work/yl/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "单体电池",
|
"navigationBarTitleText": "冷却"
|
||||||
"onReachBottomDistance": 100
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/work/dtdc/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "单体电池",
|
||||||
|
"onReachBottomDistance": 100
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,16 +128,21 @@
|
|||||||
"selectedColor": "#000000",
|
"selectedColor": "#000000",
|
||||||
"borderStyle": "white",
|
"borderStyle": "white",
|
||||||
"backgroundColor": "#ffffff",
|
"backgroundColor": "#ffffff",
|
||||||
"list": [{
|
"list": [{
|
||||||
"pagePath": "pages/index",
|
"pagePath": "pages/index",
|
||||||
"iconPath": "static/images/tabbar/home.png",
|
"iconPath": "static/images/tabbar/home.png",
|
||||||
"selectedIconPath": "static/images/tabbar/home_.png",
|
"selectedIconPath": "static/images/tabbar/home_.png",
|
||||||
"text": "首页"
|
"text": "首页"
|
||||||
}, {
|
}, {
|
||||||
"pagePath": "pages/work/index",
|
"pagePath": "pages/work/index",
|
||||||
"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",
|
||||||
@ -138,4 +155,4 @@
|
|||||||
"navigationBarTitleText": "EMS",
|
"navigationBarTitleText": "EMS",
|
||||||
"navigationBarBackgroundColor": "#FFFFFF"
|
"navigationBarBackgroundColor": "#FFFFFF"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
738
pages/index.vue
738
pages/index.vue
@ -1,229 +1,509 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="home-container">
|
||||||
<view class="status-bar"></view>
|
<site-switch-header :site-id="siteId" :site-type-options="siteTypeOptions" :site-address="baseInfo.siteAddress"
|
||||||
<view class="btn-list">
|
:running-time="baseInfo.runningTime" @change="selectedSite" />
|
||||||
<uni-row>
|
|
||||||
<uni-col :span="12">
|
<view class="base-info">
|
||||||
<button type="default" class="btns" :class="{'active-btn' : active === 'undone'}"
|
<view class="map-card">
|
||||||
@click="changeTab('undone')">待处理</button>
|
<image v-if="mapUrl" class="site-map" :src="mapUrl" mode="aspectFill"></image>
|
||||||
</uni-col>
|
<view v-else class="map-empty">暂无站点位置</view>
|
||||||
<uni-col :span="12">
|
</view>
|
||||||
<button type="default" class="btns" :class="{'active-btn' : active === 'done'}"
|
<view class="total-card">
|
||||||
@click="changeTab('done')">已处理</button>
|
<view class="total-header">
|
||||||
</uni-col>
|
<view class="title">总累计运行数据</view>
|
||||||
</uni-row>
|
<view class="total-revenue">
|
||||||
</view>
|
<text class="label">总收入</text>
|
||||||
<view v-if="list.length===0" class="no-data">暂无数据</view>
|
<text class="value">{{ format2(totalRevenueDisplayValue) }}</text>
|
||||||
<view class="content scroll-y" v-else>
|
<text class="unit">元</text>
|
||||||
<view class="item-list" v-for="item in list" :key="item.ticketNo+'ticket'" @click="toDetail(item.id)">
|
</view>
|
||||||
<view class="item-title" :class="item.status === 3 ? 'done' : item.status === 2 ? 'doing' : 'undone'">
|
</view>
|
||||||
工单号:{{item.ticketNo}}
|
<uni-grid :column="2" :showBorder="false" :square="false" :highlight="false">
|
||||||
<view class="item-status">{{ticketStatusOptions[item.status]}}</view>
|
<uni-grid-item v-for="(item, index) in runningDataCards" :key="index + 'sjglData'">
|
||||||
</view>
|
<view class="grid-item-box">
|
||||||
<view class="item-content">
|
<view class="title">{{ item.title }}</view>
|
||||||
<view class="item-info">工单标题:
|
<view class="text" :style="{ color: item.color }">
|
||||||
<text class="info-value">{{item.title}}</text>
|
{{ format2(item.value) }}
|
||||||
</view>
|
</view>
|
||||||
<view class="item-info">问题描述:
|
</view>
|
||||||
<text class="info-value">{{item.content}}</text>
|
</uni-grid-item>
|
||||||
</view>
|
</uni-grid>
|
||||||
<view class="item-info">预期完成时间:
|
</view>
|
||||||
<text class="info-value">{{item.expectedCompleteTime || '-'}}</text>
|
|
||||||
</view>
|
<uni-section title="收入曲线" type="line" class="sections-list">
|
||||||
<view class="item-info">处理人:
|
<view style="width:100%;height: 220px;">
|
||||||
<text class="info-value">
|
<qiun-data-charts type="column" :chartData="revenueChartData" :optsWatch='true'
|
||||||
{{item.workName || '-'}}
|
:inScrollView="true" :pageScrollTop="pageScrollTop" :opts="revenueOptions" :ontouch="true" />
|
||||||
</text>
|
</view>
|
||||||
</view>
|
</uni-section>
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</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'
|
||||||
export default {
|
import {
|
||||||
computed: {
|
getAllSites,
|
||||||
...mapState({
|
getSingleSiteBaseInfo,
|
||||||
ticketStatusOptions: (state) => state.ems.ticketStatusOptions
|
getDzjkHomeTotalView,
|
||||||
})
|
getProjectDisplayData,
|
||||||
},
|
getAmmeterRevenueData
|
||||||
data() {
|
} from '@/api/ems/site.js'
|
||||||
return {
|
import SiteSwitchHeader from '@/components/SiteSwitchHeader/index.vue'
|
||||||
active: 'undone',
|
const createSiteTypeOptions = () => ([{
|
||||||
total: 0,
|
text: '储能',
|
||||||
list: [],
|
value: 'cn',
|
||||||
pageNum: 1,
|
children: []
|
||||||
pageSize: 20
|
},
|
||||||
}
|
{
|
||||||
},
|
text: '光能',
|
||||||
methods: {
|
value: 'gn',
|
||||||
changeTab(active) {
|
children: []
|
||||||
if (active === this.active) return
|
},
|
||||||
this.active = active
|
{
|
||||||
this.reset()
|
text: '岸电',
|
||||||
this.init()
|
value: 'ad',
|
||||||
},
|
children: []
|
||||||
init() {
|
}
|
||||||
//1: '待处理', 2: '处理中', 3: '已处理'
|
])
|
||||||
let url = `/ticket/list?pageNum=${this.pageNum}&pageSize=${this.pageSize}`
|
|
||||||
if (this.active === 'done') {
|
export default {
|
||||||
url += `&status=3`
|
components: {
|
||||||
} else {
|
SiteSwitchHeader
|
||||||
url += `&status=1&status=2`
|
},
|
||||||
}
|
data() {
|
||||||
uni.showLoading()
|
return {
|
||||||
return listTicket(url).then(response => {
|
pageScrollTop: 0,
|
||||||
const data = JSON.parse(JSON.stringify(response?.rows || []))
|
siteOptions: [],
|
||||||
this.list = this.list.concat(data)
|
siteTypeOptions: createSiteTypeOptions(),
|
||||||
this.total = response?.total || 0
|
siteId: '',
|
||||||
}).finally(() => {
|
mapUrl: '',
|
||||||
uni.hideLoading()
|
baseInfo: {},
|
||||||
})
|
runningInfo: {},
|
||||||
},
|
runningDisplayData: [],
|
||||||
toDetail(id) {
|
revenueChartData: {},
|
||||||
this.$tab.navigateTo(`/pages/ticket/index?id=${id}`)
|
revenueOptions: {
|
||||||
},
|
padding: [10, 5, 0, 10],
|
||||||
reset() {
|
dataLabel: false,
|
||||||
this.list = []
|
enableScroll: false,
|
||||||
this.total = 0
|
xAxis: {
|
||||||
this.pageNum = 1
|
scrollShow: false,
|
||||||
}
|
itemCount: 5,
|
||||||
},
|
disableGrid: true
|
||||||
onReachBottom() {
|
},
|
||||||
if (this.list.length >= this.total) {
|
yAxis: {
|
||||||
return console.log('数据已经加载完成')
|
disabled: false,
|
||||||
}
|
splitNumber: 4
|
||||||
this.pageNum += 1;
|
},
|
||||||
this.init().catch(() => {
|
extra: {}
|
||||||
this.pageNum -= 1
|
},
|
||||||
})
|
fallbackSjglData: [{
|
||||||
|
title: "今日充电量(kWh)",
|
||||||
},
|
attr: "dayChargedCap",
|
||||||
onShow() {
|
color: '#4472c4'
|
||||||
this.reset()
|
},
|
||||||
this.init()
|
{
|
||||||
}
|
title: "今日放电量(kWh)",
|
||||||
}
|
attr: "dayDisChargedCap",
|
||||||
</script>
|
color: '#70ad47'
|
||||||
|
},
|
||||||
<style scoped lang="scss">
|
{
|
||||||
.container {
|
title: "总充电量(kWh)",
|
||||||
position: relative;
|
attr: "totalChargedCap",
|
||||||
background-color: #f5f6f7;
|
color: '#4472c4'
|
||||||
|
},
|
||||||
.no-data {
|
{
|
||||||
padding-top: 180rpx;
|
title: "今日实时收入(元)",
|
||||||
}
|
attr: "dayRevenue",
|
||||||
}
|
color: '#f67438'
|
||||||
|
},
|
||||||
uni-button:after {
|
{
|
||||||
border: none;
|
title: "昨日充电量(kWh)",
|
||||||
border-radius: 0;
|
attr: "yesterdayChargedCap",
|
||||||
}
|
color: '#4472c4'
|
||||||
|
},
|
||||||
.btn-list {
|
{
|
||||||
position: fixed;
|
title: "昨日放电量(kWh)",
|
||||||
top: var(--status-bar-height);
|
attr: "yesterdayDisChargedCap",
|
||||||
left: 0;
|
color: '#70ad47'
|
||||||
width: 100%;
|
},
|
||||||
z-index: 2;
|
{
|
||||||
padding: 20rpx 30rpx;
|
title: "总放电量(kWh)",
|
||||||
background: #ffffff;
|
attr: "totalDischargedCap",
|
||||||
|
color: '#70ad47'
|
||||||
.btns {
|
},
|
||||||
border: none;
|
{
|
||||||
border-radius: 40rpx;
|
title: "昨日实时收入(元)",
|
||||||
width: 90%;
|
attr: "yesterdayRevenue",
|
||||||
font-size: 26rpx;
|
color: '#f67438'
|
||||||
line-height: 64rpx;
|
}
|
||||||
color: #19242d;
|
]
|
||||||
background: #d9e7fc;
|
}
|
||||||
|
},
|
||||||
&.active-btn {
|
computed: {
|
||||||
background: #4c7af3;
|
...mapGetters(['belongSite', 'currentSiteId']),
|
||||||
color: #fff;
|
totalRunningSectionData() {
|
||||||
}
|
return (this.runningDisplayData || []).filter(item => item.sectionName === '总累计运行数据')
|
||||||
}
|
},
|
||||||
}
|
totalRevenueDisplayItem() {
|
||||||
|
const sectionData = this.totalRunningSectionData || []
|
||||||
.content {
|
const byFieldCode = sectionData.find(item => item.fieldCode === 'totalRevenue')
|
||||||
padding: 80px 30rpx 120rpx 30rpx;
|
if (byFieldCode) {
|
||||||
z-index: 1;
|
return byFieldCode
|
||||||
}
|
}
|
||||||
|
return sectionData.find(item => item.fieldName === '总收入')
|
||||||
// 工单列表
|
},
|
||||||
.item-list {
|
totalRevenueDisplayValue() {
|
||||||
color: #4b4951;
|
return this.totalRevenueDisplayItem ? this.totalRevenueDisplayItem.fieldValue : this.runningInfo.totalRevenue
|
||||||
border-radius: 14rpx;
|
},
|
||||||
box-shadow: 0 0 20rpx rgba(0, 0, 0, .1), 0 0 0 rgba(0, 0, 0, .5);
|
runningDataCards() {
|
||||||
font-size: 26rpx;
|
const sectionData = this.totalRunningSectionData || []
|
||||||
line-height: 40rpx;
|
if (sectionData.length > 0) {
|
||||||
margin-bottom: 30rpx;
|
const revenueFieldCode = this.totalRevenueDisplayItem ? this.totalRevenueDisplayItem.fieldCode : ''
|
||||||
border: 1px solid #eee;
|
return sectionData
|
||||||
background: #ffffff;
|
.filter(item => item.fieldCode !== revenueFieldCode)
|
||||||
|
.map((item, index) => ({
|
||||||
// 标题
|
title: item.fieldName,
|
||||||
.item-title {
|
value: item.fieldValue,
|
||||||
border-radius: 14rpx 14rpx 0 0;
|
color: this.getCardColor(index)
|
||||||
border-bottom: 1px solid #eee;
|
}))
|
||||||
padding: 20rpx 30rpx;
|
}
|
||||||
font-weight: 700;
|
return this.fallbackSjglData.map(item => ({
|
||||||
position: relative;
|
title: item.title,
|
||||||
|
value: this.runningInfo[item.attr],
|
||||||
.item-status {
|
color: item.color
|
||||||
position: absolute;
|
}))
|
||||||
right: 0;
|
}
|
||||||
top: 0;
|
},
|
||||||
padding: 2rpx 20rpx;
|
methods: {
|
||||||
color: #ffffff;
|
isAvailableSite(siteId) {
|
||||||
font-size: 22rpx;
|
const site = this.siteOptions.find(item => item.value === siteId)
|
||||||
}
|
return !!(site && !site.disable)
|
||||||
|
},
|
||||||
&.done {
|
getCardColor(index) {
|
||||||
.item-status {
|
const colors = ['#4472c4', '#70ad47', '#4472c4', '#f67438', '#4472c4', '#70ad47', '#70ad47', '#f67438']
|
||||||
background-color: #30be95;
|
return colors[index % colors.length]
|
||||||
}
|
},
|
||||||
}
|
format2(value) {
|
||||||
|
const num = Number(value || 0)
|
||||||
&.doing {
|
return Number.isFinite(num) ? num.toFixed(2) : '0.00'
|
||||||
.item-status {
|
},
|
||||||
background-color: #3c68e7;
|
getLastDaysRange(days = 7) {
|
||||||
}
|
const end = new Date()
|
||||||
}
|
const start = new Date(end.getTime() - (days - 1) * 24 * 60 * 60 * 1000)
|
||||||
|
return [formatDate(start), formatDate(end)]
|
||||||
&.undone {
|
},
|
||||||
.item-status {
|
buildDateList(start, end) {
|
||||||
background-color: #ed7876;
|
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))
|
||||||
.item-content {
|
}
|
||||||
padding: 20rpx 30rpx;
|
return list
|
||||||
font-size: 24rpx;
|
},
|
||||||
|
selectedSite(data) {
|
||||||
.item-info {
|
const siteObj = (data.detail.value || [])[1]
|
||||||
margin-bottom: 20rpx;
|
const value = siteObj?.value
|
||||||
|
if (!value) return
|
||||||
.info-value {
|
if (value === this.siteId) return
|
||||||
padding-left: 10rpx;
|
this.siteId = value
|
||||||
}
|
this.$store.commit('SET_CURRENTSITEID', value)
|
||||||
}
|
this.updateSiteInfo()
|
||||||
}
|
},
|
||||||
|
updateSiteInfo() {
|
||||||
.item-content .item-info:last-child {
|
if (!this.siteId) {
|
||||||
margin-bottom: 0;
|
this.baseInfo = {}
|
||||||
}
|
this.runningInfo = {}
|
||||||
}
|
this.runningDisplayData = []
|
||||||
|
this.revenueChartData = {}
|
||||||
.content .item-list:last-child {
|
this.mapUrl = ''
|
||||||
margin-bottom: 0;
|
return
|
||||||
}
|
}
|
||||||
</style>
|
this.updateMapCenter()
|
||||||
|
this.getSiteBaseInfo()
|
||||||
|
this.getRunningInfo()
|
||||||
|
this.getRevenueChartData()
|
||||||
|
},
|
||||||
|
getSiteBaseInfo() {
|
||||||
|
return getSingleSiteBaseInfo({
|
||||||
|
siteId: this.siteId
|
||||||
|
}).then(response => {
|
||||||
|
this.baseInfo = response?.data || {}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getSiteList() {
|
||||||
|
getAllSites().then(response => {
|
||||||
|
const data = response?.data || []
|
||||||
|
const canAccessAll = !this.belongSite || this.belongSite.length === 0 || this.belongSite.includes('all')
|
||||||
|
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,
|
||||||
|
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()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
updateMapCenter() {
|
||||||
|
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}`
|
||||||
|
},
|
||||||
|
getRunningInfo() {
|
||||||
|
return Promise.all([
|
||||||
|
getDzjkHomeTotalView(this.siteId),
|
||||||
|
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
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
currentSiteId(newSiteId) {
|
||||||
|
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>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
page {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: #fff;
|
||||||
|
min-height: 100%;
|
||||||
|
height: auto;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
view {
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #endif */
|
||||||
|
|
||||||
|
.home-container {
|
||||||
|
background-color: #fff;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.base-info {
|
||||||
|
margin-top: -80rpx;
|
||||||
|
border-radius: 80rpx 80rpx 0 0;
|
||||||
|
padding: 30rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.map-card {
|
||||||
|
border-radius: 16rpx;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-item-box {
|
||||||
|
padding-top: 6rpx;
|
||||||
|
padding-bottom: 6rpx;
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
margin-top: 10rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -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事件
|
||||||
|
|||||||
@ -96,11 +96,11 @@
|
|||||||
title: '提交成功',
|
title: '提交成功',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/index'
|
url: '/pages/ticket/list'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).finally(() => this.loading = false)
|
}).finally(() => this.loading = false)
|
||||||
|
|
||||||
},
|
},
|
||||||
// 获取上传状态
|
// 获取上传状态
|
||||||
@ -211,4 +211,4 @@
|
|||||||
.submit-button {
|
.submit-button {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
244
pages/ticket/list.vue
Normal file
244
pages/ticket/list.vue
Normal 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>
|
||||||
@ -2,16 +2,12 @@
|
|||||||
<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+'bmscc'" :open="index===0"
|
<uni-collapse-item v-for="(item,index) in list" :key="item.deviceId+'bmscc'" :open="index===0"
|
||||||
class="common-collapse-item" :class="{
|
class="common-collapse-item" :class="handleCardClass(item)">
|
||||||
'timing-collapse-item':!['0','2'].includes(item.workStatus),
|
|
||||||
'warning-collapse-item':item.workStatus === '2',
|
|
||||||
'running-collapse-item':item.workStatus === '0'
|
|
||||||
}">
|
|
||||||
|
|
||||||
<template v-slot:title>
|
<template v-slot:title>
|
||||||
<view class='title-wrapper'>
|
<view class='title-wrapper'>
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<view class="status">{{workStatusOptions[item.workStatus] || '暂无数据'}}</view>
|
<view class="status">{{CLUSTERWorkStatusOptions[item.workStatus] || '暂无数据'}}</view>
|
||||||
<text
|
<text
|
||||||
class="name">{{`${item.parentDeviceName?`${item.parentDeviceName} -> ` : ''}${item.deviceName}`}}</text>
|
class="name">{{`${item.parentDeviceName?`${item.parentDeviceName} -> ` : ''}${item.deviceName}`}}</text>
|
||||||
</view>
|
</view>
|
||||||
@ -25,7 +21,7 @@
|
|||||||
<view class="grid-item-box">
|
<view class="grid-item-box">
|
||||||
<view class="title">工作状态</view>
|
<view class="title">工作状态</view>
|
||||||
<text
|
<text
|
||||||
class="text work-status-color">{{workStatusOptions[item.workStatus] || '-'}}</text>
|
class="text work-status-color">{{CLUSTERWorkStatusOptions[item.workStatus] || '-'}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-lists">
|
<view class="flex-lists">
|
||||||
@ -45,9 +41,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</uni-group>
|
</uni-group>
|
||||||
<!-- 设备数据 -->
|
<!-- 设备数据 -->
|
||||||
<uni-group mode="card" class="data-card-group">
|
<uni-group mode="card" class="data-card-group">
|
||||||
<uni-row v-for="(infoDataItem,infoDataIndex) in infoData" :key="infoDataIndex+'infoData'"
|
<uni-row v-for="(infoDataItem,infoDataIndex) in infoData" :key="infoDataIndex+'infoData'"
|
||||||
class="data-row">
|
class="data-row">
|
||||||
<uni-col :span="8">
|
<uni-col :span="8">
|
||||||
<view class="title">{{infoDataItem.label}}</view>
|
<view class="title">{{infoDataItem.label}}</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
@ -55,37 +51,12 @@
|
|||||||
<view class="value">{{item[infoDataItem.attr] | formatNumber}}
|
<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>
|
||||||
</view>
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
</uni-group>
|
</uni-group>
|
||||||
<!-- 子设备表格 -->
|
</view>
|
||||||
<uni-group mode="card" class="child-card-group" style="margin-bottom:20rpx;">
|
</uni-collapse-item>
|
||||||
<uni-table border stripe emptyText="暂无数据" class="child-table">
|
</uni-collapse>
|
||||||
<!-- 表头行 -->
|
|
||||||
<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>
|
|
||||||
</view>
|
|
||||||
</uni-collapse-item>
|
|
||||||
</uni-collapse>
|
|
||||||
<view class="no-data" v-else>
|
<view class="no-data" v-else>
|
||||||
暂无数据
|
暂无数据
|
||||||
</view>
|
</view>
|
||||||
@ -93,32 +64,31 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
getBMSBatteryCluster
|
getProjectDisplayData,
|
||||||
} from '@/api/ems/site.js'
|
getStackNameList,
|
||||||
import {
|
getClusterNameList
|
||||||
mapState
|
} from '@/api/ems/site.js'
|
||||||
} from 'vuex'
|
import {
|
||||||
export default {
|
mapState
|
||||||
|
} from 'vuex'
|
||||||
|
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: [],
|
||||||
'温度': '℃',
|
list: [],
|
||||||
'SOC': '%'
|
siteId: '',
|
||||||
},
|
infoData: [{
|
||||||
list: [],
|
|
||||||
siteId: '',
|
|
||||||
infoData: [{
|
|
||||||
label: '簇电压',
|
label: '簇电压',
|
||||||
attr: 'clusterVoltage',
|
attr: 'clusterVoltage',
|
||||||
unit: 'V',
|
unit: 'V',
|
||||||
@ -182,27 +152,157 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
methods: {
|
||||||
uni.showLoading()
|
handleCardClass(item) {
|
||||||
this.siteId = options.siteId || ''
|
const {
|
||||||
getBMSBatteryCluster({
|
workStatus = ''
|
||||||
siteId: this.siteId
|
} = item
|
||||||
}).then(response => {
|
return !(Object.keys(this.CLUSTERWorkStatusOptions).includes(item.workStatus)) ? "timing-collapse-item" :
|
||||||
this.list = response?.data || []
|
workStatus === '9' ? 'warning-collapse-item' : 'running-collapse-item'
|
||||||
if (this.list.length > 0) {
|
},
|
||||||
this.$nextTick(() => {
|
getModuleRows(menuCode, sectionName) {
|
||||||
setTimeout(() => {
|
return (this.displayData || []).filter(item => item.menuCode === menuCode && item.sectionName === sectionName)
|
||||||
// this.$refs.collapse.resize()
|
},
|
||||||
uni.hideLoading()
|
getFieldName(fieldCode) {
|
||||||
}, 100)
|
const raw = String(fieldCode || '').trim()
|
||||||
})
|
if (!raw) return ''
|
||||||
} else {
|
const index = raw.lastIndexOf('__')
|
||||||
uni.hideLoading()
|
return index >= 0 ? raw.slice(index + 2) : raw
|
||||||
}
|
},
|
||||||
|
getFieldRowMap(rows = [], deviceId = '') {
|
||||||
}).catch(() => {
|
const map = {}
|
||||||
uni.hideLoading()
|
const targetDeviceId = String(deviceId || '')
|
||||||
})
|
rows.forEach(item => {
|
||||||
}
|
if (!item || !item.fieldCode) return
|
||||||
}
|
const itemDeviceId = String(item.deviceId || '')
|
||||||
</script>
|
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
|
||||||
|
})
|
||||||
|
.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) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.hideLoading()
|
||||||
|
}, 100)
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
uni.hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|||||||
@ -2,16 +2,12 @@
|
|||||||
<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"
|
||||||
class="common-collapse-item" :class="{
|
class="common-collapse-item" :class="handleCardClass(item,index)">
|
||||||
'timing-collapse-item':!['0','2'].includes(item.workStatus),
|
|
||||||
'warning-collapse-item':item.workStatus === '2',
|
|
||||||
'running-collapse-item':item.workStatus === '0'
|
|
||||||
}">
|
|
||||||
|
|
||||||
<template v-slot:title>
|
<template v-slot:title>
|
||||||
<view class='title-wrapper'>
|
<view class='title-wrapper'>
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<view class="status">{{workStatusOptions[item.workStatus] || '暂无数据'}}</view>
|
<view class="status">{{STACKWorkStatusOptions[item.workStatus] || '暂无数据'}}</view>
|
||||||
<text class="name">{{item.deviceName}}</text>
|
<text class="name">{{item.deviceName}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -24,7 +20,7 @@
|
|||||||
<view class="grid-item-box">
|
<view class="grid-item-box">
|
||||||
<view class="title">工作状态</view>
|
<view class="title">工作状态</view>
|
||||||
<text
|
<text
|
||||||
class="text work-status-color">{{workStatusOptions[item.workStatus] || '-'}}</text>
|
class="text work-status-color">{{STACKWorkStatusOptions[item.workStatus] || '-'}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-lists">
|
<view class="flex-lists">
|
||||||
@ -57,45 +53,9 @@
|
|||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
</uni-group>
|
</uni-group>
|
||||||
<!-- 子设备表格 -->
|
</view>
|
||||||
<uni-group mode="card" class="child-card-group" style="margin-bottom:20rpx;">
|
</uni-collapse-item>
|
||||||
<uni-table border stripe emptyText="暂无数据" class="child-table">
|
</uni-collapse>
|
||||||
<!-- 表头行 -->
|
|
||||||
<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-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.maxCellVoltageId}}</uni-td>
|
|
||||||
<uni-td align="center">{{tableItem.minCellVoltage}}V</uni-td>
|
|
||||||
<uni-td align="center">{{tableItem.maxCellVoltageId}}</uni-td>
|
|
||||||
<uni-td align="center">{{tableItem.maxCellTemp}}℃</uni-td>
|
|
||||||
<uni-td align="center">{{tableItem.maxCellTempId}}</uni-td>
|
|
||||||
<uni-td align="center">{{tableItem.minCellTemp}}℃</uni-td>
|
|
||||||
<uni-td align="center">{{tableItem.minCellTempId}}</uni-td>
|
|
||||||
</uni-tr>
|
|
||||||
</uni-table>
|
|
||||||
</uni-group>
|
|
||||||
</view>
|
|
||||||
</uni-collapse-item>
|
|
||||||
</uni-collapse>
|
|
||||||
<view class="no-data" v-else>
|
<view class="no-data" v-else>
|
||||||
暂无数据
|
暂无数据
|
||||||
</view>
|
</view>
|
||||||
@ -103,27 +63,30 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
getBMSOverView
|
getProjectDisplayData,
|
||||||
} from '@/api/ems/site.js'
|
getStackNameList
|
||||||
import {
|
} from '@/api/ems/site.js'
|
||||||
mapState
|
import {
|
||||||
} from 'vuex'
|
mapState
|
||||||
export default {
|
} from 'vuex'
|
||||||
|
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 {
|
||||||
list: [],
|
displayData: [],
|
||||||
siteId: '',
|
stackDeviceList: [],
|
||||||
infoData: [{
|
list: [],
|
||||||
|
siteId: '',
|
||||||
|
infoData: [{
|
||||||
label: '电池堆总电压',
|
label: '电池堆总电压',
|
||||||
attr: 'stackVoltage',
|
attr: 'stackVoltage',
|
||||||
unit: 'V',
|
unit: 'V',
|
||||||
@ -186,28 +149,110 @@
|
|||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
methods: {
|
||||||
uni.showLoading()
|
getModuleRows(menuCode, sectionName) {
|
||||||
this.siteId = options.siteId || ''
|
return (this.displayData || []).filter(item => item.menuCode === menuCode && item.sectionName === sectionName)
|
||||||
getBMSOverView({
|
},
|
||||||
siteId: this.siteId
|
getFieldName(fieldCode) {
|
||||||
}).then(response => {
|
const raw = String(fieldCode || '').trim()
|
||||||
this.list = response?.data || []
|
if (!raw) return ''
|
||||||
if (this.list.length > 0) {
|
const index = raw.lastIndexOf('__')
|
||||||
this.$nextTick(() => {
|
return index >= 0 ? raw.slice(index + 2) : raw
|
||||||
setTimeout(() => {
|
},
|
||||||
this.$refs.collapse.resize()
|
isEmptyValue(value) {
|
||||||
uni.hideLoading()
|
return value === undefined || value === null || value === ''
|
||||||
}, 100)
|
},
|
||||||
})
|
getFieldRowMap(rows = [], deviceId = '') {
|
||||||
} else {
|
const map = {}
|
||||||
uni.hideLoading()
|
const targetDeviceId = String(deviceId || '')
|
||||||
}
|
rows.forEach(item => {
|
||||||
|
if (!item || !item.fieldCode) return
|
||||||
}).catch(() => {
|
const itemDeviceId = String(item.deviceId || '')
|
||||||
uni.hideLoading()
|
if (itemDeviceId !== targetDeviceId) return
|
||||||
})
|
map[this.getFieldName(item.fieldCode)] = item
|
||||||
}
|
})
|
||||||
}
|
rows.forEach(item => {
|
||||||
</script>
|
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()
|
||||||
|
this.siteId = options.siteId || ''
|
||||||
|
this.updateData().then(() => {
|
||||||
|
if (this.list.length === 0) {
|
||||||
|
uni.hideLoading()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$refs.collapse && this.$refs.collapse.resize()
|
||||||
|
uni.hideLoading()
|
||||||
|
}, 100)
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
uni.hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|||||||
@ -16,22 +16,21 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<view class='content' v-if="deviceIdTypeMsg[item.deviceId]">
|
<view class='content'>
|
||||||
<uni-group mode="card" class="data-card-group">
|
<uni-group mode="card" class="data-card-group">
|
||||||
<uni-row v-for="(tempDataItem,tempDataIndex) in
|
<uni-row v-for="(tempDataItem,tempDataIndex) in
|
||||||
deviceIdTypeMsg[item.deviceId]" :key="tempDataIndex+'dbTempData'" class="data-row">
|
(item.fieldConfigs || otherTypeMsg)" :key="tempDataIndex+'dbTempData'" class="data-row">
|
||||||
<uni-col :span="8">
|
<uni-col :span="8">
|
||||||
<view class="title">{{tempDataItem.name}}</view>
|
<view class="title">{{tempDataItem.name}}</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="16">
|
<uni-col :span="16">
|
||||||
<view class="value">{{item[tempDataItem.attr] | formatNumber}}
|
<view class="value">{{item[tempDataItem.attr] | formatNumber}}
|
||||||
<!-- <text v-if="infoDataItem.unit" v-html="infoDataItem.unit"></text> -->
|
<text v-if="tempDataItem.unit" v-html="tempDataItem.unit"></text>
|
||||||
</view>
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
</uni-group>
|
</uni-group>
|
||||||
</view>
|
</view>
|
||||||
<view v-else class='unknow-bd-device'>未知的电表数据</view>
|
|
||||||
</uni-collapse-item>
|
</uni-collapse-item>
|
||||||
</uni-collapse>
|
</uni-collapse>
|
||||||
<view class="no-data" v-else>
|
<view class="no-data" v-else>
|
||||||
@ -41,129 +40,178 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
getAmmeterDataList
|
getProjectDisplayData,
|
||||||
} from '@/api/ems/site.js'
|
getDeviceList
|
||||||
import {
|
} from '@/api/ems/site.js'
|
||||||
mapState
|
import {
|
||||||
} from 'vuex'
|
mapState
|
||||||
export default {
|
} from 'vuex'
|
||||||
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
communicationStatusOptions: (state) =>
|
communicationStatusOptions: (state) =>
|
||||||
state.ems.communicationStatusOptions,
|
state.ems.communicationStatusOptions,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
siteId: '',
|
siteId: '',
|
||||||
list: [],
|
displayData: [],
|
||||||
deviceIdTypeMsg: {
|
ammeterDeviceList: [],
|
||||||
'LOAD': [{
|
list: [],
|
||||||
name: '正向有功电能',
|
otherTypeMsg: [{
|
||||||
attr: 'forwardActive',
|
name: '正向有功电能',
|
||||||
pointName: '正向有功电能'
|
attr: 'forwardActive',
|
||||||
},
|
pointName: '正向有功电能',
|
||||||
{
|
unit: 'kWh'
|
||||||
name: '反向有功电能',
|
},
|
||||||
attr: 'reverseActive',
|
{
|
||||||
pointName: '反向有功电能'
|
name: '反向有功电能',
|
||||||
},
|
attr: 'reverseActive',
|
||||||
{
|
pointName: '反向有功电能',
|
||||||
name: '正向无功电能',
|
unit: 'kWh'
|
||||||
attr: 'forwardReactive',
|
},
|
||||||
pointName: '正向无功电能'
|
{
|
||||||
},
|
name: '正向无功电能',
|
||||||
{
|
attr: 'forwardReactive',
|
||||||
name: '反向无功电能',
|
pointName: '正向无功电能',
|
||||||
attr: 'reverseReactive',
|
unit: 'kvarh'
|
||||||
pointName: '反向无功电能'
|
},
|
||||||
},
|
{
|
||||||
{
|
name: '反向无功电能',
|
||||||
name: '有功功率',
|
attr: 'reverseReactive',
|
||||||
attr: 'activePower',
|
pointName: '反向无功电能',
|
||||||
pointName: '总有功功率'
|
unit: 'kvarh'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '无功功率',
|
name: '有功功率',
|
||||||
attr: 'reactivePower',
|
attr: 'activePower',
|
||||||
pointName: '总无功功率'
|
pointName: '总有功功率',
|
||||||
}
|
unit: 'kW'
|
||||||
],
|
},
|
||||||
'METE': [{
|
{
|
||||||
name: '正向有功电能',
|
name: '无功功率',
|
||||||
attr: 'forwardActive',
|
attr: 'reactivePower',
|
||||||
pointName: '正向有功电能'
|
pointName: '总无功功率',
|
||||||
},
|
unit: 'kvar'
|
||||||
{
|
},
|
||||||
name: '反向有功电能',
|
]
|
||||||
attr: 'reverseActive',
|
}
|
||||||
pointName: '反向有功电能'
|
},
|
||||||
},
|
methods: {
|
||||||
{
|
getModuleRows(menuCode) {
|
||||||
name: '正向无功电能',
|
return (this.displayData || []).filter(item => item.menuCode === menuCode)
|
||||||
attr: 'forwardReactive',
|
},
|
||||||
pointName: '正向无功电能'
|
getFieldName(fieldCode) {
|
||||||
},
|
const raw = String(fieldCode || '').trim()
|
||||||
{
|
if (!raw) return ''
|
||||||
name: '反向无功电能',
|
const index = raw.lastIndexOf('__')
|
||||||
attr: 'reverseReactive',
|
return index >= 0 ? raw.slice(index + 2) : raw
|
||||||
pointName: '反向无功电能'
|
},
|
||||||
},
|
isEmptyValue(value) {
|
||||||
{
|
return value === undefined || value === null || value === ''
|
||||||
name: '有功功率',
|
},
|
||||||
attr: 'activePower',
|
getFieldRowMap(rows = [], deviceId = '') {
|
||||||
pointName: '总有功功率'
|
const map = {}
|
||||||
},
|
const targetDeviceId = String(deviceId || '')
|
||||||
{
|
rows.forEach(item => {
|
||||||
name: '无功功率',
|
if (!item || !item.fieldCode) return
|
||||||
attr: 'reactivePower',
|
const itemDeviceId = String(item.deviceId || '')
|
||||||
pointName: '总无功功率'
|
if (itemDeviceId !== targetDeviceId) return
|
||||||
}
|
map[this.getFieldName(item.fieldCode)] = item
|
||||||
],
|
})
|
||||||
'METEGF': [{
|
rows.forEach(item => {
|
||||||
name: '有功电能',
|
if (!item || !item.fieldCode) return
|
||||||
attr: 'activeEnergy',
|
const itemDeviceId = String(item.deviceId || '')
|
||||||
pointName: '有功电能'
|
if (itemDeviceId !== '') return
|
||||||
},
|
const fieldName = this.getFieldName(item.fieldCode)
|
||||||
{
|
const existRow = map[fieldName]
|
||||||
name: '无功电能',
|
if (!existRow || this.isEmptyValue(existRow.fieldValue)) {
|
||||||
attr: 'reactiveEnergy',
|
map[fieldName] = item
|
||||||
pointName: '无功电能'
|
}
|
||||||
},
|
})
|
||||||
{
|
return map
|
||||||
name: '有功功率',
|
},
|
||||||
attr: 'activePower',
|
getFieldConfigs(rows = []) {
|
||||||
pointName: '总有功功率'
|
const result = []
|
||||||
},
|
const seen = {}
|
||||||
{
|
(rows || []).forEach(item => {
|
||||||
name: '无功功率',
|
const attr = this.getFieldName(item?.fieldCode)
|
||||||
attr: 'reactivePower',
|
const name = String(item?.fieldName || '').trim()
|
||||||
pointName: '总无功功率'
|
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 || ''
|
||||||
onLoad(options) {
|
})
|
||||||
uni.showLoading()
|
seen[name] = true
|
||||||
this.siteId = options.siteId || ''
|
})
|
||||||
getAmmeterDataList({
|
return result.length > 0 ? result : this.otherTypeMsg
|
||||||
siteId: this.siteId
|
},
|
||||||
}).then(response => {
|
buildList() {
|
||||||
this.list = response?.data || []
|
const rows = this.getModuleRows('SBJK_DB')
|
||||||
if (this.list.length > 0) {
|
const fieldConfigs = this.getFieldConfigs(rows)
|
||||||
this.$nextTick(() => {
|
let devices = (this.ammeterDeviceList || []).filter(item => item.deviceCategory === 'AMMETER')
|
||||||
setTimeout(() => {
|
if (devices.length === 0) {
|
||||||
this.$refs.collapse.resize()
|
const grouped = {}
|
||||||
uni.hideLoading()
|
rows.forEach(item => {
|
||||||
}, 1000)
|
const id = String(item?.deviceId || '').trim()
|
||||||
})
|
if (!id || grouped[id]) return
|
||||||
} else {
|
grouped[id] = {
|
||||||
uni.hideLoading()
|
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()
|
||||||
|
this.siteId = options.siteId || ''
|
||||||
|
Promise.all([
|
||||||
|
getProjectDisplayData(this.siteId),
|
||||||
|
getDeviceList(this.siteId)
|
||||||
|
]).then(([displayResponse, deviceResponse]) => {
|
||||||
|
this.displayData = displayResponse?.data || []
|
||||||
|
this.ammeterDeviceList = deviceResponse?.data || []
|
||||||
|
this.buildList()
|
||||||
|
if (this.list.length > 0) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$refs.collapse.resize()
|
||||||
|
uni.hideLoading()
|
||||||
|
}, 100)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.hideLoading()
|
||||||
|
}
|
||||||
|
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
@ -180,4 +228,4 @@
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -329,14 +329,12 @@
|
|||||||
this.getClusterList()
|
this.getClusterList()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getStackList() {
|
getStackList() {
|
||||||
getStackNameList({
|
getStackNameList(this.siteId).then(response => {
|
||||||
siteId: this.siteId
|
this.stackOptions = JSON.parse(JSON.stringify(response?.data || [])).map(item => {
|
||||||
}).then(response => {
|
return {
|
||||||
this.stackOptions = JSON.parse(JSON.stringify(response?.data || [])).map(item => {
|
text: item.deviceName,
|
||||||
return {
|
value: item.id
|
||||||
text: item.deviceName,
|
|
||||||
value: item.id
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -516,4 +514,4 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,32 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="work-container">
|
<view class="work-container">
|
||||||
<view class="site-sections-list">
|
<site-switch-header :site-id="siteId" :site-type-options="siteTypeOptions" :site-address="baseInfo.siteAddress"
|
||||||
<uni-data-picker placeholder="请选择" popup-title="业态选择" :step-searh="true" :value="siteId" :clear-icon="false"
|
:running-time="baseInfo.runningTime" @change="selectedSite" />
|
||||||
:localdata="siteTypeOptions" :ellipsis="false" @change="selectedSite">
|
|
||||||
</uni-data-picker>
|
|
||||||
<view class="info">
|
|
||||||
<view class="list"> <uni-icons type="location" color="#fff" size="20"></uni-icons>
|
|
||||||
{{baseInfo.siteAddress || '-'}}
|
|
||||||
</view>
|
|
||||||
<view class="list">
|
|
||||||
<uni-icons type="calendar" color="#fff" size="20"></uni-icons>
|
|
||||||
{{baseInfo.runningTime || '-'}}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 静态信息 -->
|
<!-- 静态信息 -->
|
||||||
<view class="base-info">
|
<view class="base-info">
|
||||||
<uni-group mode="card" class="install-data">
|
<uni-group mode="card" class="install-data">
|
||||||
<uni-grid :column="2" :showBorder="false" :square="false" :highlight="false">
|
<uni-grid :column="2" :showBorder="false" :square="false" :highlight="false">
|
||||||
<uni-grid-item>
|
<uni-grid-item>
|
||||||
<view class="grid-item-box">
|
<view class="grid-item-box">
|
||||||
<view class="title">装机功率(MW)</view>
|
<view class="title">装机功率(MWh)</view>
|
||||||
<view class="text">{{baseInfo.installPower | formatNumber}}</view>
|
<view class="text">{{baseInfo.installPower | formatNumber}}</view>
|
||||||
</view>
|
</view>
|
||||||
</uni-grid-item>
|
</uni-grid-item>
|
||||||
<uni-grid-item>
|
<uni-grid-item>
|
||||||
<view class="grid-item-box">
|
<view class="grid-item-box">
|
||||||
<view class="title">装机容量(MW)</view>
|
<view class="title">装机容量(MWh)</view>
|
||||||
<view class="text">{{baseInfo.installCapacity | formatNumber}}</view>
|
<view class="text">{{baseInfo.installCapacity | formatNumber}}</view>
|
||||||
</view>
|
</view>
|
||||||
</uni-grid-item>
|
</uni-grid-item>
|
||||||
@ -66,29 +54,49 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
mapGetters
|
mapGetters
|
||||||
} from 'vuex'
|
} from 'vuex'
|
||||||
import DateRangeSelect from './DateRangeSelect.vue'
|
import DateRangeSelect from './DateRangeSelect.vue'
|
||||||
import {
|
import SiteSwitchHeader from '@/components/SiteSwitchHeader/index.vue'
|
||||||
getAllSites,
|
import {
|
||||||
getSingleSiteBaseInfo,
|
getAllSites,
|
||||||
getSevenChargeData,
|
getSingleSiteBaseInfo,
|
||||||
getPointData,
|
getProjectDisplayData,
|
||||||
getSiteAllDeviceCategory
|
getPointConfigCurve,
|
||||||
} from '@/api/ems/site.js'
|
getSiteAllDeviceCategory
|
||||||
export default {
|
} from '@/api/ems/site.js'
|
||||||
components: {
|
const createSiteTypeOptions = () => ([{
|
||||||
DateRangeSelect
|
text: '储能',
|
||||||
},
|
value: 'cn',
|
||||||
|
children: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '光能',
|
||||||
|
value: 'gn',
|
||||||
|
children: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '岸电',
|
||||||
|
value: 'ad',
|
||||||
|
children: []
|
||||||
|
}
|
||||||
|
])
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
DateRangeSelect,
|
||||||
|
SiteSwitchHeader
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 图表数据
|
// 图表数据
|
||||||
weekChartTimeRange: [],
|
weekChartTimeRange: [],
|
||||||
activeChartTimeRange: [],
|
activeChartTimeRange: [],
|
||||||
weekChartData: {},
|
weekChartData: {},
|
||||||
activeChartData: {},
|
activeChartData: {},
|
||||||
pageScrollTop: 0,
|
curveDisplayData: [],
|
||||||
|
curveDisplayLoadingPromise: null,
|
||||||
|
pageScrollTop: 0,
|
||||||
glqxOptions: {
|
glqxOptions: {
|
||||||
padding: [10, 5, 0, 10],
|
padding: [10, 5, 0, 10],
|
||||||
dataLabel: false,
|
dataLabel: false,
|
||||||
@ -140,25 +148,8 @@
|
|||||||
// padding: [10, 15, 10, 15]
|
// padding: [10, 15, 10, 15]
|
||||||
},
|
},
|
||||||
// 图表数据结束
|
// 图表数据结束
|
||||||
deviceCategoryOptions: [], //当前站点包含的设备类别
|
deviceCategoryOptions: [], //当前站点包含的设备类别
|
||||||
siteTypeOptions: [{
|
siteTypeOptions: createSiteTypeOptions(),
|
||||||
text: '储能',
|
|
||||||
value: 'cn',
|
|
||||||
children: []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '光能',
|
|
||||||
value: 'gn',
|
|
||||||
disable: true,
|
|
||||||
children: []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '岸电',
|
|
||||||
value: 'ad',
|
|
||||||
disable: true,
|
|
||||||
children: []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
siteId: '', //选择的站点ID
|
siteId: '', //选择的站点ID
|
||||||
baseInfo: {}, //站点基本信息
|
baseInfo: {}, //站点基本信息
|
||||||
gridList: [{
|
gridList: [{
|
||||||
@ -179,32 +170,45 @@
|
|||||||
text: 'PCS',
|
text: 'PCS',
|
||||||
categoryName: 'PCS'
|
categoryName: 'PCS'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
page: 'db',
|
page: 'db',
|
||||||
icon: 'icon-dianbiao4',
|
icon: 'icon-dianbiao4',
|
||||||
text: '电表',
|
text: '电表',
|
||||||
categoryName: 'AMMETER'
|
categoryName: 'AMMETER'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
page: 'dtdc',
|
page: 'yl',
|
||||||
icon: 'icon-dantidianchi',
|
icon: 'icon-gongneng-diandongji',
|
||||||
text: '单体电池',
|
text: '冷却',
|
||||||
|
categoryName: 'COOLING'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
page: 'dtdc',
|
||||||
|
icon: 'icon-dantidianchi',
|
||||||
|
text: '单体电池',
|
||||||
categoryName: 'BATTERY'
|
categoryName: 'BATTERY'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['belongSite']),
|
...mapGetters(['belongSite', 'currentSiteId']),
|
||||||
siteGirdList() {
|
siteGirdList() {
|
||||||
return this.gridList.filter(i => this.deviceCategoryOptions.includes(i.categoryName))
|
return this.gridList.filter(i => this.deviceCategoryOptions.includes(i.categoryName))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 更新一周冲放曲线时间范围 重置图表
|
isAvailableSite(siteId) {
|
||||||
updateWeekChartDate(data) {
|
const allSites = this.siteTypeOptions.reduce((result, typeItem) => {
|
||||||
this.weekChartTimeRange = data || []
|
return result.concat(typeItem.children || [])
|
||||||
this.siteId && this.getWeekChartData()
|
}, [])
|
||||||
|
const site = allSites.find(item => item.value === siteId)
|
||||||
|
return !!(site && !site.disable)
|
||||||
|
},
|
||||||
|
// 更新一周冲放曲线时间范围 重置图表
|
||||||
|
updateWeekChartDate(data) {
|
||||||
|
this.weekChartTimeRange = data || []
|
||||||
|
this.siteId && this.getWeekChartData()
|
||||||
},
|
},
|
||||||
// 更新当日功率曲线时间范围 重置图表
|
// 更新当日功率曲线时间范围 重置图表
|
||||||
updateActiveChartDate(data) {
|
updateActiveChartDate(data) {
|
||||||
@ -221,44 +225,162 @@
|
|||||||
} = e.detail
|
} = e.detail
|
||||||
this.$tab.navigateTo(`/pages/work/${this.siteGirdList[index].page}/index?siteId=${this.siteId}`)
|
this.$tab.navigateTo(`/pages/work/${this.siteGirdList[index].page}/index?siteId=${this.siteId}`)
|
||||||
},
|
},
|
||||||
selectedSite(data) {
|
selectedSite(data) {
|
||||||
const [typeObj, siteObj] = data.detail.value
|
const siteObj = (data.detail.value || [])[1]
|
||||||
const {
|
const value = siteObj?.value
|
||||||
text,
|
if (!value) return
|
||||||
value
|
if (value === this.siteId) return
|
||||||
} = siteObj
|
this.siteId = value
|
||||||
if (value === this.siteId) return
|
this.$store.commit('SET_CURRENTSITEID', value)
|
||||||
this.siteId = value
|
this.updateSiteInfo()
|
||||||
this.updateSiteInfo()
|
},
|
||||||
},
|
updateSiteInfo() {
|
||||||
updateSiteInfo() {
|
if (!this.siteId) return
|
||||||
if (!this.siteId) return
|
this.curveDisplayData = []
|
||||||
this.getSiteBaseInfo()
|
this.curveDisplayLoadingPromise = null
|
||||||
this.getWeekChartData()
|
this.getSiteBaseInfo()
|
||||||
this.getGVQXData()
|
this.getWeekChartData()
|
||||||
this.getSiteDeviceCategory()
|
this.getGVQXData()
|
||||||
},
|
this.getSiteDeviceCategory()
|
||||||
getSiteList() {
|
},
|
||||||
getAllSites().then(response => {
|
getFieldName(fieldCode) {
|
||||||
const data = response?.data || []
|
const raw = String(fieldCode || '').trim()
|
||||||
this.siteTypeOptions.find(i => i.value === 'cn').children = data.map(item => {
|
if (!raw) return ''
|
||||||
return {
|
const index = raw.lastIndexOf('__')
|
||||||
text: item.siteName,
|
return index >= 0 ? raw.slice(index + 2) : raw
|
||||||
value: item.siteId,
|
},
|
||||||
id: item.id,
|
normalizeDateTime(value, endOfDay) {
|
||||||
disable: !this.belongSite || this.belongSite.length === 0 || this
|
const raw = String(value || '').trim()
|
||||||
.belongSite.includes('all') ? false : !this.belongSite.includes(item
|
if (!raw) return ''
|
||||||
.siteId)
|
if (raw.includes(' ')) return raw
|
||||||
}
|
return `${raw} ${endOfDay ? '23:59:59' : '00:00:00'}`
|
||||||
})
|
},
|
||||||
// 设置默认展示的站点
|
parseToTimestamp(value) {
|
||||||
this.siteId = this.siteTypeOptions.find(i => i.children && i.children.length > 0)?.children
|
if (!value) return null
|
||||||
.find(
|
const timestamp = new Date(value).getTime()
|
||||||
item => !item
|
return Number.isNaN(timestamp) ? null : timestamp
|
||||||
.disable)?.value || ''
|
},
|
||||||
this.siteId && this.updateSiteInfo()
|
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
|
||||||
|
}
|
||||||
|
},
|
||||||
|
findActiveCurveRow(sectionRows, keywords = []) {
|
||||||
|
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 => {
|
||||||
|
const data = response?.data || []
|
||||||
|
const canAccessAll = !this.belongSite || this.belongSite.length === 0 || this.belongSite.includes('all')
|
||||||
|
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,
|
||||||
|
value: item.siteId,
|
||||||
|
id: item.id
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.siteTypeOptions = siteTypeOptions.filter(item => (item.children || []).length > 0)
|
||||||
|
const siteChildren = this.siteTypeOptions.reduce((result, typeItem) => {
|
||||||
|
return result.concat(typeItem.children || [])
|
||||||
|
}, [])
|
||||||
|
// 设置默认展示的站点
|
||||||
|
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() {
|
getSiteBaseInfo() {
|
||||||
getSingleSiteBaseInfo({
|
getSingleSiteBaseInfo({
|
||||||
siteId: this.siteId
|
siteId: this.siteId
|
||||||
@ -281,100 +403,67 @@
|
|||||||
day = time.getDate()
|
day = time.getDate()
|
||||||
return `${month<10?'0'+month : month}/${day<10 ? '0'+day : day}`
|
return `${month<10?'0'+month : month}/${day<10 ? '0'+day : day}`
|
||||||
},
|
},
|
||||||
getGVQXData() {
|
getGVQXData() {
|
||||||
this.$refs.activeChartDateRangeSelect.showBtnLoading(true)
|
this.$refs.activeChartDateRangeSelect.showBtnLoading(true)
|
||||||
getPointData({
|
const startTime = this.normalizeDateTime(this.activeChartTimeRange[0], false)
|
||||||
siteId: this.siteId,
|
const endTime = this.normalizeDateTime(this.activeChartTimeRange[1], true)
|
||||||
startDate: this.activeChartTimeRange[0],
|
this.ensureCurveDisplayData().then(displayData => {
|
||||||
endDate: this.activeChartTimeRange[1]
|
const sectionRows = (displayData || []).filter(item =>
|
||||||
}).then(response => {
|
item && item.sectionName === '当日功率曲线' && item.useFixedDisplay !== 1 && item.dataPoint
|
||||||
console.log('当日功率曲线', response)
|
)
|
||||||
let data = response?.data || [],
|
const targetRows = [{
|
||||||
categories = [],
|
name: '电网功率',
|
||||||
source = [{
|
row: this.findActiveCurveRow(sectionRows, ['gridpower', '电网功率'])
|
||||||
name: '电网功率',
|
},
|
||||||
attr: 'gridPower',
|
{
|
||||||
data: []
|
name: '负载功率',
|
||||||
},
|
row: this.findActiveCurveRow(sectionRows, ['loadpower', '负载功率'])
|
||||||
{
|
},
|
||||||
name: '负载功率',
|
{
|
||||||
attr: 'loadPower',
|
name: '储能功率',
|
||||||
data: []
|
row: this.findActiveCurveRow(sectionRows, ['storagepower', '储能功率'])
|
||||||
},
|
}
|
||||||
{
|
].filter(item => item.row && item.row.dataPoint)
|
||||||
name: '储能功率',
|
const tasks = targetRows.map(item => this.fetchCurveSeries(String(item.row.dataPoint).trim(), item.name, startTime,
|
||||||
attr: 'storagePower',
|
endTime))
|
||||||
data: []
|
return Promise.all(tasks).then(series => {
|
||||||
},
|
this.activeChartData = JSON.parse(JSON.stringify(this.buildLineChartData((series || []).filter(Boolean))))
|
||||||
{
|
})
|
||||||
name: '光伏功率',
|
}).finally(() => this.$refs.activeChartDateRangeSelect.showBtnLoading(false))
|
||||||
attr: 'pvPower',
|
|
||||||
data: []
|
},
|
||||||
},
|
getWeekChartData() {
|
||||||
{
|
this.$refs.weekChartDateRangeSelect.showBtnLoading(true)
|
||||||
name: 'soc平均值',
|
const startTime = this.normalizeDateTime(this.weekChartTimeRange[0], false)
|
||||||
attr: 'avgSoc',
|
const endTime = this.normalizeDateTime(this.weekChartTimeRange[1], true)
|
||||||
data: []
|
this.ensureCurveDisplayData().then(displayData => {
|
||||||
},
|
const sectionRows = (displayData || []).filter(item =>
|
||||||
{
|
item && item.sectionName === '一周充放曲线' && item.useFixedDisplay !== 1 && item.dataPoint
|
||||||
name: 'soh平均值',
|
)
|
||||||
attr: 'avgSoh',
|
const tasks = sectionRows.map(row => {
|
||||||
data: []
|
const pointId = String(row.dataPoint || '').trim()
|
||||||
},
|
if (!pointId) return Promise.resolve(null)
|
||||||
{
|
const name = row.fieldName || this.getFieldName(row.fieldCode) || pointId
|
||||||
name: '电池平均温度平均值平均值',
|
return this.fetchCurveSeries(pointId, name, startTime, endTime)
|
||||||
attr: 'avgTemp',
|
})
|
||||||
data: []
|
return Promise.all(tasks).then(series => {
|
||||||
},
|
this.weekChartData = JSON.parse(JSON.stringify(this.buildLineChartData((series || []).filter(Boolean))))
|
||||||
|
})
|
||||||
]
|
}).finally(() => this.$refs.weekChartDateRangeSelect.showBtnLoading(false))
|
||||||
data.forEach((item) => {
|
}
|
||||||
categories.push(item.statisDate || undefined)
|
},
|
||||||
source.forEach(i => i.data.push(item[i.attr]))
|
watch: {
|
||||||
})
|
currentSiteId(newSiteId) {
|
||||||
this.activeChartData = JSON.parse(JSON.stringify({
|
if (!newSiteId || newSiteId === this.siteId) return
|
||||||
categories,
|
if (!this.isAvailableSite(newSiteId)) return
|
||||||
series: source
|
this.siteId = newSiteId
|
||||||
}))
|
this.updateSiteInfo()
|
||||||
}).finally(() => this.$refs.activeChartDateRangeSelect.showBtnLoading(false))
|
}
|
||||||
|
},
|
||||||
},
|
// 页面切换不会重新调用,如果希望每次切换页面都重新调接口,使用onShow
|
||||||
getWeekChartData() {
|
onLoad() {
|
||||||
this.$refs.weekChartDateRangeSelect.showBtnLoading(true)
|
this.$nextTick(() => {
|
||||||
getSevenChargeData({
|
this.getSiteList()
|
||||||
siteId: this.siteId,
|
|
||||||
startDate: this.weekChartTimeRange[0],
|
|
||||||
endDate: this.weekChartTimeRange[1]
|
|
||||||
}).then(response => {
|
|
||||||
console.log('一周功率曲线', response)
|
|
||||||
let data = response?.data || [],
|
|
||||||
categories = [],
|
|
||||||
chargedCap = [],
|
|
||||||
disChargedCap = []
|
|
||||||
data.forEach(item => {
|
|
||||||
categories.push(this.handleDate(item.ammeterDate) || undefined)
|
|
||||||
chargedCap.push(item.chargedCap)
|
|
||||||
disChargedCap.push(item.disChargedCap)
|
|
||||||
})
|
|
||||||
this.weekChartData = JSON.parse(JSON.stringify({
|
|
||||||
categories,
|
|
||||||
series: [{
|
|
||||||
"name": '充电量',
|
|
||||||
"data": chargedCap
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": '放电量',
|
|
||||||
"data": disChargedCap
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}))
|
|
||||||
}).finally(() => this.$refs.weekChartDateRangeSelect.showBtnLoading(false))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 页面切换不会重新调用,如果希望每次切换页面都重新调接口,使用onShow
|
|
||||||
onLoad() {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.getSiteList()
|
|
||||||
this.$refs.weekChartDateRangeSelect.init()
|
this.$refs.weekChartDateRangeSelect.init()
|
||||||
this.$refs.activeChartDateRangeSelect.init(true)
|
this.$refs.activeChartDateRangeSelect.init(true)
|
||||||
})
|
})
|
||||||
@ -410,79 +499,8 @@
|
|||||||
margin-top: 10rpx;
|
margin-top: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 站点选择
|
// 基本信息
|
||||||
.site-sections-list {
|
.base-info {
|
||||||
background: linear-gradient(to right, #547ef4, #679ff5);
|
|
||||||
padding: 30rpx 30rpx;
|
|
||||||
padding-bottom: 100rpx;
|
|
||||||
|
|
||||||
.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 {
|
|
||||||
.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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 基本信息
|
|
||||||
.base-info {
|
|
||||||
margin-top: -80rpx;
|
margin-top: -80rpx;
|
||||||
border-radius: 80rpx 80rpx 0 0;
|
border-radius: 80rpx 80rpx 0 0;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
@ -581,4 +599,4 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 500px) {}
|
@media screen and (min-width: 500px) {}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,28 +1,48 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="page-container">
|
<view class="page-container">
|
||||||
<!-- 顶部6个数据 -->
|
<!-- 顶部总览横向展示 -->
|
||||||
<uni-grid class="info-grid" :square="false" :column="2" :showBorder="false">
|
<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="grid-item-box">
|
<view class="info-overview-card" v-for="(item,index) in runningHeadCards" :key="index+'head'">
|
||||||
<image :src="require('@/static/images/ems/pcs/'+item.img+'.jpg')" class="icon" alt="">
|
<view class="grid-item-box">
|
||||||
<view class="title">{{item.title}}</view>
|
<image :src="require('@/static/images/ems/pcs/'+item.img+'.jpg')" class="icon" alt="" />
|
||||||
<view class="text">{{runningHeadInfo[item.attr] | formatNumber}}</view>
|
<view class="title">{{item.title}}</view>
|
||||||
</view>
|
<view class="text">{{item.value | formatNumber}}</view>
|
||||||
</uni-grid-item>
|
</view>
|
||||||
</uni-grid>
|
</view>
|
||||||
|
</view>
|
||||||
<uni-collapse ref="collapse" accordion v-if="list.length > 0">
|
</scroll-view>
|
||||||
<uni-collapse-item v-for="(item,index) in list" :key="index+'pcs'" :open="index===0"
|
|
||||||
class="common-collapse-item" :class="{
|
<!-- 设备标签横向展示 -->
|
||||||
'timing-collapse-item':!['0','2'].includes(item.workStatus),
|
<scroll-view class="pcs-tags-scroll" scroll-x>
|
||||||
'warning-collapse-item':item.workStatus === '2',
|
<view class="pcs-tags-row">
|
||||||
'running-collapse-item':item.workStatus === '0'
|
<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)">
|
||||||
|
|
||||||
<template v-slot:title>
|
<template v-slot:title>
|
||||||
<view class='title-wrapper'>
|
<view class='title-wrapper'>
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<view class="status">{{workStatusOptions[item.workStatus] || '暂无数据'}}</view>
|
<view class="status">{{formatDictValue((PCSWorkStatusOptions || {}), item.workStatus, '暂无数据')}}</view>
|
||||||
<text class="name">{{item.deviceName}}</text>
|
<text class="name">{{item.deviceName}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -35,25 +55,25 @@
|
|||||||
<view class="grid-item-box">
|
<view class="grid-item-box">
|
||||||
<view class="title">工作状态</view>
|
<view class="title">工作状态</view>
|
||||||
<text
|
<text
|
||||||
class="text work-status-color">{{workStatusOptions[item.workStatus] || '-'}}</text>
|
class="text work-status-color">{{formatDictValue((PCSWorkStatusOptions || {}), item.workStatus)}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-lists">
|
<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>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-lists">
|
<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">{{deviceStatusOptions[item.deviceStatus] || '-'}}</text>
|
<text class="text">{{formatDictValue((deviceStatusOptions || {}), item.deviceStatus)}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-lists">
|
<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>
|
||||||
</view>
|
</view>
|
||||||
@ -100,73 +120,58 @@
|
|||||||
</uni-group>
|
</uni-group>
|
||||||
</view>
|
</view>
|
||||||
</uni-collapse-item>
|
</uni-collapse-item>
|
||||||
</uni-collapse>
|
</uni-collapse>
|
||||||
<view class="no-data" v-else>
|
<view class="no-data" v-else>
|
||||||
暂无数据
|
暂无数据
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
getRunningHeadInfo,
|
getProjectDisplayData,
|
||||||
getPcsDetailInfo
|
getPcsNameList
|
||||||
} from '@/api/ems/site.js'
|
} from '@/api/ems/site.js'
|
||||||
import {
|
import {
|
||||||
mapState
|
mapState
|
||||||
} from 'vuex'
|
} from 'vuex'
|
||||||
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) =>
|
||||||
state.ems.deviceStatusOptions,
|
state.ems.deviceStatusOptions,
|
||||||
gridStatusOptions: (state) =>
|
gridStatusOptions: (state) =>
|
||||||
state.ems.gridStatusOptions,
|
state.ems.gridStatusOptions,
|
||||||
controlModeOptions: (state) =>
|
controlModeOptions: (state) =>
|
||||||
state.ems.controlModeOptions,
|
state.ems.controlModeOptions,
|
||||||
})
|
}),
|
||||||
},
|
runningHeadCards() {
|
||||||
data() {
|
const sectionData = (this.runningDisplayData || []).filter(item => item.sectionName === '运行概览')
|
||||||
return {
|
return sectionData.map((item, index) => ({
|
||||||
runningHeadData: [{
|
title: item.fieldName,
|
||||||
title: '实时有功功率(kW)',
|
value: item.fieldValue,
|
||||||
bgColor: '#FFF2CB',
|
img: this.getHeadCardImg(item, index)
|
||||||
attr: 'totalActivePower',
|
}))
|
||||||
img: 'ssyggl'
|
},
|
||||||
}, {
|
filteredList() {
|
||||||
title: '实时无功功率(kVar)',
|
if (!this.selectedPcsId) {
|
||||||
bgColor: '#CBD6FF',
|
return this.list || []
|
||||||
attr: 'totalReactivePower',
|
}
|
||||||
img: 'sswggl'
|
return (this.list || []).filter(item => (item.deviceId || '') === this.selectedPcsId)
|
||||||
}, {
|
}
|
||||||
title: '电池堆SOC',
|
},
|
||||||
bgColor: '#DCCBFF',
|
data() {
|
||||||
attr: 'soc',
|
return {
|
||||||
img: 'soc'
|
runningDisplayData: [],
|
||||||
}, {
|
pcsDeviceList: [],
|
||||||
title: '电池堆SOH',
|
selectedPcsId: '',
|
||||||
bgColor: '#FFD4CB',
|
list: [],
|
||||||
attr: 'soh',
|
siteId: '',
|
||||||
img: 'soh'
|
|
||||||
}, {
|
|
||||||
title: '今日充电量(kWh)',
|
|
||||||
bgColor: '#FFD6F8',
|
|
||||||
attr: 'dayChargedCap',
|
|
||||||
img: 'jrcdl'
|
|
||||||
}, {
|
|
||||||
title: '今日放电量(kWh)',
|
|
||||||
bgColor: '#E1FFCA',
|
|
||||||
attr: 'dayDisChargedCap',
|
|
||||||
img: 'jrfdl'
|
|
||||||
}],
|
|
||||||
runningHeadInfo: {},
|
|
||||||
list: [],
|
|
||||||
siteId: '',
|
|
||||||
infoData: [{
|
infoData: [{
|
||||||
label: "总交流有功功率",
|
label: "总交流有功功率",
|
||||||
attr: "totalActivePower",
|
attr: "totalActivePower",
|
||||||
@ -261,70 +266,228 @@
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
methods: {
|
||||||
uni.showLoading()
|
normalizeDictKey(value) {
|
||||||
this.siteId = options.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
|
||||||
|
},
|
||||||
getPcsDetailInfo({
|
formatDictValue(options, value, emptyText = '-') {
|
||||||
siteId: this.siteId
|
const dict = (options && typeof options === 'object') ? options : {}
|
||||||
}).then(response => {
|
const key = this.normalizeDictKey(value)
|
||||||
this.list = response?.data || []
|
if (!key) return emptyText
|
||||||
if (this.list.length > 0) {
|
return dict[key] || key
|
||||||
this.$nextTick(() => {
|
},
|
||||||
setTimeout(() => {
|
normalizeDeviceId(value) {
|
||||||
this.$refs.collapse.resize()
|
return String(value == null ? '' : value).trim().toUpperCase()
|
||||||
uni.hideLoading()
|
},
|
||||||
}, 100)
|
getModuleRows(menuCode, sectionName) {
|
||||||
})
|
return (this.runningDisplayData || []).filter(item => item.menuCode === menuCode && item.sectionName === sectionName)
|
||||||
} else {
|
},
|
||||||
uni.hideLoading()
|
getFieldName(fieldCode) {
|
||||||
}
|
if (!fieldCode) {
|
||||||
}).catch(() => {
|
return ''
|
||||||
uni.hideLoading()
|
}
|
||||||
})
|
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 => {
|
||||||
|
if (!item || !item.fieldCode) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$refs.collapse.resize()
|
||||||
|
uni.hideLoading()
|
||||||
|
}, 100)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.hideLoading()
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
uni.hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.info-grid {
|
.info-overview-scroll {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 0 20rpx;
|
padding: 0 20rpx;
|
||||||
|
white-space: nowrap;
|
||||||
.uni-grid-item {
|
}
|
||||||
padding: 20rpx;
|
|
||||||
|
.info-overview-row {
|
||||||
.grid-item-box {
|
display: inline-flex;
|
||||||
box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.08);
|
gap: 20rpx;
|
||||||
border-radius: 20rpx;
|
padding: 20rpx 0;
|
||||||
|
}
|
||||||
.title {
|
|
||||||
color: #333;
|
.info-overview-card {
|
||||||
margin-top: 10rpx;
|
width: 280rpx;
|
||||||
}
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
.text {
|
|
||||||
color: #000;
|
.grid-item-box {
|
||||||
white-space: nowrap;
|
box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.08);
|
||||||
text-overflow: ellipsis;
|
border-radius: 20rpx;
|
||||||
width: 100%;
|
padding: 20rpx;
|
||||||
overflow-x: hidden;
|
background: #fff;
|
||||||
text-align: center;
|
}
|
||||||
}
|
|
||||||
}
|
.grid-item-box .title {
|
||||||
|
color: #333;
|
||||||
}
|
margin-top: 10rpx;
|
||||||
|
}
|
||||||
.icon {
|
|
||||||
height: 100rpx;
|
.grid-item-box .text {
|
||||||
width: 100rpx;
|
color: #000;
|
||||||
display: block;
|
white-space: nowrap;
|
||||||
border-radius: 20rpx;
|
text-overflow: ellipsis;
|
||||||
}
|
width: 100%;
|
||||||
}
|
overflow-x: hidden;
|
||||||
</style>
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
height: 100rpx;
|
||||||
|
width: 100rpx;
|
||||||
|
display: block;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pcs-tags-scroll {
|
||||||
|
background: #fff;
|
||||||
|
padding: 0 20rpx 20rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pcs-tags-row {
|
||||||
|
display: inline-flex;
|
||||||
|
gap: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pcs-tag-item {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pcs-tag-item.active {
|
||||||
|
color: #fff;
|
||||||
|
background: #007aff;
|
||||||
|
border-color: #007aff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
242
pages/work/yl/index.vue
Normal file
242
pages/work/yl/index.vue
Normal 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: '℃'
|
||||||
|
}, {
|
||||||
|
name: '回水温度',
|
||||||
|
attr: 'hsTemp',
|
||||||
|
unit: '℃'
|
||||||
|
}, {
|
||||||
|
name: '供水压力',
|
||||||
|
attr: 'gsPressure',
|
||||||
|
unit: 'MPa'
|
||||||
|
}, {
|
||||||
|
name: '回水压力',
|
||||||
|
attr: 'hsPressure',
|
||||||
|
unit: 'MPa'
|
||||||
|
}, {
|
||||||
|
name: '冷源水温度',
|
||||||
|
attr: 'lysTemp',
|
||||||
|
unit: '℃'
|
||||||
|
}, {
|
||||||
|
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>
|
||||||
40
static/images/offline/china-map.svg
Normal file
40
static/images/offline/china-map.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 373 KiB |
BIN
static/images/tabbar/ticket.png
Normal file
BIN
static/images/tabbar/ticket.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 166 B |
BIN
static/images/tabbar/ticket_.png
Normal file
BIN
static/images/tabbar/ticket_.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 169 B |
@ -2,9 +2,10 @@ const getters = {
|
|||||||
token: state => state.user.token,
|
token: state => state.user.token,
|
||||||
avatar: state => state.user.avatar,
|
avatar: state => state.user.avatar,
|
||||||
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
|
belongSite: state => state.user.belongSite,
|
||||||
}
|
currentSiteId: state => state.user.currentSiteId
|
||||||
export default getters
|
}
|
||||||
|
export default getters
|
||||||
|
|||||||
@ -1,10 +1,30 @@
|
|||||||
const ems = {
|
const ems = {
|
||||||
state: {
|
state: {
|
||||||
workStatusOptions: {
|
CLUSTERWorkStatusOptions: {
|
||||||
|
'0': '静置',
|
||||||
|
'1': '充电',
|
||||||
|
'2': '放电',
|
||||||
|
'3': '待机',
|
||||||
|
'5': '运行',
|
||||||
|
'9': "故障"
|
||||||
|
}, //电池簇工作状态
|
||||||
|
PCSWorkStatusOptions: {
|
||||||
'0': '运行',
|
'0': '运行',
|
||||||
'1': '停机',
|
'1': '停机',
|
||||||
'2': '故障'
|
'2': '故障',
|
||||||
}, //工作状态
|
'3': '待机',
|
||||||
|
'4': '充电',
|
||||||
|
'5': '放电'
|
||||||
|
}, //PCS工作状态
|
||||||
|
STACKWorkStatusOptions: {
|
||||||
|
"0": "静置",
|
||||||
|
"1": "充电",
|
||||||
|
"2": "放电",
|
||||||
|
"3": "浮充",
|
||||||
|
'4': '待机',
|
||||||
|
'5': '运行',
|
||||||
|
'9': "故障"
|
||||||
|
}, //STACKBMS总览工作状态
|
||||||
deviceStatusOptions: {
|
deviceStatusOptions: {
|
||||||
'0': '离线',
|
'0': '离线',
|
||||||
'1': '在线'
|
'1': '在线'
|
||||||
@ -64,6 +84,7 @@ const ems = {
|
|||||||
'2': '待机',
|
'2': '待机',
|
||||||
'3': '放电'
|
'3': '放电'
|
||||||
}, //冲放状态
|
}, //冲放状态
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default ems
|
export default ems
|
||||||
109
store/modules/site.js
Normal file
109
store/modules/site.js
Normal 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
|
||||||
@ -24,11 +24,12 @@ const user = {
|
|||||||
token: getToken(),
|
token: getToken(),
|
||||||
id: storage.get(constant.id),
|
id: storage.get(constant.id),
|
||||||
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)
|
belongSite: storage.get(constant.belongSite),
|
||||||
},
|
currentSiteId: storage.get(constant.currentSiteId)
|
||||||
|
},
|
||||||
|
|
||||||
mutations: {
|
mutations: {
|
||||||
SET_TOKEN: (state, token) => {
|
SET_TOKEN: (state, token) => {
|
||||||
@ -54,11 +55,15 @@ const user = {
|
|||||||
state.permissions = permissions
|
state.permissions = permissions
|
||||||
storage.set(constant.permissions, permissions)
|
storage.set(constant.permissions, permissions)
|
||||||
},
|
},
|
||||||
SET_BELONGSITE: (state, belongSite = []) => {
|
SET_BELONGSITE: (state, belongSite = []) => {
|
||||||
state.belongSite = belongSite || []
|
state.belongSite = belongSite || []
|
||||||
storage.set(constant.belongSite, belongSite || [])
|
storage.set(constant.belongSite, belongSite || [])
|
||||||
}
|
},
|
||||||
},
|
SET_CURRENTSITEID: (state, currentSiteId = '') => {
|
||||||
|
state.currentSiteId = currentSiteId || ''
|
||||||
|
storage.set(constant.currentSiteId, currentSiteId || '')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
// 登录
|
// 登录
|
||||||
@ -133,4 +138,4 @@ const user = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default user
|
export default user
|
||||||
|
|||||||
@ -636,12 +636,20 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
beforeInit(){
|
beforeInit(){
|
||||||
this.mixinDatacomErrorMessage = null;
|
this.mixinDatacomErrorMessage = null;
|
||||||
if (typeof this.chartData === 'object' && this.chartData != null && this.chartData.series !== undefined && this.chartData.series.length > 0) {
|
console.log('[map-debug] beforeInit', {
|
||||||
//拷贝一下chartData,为了opts变更后统一数据来源
|
echarts: this.echarts,
|
||||||
this.drawData = deepCloneAssign({}, this.chartData);
|
type: this.type,
|
||||||
this.mixinDatacomLoading = false;
|
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) {
|
||||||
|
//拷贝一下chartData,为了opts变更后统一数据来源
|
||||||
|
this.drawData = deepCloneAssign({}, this.chartData);
|
||||||
|
this.mixinDatacomLoading = false;
|
||||||
this.showchart = true;
|
this.showchart = true;
|
||||||
this.checkData(this.chartData);
|
this.checkData(this.chartData);
|
||||||
}else if(this.localdata.length>0){
|
}else if(this.localdata.length>0){
|
||||||
@ -782,11 +790,19 @@ export default {
|
|||||||
this.beforeInit();
|
this.beforeInit();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkData(anyData) {
|
checkData(anyData) {
|
||||||
let cid = this.cid
|
let cid = this.cid
|
||||||
//复位opts或eopts
|
console.log('[map-debug] checkData', {
|
||||||
if(this.echarts === true){
|
cid,
|
||||||
cfe.option[cid] = deepCloneAssign({}, this.eopts);
|
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
|
||||||
|
if(this.echarts === true){
|
||||||
|
cfe.option[cid] = deepCloneAssign({}, this.eopts);
|
||||||
cfe.option[cid].id = cid;
|
cfe.option[cid].id = cid;
|
||||||
cfe.option[cid].type = this.type;
|
cfe.option[cid].type = this.type;
|
||||||
}else{
|
}else{
|
||||||
@ -908,16 +924,22 @@ export default {
|
|||||||
cfu.option[cid].tapLegend = this.tapLegend;
|
cfu.option[cid].tapLegend = this.tapLegend;
|
||||||
}
|
}
|
||||||
//如果是H5或者App端,采用renderjs渲染图表
|
//如果是H5或者App端,采用renderjs渲染图表
|
||||||
if (this.inH5 || this.inApp) {
|
if (this.inH5 || this.inApp) {
|
||||||
if (this.echarts == true) {
|
if (this.echarts == true) {
|
||||||
cfe.option[cid].ontap = this.ontap;
|
cfe.option[cid].ontap = this.ontap;
|
||||||
cfe.option[cid].onmouse = this.openmouse;
|
cfe.option[cid].onmouse = this.openmouse;
|
||||||
cfe.option[cid].tooltipShow = this.tooltipShow;
|
cfe.option[cid].tooltipShow = this.tooltipShow;
|
||||||
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;
|
||||||
this.echartsOpts = deepCloneAssign({}, cfe.option[cid]);
|
console.log('[map-debug] set echartsOpts', {
|
||||||
} else {
|
cid,
|
||||||
|
type: cfe.option[cid].type,
|
||||||
|
mapName: cfe.option[cid].mapName,
|
||||||
|
hasGeo: !!cfe.option[cid].mapGeoJSON
|
||||||
|
});
|
||||||
|
this.echartsOpts = deepCloneAssign({}, cfe.option[cid]);
|
||||||
|
} else {
|
||||||
cfu.option[cid].rotateLock = cfu.option[cid].rotate;
|
cfu.option[cid].rotateLock = cfu.option[cid].rotate;
|
||||||
this.uchartsOpts = deepCloneAssign({}, cfu.option[cid]);
|
this.uchartsOpts = deepCloneAssign({}, cfu.option[cid]);
|
||||||
}
|
}
|
||||||
@ -1272,24 +1294,25 @@ 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))
|
||||||
this.rid = cid
|
console.log('[map-debug] ecinit', { cid, type: newVal.type, hasMapName: !!newVal.mapName, hasGeo: !!newVal.mapGeoJSON });
|
||||||
that[cid] = this.$ownerInstance || instance
|
this.rid = cid
|
||||||
let eopts = JSON.parse(JSON.stringify(newVal))
|
that[cid] = this.$ownerInstance || instance
|
||||||
let type = eopts.type;
|
let eopts = JSON.parse(JSON.stringify(newVal))
|
||||||
|
let type = eopts.type;
|
||||||
//载入并覆盖默认配置
|
//载入并覆盖默认配置
|
||||||
if (type && cfe.type.includes(type)) {
|
if (type && cfe.type.includes(type)) {
|
||||||
cfe.option[cid] = rddeepCloneAssign({}, cfe[type], eopts);
|
cfe.option[cid] = rddeepCloneAssign({}, cfe[type], eopts);
|
||||||
}else{
|
}else{
|
||||||
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
|
||||||
}
|
}
|
||||||
if(cfe.option[cid].yAxis && cfe.option[cid].yAxis.type && cfe.option[cid].yAxis.type === 'category'){
|
if(cfe.option[cid].yAxis && cfe.option[cid].yAxis.type && cfe.option[cid].yAxis.type === 'category'){
|
||||||
cfe.option[cid].yAxis.data = newData.categories
|
cfe.option[cid].yAxis.data = newData.categories
|
||||||
}
|
}
|
||||||
@ -1297,14 +1320,26 @@ export default {
|
|||||||
for (var i = 0; i < newData.series.length; i++) {
|
for (var i = 0; i < newData.series.length; i++) {
|
||||||
cfe.option[cid].seriesTemplate = cfe.option[cid].seriesTemplate ? cfe.option[cid].seriesTemplate : {}
|
cfe.option[cid].seriesTemplate = cfe.option[cid].seriesTemplate ? cfe.option[cid].seriesTemplate : {}
|
||||||
let Template = rddeepCloneAssign({},cfe.option[cid].seriesTemplate,newData.series[i])
|
let Template = rddeepCloneAssign({},cfe.option[cid].seriesTemplate,newData.series[i])
|
||||||
cfe.option[cid].series.push(Template)
|
cfe.option[cid].series.push(Template)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof window.echarts === 'object') {
|
if (typeof window.echarts === 'object' && eopts.mapName && eopts.mapGeoJSON) {
|
||||||
this.newEChart()
|
try {
|
||||||
}else{
|
if (!window.echarts.getMap(eopts.mapName)) {
|
||||||
const script = document.createElement('script')
|
window.echarts.registerMap(eopts.mapName, eopts.mapGeoJSON);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log('[map-debug] registerMap error', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof window.echarts === 'object') {
|
||||||
|
console.log('[map-debug] echarts exists, init');
|
||||||
|
this.newEChart()
|
||||||
|
}else{
|
||||||
|
console.log('[map-debug] echarts not found, load 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'
|
||||||
// #endif
|
// #endif
|
||||||
@ -1322,10 +1357,21 @@ export default {
|
|||||||
cfe.instance[this.rid].resize()
|
cfe.instance[this.rid].resize()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
newEChart(){
|
newEChart(){
|
||||||
let cid = this.rid
|
let cid = this.rid
|
||||||
if(cfe.instance[cid] === undefined){
|
console.log('[map-debug] newEChart', { cid });
|
||||||
cfe.instance[cid] = echarts.init(that[cid].$el.children[0])
|
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){
|
||||||
|
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 => {
|
||||||
@ -1339,14 +1385,15 @@ export default {
|
|||||||
that[cid].callMethod('emitMsg',{name:"getHighlight", params:{type:"highlight", res:resdata, id:cid}})
|
that[cid].callMethod('emitMsg',{name:"getHighlight", params:{type:"highlight", res:resdata, id:cid}})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.updataEChart(cid,cfe.option[cid])
|
this.updataEChart(cid,cfe.option[cid])
|
||||||
}else{
|
}else{
|
||||||
this.updataEChart(cid,cfe.option[cid])
|
this.updataEChart(cid,cfe.option[cid])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updataEChart(cid,option){
|
updataEChart(cid,option){
|
||||||
//替换option内format属性为formatter的预定义方法
|
console.log('[map-debug] updateEChart', { cid, hasSeries: !!option.series, seriesLen: option.series ? option.series.length : 0 });
|
||||||
option = rdformatterAssign(option,cfe.formatter)
|
//替换option内format属性为formatter的预定义方法
|
||||||
|
option = rdformatterAssign(option,cfe.formatter)
|
||||||
if(option.tooltip){
|
if(option.tooltip){
|
||||||
option.tooltip.show = option.tooltipShow?true:false;
|
option.tooltip.show = option.tooltipShow?true:false;
|
||||||
option.tooltip.position = this.tooltipPosition()
|
option.tooltip.position = this.tooltipPosition()
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user