feat(system): 优化系统日志页面布局和功能

- 修改系统日志页面的列配置,增加固定列和对齐方式
- 优化表格组件的样式和功能,支持右列固定和自定义样式
- 调整分页配置,统一表格相关属性
This commit is contained in:
zhoumengru
2025-09-10 09:23:47 +08:00
parent 5a11916a02
commit 1f20215383
24 changed files with 527 additions and 322 deletions

View File

@@ -95,7 +95,7 @@ export default {
},
{
name: '告警日志',
path: '/log'
path: '/alarmlog'
},
{
name: '系统日志',
@@ -214,7 +214,7 @@ export default {
}
.page {
width: calc(100% - 20px);
height: calc(100% - 70px - 65px - 40px);
height: calc(100% - 70px - 60px - 40px);
margin: 20px 10px;
border-radius: 20px;
}
@@ -227,7 +227,8 @@ export default {
.menu {
position: absolute;
width: 100%;
bottom: 15px;
bottom: 10px;
height: 50px;
// height: 150px;
display: flex;
justify-content: center;

View File

@@ -15,11 +15,13 @@
<div class="search-item">
<span>运行模式</span>
<a-select v-model:value="workMode" style="width: 220px">
<a-select-option :value="item.value" v-for="item in workModes">{{ item.label }}</a-select-option>
<a-select-option :value="item.value" v-for="item in workModes">{{
item.label
}}</a-select-option>
</a-select>
</div>
<div class="search-item">
<a-button type="primary">下发</a-button>
<a-button type="primary" @click="handleDispatch">下发</a-button>
</div>
</div>
</div>
@@ -33,13 +35,14 @@
:class="systemType == system.systemType ? 'active' : ''"
>
<span class="name">{{ system.name }}</span>
<span class="des">边缘网关{{ system.power }} W</span>
<span class="des">总有功功率(台区){{ system.num }}</span>
<span class="des" v-for="title in system.titles" :key="title.v"
>{{ title.v }}{{ system[title.key] }}{{ title.sufix }}
</span>
</div>
</div>
<div class="container">
<videos v-if="systemType == 4" :station-id="selectStationId"/>
<device v-else :station-id="selectStationId" :system-type="systemType"/>
<videos v-if="systemType == 4" :station-id="selectStationId" />
<device v-else :station-id="selectStationId" :system-type="systemType" />
</div>
</div>
</div>
@@ -62,10 +65,14 @@ export default {
systemType: 1,
value: [],
stations: [],
selectStationId:'',
selectStationId: '',
systems: [
{
name: '储能系统',
titles: [
{ v: '边缘网关', key: 'num' },
{ v: '总有功功率(台区)', key: 'power', sufix: 'kW' }
],
power: 60,
num: 62,
systemType: 1
@@ -74,99 +81,125 @@ export default {
name: '充电系统',
power: 60,
num: 62,
systemType: 2
systemType: 2,
titles: [
{ v: '总功率', key: 'power', sufix: 'kW' },
{ v: '数量', key: 'num' }
]
},
{
name: '光伏系统',
power: 60,
num: 62,
systemType: 3
systemType: 3,
titles: [
{ v: '总功率', key: 'power', sufix: 'kW' },
{ v: '数量', key: 'num' }
]
},
{
name: '安防系统',
power: 60,
num: 62,
systemType: 4
systemType: 4,
titles: [
{ v: '总功率', key: 'power', sufix: 'kW' },
{ v: '数量', key: 'num' }
]
}
// {
// name: "储能系统4",
// }
],
workMode:'',
workModes:[
workMode: '',
workModes: [
// 0手动1峰谷套利2增网配容3应急供电4并网保电5自定时段
{
value:0,
label:'手动'
value: 0,
label: '手动'
},
{
value:1,
label:'峰谷套利'
value: 1,
label: '峰谷套利'
},
{
value:2,
label:'增网配容'
value: 2,
label: '增网配容'
},
{
value:3,
label:'应急供电'
value: 3,
label: '应急供电'
},
{
value:4,
label:'并网保电'
value: 4,
label: '并网保电'
},
{
value:5,
label:'自定时段'
value: 5,
label: '自定时段'
}
],
deviceGroup:[]
deviceGroup: []
}
},
mounted() {
this.getStations()
},
methods: {
//下发
async handleDispatch() {
console.log(this.workMode)
try {
const res = await postReq('/updateStation', {
station_id: this.selectStationId,
work_mode: this.workMode
})
if (res.errcode == 0) {
this.$message.success('下发成功')
}
} catch (error) {
this.$message.error('下发失败')
}
},
//场站切换
getStationChange(val){
console.log(val);
getStationChange(val) {
console.log(val)
this.getStationAttr()
},
//查询场站列表
async getStations() {
try {
const res = await getReq('/queryStationList', { page: 0, 'page_size': 10000 })
const res = await getReq('/queryStationList', { page: 0, page_size: 10000 })
this.stations = res.data
this.selectStationId=this.stations[0]['station_id']
this.selectStationId = this.stations[0]['station_id']
this.getStationAttr()
} catch (error) {
this.stations = []
this.selectStationId=''
this.selectStationId = ''
this.$message.error(error.message)
}
},
// 查询场站的参数
async getStationAttr(){
async getStationAttr() {
try {
const res = await getReq('/queryStationOverview', { station_id: this.selectStationId })
res.data.device_group.forEach((Element,index) => {
this.systems[index].num=Element.count
this.systems[index].power=Element.power
});
this.workMode=res.data.work_mode
res.data.device_group.forEach((Element, index) => {
this.systems[index].num = Element.count
this.systems[index].power = Element.power
})
this.workMode = res.data.work_mode
} catch (error) {
this.deviceGroup = []
this.workMode=''
this.workMode = ''
// this.$message.error(error.errmsg)
}
},
chooseStation(system) {
console.log(system, 'system')
this.systemType = system.systemType
}
}
@@ -176,8 +209,8 @@ export default {
<style scoped lang="scss">
@import url(@/style/color.scss);
.monitor {
width: 100%;
height: 100%;
// width: 100%;
height: calc(100% - 40px);
padding: 20px;
background: $bg1-color;
border-radius: 15px;
@@ -207,24 +240,21 @@ export default {
display: flex;
justify-content: space-between;
.stations {
min-width: 155px;
max-width: 235px;
width: 13%;
height: 100%;
display: grid;
border-radius: 12px;
background: $bg2-color;
padding: 15px 0;
overflow-y: auto;
padding-top: 10px;
grid-template-rows: repeat(auto-fit, minmax(140px, 4fr));
.station-item {
width: calc(100% - 30px);
margin: 0 15px 15px 15px;
flex: 1;
width: 100px;
margin: 0 10px 10px 10px;
border-radius: 12px;
min-width: 150px;
min-width: 160px;
display: flex;
flex-direction: column;
color: #fff;
padding: 10px 15px;
padding: 10px 10px;
cursor: pointer;
.name {
@@ -236,6 +266,11 @@ export default {
font-size: 14px;
font-weight: 600;
line-height: 40px;
display: inline-block;
max-width: 160px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.active {
@@ -243,7 +278,7 @@ export default {
}
}
.container {
width: 100%;
width: calc(100% - 200px);
display: flex;
justify-content: space-between;
}

View File

@@ -1,9 +1,6 @@
<template>
<div class="alarmLog">
<searchBox
:btn-option-list="btnOptionList"
@operateForm="operateForm"
></searchBox>
<searchBox :btn-option-list="btnOptionList" @operateForm="operateForm"></searchBox>
<div class="content-table">
<ComTable
@@ -11,17 +8,17 @@
:table-data="tableData"
@handlePagesizeChange="handlePagesizeChange"
ref="comTable"
:table-option="tableOption"
:page-option="pageOption"
:table-h="tableH"
>
<template #type="record">
<span>{{ ['其它','系统日志','操作日志','设备日志'][record.type] }}</span>
<span>{{ ['其它', '系统日志', '操作日志', '设备日志'][record.type] }}</span>
</template>
<template #status="record">
<span><a-tag :color="record.status ? 'red' : 'green'">{{
record.status ? '异常' : '正常'
}}</a-tag></span>
<span
><a-tag :color="record.status ? 'red' : 'green'">{{
record.status ? '异常' : '正常'
}}</a-tag></span
>
</template>
<template #action="record">
@@ -29,7 +26,7 @@
</template>
</ComTable>
</div>
<a-modal v-model:open="formModal" width="750px" style="top: 20px" :footer="null">
<a-modal v-model:open="formModal" width="750px" style="top: 20px" :footer="null">
<!-- action:edit add -->
<EditCom
:record="formState"
@@ -47,11 +44,11 @@ import { getReq, postReq } from '@/request/api.js'
import EditCom from '@/components/EditCom.vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
import { createVNode } from 'vue'
import { Modal } from 'ant-design-vue'
export default {
name: '',
components: {
EditCom,
EditCom
},
props: {},
data() {
@@ -64,7 +61,8 @@ export default {
page: 1
},
btnOptionList: [],
paramsDate: {}
paramsDate: {},
tableData: []
}
},
computed: {},
@@ -80,7 +78,7 @@ export default {
},
mounted() {
this.operateList = this.$getBtns(['查看', '删除'])
this.operateList = this.$getBtns(['查看'])
// this.btnOptionList = this.$getBtns(['新增'])
this.getList()
},
@@ -119,22 +117,21 @@ export default {
},
async operateForm(type, record = {}) {
this.formStatus = type
if(type=='edit'||type=='read'){
if (type == 'edit' || type == 'read') {
await this.getRuleFormInfo(record)
this.formModal = true
this.formState = record
}else if(type=='del'){
this.handleDelete([record.device_id],this.getList)
}else if(type=='back'){
} else if (type == 'del') {
this.handleDelete([record.device_id], this.getList)
} else if (type == 'back') {
this.formModal = false
this.getList()
}
},
// 删除操作
async handleDelete(id,callback) {
async handleDelete(id, callback) {
const that = this
Modal.confirm({
title: '你确认删除数据吗?',
@@ -142,10 +139,10 @@ export default {
async onOk() {
try {
const res = await getReq('/deleteUser',{user_id:id})
const res = await getReq('/deleteUser', { user_id: id })
if (res.errcode === 0) {
this.$message.success(res.errmsg)
this.pageOption.page=1
this.pageOption.page = 1
callback()
} else {
throw res
@@ -161,8 +158,6 @@ export default {
})
},
async getRuleFormInfo(record) {
const row = record || {}
for (let e of alarmlogOptions) {
@@ -183,8 +178,6 @@ export default {
// const attrs=JSON.parse(row.attrs||"{}")
// e.ruleForm[i.key] = attrs[i.key]
// }
}
}
},
@@ -202,7 +195,7 @@ export default {
height: 100%;
.content-table {
height: calc(100% - 70px);
height: calc(100% - 90px);
padding: 10px;
}
}

View File

@@ -48,7 +48,7 @@ import OperateCom from '@/components/OperateCom'
import EditCom from '@/components/EditCom.vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
import { createVNode } from 'vue'
import { Modal } from 'ant-design-vue'
import searchBox from '@/components/SearchBox.vue'
import {deviceTypeList} from '@/utils/config'
export default {
@@ -170,7 +170,7 @@ export default {
// 删除操作
async handleDelete(id,callback) {
const that = this
Modal.confirm({
this.$Modal.confirm({
title: '你确认删除数据吗?',
icon: createVNode(ExclamationCircleOutlined),
@@ -234,7 +234,7 @@ export default {
height: 100%;
.content-table {
height: calc(100% - 70px);
height: calc(100% - 90px);
padding: 10px;
}
}

View File

@@ -1,9 +1,6 @@
<template>
<div class="alarmlog">
<searchBox
:btn-option-list="btnOptionList"
@operateForm="operateForm"
></searchBox>
<div class="syslog">
<searchBox :btn-option-list="btnOptionList" @operateForm="operateForm"></searchBox>
<div class="content-table">
<ComTable
@@ -11,13 +8,14 @@
:table-data="tableData"
@handlePagesizeChange="handlePagesizeChange"
ref="comTable"
:table-option="tableOption"
:page-option="pageOption"
:table-h="tableH"
>
<template #gender="record">
<!-- 0:; 1: -->
<span>{{ ['女', '男'][record.gender] }}</span>
<template #status="record">
<span>
<a-tag :color="record.status ? 'red' : 'green'">{{
record.status ? '异常' : '正常'
}}</a-tag>
</span>
</template>
<template #action="record">
@@ -38,7 +36,7 @@
</template>
<script>
import { columnList, userOptions } from '../../../public/config/columnList'
import { columnList, syslogOptions } from '../../../public/config/columnList'
import { getReq, postReq } from '@/request/api.js'
import EditCom from '@/components/EditCom.vue'
@@ -61,13 +59,14 @@ export default {
page: 1
},
btnOptionList: [],
paramsDate: {}
paramsDate: {},
tableData: []
}
},
computed: {},
created() {
let info = []
let col = columnList.find((i) => i.page == 'alarmlog').columns
let col = columnList.find((i) => i.page == 'syslog').columns
if (col.length) {
col.forEach((item) => {
info.push(this.$setWidth(item))
@@ -77,8 +76,8 @@ export default {
},
mounted() {
this.operateList = this.$getBtns(['查看', '修改', '删除'])
this.btnOptionList = this.$getBtns(['新增'])
this.operateList = this.$getBtns(['查看'])
// this.btnOptionList = this.$getBtns(['新增'])
this.getList()
},
@@ -95,7 +94,7 @@ export default {
}
try {
const res = await getReq('/queryUserList', params)
const res = await getReq('/querySystemLogList', params)
if (res.errcode === 0) {
this.$refs.comTable.loading = false
@@ -114,41 +113,25 @@ export default {
//统一处理报错提示
}
},
operateForm(type, record = {}) {
console.log(record, record.id, 'rrrrrrrrrr')
async operateForm(type, record = {}) {
this.formStatus = type
switch (type) {
case 'add':
this.formModal = true
this.formState = {}
this.getRuleFormInfo()
break
case 'edit':
case 'read':
if (type == 'edit' || type == 'read') {
await this.getRuleFormInfo(record)
this.formModal = true
this.formState = record
this.getRuleFormInfo(record)
break
case 'del':
this.handleDelete([record.user_id], this.getList)
break
case 'back':
} else if (type == 'del') {
this.handleDelete([record.device_id], this.getList)
} else if (type == 'back') {
this.formModal = false
this.getList()
break
default:
break
}
},
// 删除操作
async handleDelete(id, callback) {
const that = this
Modal.confirm({
this.$Modal.confirm({
title: '你确认删除数据吗?',
icon: createVNode(ExclamationCircleOutlined),
@@ -173,27 +156,13 @@ export default {
})
},
async getRuleFormInfo(record) {
function getInfo(data, url) {
return new Promise((reslove, reject) => {
getReq(data, url).then((res) => {
reslove(res.data)
})
})
}
const row = record || {}
let row = {}
if (record && record.user_id) {
// row = await getInfo({ id: record.id },'/queryUserList')
this.record = record
row = record
// this.type='edit'
for (let e of syslogOptions) {
for (let i of e.list) {
e.ruleForm[i.key] = row[i.key] || ''
}
}
userOptions.forEach((e, index) => {
e.list.forEach((i) => {
e.ruleForm[i.key] = row ? row[i.key] : ''
e.ruleForm.id = row.id
})
})
},
handlePagesizeChange(pageOption) {
this.pageOption.pageSize = pageOption.pageSize
@@ -205,11 +174,11 @@ export default {
</script>
<style lang="scss" scoped>
.user {
.syslog {
height: 100%;
.content-table {
height: calc(100% - 70px);
height: calc(100% - 90px);
padding: 10px;
}
}

View File

@@ -49,7 +49,7 @@ import { getReq, postReq } from '@/request/api.js'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
import { createVNode } from 'vue'
import { Modal } from 'ant-design-vue'
export default {
name: '',
components: {

View File

@@ -234,7 +234,7 @@ export default {
<style lang="scss" scoped>
.policy {
width: 100%;
// width: 100%;
height: 100%;
padding: 0 15px;
.content-table {

View File

@@ -52,7 +52,7 @@ import OperateCom from '@/components/OperateCom'
import EditCom from '@/components/EditCom.vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
import { createVNode } from 'vue'
import { Modal } from 'ant-design-vue'
import searchBox from '@/components/SearchBox.vue'
export default {
name: '',

View File

@@ -45,7 +45,7 @@ import { getReq, postReq } from '@/request/api.js'
import EditCom from '@/components/EditCom.vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
import { createVNode } from 'vue'
import { Modal } from 'ant-design-vue'
import searchBox from '@/components/SearchBox.vue'
export default {
name: '',

View File

@@ -52,7 +52,7 @@ import OperateCom from '@/components/OperateCom'
import EditCom from '@/components/EditCom.vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
import { createVNode } from 'vue'
import { Modal } from 'ant-design-vue'
import searchBox from '@/components/SearchBox.vue'
export default {
name: '',

View File

@@ -42,20 +42,13 @@
<script>
import { columnList, userOptions } from '../../../public/config/columnList'
import { getReq, postReq } from '@/request/api.js'
import ComTable from '@/components/ComTable'
import OperateCom from '@/components/OperateCom'
import EditCom from '@/components/EditCom.vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
import { createVNode } from 'vue'
import { Modal } from 'ant-design-vue'
import searchBox from '@/components/SearchBox.vue'
export default {
name: '',
components: {
searchBox,
EditCom,
ComTable,
OperateCom
},
props: {},
data() {
@@ -155,7 +148,7 @@ export default {
// 删除操作
async handleDelete(id,callback) {
const that = this
Modal.confirm({
this.$Modal.confirm({
title: '你确认删除数据吗?',
icon: createVNode(ExclamationCircleOutlined),