sige 1 year ago
parent
commit
c3a1c2be1c
  1. 73
      src/components/Test.vue
  2. 2
      src/store/modules/websocket.js

73
src/components/Test.vue

@ -6,11 +6,32 @@
<div class="num"> <div class="num">
<my-input type="number" class="add_liquid_input" <my-input type="number" class="add_liquid_input"
v-model:value="sprayLiquidPumpGPMValue" v-model:value="sprayLiquidPumpGPMValue"
@done="actionSprayLiquidPumpGPMValueChange"
></my-input> ></my-input>
<p>g/min</p> <p>g/min</p>
</div> </div>
<div class="btn_wrap">
<!-- <div class="btn_wrap">
<div class="open style-btn" @click="actionSprayLiquidPumpGPMValueChange">更新</div> <div class="open style-btn" @click="actionSprayLiquidPumpGPMValueChange">更新</div>
</div> -->
<div class="btn_wrap" style="margin-left:10px;">
<div
:class="sprayLiquidPumpGPMValue >= 0 ? 'open style-btn mg' : 'close style-btn mg'"
@click="actionSprayLiquidPumpGPMValueChange('forward')"
>正转</div>
<div
:class="sprayLiquidPumpGPMValue < 0 ? 'open style-btn' : 'close style-btn'"
@click="actionSprayLiquidPumpGPMValueChange('backward')"
>反转</div>
</div>
<div class="btn_wrap" style="margin-left:10px;">
<div
:class="sprayLiquidPumpGPMValue != 0 ? 'open style-btn mg' : 'close style-btn mg'"
@click="actionSprayLiquidPumpGPMValueChange('start')"
>打开</div>
<div
:class="sprayLiquidPumpGPMValue == 0 ? 'open style-btn' : 'close style-btn'"
@click="actionSprayLiquidPumpGPMValueChange('stop')"
>关闭</div>
</div> </div>
</div> </div>
@ -30,7 +51,7 @@
</div> </div>
<!-- 风机 --> <!-- 风机 -->
<div class="common_set switch_wrap">
<!-- <div class="common_set switch_wrap">
<p class="title"> 风机</p> <p class="title"> 风机</p>
<div class="btn_wrap"> <div class="btn_wrap">
<div class="style-btn" <div class="style-btn"
@ -42,11 +63,31 @@
@click="actionMiniPwmBlowerCtrl(0)" @click="actionMiniPwmBlowerCtrl(0)"
>关闭</div> >关闭</div>
</div> </div>
</div> -->
<div class="common_set switch_wrap">
<p class="title"> 风机</p>
<div class="num">
<my-input type="number" class="add_liquid_input"
v-model:value="miniPwmBlowerCtrlValue"
@done="actionMiniPwmBlowerCtrl"
></my-input>
<p>%</p>
</div>
<div class="btn_wrap">
<div class="style-btn"
:class="50 < miniPwmBlowerCtrl ? 'open mg' : 'close style-btn mg'"
@click="actionMiniPwmBlowerCtrl(50)"
>打开</div>
<div
:class="0 == miniPwmBlowerCtrl ? 'open style-btn ' : 'close style-btn'"
@click="actionMiniPwmBlowerCtrl(0)"
>关闭</div>
</div>
</div> </div>
<!-- 加热片 --> <!-- 加热片 -->
<div class="common_set switch_wrap"> <div class="common_set switch_wrap">
<p class="title">加热空压机控制</p>
<p class="title">加热控制</p>
<div class="btn_wrap"> <div class="btn_wrap">
<div <div
:class="1 === heaterCtrl ? 'open style-btn mg' : 'close style-btn mg'" :class="1 === heaterCtrl ? 'open style-btn mg' : 'close style-btn mg'"
@ -199,6 +240,8 @@ const {
sprayAirCompressorPowerCtrl, // sprayAirCompressorPowerCtrl, //
} = storeToRefs(testStore); } = storeToRefs(testStore);
const sprayLiquidPumpGPMValue = ref(sprayLiquidPumpGPM); const sprayLiquidPumpGPMValue = ref(sprayLiquidPumpGPM);
const miniPwmBlowerCtrlValue = ref(0);
// //
function actionSetExtChannelActiveName( name ) { function actionSetExtChannelActiveName( name ) {
@ -207,15 +250,33 @@ function actionSetExtChannelActiveName( name ) {
} }
// //
function actionMiniPwmBlowerCtrl(power) {
function actionMiniPwmBlowerCtrl(power=null) {
if ( null === power ) {
power = miniPwmBlowerCtrlValue.value;
}
miniPwmBlowerCtrlValue.value = power;
testStore.miniPwmBlowerCtrl = power; testStore.miniPwmBlowerCtrl = power;
websocketStore.call('DBDBTestPage__miniPwmBlowerCtrl',{power100:power}); websocketStore.call('DBDBTestPage__miniPwmBlowerCtrl',{power100:power});
} }
// GPM // GPM
function actionSprayLiquidPumpGPMValueChange() {
function actionSprayLiquidPumpGPMValueChange( action=null ) {
let value = sprayLiquidPumpGPMValue.value;
if ( null === action ) {
// nothing to do here
} if ( 'start' === action ) {
value = 20;
} else if ( 'stop' === action ) {
value = 0;
} else if ( 'forward' === action ) {
value = value > 0 ? value : value * -1;
} else if ( 'backward' === action ) {
value = value < 0 ? value : value * -1;
}
sprayLiquidPumpGPMValue.value = value;
testStore.sprayLiquidPumpGPM = sprayLiquidPumpGPMValue.value; testStore.sprayLiquidPumpGPM = sprayLiquidPumpGPMValue.value;
websocketStore.call('DBDBTestPage__sprayLiquidPump_run',{gpm:sprayLiquidPumpGPMValue.value});
websocketStore.call('DBDBTestPage__sprayLiquidPump_run',{gpm:value});
} }
// //

2
src/store/modules/websocket.js

@ -362,7 +362,7 @@ export const useWebSocketStore = defineStore({
message.params = params; message.params = params;
} }
this.callPromiseHandlers[callId] = { resolve, reject, message }; this.callPromiseHandlers[callId] = { resolve, reject, message };
console.log('call-request', message);
console.log('[Call Request]', `${command}(${JSON.stringify(params)})`);
this.sendCommandMsg(message); this.sendCommandMsg(message);
}); });
}, },

Loading…
Cancel
Save