新增灭蚊灯自动清扫功能
This commit is contained in:
parent
d423df4ad6
commit
30d5372b30
|
@ -60,24 +60,58 @@
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<el-button type="primary" icon="el-icon-delete" size="mini" @click="handleCountClear">计数清零</el-button>
|
<el-button type="primary" icon="el-icon-refresh" size="mini" @click="handleCountClear">计数清零</el-button>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<el-button type="primary" icon="el-icon-delete" size="mini" @click="handleMosqClean">自动清扫</el-button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 确认弹窗 -->
|
<!-- 计数器清零确认弹窗 -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="确认"
|
title="确认"
|
||||||
:visible.sync="dialogVisible"
|
:visible.sync="dialogCountVisible"
|
||||||
width="30%"
|
:width="dialogWidth"
|
||||||
center
|
center
|
||||||
>
|
>
|
||||||
<span>确定要清零计数器吗?</span>
|
<span>确定要清零计数器吗?</span>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button @click="dialogVisible = false">取消</el-button>
|
<el-button @click="dialogCountVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="handleCountClear">确定</el-button>
|
<el-button type="primary" @click="handleCountClear">确定</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 清理速度选择、确认弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
title="请选择清理速度,并确定!"
|
||||||
|
:visible.sync="dialogMosqVisible"
|
||||||
|
:width="dialogWidth"
|
||||||
|
center
|
||||||
|
>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12"><div class="grid-content bg-purple">
|
||||||
|
<span style="display: flex; justify-content: flex-start;">慢🐢</span>
|
||||||
|
</div></el-col>
|
||||||
|
<el-col :span="12"><div class="grid-content bg-purple">
|
||||||
|
<span style="display: flex; justify-content: flex-end;">🐰快</span>
|
||||||
|
</div></el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-slider
|
||||||
|
v-model="cleanSpeed"
|
||||||
|
:step="1"
|
||||||
|
:min="1"
|
||||||
|
:max="9"
|
||||||
|
show-stops>
|
||||||
|
</el-slider>
|
||||||
|
</div>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogMosqVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleMosqClean">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -95,7 +129,9 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
led: true,
|
led: true,
|
||||||
dialogVisible: false
|
dialogCountVisible: false,
|
||||||
|
dialogMosqVisible: false,
|
||||||
|
cleanSpeed: 6
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -104,26 +140,41 @@ export default {
|
||||||
await this.sendRemoteControlCommand(action)
|
await this.sendRemoteControlCommand(action)
|
||||||
},
|
},
|
||||||
async handleCountClear() {
|
async handleCountClear() {
|
||||||
if (!this.dialogVisible) {
|
if (!this.dialogCountVisible) {
|
||||||
this.showConfirmationDialog()
|
this.showCountConfirmationDialog()
|
||||||
} else {
|
} else {
|
||||||
await this.sendRemoteControlCommand('countClear')
|
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 {
|
try {
|
||||||
|
const { speed } = options
|
||||||
const deviceID = this.deviceID
|
const deviceID = this.deviceID
|
||||||
console.log(deviceID, command)
|
console.log(deviceID, command, speed)
|
||||||
const response = await fetchRemoteControl(deviceID, { command: command })
|
|
||||||
|
const requestData = { command, speed }
|
||||||
|
|
||||||
|
const response = await fetchRemoteControl(deviceID, requestData)
|
||||||
console.log('Command sent successfully:', response.data)
|
console.log('Command sent successfully:', response.data)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error sending command:', error)
|
console.error('Error sending command:', error)
|
||||||
} finally {
|
} finally {
|
||||||
this.dialogVisible = false
|
this.dialogCountVisible = false
|
||||||
|
this.dialogMosqVisible = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showConfirmationDialog() {
|
showCountConfirmationDialog() {
|
||||||
this.dialogVisible = true
|
this.dialogCountVisible = true
|
||||||
|
},
|
||||||
|
showMosqConfirmationDialog() {
|
||||||
|
this.dialogMosqVisible = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -136,6 +187,13 @@ export default {
|
||||||
const count = this.lastItem.count
|
const count = this.lastItem.count
|
||||||
const qty = 'Qty.' + ' '.repeat(10 - count.length) + '00' + count
|
const qty = 'Qty.' + ' '.repeat(10 - count.length) + '00' + count
|
||||||
return qty.split('')
|
return qty.split('')
|
||||||
|
},
|
||||||
|
dialogWidth() {
|
||||||
|
// 获取当前浏览器窗口宽度
|
||||||
|
const windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
|
||||||
|
|
||||||
|
// 如果窗口宽度大于800像素,设置对话框宽度为30%,否则设置为100%
|
||||||
|
return windowWidth > 600 ? '30%' : '100%'
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
v-show="!showHumiture"
|
v-show="!showHumiture"
|
||||||
v-loading="listLoading"
|
v-loading="listLoading"
|
||||||
:data="deviceLogs"
|
:data="deviceLogs"
|
||||||
border="ture"
|
|
||||||
style="width: 100%">
|
style="width: 100%">
|
||||||
<el-table-column
|
<el-table-column
|
||||||
type="index"
|
type="index"
|
||||||
|
|
Loading…
Reference in New Issue