mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
样式 警告处理
This commit is contained in:
@@ -228,6 +228,8 @@ export const columnList = [
|
|||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'operate',
|
dataIndex: 'operate',
|
||||||
|
fixed: 'right',
|
||||||
|
|
||||||
key: 'operate',
|
key: 'operate',
|
||||||
scopedSlots: { customRender: 'action' }
|
scopedSlots: { customRender: 'action' }
|
||||||
}
|
}
|
||||||
@@ -667,29 +669,9 @@ export const stationOptions = [
|
|||||||
label: '场站运行模式',
|
label: '场站运行模式',
|
||||||
value: undefined,
|
value: undefined,
|
||||||
key: 'work_mode',
|
key: 'work_mode',
|
||||||
type: 'select',
|
type: 'slot',
|
||||||
list: [
|
slotName: 'work_mode',
|
||||||
{
|
list: []
|
||||||
label: '峰谷套利',
|
|
||||||
value: '1'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '增网配容',
|
|
||||||
value: '2'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '应急供电',
|
|
||||||
value: '3'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '并网保电',
|
|
||||||
value: '4'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '自定时段',
|
|
||||||
value: '5'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// 0:未启用,1:启用
|
// 0:未启用,1:启用
|
||||||
@@ -697,7 +679,7 @@ export const stationOptions = [
|
|||||||
label: '场站运行策略',
|
label: '场站运行策略',
|
||||||
value: undefined,
|
value: undefined,
|
||||||
key: 'policy_id',
|
key: 'policy_id',
|
||||||
type: 'select',
|
type: 'unshow',
|
||||||
list: [
|
list: [
|
||||||
{
|
{
|
||||||
label: '削峰套利',
|
label: '削峰套利',
|
||||||
|
|||||||
@@ -387,11 +387,15 @@ defineExpose({ ...toRefs(data), loading, mountedScroll, scroll: data.scroll })
|
|||||||
background: #082e4a !important;
|
background: #082e4a !important;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
:deep(.ant-table.ant-table-has-fix-left.ant-table-middle.ant-table-bordered){
|
||||||
|
border-radius: 20px !important;
|
||||||
|
|
||||||
|
}
|
||||||
:deep(.ant-table-body) {
|
:deep(.ant-table-body) {
|
||||||
color:#fff;
|
color:#fff;
|
||||||
background: $table-bg !important;
|
background: $table-bg !important;
|
||||||
border: 1px solid $table-border;
|
// border: 1px solid $table-border;
|
||||||
border-radius: 0px 0px 20px 20px;
|
border-radius: 20px!important;
|
||||||
.ant-table-cell {
|
.ant-table-cell {
|
||||||
background: var(--theme-bg) !important;
|
background: var(--theme-bg) !important;
|
||||||
}
|
}
|
||||||
@@ -424,6 +428,8 @@ defineExpose({ ...toRefs(data), loading, mountedScroll, scroll: data.scroll })
|
|||||||
}
|
}
|
||||||
|
|
||||||
:deep(.ant-table-wrapper .ant-table) {
|
:deep(.ant-table-wrapper .ant-table) {
|
||||||
|
border: 1px solid $table-border!important;
|
||||||
|
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,24 @@
|
|||||||
:ref="'detailInfo' + index"
|
:ref="'detailInfo' + index"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
>
|
>
|
||||||
|
<template #work_mode="item">
|
||||||
|
<a-select
|
||||||
|
:dropdown-match-select-width="false"
|
||||||
|
v-model:value="workModeIdSelect"
|
||||||
|
:placeholder="'请选择' + item.label"
|
||||||
|
:disabled="disabled"
|
||||||
|
allow-clear
|
||||||
|
>
|
||||||
|
<a-select-option
|
||||||
|
:value="selectItem.value"
|
||||||
|
v-for="selectItem in workModeList"
|
||||||
|
:key="selectItem.value"
|
||||||
|
>
|
||||||
|
{{ selectItem.label }}
|
||||||
|
</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #role_id="item">
|
<template #role_id="item">
|
||||||
<a-select
|
<a-select
|
||||||
:dropdown-match-select-width="false"
|
:dropdown-match-select-width="false"
|
||||||
@@ -109,6 +127,31 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
workModeIdSelect: undefined,
|
||||||
|
|
||||||
|
workModeList: [
|
||||||
|
{
|
||||||
|
label: '峰谷套利',
|
||||||
|
value: '1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '增网配容',
|
||||||
|
value: '2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '应急供电',
|
||||||
|
value: '3'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '并网保电',
|
||||||
|
value: '4'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '自定时段',
|
||||||
|
value: '5'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
tip: '正在加载...',
|
tip: '正在加载...',
|
||||||
roleIdList: [],
|
roleIdList: [],
|
||||||
transferDialog: false,
|
transferDialog: false,
|
||||||
@@ -131,6 +174,28 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
watch: {
|
watch: {
|
||||||
|
workModeIdSelect: {
|
||||||
|
handler(n) {
|
||||||
|
console.log(n,'nnnnnnnnnnnnnnnnworkModeIdSelectn')
|
||||||
|
|
||||||
|
switch (n) {
|
||||||
|
case '1':
|
||||||
|
this.detailInfos[0].list[this.detailInfos[0].list.length-1].type='select'
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '5':
|
||||||
|
this.detailInfos[0].list[this.detailInfos[0].list.length-1].type='select'
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.detailInfos[0].list[this.detailInfos[0].list.length-1].type='unshow'
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// immediate: true
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
action: {
|
action: {
|
||||||
handler(n) {
|
handler(n) {
|
||||||
if (n === 'read') {
|
if (n === 'read') {
|
||||||
@@ -154,7 +219,6 @@ export default {
|
|||||||
// this.formRules = menuFormRules
|
// this.formRules = menuFormRules
|
||||||
break
|
break
|
||||||
case 'permission':
|
case 'permission':
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'role':
|
case 'role':
|
||||||
@@ -307,8 +371,8 @@ export default {
|
|||||||
add: '/insertRole',
|
add: '/insertRole',
|
||||||
edit: '/updateRole'
|
edit: '/updateRole'
|
||||||
}
|
}
|
||||||
const { selectedRowKeys ,selectedArr} = this.$refs.treeTable[0]
|
const { selectedRowKeys, selectedArr } = this.$refs.treeTable[0]
|
||||||
console.log(selectedRowKeys,selectedArr, 'selectedRowKeys')
|
console.log(selectedRowKeys, selectedArr, 'selectedRowKeys')
|
||||||
// const arr = selectedArr.map((item) => ({
|
// const arr = selectedArr.map((item) => ({
|
||||||
// ...item,
|
// ...item,
|
||||||
|
|
||||||
@@ -325,8 +389,8 @@ export default {
|
|||||||
// }))
|
// }))
|
||||||
// console.log(arr,"arr")
|
// console.log(arr,"arr")
|
||||||
|
|
||||||
const data=this.filterTreeData(selectedRowKeys,this.$refs.treeTable[0].tableData)
|
const data = this.filterTreeData(selectedRowKeys, this.$refs.treeTable[0].tableData)
|
||||||
const arr = data.map((item) => ({
|
const arr = data.map((item) => ({
|
||||||
...item,
|
...item,
|
||||||
|
|
||||||
// 转换操作权限为布尔值
|
// 转换操作权限为布尔值
|
||||||
@@ -335,14 +399,13 @@ export default {
|
|||||||
children: item.children
|
children: item.children
|
||||||
? item.children.map((child) => ({
|
? item.children.map((child) => ({
|
||||||
...child,
|
...child,
|
||||||
...this.getPerOperBoolean(child),
|
...this.getPerOperBoolean(child)
|
||||||
|
|
||||||
}))
|
}))
|
||||||
: []
|
: []
|
||||||
}))
|
}))
|
||||||
const paramsDate = {
|
const paramsDate = {
|
||||||
...this.form,
|
...this.form,
|
||||||
permission:arr
|
permission: arr
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.action == 'edit') {
|
if (this.action == 'edit') {
|
||||||
@@ -363,61 +426,57 @@ export default {
|
|||||||
},
|
},
|
||||||
// 定义筛选树形数据的函数
|
// 定义筛选树形数据的函数
|
||||||
filterTreeData(list1, list2) {
|
filterTreeData(list1, list2) {
|
||||||
const keySet = new Set(list1);
|
const keySet = new Set(list1)
|
||||||
|
|
||||||
// 递归处理节点的函数
|
// 递归处理节点的函数
|
||||||
const filterNode = (node) => {
|
const filterNode = (node) => {
|
||||||
// 创建新节点对象(浅拷贝)
|
// 创建新节点对象(浅拷贝)
|
||||||
const newNode = Object.assign({}, node);
|
const newNode = Object.assign({}, node)
|
||||||
|
|
||||||
// 临时删除children属性以便处理
|
// 临时删除children属性以便处理
|
||||||
const { children, ...rest } = newNode;
|
const { children, ...rest } = newNode
|
||||||
|
|
||||||
// 处理子节点
|
// 处理子节点
|
||||||
let newChildren = [];
|
let newChildren = []
|
||||||
if (children) {
|
if (children) {
|
||||||
newChildren = children
|
newChildren = children.map((child) => filterNode(child)).filter((child) => child !== null)
|
||||||
.map((child) => filterNode(child))
|
|
||||||
.filter((child) => child !== null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重建新节点
|
// 重建新节点
|
||||||
const resultNode = Object.assign(rest, {});
|
const resultNode = Object.assign(rest, {})
|
||||||
|
|
||||||
if (newChildren.length > 0) {
|
if (newChildren.length > 0) {
|
||||||
resultNode.children = newChildren;
|
resultNode.children = newChildren
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断是否保留节点
|
// 判断是否保留节点
|
||||||
if (keySet.has(node.key)) {
|
if (keySet.has(node.key)) {
|
||||||
return resultNode;
|
return resultNode
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保留有符合条件子节点的父节点(移除自身key)
|
// 保留有符合条件子节点的父节点(移除自身key)
|
||||||
if (newChildren.length > 0) {
|
if (newChildren.length > 0) {
|
||||||
return resultNode;
|
return resultNode
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null
|
||||||
};
|
}
|
||||||
|
|
||||||
// 处理根节点
|
// 处理根节点
|
||||||
const result = list2
|
const result = list2.map((node) => filterNode(node)).filter((node) => node !== null)
|
||||||
.map((node) => filterNode(node))
|
|
||||||
.filter((node) => node !== null);
|
|
||||||
|
|
||||||
return result;
|
return result
|
||||||
},
|
},
|
||||||
getPerOperBoolean(data) {
|
getPerOperBoolean(data) {
|
||||||
return {
|
return {
|
||||||
is_add: Boolean(data.is_add)? '1' : '0',
|
is_add: Boolean(data.is_add) ? '1' : '0',
|
||||||
is_del: Boolean(data.is_del)? '1' : '0',
|
is_del: Boolean(data.is_del) ? '1' : '0',
|
||||||
is_edit: Boolean(data.is_edit)? '1' : '0',
|
is_edit: Boolean(data.is_edit) ? '1' : '0',
|
||||||
is_view: Boolean(data.is_view)? '1' : '0'
|
is_view: Boolean(data.is_view) ? '1' : '0'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getPermissionData(keys,list){
|
getPermissionData(keys, list) {
|
||||||
const arr=[]
|
const arr = []
|
||||||
// list.forEach(item=>{
|
// list.forEach(item=>{
|
||||||
// if(keys.include(item.key)){
|
// if(keys.include(item.key)){
|
||||||
// arr.push(item)
|
// arr.push(item)
|
||||||
|
|||||||
@@ -439,8 +439,13 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
:deep(.ant-table-container > .ant-table-content > table) {
|
:deep(.ant-table-container > .ant-table-content > table) {
|
||||||
|
|
||||||
border-inline-start: 1px solid var(--theme-bg) !important;
|
border-inline-start: 1px solid var(--theme-bg) !important;
|
||||||
}
|
}
|
||||||
|
:deep(.ant-table.ant-table-has-fix-left.ant-table-middle.ant-table-bordered){
|
||||||
|
border-radius: 20px !important;
|
||||||
|
|
||||||
|
}
|
||||||
:deep(.ant-pagination-item-link) {
|
:deep(.ant-pagination-item-link) {
|
||||||
color: var(--theme-text-default) !important;
|
color: var(--theme-text-default) !important;
|
||||||
|
|
||||||
|
|||||||
@@ -14,40 +14,47 @@ export const routes = [
|
|||||||
path: '/',
|
path: '/',
|
||||||
name: '/',
|
name: '/',
|
||||||
redirect: '/home',
|
redirect: '/home',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () => import(/* webpackChunkName: "main" */ '@/views/MainView.vue'),
|
component: () => import(/* webpackChunkName: "main" */ '@/views/MainView.vue'),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'home',
|
path: 'home',
|
||||||
component: () => import(/* webpackChunkName: "monitor" */ '@/views/sub/Home.vue')
|
component: () => import(/* webpackChunkName: "monitor" */ '@/views/sub/Home.vue'),
|
||||||
|
meta: { requiresAuth: true }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'monitor',
|
path: 'monitor',
|
||||||
name: 'monitor',
|
name: 'monitor',
|
||||||
title: '运行监控',
|
title: '运行监控',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () => import(/* webpackChunkName: "monitor" */ '@/views/monitor.vue')
|
component: () => import(/* webpackChunkName: "monitor" */ '@/views/monitor.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'predict',
|
path: 'predict',
|
||||||
name: 'predict',
|
name: 'predict',
|
||||||
title: '预测管理',
|
title: '预测管理',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () => import(/* webpackChunkName: "predict" */ '@/views/predict.vue')
|
component: () => import(/* webpackChunkName: "predict" */ '@/views/predict.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'statisticalAnalysis',
|
path: 'statisticalAnalysis',
|
||||||
name: 'statisticalAnalysis',
|
name: 'statisticalAnalysis',
|
||||||
title: '统计分析',
|
title: '统计分析',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () => import(/* webpackChunkName: "monitor" */ '@/views/statisticalAnalysis.vue')
|
component: () => import(/* webpackChunkName: "monitor" */ '@/views/statisticalAnalysis.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'system',
|
path: 'system',
|
||||||
name: 'system',
|
name: 'system',
|
||||||
redirect: '/system/user',
|
redirect: '/system/user',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () => import(/* webpackChunkName: "system" */ '@/views/system/index.vue'),
|
component: () => import(/* webpackChunkName: "system" */ '@/views/system/index.vue'),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'user',
|
path: 'user',
|
||||||
name: 'user',
|
name: 'user',
|
||||||
title: '用户管理',
|
title: '用户管理',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () => import(/* webpackChunkName: "system" */ '@/views/system/user.vue')
|
component: () => import(/* webpackChunkName: "system" */ '@/views/system/user.vue')
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -55,12 +62,14 @@ export const routes = [
|
|||||||
name: 'role',
|
name: 'role',
|
||||||
path: 'role',
|
path: 'role',
|
||||||
title: '角色管理',
|
title: '角色管理',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () => import(/* webpackChunkName: "system" */ '@/views/system/role.vue')
|
component: () => import(/* webpackChunkName: "system" */ '@/views/system/role.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'permission',
|
name: 'permission',
|
||||||
path: 'permission',
|
path: 'permission',
|
||||||
title: '权限管理',
|
title: '权限管理',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () =>
|
component: () =>
|
||||||
import(/* webpackChunkName: "system" */ '@/views/system/permission.vue')
|
import(/* webpackChunkName: "system" */ '@/views/system/permission.vue')
|
||||||
},
|
},
|
||||||
@@ -68,36 +77,42 @@ export const routes = [
|
|||||||
name: 'station',
|
name: 'station',
|
||||||
path: 'station',
|
path: 'station',
|
||||||
title: '场站管理',
|
title: '场站管理',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () => import(/* webpackChunkName: "system" */ '@/views/system/station.vue')
|
component: () => import(/* webpackChunkName: "system" */ '@/views/system/station.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'service',
|
name: 'service',
|
||||||
path: 'service',
|
path: 'service',
|
||||||
title: '服务管理',
|
title: '服务管理',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () => import(/* webpackChunkName: "system" */ '@/views/system/service.vue')
|
component: () => import(/* webpackChunkName: "system" */ '@/views/system/service.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'policy',
|
path: 'policy',
|
||||||
name: 'policy',
|
name: 'policy',
|
||||||
title: '策略管理',
|
title: '策略管理',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () => import(/* webpackChunkName: "system" */ '@/views/system/policy.vue')
|
component: () => import(/* webpackChunkName: "system" */ '@/views/system/policy.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'device',
|
name: 'device',
|
||||||
path: 'device',
|
path: 'device',
|
||||||
title: '设备管理',
|
title: '设备管理',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () => import(/* webpackChunkName: "system" */ '@/views/system/device.vue')
|
component: () => import(/* webpackChunkName: "system" */ '@/views/system/device.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'alarmlog',
|
name: 'alarmlog',
|
||||||
path: 'alarmlog',
|
path: 'alarmlog',
|
||||||
title: '告警日志',
|
title: '告警日志',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () => import(/* webpackChunkName: "system" */ '@/views/system/alarmLog.vue')
|
component: () => import(/* webpackChunkName: "system" */ '@/views/system/alarmLog.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'syslog',
|
name: 'syslog',
|
||||||
path: 'syslog',
|
path: 'syslog',
|
||||||
title: '系统日志',
|
title: '系统日志',
|
||||||
|
meta: { requiresAuth: true },
|
||||||
component: () => import(/* webpackChunkName: "system" */ '@/views/system/log.vue')
|
component: () => import(/* webpackChunkName: "system" */ '@/views/system/log.vue')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -111,4 +126,27 @@ const router = createRouter({
|
|||||||
routes
|
routes
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 全局前置守卫
|
||||||
|
router.beforeEach((to, from, next) => {
|
||||||
|
const isLoggedIn = localStorage.getItem('token') // 检查用户是否已登录
|
||||||
|
|
||||||
|
// 2. 如果访问登录页且已登录,跳转到首页
|
||||||
|
if (to.path === '/login' && isLoggedIn) {
|
||||||
|
next('/')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 检查路由权限
|
||||||
|
if (to.matched.some((record) => record.meta.requiresAuth)) {
|
||||||
|
if (!isLoggedIn) {
|
||||||
|
// 未登录则重定向到登录页,并携带原路径
|
||||||
|
next('/login')
|
||||||
|
} else {
|
||||||
|
next()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
next() // 无需认证的路由直接放行
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
export default router
|
export default router
|
||||||
|
|||||||
@@ -18,8 +18,14 @@ $page-border: #cad2dd;
|
|||||||
.ant-switch {
|
.ant-switch {
|
||||||
background: #b1c4c4;
|
background: #b1c4c4;
|
||||||
}
|
}
|
||||||
.ant-switch.ant-switch-checked{
|
.ant-switch.ant-switch-checked {
|
||||||
background: #00fffb
|
background: #00fffb;
|
||||||
|
}
|
||||||
|
.ant-select .ant-select-arrow {
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
|
.ant-select .ant-select-clear {
|
||||||
|
background: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-switch .ant-switch-handle::before {
|
.ant-switch .ant-switch-handle::before {
|
||||||
@@ -58,9 +64,8 @@ $page-border: #cad2dd;
|
|||||||
.ant-picker-input input::placeholder {
|
.ant-picker-input input::placeholder {
|
||||||
color: #ffffff3b !important;
|
color: #ffffff3b !important;
|
||||||
}
|
}
|
||||||
.ant-picker-suffix{
|
.ant-picker-suffix {
|
||||||
color: #ffffff !important;
|
color: #ffffff !important;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.ant-input-affix-wrapper {
|
.ant-input-affix-wrapper {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
>
|
>
|
||||||
<template #stationSelect="item">
|
<template #stationSelect="item">
|
||||||
<a-select
|
<a-select
|
||||||
style="width: 120px;"
|
style="width: 120px"
|
||||||
:dropdown-match-select-width="false"
|
:dropdown-match-select-width="false"
|
||||||
v-model:value="stationId"
|
v-model:value="stationId"
|
||||||
allow-clear
|
allow-clear
|
||||||
@@ -39,17 +39,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="main_content">
|
<div class="main_content">
|
||||||
<a-spin :spinning="loading.chart || loading.table">
|
<a-spin :spinning="loading.chart || loading.table">
|
||||||
<energyEchart
|
<energyEchart
|
||||||
:key="`${activeKey}_${renderKey}`"
|
:key="`${activeKey}_${renderKey}`"
|
||||||
:chart-options="echartsInfo[activeKey].chartOptions"
|
:chart-options="echartsInfo[activeKey].chartOptions"
|
||||||
:chart-data="echartsInfo[activeKey].chartData"
|
:chart-data="echartsInfo[activeKey].chartData"
|
||||||
:chart-datav="echartsInfo[activeKey].chartDatav"
|
:chart-datav="echartsInfo[activeKey].chartDatav"
|
||||||
:columns="tableList[activeKey].columns"
|
:columns="tableList[activeKey].columns"
|
||||||
:page-option="tableList[activeKey].pageOption"
|
:page-option="tableList[activeKey].pageOption"
|
||||||
:table-info="tableList[activeKey].tableInfo"
|
:table-info="tableList[activeKey].tableInfo"
|
||||||
:table-data="tableList[activeKey].tableData"
|
:table-data="tableList[activeKey].tableData"
|
||||||
@pagesizeChange="pagesizeChange()"
|
@pagesizeChange="pagesizeChange()"
|
||||||
></energyEchart>
|
></energyEchart>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -166,7 +166,7 @@ export default {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
chartData: {},
|
chartData: {},
|
||||||
chartDatav: {},
|
chartDatav: {}
|
||||||
},
|
},
|
||||||
2: {
|
2: {
|
||||||
chartOptions: [
|
chartOptions: [
|
||||||
@@ -281,19 +281,20 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
activeKey: 1,
|
activeKey: 1,
|
||||||
interval:null,
|
interval: null,
|
||||||
tabList: [
|
tabList: [
|
||||||
{
|
{
|
||||||
key: 1,
|
key: 1,
|
||||||
name: '储能设备'
|
name: '储能设备'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 2,
|
|
||||||
name: '光伏设备'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 3,
|
key: 3,
|
||||||
name: '充电设备'
|
name: '充电设备'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 2,
|
||||||
|
name: '光伏设备'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
tableList: {
|
tableList: {
|
||||||
@@ -505,123 +506,116 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
activeKey: {
|
activeKey: {
|
||||||
handler(newVal) {
|
handler(newVal) {
|
||||||
if (!newVal) return;
|
if (!newVal) return
|
||||||
|
|
||||||
// 清除之前的数据
|
// 清除之前的数据
|
||||||
this.resetDataForInactiveKey();
|
this.resetDataForInactiveKey()
|
||||||
|
|
||||||
// 并行加载新数据
|
// 并行加载新数据
|
||||||
Promise.all([
|
Promise.all([this.getEchartsListForActiveKey(), this.getTableListForActiveKey()]).then(
|
||||||
this.getEchartsListForActiveKey(),
|
() => {
|
||||||
this.getTableListForActiveKey()
|
this.$nextTick(() => {
|
||||||
]).then(() => {
|
this.getStatCharts()
|
||||||
this.$nextTick(() => {
|
})
|
||||||
this.getStatCharts();
|
}
|
||||||
|
)
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
immediate: true // 添加立即执行
|
immediate: true // 添加立即执行
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
// 优先加载第一个页面(activeKey=1)所需的数据
|
// 优先加载第一个页面(activeKey=1)所需的数据
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.getStationList(),
|
this.getStationList(),
|
||||||
this.getEchartsListForActiveKey(),
|
this.getEchartsListForActiveKey(),
|
||||||
this.getTableListForActiveKey()
|
this.getTableListForActiveKey()
|
||||||
]);
|
])
|
||||||
|
|
||||||
// 初始化实时刷新
|
// 初始化实时刷新
|
||||||
this.startRealtimeRefresh();
|
this.startRealtimeRefresh()
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
console.log('beforeUnmount')
|
console.log('beforeUnmount')
|
||||||
clearInterval(this.interval); // 组件销毁时清除定时器
|
clearInterval(this.interval) // 组件销毁时清除定时器
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
forceRerender() {
|
forceRerender() {
|
||||||
this.renderKey += 1;
|
this.renderKey += 1
|
||||||
},
|
},
|
||||||
resetDataForInactiveKey() {
|
resetDataForInactiveKey() {
|
||||||
// 重置非当前激活页面的数据,减少内存占用
|
// 重置非当前激活页面的数据,减少内存占用
|
||||||
Object.keys(this.echartsInfo).forEach((key) => {
|
Object.keys(this.echartsInfo).forEach((key) => {
|
||||||
if (key != this.activeKey) {
|
if (key != this.activeKey) {
|
||||||
this.echartsInfo[key].chartData={}
|
this.echartsInfo[key].chartData = {}
|
||||||
this.echartsInfo[key].chartDatav={}
|
this.echartsInfo[key].chartDatav = {}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
Object.keys(this.tableList).forEach((key) => {
|
Object.keys(this.tableList).forEach((key) => {
|
||||||
if (key != this.activeKey) {
|
if (key != this.activeKey) {
|
||||||
this.echartsInfo[key].tableData={}
|
this.echartsInfo[key].tableData = {}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
async getEchartsListForActiveKey() {
|
async getEchartsListForActiveKey() {
|
||||||
if (!this.activeKey) return;
|
if (!this.activeKey) return
|
||||||
this.loading.chart = true;
|
this.loading.chart = true
|
||||||
|
|
||||||
const currentInfo = this.echartsInfo[this.activeKey];
|
const currentInfo = this.echartsInfo[this.activeKey]
|
||||||
const query = {
|
const query = {
|
||||||
...this.paramsDate,
|
...this.paramsDate,
|
||||||
category: this.activeKey
|
category: this.activeKey
|
||||||
};
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await getReq('/queryStatDayList', query);
|
const res = await getReq('/queryStatDayList', query)
|
||||||
if (res.errcode === 0) {
|
if (res.errcode === 0) {
|
||||||
this.echartsInfo[this.activeKey].chartData=res.data
|
this.echartsInfo[this.activeKey].chartData = res.data
|
||||||
this.loading.chart = false;
|
this.loading.chart = false
|
||||||
} else {
|
} else {
|
||||||
throw res;
|
throw res
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.loading.chart = false;
|
this.loading.chart = false
|
||||||
this.echartsInfo[this.activeKey].chartData={}
|
this.echartsInfo[this.activeKey].chartData = {}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 专门获取当前激活页面的表格数据
|
// 专门获取当前激活页面的表格数据
|
||||||
async getTableListForActiveKey() {
|
async getTableListForActiveKey() {
|
||||||
this.loading.table = true;
|
this.loading.table = true
|
||||||
if (!this.activeKey) return;
|
if (!this.activeKey) return
|
||||||
|
|
||||||
const currentInfo = this.tableList[this.activeKey];
|
const currentInfo = this.tableList[this.activeKey]
|
||||||
const query = {
|
const query = {
|
||||||
...this.paramsDate,
|
...this.paramsDate,
|
||||||
category: this.activeKey,
|
category: this.activeKey,
|
||||||
page_size: currentInfo.pageOption.pageSize,
|
page_size: currentInfo.pageOption.pageSize,
|
||||||
pageNumber: currentInfo.pageOption.page
|
pageNumber: currentInfo.pageOption.page
|
||||||
};
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await getReq('/queryStatDayList', query);
|
const res = await getReq('/queryStatDayList', query)
|
||||||
if (res.errcode === 0) {
|
if (res.errcode === 0) {
|
||||||
this.tableList[this.activeKey].tableData=res.data.list || res.data
|
this.tableList[this.activeKey].tableData = res.data.list || res.data
|
||||||
this.tableList[this.activeKey].pageOption.count=res.data.count || 0
|
this.tableList[this.activeKey].pageOption.count = res.data.count || 0
|
||||||
this.loading.table = false;
|
this.loading.table = false
|
||||||
} else {
|
} else {
|
||||||
throw res;
|
throw res
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.tableList[this.activeKey].tableData = []
|
||||||
this.tableList[this.activeKey].tableData=[]
|
this.tableList[this.activeKey].pageOption.count = 0
|
||||||
this.tableList[this.activeKey].pageOption.count= 0
|
this.loading.table = false
|
||||||
this.loading.table = false;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
startRealtimeRefresh() {
|
startRealtimeRefresh() {
|
||||||
this.interval = setInterval(() => {
|
this.interval = setInterval(() => {
|
||||||
if (this.activeKey) {
|
if (this.activeKey) {
|
||||||
this.getStatCharts(); // 定时获取最新实时数据
|
this.getStatCharts() // 定时获取最新实时数据
|
||||||
}
|
}
|
||||||
}, 10000); // 30秒刷新一次
|
}, 10000) // 30秒刷新一次
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
async getStationList() {
|
async getStationList() {
|
||||||
const params = {
|
const params = {
|
||||||
page_size: 1000,
|
page_size: 1000,
|
||||||
@@ -655,21 +649,18 @@ export default {
|
|||||||
this.tableList[this.activeKey].pageOption.pageSize = e.pageSize
|
this.tableList[this.activeKey].pageOption.pageSize = e.pageSize
|
||||||
this.tableList[this.activeKey].pageOption.page = e.page
|
this.tableList[this.activeKey].pageOption.page = e.page
|
||||||
this.getTableListForActiveKey()
|
this.getTableListForActiveKey()
|
||||||
|
|
||||||
},
|
},
|
||||||
onSearch(data) {
|
onSearch(data) {
|
||||||
this.paramsDate.start_date = data.time ? data.time[0] : ''
|
this.paramsDate.start_date = data.time ? data.time[0] : ''
|
||||||
this.paramsDate.end_date = data.time ? data.time[1] : ''
|
this.paramsDate.end_date = data.time ? data.time[1] : ''
|
||||||
|
|
||||||
this.tableList[this.activeKey].pageOption.page = 1
|
this.tableList[this.activeKey].pageOption.page = 1
|
||||||
this.getStationList(),
|
this.getStationList(), this.getEchartsListForActiveKey(), this.getTableListForActiveKey()
|
||||||
this.getEchartsListForActiveKey(),
|
|
||||||
this.getTableListForActiveKey()
|
|
||||||
},
|
},
|
||||||
changeStation() {
|
changeStation() {
|
||||||
this.getStatCharts();
|
this.getStatCharts()
|
||||||
},
|
},
|
||||||
|
|
||||||
// async getEchartsList() {
|
// async getEchartsList() {
|
||||||
// const key = activeKey || this.activeKey;
|
// const key = activeKey || this.activeKey;
|
||||||
// if (!key) return;
|
// if (!key) return;
|
||||||
@@ -705,26 +696,23 @@ export default {
|
|||||||
const res = await getReq('/queryStatCharts', query)
|
const res = await getReq('/queryStatCharts', query)
|
||||||
if (res.errcode === 0) {
|
if (res.errcode === 0) {
|
||||||
this.echartsInfo[this.activeKey].chartDatav = {
|
this.echartsInfo[this.activeKey].chartDatav = {
|
||||||
"V":[100.0,100.0,100.0], // 电压曲线
|
V: [100.0, 100.0, 100.0], // 电压曲线
|
||||||
"I":[10.0,10.0,10.0], // 电流曲线
|
I: [10.0, 10.0, 10.0], // 电流曲线
|
||||||
"P":[1000.0,1000.0,1000.0], // 功率曲线
|
P: [1000.0, 1000.0, 1000.0] // 功率曲线
|
||||||
}
|
}
|
||||||
|
|
||||||
// x轴0点到24点
|
// x轴0点到24点
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw res
|
throw res
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.echartsInfo[this.activeKey].chartDatav = {
|
this.echartsInfo[this.activeKey].chartDatav = {
|
||||||
"V":[100.0,100.0,100.0], // 电压曲线
|
V: [100.0, 100.0, 100.0], // 电压曲线
|
||||||
"I":[10.0,10.0,10.0], // 电流曲线
|
I: [10.0, 10.0, 10.0], // 电流曲线
|
||||||
"P":[1000.0,1000.0,1000.0], // 功率曲线
|
P: [1000.0, 1000.0, 1000.0] // 功率曲线
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
// async getTableList() {
|
// async getTableList() {
|
||||||
// const currentInfo = this.tableList[this.activeKey]
|
// const currentInfo = this.tableList[this.activeKey]
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
<searchBox
|
<searchBox
|
||||||
:btn-option-list="btnOptionList"
|
:btn-option-list="btnOptionList"
|
||||||
@onSearch="onSearch"
|
@onSearch="onSearch"
|
||||||
:search-options="searchOptions"
|
|
||||||
@operateForm="operateForm"
|
@operateForm="operateForm"
|
||||||
></searchBox>
|
></searchBox>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
<searchBox
|
<searchBox
|
||||||
:btn-option-list="btnOptionList"
|
:btn-option-list="btnOptionList"
|
||||||
@onSearch="onSearch"
|
@onSearch="onSearch"
|
||||||
:search-options="searchOptions"
|
|
||||||
@operateForm="operateForm"
|
@operateForm="operateForm"
|
||||||
></searchBox>
|
></searchBox>
|
||||||
|
|
||||||
@@ -125,6 +124,8 @@ export default {
|
|||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.$refs.comTable.loading = false
|
||||||
|
|
||||||
//统一处理报错提示
|
//统一处理报错提示
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
<searchBox
|
<searchBox
|
||||||
:btn-option-list="btnOptionList"
|
:btn-option-list="btnOptionList"
|
||||||
@onSearch="onSearch"
|
@onSearch="onSearch"
|
||||||
:search-options="searchOptions"
|
|
||||||
@operateForm="operateForm"
|
@operateForm="operateForm"
|
||||||
></searchBox>
|
></searchBox>
|
||||||
|
|
||||||
@@ -145,6 +144,8 @@ export default {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//统一处理报错提示
|
//统一处理报错提示
|
||||||
|
this.$refs.comTable.loading = false
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
operateForm(type, record = {}) {
|
operateForm(type, record = {}) {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
<searchBox
|
<searchBox
|
||||||
:btn-option-list="btnOptionList"
|
:btn-option-list="btnOptionList"
|
||||||
@onSearch="onSearch"
|
@onSearch="onSearch"
|
||||||
:search-options="searchOptions"
|
|
||||||
@operateForm="operateForm"
|
@operateForm="operateForm"
|
||||||
></searchBox>
|
></searchBox>
|
||||||
|
|
||||||
@@ -161,6 +160,8 @@ export default {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//统一处理报错提示
|
//统一处理报错提示
|
||||||
|
this.$refs.comTable.loading = false
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
operateForm(type, record = {}) {
|
operateForm(type, record = {}) {
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ export default {
|
|||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.$refs.comTable.loading = false
|
||||||
|
|
||||||
//统一处理报错提示
|
//统一处理报错提示
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user