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