|
|
@ -15,23 +15,29 @@ export const useSystemStore = defineStore('system', () => { |
|
|
|
systemLogList.value.unshift(log) |
|
|
|
systemLogList.value = systemLogList.value.slice(0, 200) |
|
|
|
} |
|
|
|
const uuids: Set<string> = new Set() |
|
|
|
const insertLogs = (appEvents: System.appEvent[]) => { |
|
|
|
appEvents.forEach((item) => { |
|
|
|
if (item.type === 'AppCheckPointCheckFailEvent' && item.errCheckPoints) { |
|
|
|
if (uuids.has(item.uuid)) { |
|
|
|
return |
|
|
|
} |
|
|
|
if (uuids.size > 500) { |
|
|
|
uuids.clear() |
|
|
|
} |
|
|
|
uuids.add(item.uuid) |
|
|
|
if (item.type === 'AppCheckPointCheckFailEvent' && item.errCheckPoints) { // 传感器检测失败弹窗事件
|
|
|
|
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 } |
|
|
|
ElMessage.error(errCheckPoint.ecodeInfo) |
|
|
|
insertLog(log) |
|
|
|
}) |
|
|
|
} |
|
|
|
if (item.type === 'AppWarningPromoptEvent') { |
|
|
|
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 } |
|
|
|
ElMessage.warning(item.message) |
|
|
|
insertLog(log) |
|
|
|
} |
|
|
|
}) |
|
|
|