样式 警告处理

This commit is contained in:
ym1026
2025-09-12 10:58:59 +08:00
parent 23b5352635
commit f0720439d2
12 changed files with 246 additions and 159 deletions

View File

@@ -228,6 +228,8 @@ export const columnList = [
{
title: '操作',
dataIndex: 'operate',
fixed: 'right',
key: 'operate',
scopedSlots: { customRender: 'action' }
}
@@ -667,29 +669,9 @@ export const stationOptions = [
label: '场站运行模式',
value: undefined,
key: 'work_mode',
type: 'select',
list: [
{
label: '峰谷套利',
value: '1'
},
{
label: '增网配容',
value: '2'
},
{
label: '应急供电',
value: '3'
},
{
label: '并网保电',
value: '4'
},
{
label: '自定时段',
value: '5'
}
]
type: 'slot',
slotName: 'work_mode',
list: []
},
{
// 0未启用1启用
@@ -697,7 +679,7 @@ export const stationOptions = [
label: '场站运行策略',
value: undefined,
key: 'policy_id',
type: 'select',
type: 'unshow',
list: [
{
label: '削峰套利',

View File

@@ -387,11 +387,15 @@ defineExpose({ ...toRefs(data), loading, mountedScroll, scroll: data.scroll })
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) {
color:#fff;
background: $table-bg !important;
border: 1px solid $table-border;
border-radius: 0px 0px 20px 20px;
// border: 1px solid $table-border;
border-radius: 20px!important;
.ant-table-cell {
background: var(--theme-bg) !important;
}
@@ -424,6 +428,8 @@ defineExpose({ ...toRefs(data), loading, mountedScroll, scroll: data.scroll })
}
:deep(.ant-table-wrapper .ant-table) {
border: 1px solid $table-border!important;
background-color: transparent !important;
}

View File

@@ -8,6 +8,24 @@
:ref="'detailInfo' + index"
: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">
<a-select
:dropdown-match-select-width="false"
@@ -109,6 +127,31 @@ export default {
data() {
return {
workModeIdSelect: undefined,
workModeList: [
{
label: '峰谷套利',
value: '1'
},
{
label: '增网配容',
value: '2'
},
{
label: '应急供电',
value: '3'
},
{
label: '并网保电',
value: '4'
},
{
label: '自定时段',
value: '5'
}
],
tip: '正在加载...',
roleIdList: [],
transferDialog: false,
@@ -131,6 +174,28 @@ export default {
},
computed: {},
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: {
handler(n) {
if (n === 'read') {
@@ -154,7 +219,6 @@ export default {
// this.formRules = menuFormRules
break
case 'permission':
break
case 'role':
@@ -307,8 +371,8 @@ export default {
add: '/insertRole',
edit: '/updateRole'
}
const { selectedRowKeys ,selectedArr} = this.$refs.treeTable[0]
console.log(selectedRowKeys,selectedArr, 'selectedRowKeys')
const { selectedRowKeys, selectedArr } = this.$refs.treeTable[0]
console.log(selectedRowKeys, selectedArr, 'selectedRowKeys')
// const arr = selectedArr.map((item) => ({
// ...item,
@@ -325,8 +389,8 @@ export default {
// }))
// console.log(arr,"arr")
const data=this.filterTreeData(selectedRowKeys,this.$refs.treeTable[0].tableData)
const arr = data.map((item) => ({
const data = this.filterTreeData(selectedRowKeys, this.$refs.treeTable[0].tableData)
const arr = data.map((item) => ({
...item,
// 转换操作权限为布尔值
@@ -335,14 +399,13 @@ export default {
children: item.children
? item.children.map((child) => ({
...child,
...this.getPerOperBoolean(child),
...this.getPerOperBoolean(child)
}))
: []
}))
const paramsDate = {
...this.form,
permission:arr
permission: arr
}
if (this.action == 'edit') {
@@ -363,61 +426,57 @@ export default {
},
// 定义筛选树形数据的函数
filterTreeData(list1, list2) {
const keySet = new Set(list1);
const keySet = new Set(list1)
// 递归处理节点的函数
const filterNode = (node) => {
// 创建新节点对象(浅拷贝)
const newNode = Object.assign({}, node);
const newNode = Object.assign({}, node)
// 临时删除children属性以便处理
const { children, ...rest } = newNode;
const { children, ...rest } = newNode
// 处理子节点
let newChildren = [];
let newChildren = []
if (children) {
newChildren = children
.map((child) => filterNode(child))
.filter((child) => child !== null);
newChildren = children.map((child) => filterNode(child)).filter((child) => child !== null)
}
// 重建新节点
const resultNode = Object.assign(rest, {});
const resultNode = Object.assign(rest, {})
if (newChildren.length > 0) {
resultNode.children = newChildren;
resultNode.children = newChildren
}
// 判断是否保留节点
if (keySet.has(node.key)) {
return resultNode;
return resultNode
}
// 保留有符合条件子节点的父节点移除自身key
if (newChildren.length > 0) {
return resultNode;
return resultNode
}
return null;
};
return null
}
// 处理根节点
const result = list2
.map((node) => filterNode(node))
.filter((node) => node !== null);
const result = list2.map((node) => filterNode(node)).filter((node) => node !== null)
return result;
return result
},
getPerOperBoolean(data) {
return {
is_add: Boolean(data.is_add)? '1' : '0',
is_del: Boolean(data.is_del)? '1' : '0',
is_edit: Boolean(data.is_edit)? '1' : '0',
is_view: Boolean(data.is_view)? '1' : '0'
is_add: Boolean(data.is_add) ? '1' : '0',
is_del: Boolean(data.is_del) ? '1' : '0',
is_edit: Boolean(data.is_edit) ? '1' : '0',
is_view: Boolean(data.is_view) ? '1' : '0'
}
},
getPermissionData(keys,list){
const arr=[]
getPermissionData(keys, list) {
const arr = []
// list.forEach(item=>{
// if(keys.include(item.key)){
// arr.push(item)

View File

@@ -439,8 +439,13 @@ export default {
}
:deep(.ant-table-container > .ant-table-content > table) {
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) {
color: var(--theme-text-default) !important;

View File

@@ -14,40 +14,47 @@ export const routes = [
path: '/',
name: '/',
redirect: '/home',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "main" */ '@/views/MainView.vue'),
children: [
{
path: 'home',
component: () => import(/* webpackChunkName: "monitor" */ '@/views/sub/Home.vue')
component: () => import(/* webpackChunkName: "monitor" */ '@/views/sub/Home.vue'),
meta: { requiresAuth: true }
},
{
path: 'monitor',
name: 'monitor',
title: '运行监控',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "monitor" */ '@/views/monitor.vue')
},
{
path: 'predict',
name: 'predict',
title: '预测管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "predict" */ '@/views/predict.vue')
},
{
path: 'statisticalAnalysis',
name: 'statisticalAnalysis',
title: '统计分析',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "monitor" */ '@/views/statisticalAnalysis.vue')
},
{
path: 'system',
name: 'system',
redirect: '/system/user',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/index.vue'),
children: [
{
path: 'user',
name: 'user',
title: '用户管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/user.vue')
},
@@ -55,12 +62,14 @@ export const routes = [
name: 'role',
path: 'role',
title: '角色管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/role.vue')
},
{
name: 'permission',
path: 'permission',
title: '权限管理',
meta: { requiresAuth: true },
component: () =>
import(/* webpackChunkName: "system" */ '@/views/system/permission.vue')
},
@@ -68,36 +77,42 @@ export const routes = [
name: 'station',
path: 'station',
title: '场站管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/station.vue')
},
{
name: 'service',
path: 'service',
title: '服务管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/service.vue')
},
{
path: 'policy',
name: 'policy',
title: '策略管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/policy.vue')
},
{
name: 'device',
path: 'device',
title: '设备管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/device.vue')
},
{
name: 'alarmlog',
path: 'alarmlog',
title: '告警日志',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/alarmLog.vue')
},
{
name: 'syslog',
path: 'syslog',
title: '系统日志',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/log.vue')
}
]
@@ -111,4 +126,27 @@ const router = createRouter({
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

View File

@@ -18,8 +18,14 @@ $page-border: #cad2dd;
.ant-switch {
background: #b1c4c4;
}
.ant-switch.ant-switch-checked{
background: #00fffb
.ant-switch.ant-switch-checked {
background: #00fffb;
}
.ant-select .ant-select-arrow {
background: transparent !important;
}
.ant-select .ant-select-clear {
background: transparent !important;
}
.ant-switch .ant-switch-handle::before {
@@ -58,9 +64,8 @@ $page-border: #cad2dd;
.ant-picker-input input::placeholder {
color: #ffffff3b !important;
}
.ant-picker-suffix{
.ant-picker-suffix {
color: #ffffff !important;
}
}
.ant-input-affix-wrapper {

View File

@@ -20,7 +20,7 @@
>
<template #stationSelect="item">
<a-select
style="width: 120px;"
style="width: 120px"
:dropdown-match-select-width="false"
v-model:value="stationId"
allow-clear
@@ -39,17 +39,17 @@
</div>
<div class="main_content">
<a-spin :spinning="loading.chart || loading.table">
<energyEchart
:key="`${activeKey}_${renderKey}`"
:chart-options="echartsInfo[activeKey].chartOptions"
:chart-data="echartsInfo[activeKey].chartData"
:chart-datav="echartsInfo[activeKey].chartDatav"
:columns="tableList[activeKey].columns"
:page-option="tableList[activeKey].pageOption"
:table-info="tableList[activeKey].tableInfo"
:table-data="tableList[activeKey].tableData"
@pagesizeChange="pagesizeChange()"
></energyEchart>
<energyEchart
:key="`${activeKey}_${renderKey}`"
:chart-options="echartsInfo[activeKey].chartOptions"
:chart-data="echartsInfo[activeKey].chartData"
:chart-datav="echartsInfo[activeKey].chartDatav"
:columns="tableList[activeKey].columns"
:page-option="tableList[activeKey].pageOption"
:table-info="tableList[activeKey].tableInfo"
:table-data="tableList[activeKey].tableData"
@pagesizeChange="pagesizeChange()"
></energyEchart>
</a-spin>
</div>
</div>
@@ -166,7 +166,7 @@ export default {
}
],
chartData: {},
chartDatav: {},
chartDatav: {}
},
2: {
chartOptions: [
@@ -281,19 +281,20 @@ export default {
}
},
activeKey: 1,
interval:null,
interval: null,
tabList: [
{
key: 1,
name: '储能设备'
},
{
key: 2,
name: '光伏设备'
},
{
key: 3,
name: '充电设备'
},
{
key: 2,
name: '光伏设备'
}
],
tableList: {
@@ -505,123 +506,116 @@ export default {
watch: {
activeKey: {
handler(newVal) {
if (!newVal) return;
if (!newVal) return
// 清除之前的数据
this.resetDataForInactiveKey();
this.resetDataForInactiveKey()
// 并行加载新数据
Promise.all([
this.getEchartsListForActiveKey(),
this.getTableListForActiveKey()
]).then(() => {
this.$nextTick(() => {
this.getStatCharts();
});
});
Promise.all([this.getEchartsListForActiveKey(), this.getTableListForActiveKey()]).then(
() => {
this.$nextTick(() => {
this.getStatCharts()
})
}
)
},
immediate: true // 添加立即执行
}
},
async mounted() {
// 优先加载第一个页面(activeKey=1)所需的数据
// 优先加载第一个页面(activeKey=1)所需的数据
await Promise.all([
this.getStationList(),
this.getEchartsListForActiveKey(),
this.getTableListForActiveKey()
]);
])
// 初始化实时刷新
this.startRealtimeRefresh();
this.startRealtimeRefresh()
},
beforeUnmount() {
console.log('beforeUnmount')
clearInterval(this.interval); // 组件销毁时清除定时器
clearInterval(this.interval) // 组件销毁时清除定时器
},
methods: {
forceRerender() {
this.renderKey += 1;
this.renderKey += 1
},
resetDataForInactiveKey() {
// 重置非当前激活页面的数据,减少内存占用
// 重置非当前激活页面的数据,减少内存占用
Object.keys(this.echartsInfo).forEach((key) => {
if (key != this.activeKey) {
this.echartsInfo[key].chartData={}
this.echartsInfo[key].chartDatav={}
this.echartsInfo[key].chartData = {}
this.echartsInfo[key].chartDatav = {}
}
});
})
Object.keys(this.tableList).forEach((key) => {
if (key != this.activeKey) {
this.echartsInfo[key].tableData={}
this.echartsInfo[key].tableData = {}
}
});
})
},
async getEchartsListForActiveKey() {
if (!this.activeKey) return;
this.loading.chart = true;
if (!this.activeKey) return
this.loading.chart = true
const currentInfo = this.echartsInfo[this.activeKey];
const currentInfo = this.echartsInfo[this.activeKey]
const query = {
...this.paramsDate,
category: this.activeKey
};
}
try {
const res = await getReq('/queryStatDayList', query);
const res = await getReq('/queryStatDayList', query)
if (res.errcode === 0) {
this.echartsInfo[this.activeKey].chartData=res.data
this.loading.chart = false;
this.echartsInfo[this.activeKey].chartData = res.data
this.loading.chart = false
} else {
throw res;
throw res
}
} catch (error) {
this.loading.chart = false;
this.echartsInfo[this.activeKey].chartData={}
this.loading.chart = false
this.echartsInfo[this.activeKey].chartData = {}
}
},
// 专门获取当前激活页面的表格数据
async getTableListForActiveKey() {
this.loading.table = true;
if (!this.activeKey) return;
this.loading.table = true
if (!this.activeKey) return
const currentInfo = this.tableList[this.activeKey];
const currentInfo = this.tableList[this.activeKey]
const query = {
...this.paramsDate,
category: this.activeKey,
page_size: currentInfo.pageOption.pageSize,
pageNumber: currentInfo.pageOption.page
};
}
try {
const res = await getReq('/queryStatDayList', query);
const res = await getReq('/queryStatDayList', query)
if (res.errcode === 0) {
this.tableList[this.activeKey].tableData=res.data.list || res.data
this.tableList[this.activeKey].pageOption.count=res.data.count || 0
this.loading.table = false;
this.tableList[this.activeKey].tableData = res.data.list || res.data
this.tableList[this.activeKey].pageOption.count = res.data.count || 0
this.loading.table = false
} else {
throw res;
throw res
}
} catch (error) {
this.tableList[this.activeKey].tableData=[]
this.tableList[this.activeKey].pageOption.count= 0
this.loading.table = false;
this.tableList[this.activeKey].tableData = []
this.tableList[this.activeKey].pageOption.count = 0
this.loading.table = false
}
},
startRealtimeRefresh() {
this.interval = setInterval(() => {
if (this.activeKey) {
this.getStatCharts(); // 定时获取最新实时数据
this.getStatCharts() // 定时获取最新实时数据
}
}, 10000); // 30秒刷新一次
}, 10000) // 30秒刷新一次
},
async getStationList() {
const params = {
page_size: 1000,
@@ -655,19 +649,16 @@ export default {
this.tableList[this.activeKey].pageOption.pageSize = e.pageSize
this.tableList[this.activeKey].pageOption.page = e.page
this.getTableListForActiveKey()
},
onSearch(data) {
this.paramsDate.start_date = data.time ? data.time[0] : ''
this.paramsDate.end_date = data.time ? data.time[1] : ''
this.tableList[this.activeKey].pageOption.page = 1
this.getStationList(),
this.getEchartsListForActiveKey(),
this.getTableListForActiveKey()
this.getStationList(), this.getEchartsListForActiveKey(), this.getTableListForActiveKey()
},
changeStation() {
this.getStatCharts();
this.getStatCharts()
},
// async getEchartsList() {
@@ -705,26 +696,23 @@ export default {
const res = await getReq('/queryStatCharts', query)
if (res.errcode === 0) {
this.echartsInfo[this.activeKey].chartDatav = {
"V":[100.0,100.0,100.0], // 电压曲线
"I":[10.0,10.0,10.0], // 电流曲线
"P":[1000.0,1000.0,1000.0], // 功率曲线
V: [100.0, 100.0, 100.0], // 电压曲线
I: [10.0, 10.0, 10.0], // 电流曲线
P: [1000.0, 1000.0, 1000.0] // 功率曲线
}
// x轴0点到24点
} else {
throw res
}
} catch (error) {
this.echartsInfo[this.activeKey].chartDatav = {
"V":[100.0,100.0,100.0], // 电压曲线
"I":[10.0,10.0,10.0], // 电流曲线
"P":[1000.0,1000.0,1000.0], // 功率曲线
V: [100.0, 100.0, 100.0], // 电压曲线
I: [10.0, 10.0, 10.0], // 电流曲线
P: [1000.0, 1000.0, 1000.0] // 功率曲线
}
}
},
}
// async getTableList() {
// const currentInfo = this.tableList[this.activeKey]

View File

@@ -3,7 +3,6 @@
<searchBox
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>

View File

@@ -3,7 +3,6 @@
<searchBox
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
@@ -125,6 +124,8 @@ export default {
throw err
}
} catch (error) {
this.$refs.comTable.loading = false
//统一处理报错提示
}
},

View File

@@ -3,7 +3,6 @@
<searchBox
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
@@ -145,6 +144,8 @@ export default {
}
} catch (error) {
//统一处理报错提示
this.$refs.comTable.loading = false
}
},
operateForm(type, record = {}) {

View File

@@ -3,7 +3,6 @@
<searchBox
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
@@ -161,6 +160,8 @@ export default {
}
} catch (error) {
//统一处理报错提示
this.$refs.comTable.loading = false
}
},
operateForm(type, record = {}) {

View File

@@ -114,6 +114,8 @@ export default {
throw err
}
} catch (error) {
this.$refs.comTable.loading = false
//统一处理报错提示
}
},