diff --git a/src/components/common/ExecutionResult/index.vue b/src/components/common/ExecutionResult/index.vue index af65d62..22e898f 100644 --- a/src/components/common/ExecutionResult/index.vue +++ b/src/components/common/ExecutionResult/index.vue @@ -51,11 +51,7 @@ watch(() => props.logs, (newLogs) => { // 滚动到底部 const scrollToBottom = () => { if (logContainer.value) { - setTimeout(() => { - if (logContainer.value) { - logContainer.value.scrollTop = logContainer.value.scrollHeight; - } - }, 0); + logContainer.value.scrollTop = logContainer.value.scrollHeight; } }; diff --git a/src/views/index.vue b/src/views/index.vue index 2e2f543..128c625 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -49,14 +49,6 @@ const executionLogs = ref([]); const packageLogs = ref([]); -// 滚动到检测设备日志底部的函数 -const scrollToExecutionBottom = () => { - const logsContainer = document.querySelector('.execution-logs-content'); - if (logsContainer) { - logsContainer.scrollTop = logsContainer.scrollHeight; - } -}; - // 底部操作按钮配置 const actionButtons = ref([ { label: '工序过站', handler: 'handleProcessPass', type: 'primary' as const, status: 'idle' as const }, @@ -87,25 +79,12 @@ const addDetectionLog = (message: string) => { const timestamp = new Date().toLocaleTimeString('zh-CN', { hour12: false }); const logEntry = `${timestamp} - ${message}`; executionLogs.value.push(logEntry); - - // 自动滚动到底部 - nextTick(() => { - scrollToExecutionBottom(); - }); }; const addPackageLog = (message: string) => { const timestamp = new Date().toLocaleTimeString('zh-CN', { hour12: false }); const logEntry = `${timestamp} - ${message}`; packageLogs.value.push(logEntry); - - // 自动滚动到底部 - nextTick(() => { - const logContainers = document.querySelectorAll('.log-container'); - logContainers.forEach(container => { - container.scrollTop = container.scrollHeight; - }); - }); }; // 清空检测设备执行日志 diff --git a/src/views/lms/index.vue b/src/views/lms/index.vue index ccc22c7..152de49 100644 --- a/src/views/lms/index.vue +++ b/src/views/lms/index.vue @@ -49,14 +49,6 @@ const executionLogs = ref([]); const packageLogs = ref([]); -// 滚动到检测设备日志底部的函数 -const scrollToExecutionBottom = () => { - const logsContainer = document.querySelector('.execution-logs-content'); - if (logsContainer) { - logsContainer.scrollTop = logsContainer.scrollHeight; - } -}; - // 底部操作按钮配置 const actionButtons = ref([ { label: '工序过站', handler: 'handleProcessPass', type: 'primary' as const, status: 'idle' as const }, @@ -87,25 +79,12 @@ const addDetectionLog = (message: string) => { const timestamp = new Date().toLocaleTimeString('zh-CN', { hour12: false }); const logEntry = `${timestamp} - ${message}`; executionLogs.value.push(logEntry); - - // 自动滚动到底部 - nextTick(() => { - scrollToExecutionBottom(); - }); }; const addPackageLog = (message: string) => { const timestamp = new Date().toLocaleTimeString('zh-CN', { hour12: false }); const logEntry = `${timestamp} - ${message}`; packageLogs.value.push(logEntry); - - // 自动滚动到底部 - nextTick(() => { - const logContainers = document.querySelectorAll('.log-container'); - logContainers.forEach(container => { - container.scrollTop = container.scrollHeight; - }); - }); }; // 清空检测设备执行日志 @@ -161,12 +140,12 @@ const handlePackagePass = () => { // SSE事件处理函数 const handleL1Event = (data: any) => { // L1_EVENT放到自动包装日志区 - addPackageLog(`L1事件: ${JSON.stringify(data)}`); + addPackageLog(`L1事件: ${data.message}`); }; const handleL4Event = (data: any) => { // L4_EVENT放到检测设备日志区 - addDetectionLog(`L4事件: ${JSON.stringify(data)}`); + addDetectionLog(`L4事件: ${data.message}`); if (data.code === 201) { detectForm.confirmSequence = data.data } @@ -174,7 +153,7 @@ const handleL4Event = (data: any) => { const handleMESEvent = (data: any) => { // MES_EVENT放到检测设备日志区 - addDetectionLog(`MES事件: ${JSON.stringify(data)}`); + addDetectionLog(`MES事件: ${data.message}`); }; const handleSseMessage = (data: string) => { @@ -466,27 +445,27 @@ onBeforeUnmount(() => { - + - + - + - + - + @@ -500,22 +479,22 @@ onBeforeUnmount(() => { - + - + - + - +