Browse Source

首页air switch config

master
maochaoying 2 years ago
parent
commit
19ed1b9abd
  1. 1
      src/components/SealTest.vue
  2. 40
      src/components/info/AirSwitchConfig.vue
  3. 8
      src/mock/command.js

1
src/components/SealTest.vue

@ -299,6 +299,7 @@ const newStartTest = async flag => {
* 风机入口比例阀恢复
* 风机出口比例阀恢复
*/
sealStore.updateAirProportionalValveIsBusy(1)
websocketStore.sendCommandMsg(airCompressorSetValve1JSON([1]))
websocketStore.sendCommandMsg(airCompressorSetValve2JSON([1]))
websocketStore.sendCommandMsg(airCompressorChannelSelectJSON([1]))

40
src/components/info/AirSwitchConfig.vue

@ -81,18 +81,21 @@
<script setup>
import A1 from '@/assets/img/air/1.png'
import A2 from '@/assets/img/air/2.png'
import { useSealStore, useWebSocketStore } from '@/store'
import { useSealStore, useWebSocketStore, useSettingStore } from '@/store'
import {
AirInletProportionalValve_setStateJSON,
AirOutletProportionalValve_setStateJSON,
airInletProportionalValve_getStateJSON,
getAllSettingJSON,
AirOutletProportionalValve_getStateJSON,
AirInOutletProportionalValve_setStateJSON,
} from '@/mock/command'
import { ref, onMounted, watch, computed } from 'vue'
const activeTab = ref('1')
const sealStore = useSealStore()
const webSocketStore = useWebSocketStore()
const settingStore = useSettingStore()
const changeTab = tab => {
activeTab.value = tab
@ -126,18 +129,31 @@ const changeAir = tab => {
// :
// 0
if (tab == '0') {
webSocketStore.sendCommandMsg(AirInletProportionalValve_setStateJSON([0]))
webSocketStore.sendCommandMsg(AirOutletProportionalValve_setStateJSON([0]))
webSocketStore.sendCommandMsg(
AirInOutletProportionalValve_setStateJSON([0, 0]),
)
}
if (tab == '1') {
webSocketStore.sendCommandMsg(AirInletProportionalValve_setStateJSON([100]))
webSocketStore.sendCommandMsg(AirOutletProportionalValve_setStateJSON([0]))
webSocketStore.sendCommandMsg(
AirInOutletProportionalValve_setStateJSON([
settingStore.proportionalValveDefaultValue * 10,
0,
]),
)
selectedValuesTop.value = [
settingStore.proportionalValveDefaultValue * 10 + '',
]
}
if (tab == '2') {
webSocketStore.sendCommandMsg(AirInletProportionalValve_setStateJSON([0]))
webSocketStore.sendCommandMsg(
AirOutletProportionalValve_setStateJSON([100]),
AirInOutletProportionalValve_setStateJSON([
0,
settingStore.proportionalValveDefaultValue * 10,
]),
)
selectedValuesBottom.value = [
settingStore.proportionalValveDefaultValue * 10 + '',
]
}
}
@ -158,8 +174,8 @@ const selectedValuesTop = ref(['100'])
const selectedValuesBottom = ref(['100'])
const tabChange = () => {
console.log('airin', sealStore.airInletProportionalInitVal)
console.log('airout', sealStore.airOutletProportionalInitVal)
console.log('airin', sealStore.airInletProportionalInitVal[0])
console.log('airout', sealStore.airOutletProportionalInitVal[0])
if (
sealStore.airInletProportionalInitVal == 0 &&
sealStore.airOutletProportionalInitVal == 0
@ -169,10 +185,14 @@ const tabChange = () => {
}
if (sealStore.airInletProportionalInitVal > 0) {
activeTab.value = '1'
selectedValuesTop.value = [sealStore.airInletProportionalInitVal[0] + '']
return
}
if (sealStore.airOutletProportionalInitVal > 0) {
activeTab.value = '2'
selectedValuesBottom.value = [
sealStore.airOutletProportionalInitVal[0] + '',
]
return
}
activeTab.value = '0'
@ -182,9 +202,11 @@ onMounted(() => {
try {
webSocketStore.sendCommandMsg(airInletProportionalValve_getStateJSON)
webSocketStore.sendCommandMsg(AirOutletProportionalValve_getStateJSON)
webSocketStore.sendCommandMsg(getAllSettingJSON)
tabChange()
} catch (error) {
setTimeout(() => {
webSocketStore.sendCommandMsg(getAllSettingJSON)
webSocketStore.sendCommandMsg(airInletProportionalValve_getStateJSON)
webSocketStore.sendCommandMsg(AirOutletProportionalValve_getStateJSON)
}, 1000)

8
src/mock/command.js

@ -419,3 +419,11 @@ export const airProportionalValveIsBusyJSON = {
command: 'DeviceIOControlService.AirProportionalValve_isBusy',
messageId: 'AirProportionalValve_isBusy',
}
export const AirInOutletProportionalValve_setStateJSON = params => {
return {
command: 'DeviceIOControlService.AirProportionalValve_setState',
messageId: 'AirProportionalValve_setState',
params,
}
}
Loading…
Cancel
Save