Browse Source

加液排液逻辑

master
maochaoying 2 years ago
parent
commit
4ef89727c1
  1. BIN
      src/assets/img/liquid/chart.png
  2. 45
      src/components/LiquidHandle.vue
  3. 9
      src/components/dialogs/LiquidModal.vue

BIN
src/assets/img/liquid/chart.png

Before

Width: 600  |  Height: 452  |  Size: 6.1 KiB

After

Width: 600  |  Height: 452  |  Size: 6.9 KiB

45
src/components/LiquidHandle.vue

@ -14,28 +14,34 @@
<p class="title">设置加液</p>
</div>
<div
:class="isAddLiquidStatus ? 'btn mr active' : 'btn mr '"
:class="
operatorStore.replenishingFluidsWorkState
? 'btn mr active'
: 'btn mr '
"
v-if="tabType == 1"
@click="stopAdd"
>
停止加液
</div>
<div
:class="isAddLiquidStatus ? 'btn' : 'btn active'"
:class="
operatorStore.replenishingFluidsWorkState ? 'btn' : 'btn active'
"
v-if="tabType == 1"
@click="startAdd"
>
开始加液
</div>
<div
:class="isPopLiquidStatus ? 'btn mr active' : 'btn mr '"
:class="operatorStore.drainingWorkState ? 'btn mr active' : 'btn mr '"
v-if="tabType == 2"
@click="stopPop"
>
停止排液
</div>
<div
:class="isPopLiquidStatus ? 'btn' : 'btn active'"
:class="operatorStore.drainingWorkState ? 'btn' : 'btn active'"
v-if="tabType == 2"
@click="startTabLiquid"
>
@ -92,15 +98,13 @@
<div
class="liquid_column"
:style="{
'--height': `${(disinfectantCapacity / 500) * 427}px`,
'--height': `${(disinfectantCapacity / 5000) * 427}px`,
}"
></div>
</div>
<LiquidModal
v-if="tabType == 2 && tipModalVisible"
:hideTabLiquid="hideTabLiquid"
:startPopFlag="startPopFlag"
:isPopLiquidStatus="isPopLiquidStatus"
/>
<van-number-keyboard
v-model="addLiquidVal"
@ -135,12 +139,10 @@ const addLiquidVal = ref(1)
const tipModalVisible = ref(false)
const webSocketStore = useWebSocketStore()
const isAddLiquidStatus = ref(false)
const isPopLiquidStatus = ref(false)
const startAdd = () => {
if (!isAddLiquidStatus.value) {
isAddLiquidStatus.value = true
if (!operatorStore.replenishingFluidsWorkState) {
console.log(startReplenishingFluidsJSON(parseInt(addLiquidVal.value)))
webSocketStore.sendCommandMsg(
startReplenishingFluidsJSON(parseInt(addLiquidVal.value)),
@ -149,40 +151,23 @@ const startAdd = () => {
}
const stopAdd = () => {
if (isAddLiquidStatus.value) {
isAddLiquidStatus.value = false
if (operatorStore.replenishingFluidsWorkState) {
webSocketStore.sendCommandMsg(stopReplenishingFluidsJSON)
}
}
const stopPop = () => {
if (isPopLiquidStatus.value) {
if (operatorStore.drainingWorkState) {
webSocketStore.sendCommandMsg(stopDrainingJSON)
isPopLiquidStatus.value = false
}
}
const startPopFlag = () => {
isPopLiquidStatus.value = true
}
const startTabLiquid = () => {
if (!isPopLiquidStatus.value) {
if (!operatorStore.drainingWorkState) {
tipModalVisible.value = true
}
}
const formatter = value => {
if (value > 500) {
return '500/g'
}
if (value != 0) {
var newVal = value.replace(/\b(0+)/gi, '')
return newVal + '/g'
}
return '0/g'
}
const hideTabLiquid = () => {
tipModalVisible.value = false
}

9
src/components/dialogs/LiquidModal.vue

@ -42,21 +42,12 @@ const props = defineProps({
hideTabLiquid: {
type: Function,
},
startPopFlag: {
type: Function,
},
isPopLiquidStatus: {
type: Boolean,
},
})
const tapLiquid = () => {
if (!props.isPopLiquidStatus) {
props.startPopFlag()
webSocketStore.sendCommandMsg(startDrainingJSON)
props?.hideTabLiquid()
}
}
const cancelTap = () => {
props?.hideTabLiquid()

Loading…
Cancel
Save