Browse Source

测试

master
maochaoying 2 years ago
parent
commit
e58f4bc9f5
  1. 51
      src/components/Test.vue
  2. 18
      src/mock/command.js

51
src/components/Test.vue

@ -14,18 +14,6 @@
/> />
<p>g/min</p> <p>g/min</p>
</div> </div>
<div class="num">
<van-field
type="number"
v-model="addLiquidPower"
:clickable="true"
readonly
:formatter="formatter"
@click.stop="hideAllKeyboards(2)"
class="add_liquid_input"
/>
<p>P</p>
</div>
<div class="btn_wrap"> <div class="btn_wrap">
<div <div
:class=" :class="
@ -70,18 +58,6 @@
/> />
<p>g/min</p> <p>g/min</p>
</div> </div>
<div class="num">
<van-field
type="number"
:formatter="formatter"
v-model="addLiquidPower2"
:clickable="true"
readonly
@click.stop="hideAllKeyboards(4)"
class="add_liquid_input"
/>
<p>P</p>
</div>
<div class="btn_wrap"> <div class="btn_wrap">
<div <div
:class=" :class="
@ -265,6 +241,8 @@ import {
liquidpumpctrlJSON, liquidpumpctrlJSON,
getStateJSON, getStateJSON,
addLiquidCtrlJSON, addLiquidCtrlJSON,
test_replenishingFluidsPumpCtrJSON,
sprayLiquidPump_open_for_testJSON,
} from '@/mock/command' } from '@/mock/command'
import { showSuccessToast, showFailToast } from 'vant' import { showSuccessToast, showFailToast } from 'vant'
const testStore = useTestStore() const testStore = useTestStore()
@ -294,8 +272,8 @@ const formatter6 = value => {
item => item.name == 'drainage_pump_speed', item => item.name == 'drainage_pump_speed',
) )
if (arr && arr.length > 0) { if (arr && arr.length > 0) {
if (parseInt(value) > arr[0].val_upper_limit) {
return arr[0].val_upper_limit + ''
if (parseInt(value) > 40) {
return '40'
} }
if (parseInt(value) < arr[0].val_lower_limit) { if (parseInt(value) < arr[0].val_lower_limit) {
return arr[0].val_lower_limit + '' return arr[0].val_lower_limit + ''
@ -309,8 +287,8 @@ const formatter7 = value => {
item => item.name == 'injection_pump_speed', item => item.name == 'injection_pump_speed',
) )
if (arr && arr.length > 0) { if (arr && arr.length > 0) {
if (parseInt(value) > arr[0].val_upper_limit) {
return arr[0].val_upper_limit + ''
if (parseInt(value) > 40) {
return '40'
} }
if (parseInt(value) < arr[0].val_lower_limit) { if (parseInt(value) < arr[0].val_lower_limit) {
return arr[0].val_lower_limit + '' return arr[0].val_lower_limit + ''
@ -377,30 +355,35 @@ const handleInput = (value, index) => {
const setAddLiquidConfig = flag => { const setAddLiquidConfig = flag => {
if (flag == 1) { if (flag == 1) {
websocketStore.sendCommandMsg( websocketStore.sendCommandMsg(
addLiquidCtrlJSON(1, addLiquidVal.value, addLiquidPower.value),
//
test_replenishingFluidsPumpCtrJSON(1, addLiquidVal.value),
) )
showSuccessToast('设置成功') showSuccessToast('设置成功')
} else if (flag == 2) { } else if (flag == 2) {
websocketStore.sendCommandMsg( websocketStore.sendCommandMsg(
addLiquidCtrlJSON(2, addLiquidVal2.value, addLiquidPower2.value),
sprayLiquidPump_open_for_testJSON(1, addLiquidVal2.value),
) )
showSuccessToast('设置成功') showSuccessToast('设置成功')
} else if (flag == 3) { } else if (flag == 3) {
websocketStore.sendCommandMsg(addLiquidCtrlJSON(1, 0, addLiquidPower.value))
//
websocketStore.sendCommandMsg(
test_replenishingFluidsPumpCtrJSON(0, addLiquidVal.value),
)
showSuccessToast('关闭加液蠕动泵成功') showSuccessToast('关闭加液蠕动泵成功')
} else if (flag == 5) { } else if (flag == 5) {
//
websocketStore.sendCommandMsg( websocketStore.sendCommandMsg(
addLiquidCtrlJSON(1, '-' + addLiquidVal.value, addLiquidPower.value),
test_replenishingFluidsPumpCtrJSON(-1, addLiquidVal.value),
) )
showSuccessToast('设置成功') showSuccessToast('设置成功')
} else if (flag == 6) { } else if (flag == 6) {
websocketStore.sendCommandMsg( websocketStore.sendCommandMsg(
addLiquidCtrlJSON(2, '-' + addLiquidVal2.value, addLiquidPower2.value),
sprayLiquidPump_open_for_testJSON(-1, addLiquidVal2.value),
) )
showSuccessToast('设置成功') showSuccessToast('设置成功')
} else { } else {
websocketStore.sendCommandMsg( websocketStore.sendCommandMsg(
addLiquidCtrlJSON(2, 0, addLiquidPower2.value),
sprayLiquidPump_open_for_testJSON(0, addLiquidVal2.value),
) )
showSuccessToast('关闭注射蠕动泵成功') showSuccessToast('关闭注射蠕动泵成功')
} }

18
src/mock/command.js

@ -139,3 +139,21 @@ export const addLiquidCtrlJSON = (num, speed, power) => {
cancmd: `pumpctrl_c1004 ${num} 300 ${speed} 1 ${power}`, cancmd: `pumpctrl_c1004 ${num} 300 ${speed} 1 ${power}`,
} }
} }
export const test_replenishingFluidsPumpCtrJSON = (ctrl, speed) => {
return {
command: 'test_replenishingFluidsPumpCtr',
messageId: 'test_replenishingFluidsPumpCtr',
ctrl,
speed,
}
}
export const sprayLiquidPump_open_for_testJSON = (ctrl, speed) => {
return {
command: 'sprayLiquidPump_open_for_test',
messageId: 'sprayLiquidPump_open_for_test',
ctrl,
speed,
}
}
Loading…
Cancel
Save