Browse Source

test

master
maochaoying 2 years ago
parent
commit
2dce3ff05b
  1. 7
      src/components/LiquidHandle.vue
  2. 1
      src/components/Operator.vue
  3. 4
      src/components/Progress.vue
  4. 9
      src/mock/command.js
  5. 2
      src/pages/Home.vue
  6. 10
      src/store/modules/test.js
  7. 4
      src/store/modules/websocket.js

7
src/components/LiquidHandle.vue

@ -105,7 +105,12 @@ const isPopLiquidStatus = ref(false)
const startAdd = () => { const startAdd = () => {
if (!isAddLiquidStatus.value) { if (!isAddLiquidStatus.value) {
isAddLiquidStatus.value = true isAddLiquidStatus.value = true
webSocketStore.sendCommandMsg(startReplenishingFluidsJSON)
console.log(
startReplenishingFluidsJSON(parseInt(addLiquidVal.value.slice(0, -2))),
)
webSocketStore.sendCommandMsg(
startReplenishingFluidsJSON(parseInt(addLiquidVal.value.slice(0, -2))),
)
} }
} }

1
src/components/Operator.vue

@ -117,7 +117,6 @@ const logVal = ref(1)
const roomSize = ref(0) const roomSize = ref(0)
watch(() => { watch(() => {
console.log(props.input)
roomSize.value = props.input.match(/\d+/g) roomSize.value = props.input.match(/\d+/g)
}) })

4
src/components/Progress.vue

@ -4,14 +4,14 @@
<div class="left_progress"> <div class="left_progress">
<div class="left_time_tag">剩余时间</div> <div class="left_time_tag">剩余时间</div>
<p class="time">{{ operatorStore.estimatedRemainingTimeS }} S</p> <p class="time">{{ operatorStore.estimatedRemainingTimeS }} S</p>
<div class="progress_bg">
<!-- <div class="progress_bg">
<div <div
class="pro" class="pro"
:style="{ :style="{
'--width': '325px', '--width': '325px',
}" }"
></div> ></div>
</div>
</div> -->
</div> </div>
<div class="right_btns"> <div class="right_btns">
<div <div

9
src/mock/command.js

@ -99,9 +99,12 @@ export const someAirSwitchJSON = (num, flag) => {
} }
} }
export const startReplenishingFluidsJSON = {
command: 'startReplenishingFluids',
messageId: 'startReplenishingFluids',
export const startReplenishingFluidsJSON = stopAt => {
return {
command: 'startReplenishingFluids',
messageId: 'startReplenishingFluids',
stopAt,
}
} }
export const stopReplenishingFluidsJSON = { export const stopReplenishingFluidsJSON = {

2
src/pages/Home.vue

@ -235,7 +235,7 @@ const changeShowOperator = flag => {
showOpertor.value = flag showOpertor.value = flag
} }
const input = ref('')
const input = ref('0')
const onChange = a => { const onChange = a => {
input.value = a input.value = a
} }

10
src/store/modules/test.js

@ -55,9 +55,19 @@ export const useTestStore = defineStore({
}, },
updateSprinklerPump(sprinklerPump) { updateSprinklerPump(sprinklerPump) {
this.sprinklerPump = sprinklerPump this.sprinklerPump = sprinklerPump
if (sprinklerPump == 0) {
this.sprayPeristalticPump = false
} else {
this.sprayPeristalticPump = true
}
}, },
updateChargingPump(chargingPump) { updateChargingPump(chargingPump) {
this.chargingPump = chargingPump this.chargingPump = chargingPump
if (chargingPump == 0) {
this.feedingPeristalticPumpStatus = false
} else {
this.feedingPeristalticPumpStatus = true
}
}, },
updateFeedingPeristalticPumpStatus(status) { updateFeedingPeristalticPumpStatus(status) {
this.feedingPeristalticPumpStatus = status this.feedingPeristalticPumpStatus = status

4
src/store/modules/websocket.js

@ -29,7 +29,7 @@ export const useWebSocketStore = defineStore({
const operatorStore = useOperatorStore() const operatorStore = useOperatorStore()
init.connect() init.connect()
init.ws.onmessage = function (ev) { init.ws.onmessage = function (ev) {
console.log(JSON.parse(ev.data))
// console.log(JSON.parse(ev.data))
const { ackcode, messageId } = JSON.parse(ev.data) const { ackcode, messageId } = JSON.parse(ev.data)
if (ackcode == 0) { if (ackcode == 0) {
@ -129,7 +129,7 @@ export const useWebSocketStore = defineStore({
const testStore = useTestStore() const testStore = useTestStore()
const settingStore = useSettingStore() const settingStore = useSettingStore()
init.ws.onmessage = function (ev) { init.ws.onmessage = function (ev) {
console.log(JSON.parse(ev.data))
// console.log(JSON.parse(ev.data))
const { command } = JSON.parse(ev.data) const { command } = JSON.parse(ev.data)
switch (command) { switch (command) {
case 'RealtimeSensorDataReport': case 'RealtimeSensorDataReport':

Loading…
Cancel
Save