|
|
@ -5,7 +5,7 @@ |
|
|
|
<p class="num"> |
|
|
|
<van-field |
|
|
|
type="number" |
|
|
|
v-model="addLiquidVal" |
|
|
|
v-model="addLiquidConfigVal" |
|
|
|
:clickable="true" |
|
|
|
:formatter="formatter" |
|
|
|
placeholder="设置加液蠕动泵转速" |
|
|
@ -18,7 +18,7 @@ |
|
|
|
<p class="num"> |
|
|
|
<van-field |
|
|
|
type="number" |
|
|
|
v-model="sprayLiquidVal" |
|
|
|
v-model="sprayLiquidConfigVal" |
|
|
|
:clickable="true" |
|
|
|
:formatter="formatter" |
|
|
|
placeholder="设置喷液蠕动泵转速" |
|
|
@ -32,12 +32,18 @@ |
|
|
|
<script setup> |
|
|
|
import { ref } from 'vue' |
|
|
|
import { showSuccessToast, showFailToast } from 'vant' |
|
|
|
import { useSettingStore } from '@/store' |
|
|
|
import { useSettingStore, useWebSocketStore } from '@/store' |
|
|
|
import { storeToRefs } from 'pinia' |
|
|
|
import { setSettingValJSON } from '@/mock/command' |
|
|
|
|
|
|
|
const settingStore = useSettingStore() |
|
|
|
const addLiquidVal = ref(settingStore.addLiquidConfigVal) |
|
|
|
const sprayLiquidVal = ref(settingStore.sprayLiquidConfigVal) |
|
|
|
const webSocketStore = useWebSocketStore() |
|
|
|
const { addLiquidConfigVal, sprayLiquidConfigVal } = storeToRefs(settingStore) |
|
|
|
|
|
|
|
const formatter = value => { |
|
|
|
if (value > 2000) { |
|
|
|
return '2000/g' |
|
|
|
} |
|
|
|
if (value != 0) { |
|
|
|
var newVal = value.replace(/\b(0+)/gi, '') |
|
|
|
return newVal + '/g' |
|
|
@ -47,17 +53,26 @@ const formatter = value => { |
|
|
|
|
|
|
|
const setAddliquidVal = () => { |
|
|
|
const val = parseInt( |
|
|
|
addLiquidVal.value.substring(0, addLiquidVal.value.length - 2), |
|
|
|
addLiquidConfigVal.value.substring(0, addLiquidConfigVal.value.length - 2), |
|
|
|
) |
|
|
|
settingStore.changeAddLiquidConfigVal(val) |
|
|
|
webSocketStore.sendCommandMsg( |
|
|
|
setSettingValJSON('drainage_pump_speed', addLiquidConfigVal.value), |
|
|
|
) |
|
|
|
showSuccessToast('设置成功') |
|
|
|
} |
|
|
|
|
|
|
|
const setSprayLiquidVal = () => { |
|
|
|
const val = parseInt( |
|
|
|
sprayLiquidVal.value.substring(0, sprayLiquidVal.value.length - 2), |
|
|
|
sprayLiquidConfigVal.value.substring( |
|
|
|
0, |
|
|
|
sprayLiquidConfigVal.value.length - 2, |
|
|
|
), |
|
|
|
) |
|
|
|
settingStore.changeSprayLiquidConfigVal(val) |
|
|
|
webSocketStore.sendCommandMsg( |
|
|
|
setSettingValJSON('injection_pump_speed', sprayLiquidConfigVal.value), |
|
|
|
) |
|
|
|
showSuccessToast('设置成功') |
|
|
|
} |
|
|
|
</script> |
|
|
|