From 530c8e4742978a25d2358561d55a4add144e9c2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=A2=A6=E8=BF=9C?= <1063331231@qq.com> Date: Mon, 7 Jul 2025 00:52:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E5=8F=B0=E6=8A=A5?= =?UTF-8?q?=E8=AD=A6=E4=BF=A1=E6=81=AF=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/default.vue | 94 ++++++++++++++++++++++++++++++++++++++--------- src/stores/systemStore.ts | 57 +++++++++++++--------------- 2 files changed, 103 insertions(+), 48 deletions(-) diff --git a/src/layouts/default.vue b/src/layouts/default.vue index 79c95fa..e171baf 100644 --- a/src/layouts/default.vue +++ b/src/layouts/default.vue @@ -1,7 +1,7 @@ @@ -303,7 +350,7 @@ const statusMap = { - + @@ -408,6 +455,19 @@ const statusMap = { width: 100%; } } + .close-btn{ + display: flex; + justify-content: center; + align-items: flex-end; + margin-top: 12px; + } + .tag-box{ + height: 350px; + overflow: auto; + } +} +:deep(.el-popover) { + padding: 10px!important; } .aside { overflow: hidden; diff --git a/src/stores/systemStore.ts b/src/stores/systemStore.ts index 4c9d0fd..a2424aa 100644 --- a/src/stores/systemStore.ts +++ b/src/stores/systemStore.ts @@ -15,48 +15,43 @@ export const useSystemStore = defineStore( systemLogList.value.unshift(log) systemLogList.value = systemLogList.value.slice(0, 200) } - const uuids: Set = new Set() const insertLogs = (appEvents: System.appEvent[]) => { appEvents.forEach((item) => { - if (uuids.has(item.uuid)) { - return - } - if (uuids.size > 500) { - uuids.clear() - } - uuids.add(item.uuid) - if (item.type === 'AppCheckPointCheckFailEvent' && item.errCheckPoints) { + const log = systemLogList.value.find(log => log.uuid === item.uuid) + if (!log) { + if (item.type === 'AppCheckPointCheckFailEvent' && item.errCheckPoints) { // 传感器检测失败弹窗事件 - item.errCheckPoints.forEach((errCheckPoint) => { + item.errCheckPoints.forEach((errCheckPoint) => { + const log: System.SystemLog = { + name: `${errCheckPoint.ecodeInfo}(${errCheckPoint.ecode})`, + status: 'check', + time: formatDateTime('YYYY-MM-DD HH:mm:ss', Date.now()), + uuid: item.uuid, + } + insertLog(log) + }) + } + if (item.type === 'AppWarningPromoptEvent') { + // 报警事件 const log: System.SystemLog = { - name: `${errCheckPoint.ecodeInfo}(${errCheckPoint.ecode})`, - status: 'check', + name: item.description || '', + status: 'warn', time: formatDateTime('YYYY-MM-DD HH:mm:ss', Date.now()), uuid: item.uuid, } + ElMessage.warning(item.description) insertLog(log) - }) - } - if (item.type === 'AppWarningPromoptEvent') { - // 报警事件 - const log: System.SystemLog = { - name: item.description || '', - status: 'warn', - time: formatDateTime('YYYY-MM-DD HH:mm:ss', Date.now()), - uuid: item.uuid, } - ElMessage.warning(item.description) - insertLog(log) - } - if (item.type === 'AppPromoptEvent') { + if (item.type === 'AppPromoptEvent') { // 普通弹窗事件 - const log: System.SystemLog = { - name: item.message || '', - status: 'info', - time: formatDateTime('YYYY-MM-DD HH:mm:ss', Date.now()), - uuid: item.uuid, + const log: System.SystemLog = { + name: item.message || '', + status: 'check', + time: formatDateTime('YYYY-MM-DD HH:mm:ss', Date.now()), + uuid: item.uuid, + } + insertLog(log) } - insertLog(log) } }) }