Browse Source

fix:开始消毒实时监听消毒状态

master
guoapeng 2 weeks ago
parent
commit
b7e9bc2e1f
  1. 27
      src/components/home/HomeOperation.vue

27
src/components/home/HomeOperation.vue

@ -4,7 +4,7 @@ import homeFinish from 'assets/images/home/home-finish.svg'
import homeStart from 'assets/images/home/home-start.svg'
import { startTimer, stopTimer } from 'libs/countdownTimer'
import { deviceStateMap } from 'libs/utils'
import { computed, onMounted, ref, watchEffect } from 'vue'
import { computed, ref, watchEffect } from 'vue'
import { getDeviceStatus } from '@/libs/deviceComm'
import { FtMessage } from '@/libs/message'
@ -54,11 +54,6 @@ watchEffect(() => {
})
/**
* @hook 生命周期钩子 - 组件挂载完成时执行
*/
onMounted(async () => {})
/**
* @function 开始消毒操作
* @desc 校验设备状态并发起消毒请求
*/
@ -74,8 +69,6 @@ const onStartDisinfect = () => {
})
}
let poll = null
const doStartDisinfect = async () => {
//
const statusName = getDeviceStatus()
@ -89,6 +82,12 @@ const doStartDisinfect = async () => {
// 使
if (formulaStore.selectedFormulaInfo && formulaStore.selectedFormulaInfo.formula_id) {
await formulaStore.startDisinfectFormula(formulaStore.selectedFormulaInfo)
const poll = setInterval(() => {
if (!operationState.value) {
systemStore.updateLoading(false)
clearInterval(poll)
}
}, 100)
}
else {
const startParams = {
@ -97,12 +96,16 @@ const doStartDisinfect = async () => {
params: { loglevel: formulaStore.loglevel },
}
await sendCmd(startParams)
const poll = setInterval(() => {
if (!operationState.value) {
systemStore.updateLoading(false)
clearInterval(poll)
}
// , 30
poll = setInterval(async () => {}, 1000 * 30)
console.log(poll)
}, 100)
}
finally {
}
catch (e) {
console.log(e)
systemStore.updateLoading(false)
}
}

Loading…
Cancel
Save