fix: 修复screen清零不同步更新计数问题

This commit is contained in:
fxxian 2024-04-08 13:40:41 +08:00
parent 111cbdc0fb
commit 60f0deaa55
1 changed files with 12 additions and 3 deletions

View File

@ -60,7 +60,7 @@
</p> </p>
</li> </li>
<li> <li>
<el-button type="primary" icon="el-icon-refresh" size="mini" @click="handleCountClear">计数清零</el-button> <el-button type="primary" icon="el-icon-refresh" size="mini" @click="handleCountClear" :loading="clearCountLoading">计数清零</el-button>
</li> </li>
<!-- <li> <!-- <li>
<el-button type="primary" icon="el-icon-delete" size="mini" @click="handleMosqClean">自动清扫</el-button> <el-button type="primary" icon="el-icon-delete" size="mini" @click="handleMosqClean">自动清扫</el-button>
@ -128,13 +128,17 @@ export default {
}, },
data() { data() {
return { return {
led: true, led: undefined,
dialogCountVisible: false, dialogCountVisible: false,
dialogMosqVisible: false, dialogMosqVisible: false,
clearCountLoading: false,
cleanSpeed: 6 cleanSpeed: 6
} }
}, },
methods: { methods: {
sleep(time) {
return new Promise(resolve => setTimeout(resolve, time))
},
async handleLedSwitchChange() { async handleLedSwitchChange() {
const action = this.led ? 'ledOn' : 'ledOff' const action = this.led ? 'ledOn' : 'ledOff'
await this.sendRemoteControlCommand(action) await this.sendRemoteControlCommand(action)
@ -144,7 +148,11 @@ export default {
this.showCountConfirmationDialog() this.showCountConfirmationDialog()
} else { } else {
await this.sendRemoteControlCommand('countClear') await this.sendRemoteControlCommand('countClear')
this.clearCountLoading = true
this.sleep(4000).then(() => {
this.clearCountLoading = false
this.$emit('countClear') this.$emit('countClear')
})
} }
}, },
async handleMosqClean() { async handleMosqClean() {
@ -199,6 +207,7 @@ export default {
}, },
mounted() { mounted() {
this.led = this.lastItem.led_status !== 'OFF'
} }
} }
</script> </script>