From 30d5372b309e714752941b45460a6337f8da99c7 Mon Sep 17 00:00:00 2001
From: Jay Huang
Date: Sat, 2 Dec 2023 16:26:09 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=81=AD=E8=9A=8A=E7=81=AF?=
=?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=B8=85=E6=89=AB=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/counter/components/screen.vue | 86 +++++++++++++++++++++----
src/views/counter/detail.vue | 1 -
2 files changed, 72 insertions(+), 15 deletions(-)
diff --git a/src/views/counter/components/screen.vue b/src/views/counter/components/screen.vue
index 7608f3c..a22df40 100644
--- a/src/views/counter/components/screen.vue
+++ b/src/views/counter/components/screen.vue
@@ -60,24 +60,58 @@
- 计数清零
+ 计数清零
+
+
+ 自动清扫
-
+
确定要清零计数器吗?
+
+
+
+
+
+
+
+ 慢🐢
+
+
+ 🐰快
+
+
+
+
+
+
+
@@ -95,7 +129,9 @@ export default {
data() {
return {
led: true,
- dialogVisible: false
+ dialogCountVisible: false,
+ dialogMosqVisible: false,
+ cleanSpeed: 6
}
},
methods: {
@@ -104,26 +140,41 @@ export default {
await this.sendRemoteControlCommand(action)
},
async handleCountClear() {
- if (!this.dialogVisible) {
- this.showConfirmationDialog()
+ if (!this.dialogCountVisible) {
+ this.showCountConfirmationDialog()
} else {
await this.sendRemoteControlCommand('countClear')
}
},
- async sendRemoteControlCommand(command) {
+ async handleMosqClean() {
+ if (!this.dialogMosqVisible) {
+ this.showMosqConfirmationDialog()
+ } else {
+ await this.sendRemoteControlCommand('mosqClean', { speed: this.cleanSpeed })
+ }
+ },
+ async sendRemoteControlCommand(command, options = {}) {
try {
+ const { speed } = options
const deviceID = this.deviceID
- console.log(deviceID, command)
- const response = await fetchRemoteControl(deviceID, { command: command })
+ console.log(deviceID, command, speed)
+
+ const requestData = { command, speed }
+
+ const response = await fetchRemoteControl(deviceID, requestData)
console.log('Command sent successfully:', response.data)
} catch (error) {
console.error('Error sending command:', error)
} finally {
- this.dialogVisible = false
+ this.dialogCountVisible = false
+ this.dialogMosqVisible = false
}
},
- showConfirmationDialog() {
- this.dialogVisible = true
+ showCountConfirmationDialog() {
+ this.dialogCountVisible = true
+ },
+ showMosqConfirmationDialog() {
+ this.dialogMosqVisible = true
}
},
computed: {
@@ -136,6 +187,13 @@ export default {
const count = this.lastItem.count
const qty = 'Qty.' + ' '.repeat(10 - count.length) + '00' + count
return qty.split('')
+ },
+ dialogWidth() {
+ // 获取当前浏览器窗口宽度
+ const windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
+
+ // 如果窗口宽度大于800像素,设置对话框宽度为30%,否则设置为100%
+ return windowWidth > 600 ? '30%' : '100%'
}
},
diff --git a/src/views/counter/detail.vue b/src/views/counter/detail.vue
index f99ffce..6e17e4b 100644
--- a/src/views/counter/detail.vue
+++ b/src/views/counter/detail.vue
@@ -53,7 +53,6 @@
v-show="!showHumiture"
v-loading="listLoading"
:data="deviceLogs"
- border="ture"
style="width: 100%">