Browse Source

fix: 喷涂倒计时:暂停停止计时,恢复继续计时

master
guoapeng 3 weeks ago
parent
commit
0c6f43da64
  1. 5
      src/components/spray/Countdown/index.vue
  2. 10
      src/views/spray/index.vue

5
src/components/spray/Countdown/index.vue

@ -85,6 +85,11 @@ watch(
}, },
{ immediate: true }, { immediate: true },
) )
defineExpose({
startTimer,
stopTimer,
})
</script> </script>
<template> <template>

10
src/views/spray/index.vue

@ -94,12 +94,17 @@ const startWork = async () => {
// currentSpeed = Number(form.value.movingSpeed) // currentSpeed = Number(form.value.movingSpeed)
} }
const countdownRefs = ref([])
const pauseWork = async () => { const pauseWork = async () => {
const params = { const params = {
cmdCode: 'matrix_spray_pause', cmdCode: 'matrix_spray_pause',
cmdId: '', cmdId: '',
} }
await sendControl(params) await sendControl(params)
countdownRefs.value.forEach((item) => {
item?.stopTimer()
})
} }
const continueWork = async () => { const continueWork = async () => {
@ -109,6 +114,9 @@ const continueWork = async () => {
params: {}, params: {},
} }
await sendControl(params) await sendControl(params)
countdownRefs.value.forEach((item) => {
item?.startTimer()
})
// currentSpeed = Number(form.value.movingSpeed) // currentSpeed = Number(form.value.movingSpeed)
} }
@ -297,7 +305,7 @@ const viewParams = (index: number) => {
运行参数 运行参数
</ft-button> </ft-button>
<div class="spray-params-footer"> <div class="spray-params-footer">
<Countdown v-if="finishTImeList.find(item => item.index === index)?.finishTime" :end-time="finishTImeList.find(item => item.index === index)?.finishTime" />
<Countdown v-if="finishTImeList.find(item => item.index === index)?.finishTime" ref="countdownRefs" :end-time="finishTImeList.find(item => item.index === index)?.finishTime" />
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save