fix(断路器): 日志上限改成200条,格式化代码
This commit is contained in:
parent
6257501187
commit
3af303b605
|
@ -1,15 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-header style="display: flex; font-size: 16px">
|
<el-header style="display: flex; font-size: 16px">
|
||||||
<div class='header-left'>
|
<div class="header-left">
|
||||||
<img :src="logo" alt="">
|
<img :src="logo" alt="" />
|
||||||
</div>
|
</div>
|
||||||
<div class='haeder-menu' :style="{width:menuWidth + 'px'}">
|
<div class="haeder-menu" :style="{ width: menuWidth + 'px' }">
|
||||||
<el-menu
|
<el-menu default-active="/system" mode="horizontal" router="true">
|
||||||
default-active="/system"
|
|
||||||
mode="horizontal"
|
|
||||||
router="true"
|
|
||||||
>
|
|
||||||
<el-menu-item index="/system">系统模板</el-menu-item>
|
<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>
|
</el-menu>
|
||||||
|
@ -18,12 +14,10 @@
|
||||||
<div class="block" style="margin-right: 25px">
|
<div class="block" style="margin-right: 25px">
|
||||||
<el-icon size="24" color="#80b3e6"><BellFilled /></el-icon>
|
<el-icon size="24" color="#80b3e6"><BellFilled /></el-icon>
|
||||||
</div>
|
</div>
|
||||||
<div class="user-name" style="margin-right: 10px">
|
<div class="user-name" style="margin-right: 10px">admin</div>
|
||||||
admin
|
|
||||||
</div>
|
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<div class="el-dropdown-link avatar-box" style="cursor: pointer">
|
<div class="el-dropdown-link avatar-box" style="cursor: pointer">
|
||||||
<img :src="avatar" alt="">
|
<img :src="avatar" alt="" />
|
||||||
</div>
|
</div>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
|
@ -38,12 +32,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from "vue"
|
import { ref, watch } from 'vue';
|
||||||
|
|
||||||
import logo from '@renderer/assets/image/logo.png'
|
import logo from '@renderer/assets/image/logo.png';
|
||||||
import avatar from '@renderer/assets/image/avatar.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 timer = ref(false);
|
||||||
const domWidth = ref(document.body.clientWidth);
|
const domWidth = ref(document.body.clientWidth);
|
||||||
|
@ -51,26 +45,21 @@ const menuWidth = ref(document.body.clientWidth - 363);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
(screenWidth.value = () => {
|
(screenWidth.value = () => {
|
||||||
console.log("页面变化",document.body.clientWidth)
|
|
||||||
// 为了避免频繁触发导致页面卡顿,使用定时器
|
// 为了避免频繁触发导致页面卡顿,使用定时器
|
||||||
if (!timer.value) {
|
if (!timer.value) {
|
||||||
if (domWidth.value != document.body.clientWidth) {
|
if (domWidth.value != document.body.clientWidth) {
|
||||||
console.log("更新页面")
|
domWidth.value = document.body.clientWidth;
|
||||||
domWidth.value = document.body.clientWidth
|
menuWidth.value = document.body.clientWidth - 363;
|
||||||
menuWidth.value = document.body.clientWidth - 363
|
|
||||||
}
|
}
|
||||||
timer.value = true;
|
timer.value = true;
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
timer.value = false
|
timer.value = false;
|
||||||
}, 200)
|
}, 500);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.el-header {
|
.el-header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -116,7 +105,7 @@ watch(
|
||||||
background: #267dd4;
|
background: #267dd4;
|
||||||
position: relative;
|
position: relative;
|
||||||
&:after {
|
&:after {
|
||||||
content: "";
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 22px;
|
top: 22px;
|
||||||
left: 20px;
|
left: 20px;
|
||||||
|
@ -141,7 +130,7 @@ watch(
|
||||||
font-family: Source Han Sans CN;
|
font-family: Source Han Sans CN;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #FFFFFF;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
.avatar-box {
|
.avatar-box {
|
||||||
img {
|
img {
|
||||||
|
|
|
@ -1004,12 +1004,18 @@ const clearLog = () => {
|
||||||
const getSocketMeassage = message => {
|
const getSocketMeassage = message => {
|
||||||
let msg = JSON.parse(message.data);
|
let msg = JSON.parse(message.data);
|
||||||
if (msg.msgType !== undefined) {
|
if (msg.msgType !== undefined) {
|
||||||
|
if (logList.value.length > 200) {
|
||||||
|
logList.value.shift();
|
||||||
|
}
|
||||||
logList.value.push({
|
logList.value.push({
|
||||||
time: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
time: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
msg: msg.data,
|
msg: msg.data,
|
||||||
type: msg.msgType
|
type: msg.msgType
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
if (logList.value.length > 200) {
|
||||||
|
logList.value.shift();
|
||||||
|
}
|
||||||
logList.value.push({
|
logList.value.push({
|
||||||
time: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
time: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
msg,
|
msg,
|
||||||
|
@ -1064,7 +1070,6 @@ const switchSocketStatus = computed(() => {
|
||||||
const searchLogList = computed(() => {
|
const searchLogList = computed(() => {
|
||||||
if (!logSearch.value) {
|
if (!logSearch.value) {
|
||||||
return logList.value.filter(item => {
|
return logList.value.filter(item => {
|
||||||
console.log(item, logType.value.indexOf(item.type));
|
|
||||||
return logType.value.indexOf(item.type) !== -1;
|
return logType.value.indexOf(item.type) !== -1;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue