From cc8c4f44825c3b3a9b3d3624b538174ecb1844e4 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Tue, 8 Jul 2025 20:50:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=A6=96=E9=A1=B5loading=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/home/HomeOperation.vue | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/components/home/HomeOperation.vue b/src/components/home/HomeOperation.vue index 8743a9e..a636080 100644 --- a/src/components/home/HomeOperation.vue +++ b/src/components/home/HomeOperation.vue @@ -2,8 +2,8 @@ import { sendCmd } from 'apis/system' import homeFinish from 'assets/images/home/home-finish.svg' import homeStart from 'assets/images/home/home-start.svg' +import { ElLoading } from 'element-plus' import { startTimer, stopTimer } from 'libs/countdownTimer' -import { deviceStateMap } from 'libs/utils' import { computed, ref, watchEffect } from 'vue' import { getDeviceStatus } from '@/libs/deviceComm' @@ -77,14 +77,18 @@ const doStartDisinfect = async () => { return } - systemStore.updateLoading(true) + const loading = ElLoading.service({ + lock: true, + text: '准备开始消毒', + background: 'rgba(255, 255, 255, 0.8)', + }) try { // 使用选中配方或默认配置启动消毒 if (formulaStore.selectedFormulaInfo && formulaStore.selectedFormulaInfo.formula_id) { await formulaStore.startDisinfectFormula(formulaStore.selectedFormulaInfo) const poll = setInterval(() => { if (!operationState.value) { - systemStore.updateLoading(false) + loading.close() clearInterval(poll) } }, 100) @@ -98,7 +102,7 @@ const doStartDisinfect = async () => { await sendCmd(startParams) const poll = setInterval(() => { if (!operationState.value) { - systemStore.updateLoading(false) + loading.close() clearInterval(poll) } }, 100) @@ -106,7 +110,7 @@ const doStartDisinfect = async () => { } catch (e) { console.log(e) - systemStore.updateLoading(false) + loading.close() } } @@ -124,7 +128,11 @@ const onFinishDisinfect = () => { const doStopDisinfect = async () => { stopTimer() // 停止倒计时 - systemStore.updateLoading(true) + const loading = ElLoading.service({ + lock: true, + text: '正在停止消毒', + background: 'rgba(255, 255, 255, 0.8)', + }) try { const stopParams = { className: 'DisinfectionCtrlServiceExt', @@ -134,14 +142,14 @@ const doStopDisinfect = async () => { await sendCmd(stopParams) const poll = setInterval(() => { if (operationState.value) { - systemStore.updateLoading(false) + loading.close() clearInterval(poll) } }, 100) } catch (e) { console.log(e) - systemStore.updateLoading(false) + loading.close() } }