fix(断路器): 日志上限改成200条,格式化代码
This commit is contained in:
parent
6257501187
commit
3af303b605
|
@ -1,34 +1,28 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-header style="display: flex; font-size: 16px">
|
||||
<div class='header-left'>
|
||||
<img :src="logo" alt="">
|
||||
<div class="header-left">
|
||||
<img :src="logo" alt="" />
|
||||
</div>
|
||||
<div class='haeder-menu' :style="{width:menuWidth + 'px'}">
|
||||
<el-menu
|
||||
default-active="/system"
|
||||
mode="horizontal"
|
||||
router="true"
|
||||
>
|
||||
<div class="haeder-menu" :style="{ width: menuWidth + 'px' }">
|
||||
<el-menu default-active="/system" mode="horizontal" router="true">
|
||||
<el-menu-item index="/system">系统模板</el-menu-item>
|
||||
<!-- <el-menu-item index="/test">测试</el-menu-item>-->
|
||||
<!-- <el-menu-item index="/test">测试</el-menu-item>-->
|
||||
</el-menu>
|
||||
</div>
|
||||
<div class="haeder-right">
|
||||
<div class="block" style="margin-right: 25px">
|
||||
<el-icon size="24" color="#80b3e6"><BellFilled /></el-icon>
|
||||
</div>
|
||||
<div class="user-name" style="margin-right: 10px">
|
||||
admin
|
||||
</div>
|
||||
<div class="user-name" style="margin-right: 10px">admin</div>
|
||||
<el-dropdown trigger="click">
|
||||
<div class="el-dropdown-link avatar-box" style="cursor: pointer">
|
||||
<img :src="avatar" alt="">
|
||||
<img :src="avatar" alt="" />
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item>admin</el-dropdown-item>
|
||||
<!-- <el-dropdown-item @click="LogOut">退出登录</el-dropdown-item>-->
|
||||
<!-- <el-dropdown-item @click="LogOut">退出登录</el-dropdown-item>-->
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
|
@ -38,12 +32,12 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from "vue"
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
import logo from '@renderer/assets/image/logo.png'
|
||||
import avatar from '@renderer/assets/image/avatar.png'
|
||||
import logo from '@renderer/assets/image/logo.png';
|
||||
import avatar from '@renderer/assets/image/avatar.png';
|
||||
|
||||
const screenWidth = ref(document.documentElement.clientWidth || document.body.clientWidth)
|
||||
const screenWidth = ref(document.documentElement.clientWidth || document.body.clientWidth);
|
||||
|
||||
const timer = ref(false);
|
||||
const domWidth = ref(document.body.clientWidth);
|
||||
|
@ -51,26 +45,21 @@ const menuWidth = ref(document.body.clientWidth - 363);
|
|||
|
||||
watch(
|
||||
(screenWidth.value = () => {
|
||||
console.log("页面变化",document.body.clientWidth)
|
||||
// 为了避免频繁触发导致页面卡顿,使用定时器
|
||||
if (!timer.value) {
|
||||
if(domWidth.value != document.body.clientWidth){
|
||||
console.log("更新页面")
|
||||
domWidth.value = document.body.clientWidth
|
||||
menuWidth.value = document.body.clientWidth - 363
|
||||
if (domWidth.value != document.body.clientWidth) {
|
||||
domWidth.value = document.body.clientWidth;
|
||||
menuWidth.value = document.body.clientWidth - 363;
|
||||
}
|
||||
timer.value = true;
|
||||
setTimeout(function () {
|
||||
timer.value = false
|
||||
}, 200)
|
||||
timer.value = false;
|
||||
}, 500);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<style scoped lang="scss">
|
||||
.el-header {
|
||||
width: 100%;
|
||||
|
@ -79,17 +68,17 @@ watch(
|
|||
justify-content: space-between;
|
||||
padding: 0;
|
||||
}
|
||||
.header-left{
|
||||
.header-left {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 180px;
|
||||
img{
|
||||
img {
|
||||
width: 154px;
|
||||
height: 37px;
|
||||
}
|
||||
}
|
||||
.haeder-menu{
|
||||
.haeder-menu {
|
||||
width: calc(100% - 180px - 183px);
|
||||
overflow: hidden;
|
||||
:deep(.el-scrollbar__bar.is-vertical) {
|
||||
|
@ -105,18 +94,18 @@ watch(
|
|||
box-sizing: border-box;
|
||||
background: #0066cc;
|
||||
border-bottom: none;
|
||||
.el-menu-item{
|
||||
.el-menu-item {
|
||||
color: #fff !important;
|
||||
width: 124px;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
text-indent: 10px;
|
||||
|
||||
&.is-active{
|
||||
&.is-active {
|
||||
background: #267dd4;
|
||||
position: relative;
|
||||
&:after{
|
||||
content: "";
|
||||
&:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 22px;
|
||||
left: 20px;
|
||||
|
@ -126,25 +115,25 @@ watch(
|
|||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
&:not(.is-disabled):hover{
|
||||
&:not(.is-disabled):hover {
|
||||
background: #4c94db;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.haeder-right{
|
||||
.haeder-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 165px;
|
||||
margin-right: 18px;
|
||||
.user-name{
|
||||
.user-name {
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 12px;
|
||||
color: #FFFFFF;
|
||||
color: #ffffff;
|
||||
}
|
||||
.avatar-box{
|
||||
img{
|
||||
.avatar-box {
|
||||
img {
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
margin-bottom: -2px;
|
||||
|
|
|
@ -1004,12 +1004,18 @@ const clearLog = () => {
|
|||
const getSocketMeassage = message => {
|
||||
let msg = JSON.parse(message.data);
|
||||
if (msg.msgType !== undefined) {
|
||||
if (logList.value.length > 200) {
|
||||
logList.value.shift();
|
||||
}
|
||||
logList.value.push({
|
||||
time: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
msg: msg.data,
|
||||
type: msg.msgType
|
||||
});
|
||||
} else {
|
||||
if (logList.value.length > 200) {
|
||||
logList.value.shift();
|
||||
}
|
||||
logList.value.push({
|
||||
time: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
msg,
|
||||
|
@ -1064,7 +1070,6 @@ const switchSocketStatus = computed(() => {
|
|||
const searchLogList = computed(() => {
|
||||
if (!logSearch.value) {
|
||||
return logList.value.filter(item => {
|
||||
console.log(item, logType.value.indexOf(item.type));
|
||||
return logType.value.indexOf(item.type) !== -1;
|
||||
});
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue