Browse Source

修改接口

master
maochaoying 2 years ago
parent
commit
7f8e8ff852
  1. BIN
      src/assets/img/seal/dis_start.png
  2. BIN
      src/assets/img/seal/dis_stop.png
  3. BIN
      src/assets/img/seal/start.png
  4. BIN
      src/assets/img/seal/starttest.png
  5. BIN
      src/assets/img/seal/stop.png
  6. BIN
      src/assets/img/seal/stoptest.png
  7. 134
      src/components/SealTest.vue
  8. 15
      src/components/dialogs/LeaveModal.vue
  9. 35
      src/mock/command.js
  10. 9
      src/store/modules/websocket.js

BIN
src/assets/img/seal/dis_start.png

Before

Width: 341  |  Height: 110  |  Size: 7.1 KiB

BIN
src/assets/img/seal/dis_stop.png

Before

Width: 341  |  Height: 110  |  Size: 6.2 KiB

BIN
src/assets/img/seal/start.png

Before

Width: 341  |  Height: 110  |  Size: 8.3 KiB

BIN
src/assets/img/seal/starttest.png

Before

Width: 300  |  Height: 50  |  Size: 3.7 KiB

After

Width: 341  |  Height: 110  |  Size: 8.6 KiB

BIN
src/assets/img/seal/stop.png

Before

Width: 341  |  Height: 110  |  Size: 6.9 KiB

BIN
src/assets/img/seal/stoptest.png

Before

Width: 300  |  Height: 50  |  Size: 3.7 KiB

After

Width: 341  |  Height: 110  |  Size: 7.4 KiB

134
src/components/SealTest.vue

@ -20,22 +20,16 @@
</div>
<img
class="air_img"
:src="DisStart"
alt=""
v-if="sealStore.isStartTest"
/>
<img
class="air_img"
v-if="!sealStore.isStartTest && !testStore.airCompressor"
@click="changeAirStatus(2)"
:src="StartAir"
v-if="!sealStore.isStartTest"
@click="newStartTest(1)"
:src="StartTest"
alt=""
/>
<img
class="air_img"
@click="changeAirStatus(1)"
v-if="!sealStore.isStartTest && testStore.airCompressor"
:src="StopAir"
@click="newStartTest(2)"
v-if="sealStore.isStartTest"
:src="StopTest"
alt=""
/>
</div>
@ -65,20 +59,6 @@
}}
</div>
</div>
<img
:src="StartTest"
v-if="!sealStore.isStartTest"
class="test_png"
@click="handleStartTest('1')"
alt=""
/>
<img
@click="handleStartTest('2')"
:src="StopTest"
v-else
class="test_png"
alt=""
/>
</div>
</div>
</div>
@ -88,18 +68,21 @@
import * as echarts from 'echarts'
import { ref, onMounted, onBeforeUnmount, watch } from 'vue'
import SealPng from '@/assets/img/seal/seal.png'
import StartAir from '@/assets/img/seal/start.png'
import DisStart from '@/assets/img/seal/dis_start.png'
import TestIcon from '@/assets/img/seal/test.png'
import StartTest from '@/assets/img/seal/starttest.png'
import StopTest from '@/assets/img/seal/stoptest.png'
import StopAir from '@/assets/img/seal/stop.png'
import {
someAirSwitchJSON,
airCompressor_setStateJSON,
airCompressor_channelCtrlJSON,
AirInletProportionalValve_setStateJSON,
AirOutletProportionalValve_setStateJSON,
airCompressorGetPressureDirectJSON,
airCompressorSetValve1JSON,
airCompressorSetValve2JSON,
airCompressorChannelSelectJSON,
AirOutletProportionalValve_getStateJSON,
airInletProportionalValve_getStateJSON,
} from '@/mock/command'
import { useSealStore, useTestStore, useWebSocketStore } from '@/store'
@ -226,8 +209,6 @@ const stopTimer = () => {
n_min.value = 0
n_hour.value = 0
sealStore.updateIsStartTest(false)
//
websocketStore.sendCommandMsg(airCompressor_channelCtrlJSON([1]))
}
const timerFunc = () => {
@ -237,48 +218,64 @@ const timerFunc = () => {
}, 1000)
}
const changeAirStatus = flag => {
if (flag == 1) {
if (testStore.airCompressor) {
//
websocketStore.sendCommandMsg(airCompressor_channelCtrlJSON([1]))
websocketStore.sendCommandMsg(airCompressor_setStateJSON([0]))
websocketStore.sendCommandMsg(AirInletProportionalValve_setStateJSON([0]))
websocketStore.sendCommandMsg(
AirOutletProportionalValve_setStateJSON([0]),
)
testStore.updateAirCompressor(false)
}
} else {
if (!testStore.airCompressor) {
//
websocketStore.sendCommandMsg(AirInletProportionalValve_setStateJSON([0]))
websocketStore.sendCommandMsg(
AirOutletProportionalValve_setStateJSON([0]),
)
websocketStore.sendCommandMsg(airCompressor_channelCtrlJSON([0]))
websocketStore.sendCommandMsg(airCompressor_setStateJSON([1]))
testStore.updateAirCompressor(true)
}
}
const wait = async ms => {
await new Promise(resolve => setTimeout(resolve, ms))
}
const handleStartTest = flag => {
if (flag == '1') {
// oldAirPressure
// getStatecurrentAirPressure
//
const newStartTest = flag => {
if (flag == 1) {
//
//
timerFunc()
//
websocketStore.sendCommandMsg(airCompressor_channelCtrlJSON([1]))
sealStore.updateIsStartTest(true)
// 2
websocketStore.sendCommandMsg(airCompressorChannelSelectJSON([2]))
// 1 2
websocketStore.sendCommandMsg(airCompressorSetValve1JSON([1]))
websocketStore.sendCommandMsg(airCompressorSetValve2JSON([1]))
//
websocketStore.sendCommandMsg(AirInletProportionalValve_setStateJSON([0]))
websocketStore.sendCommandMsg(AirOutletProportionalValve_setStateJSON([0]))
//
websocketStore.sendCommandMsg(airCompressor_setStateJSON([1]))
// 1s
wait(1000)
//
websocketStore.sendCommandMsg(airCompressor_setStateJSON([0]))
testStore.updateAirCompressor(false)
sealStore.updateOldAirPressure(sealStore.currentAirPressure)
sealStore.updateIsStartTest(true)
// 1 2
websocketStore.sendCommandMsg(airCompressorSetValve1JSON([0]))
websocketStore.sendCommandMsg(airCompressorSetValve2JSON([0]))
// 1
websocketStore.sendCommandMsg(airCompressorChannelSelectJSON([1]))
// 5s
wait(5000)
//
websocketStore.sendCommandMsg(airCompressorGetPressureDirectJSON)
}
if (flag == '2') {
if (flag == 2) {
//
/**
* 空压机电子阀1打开
* 空压机电子阀2打开
* 空压机选通阀切换到通道1
* 风机入口比例阀恢复
* 风机出口比例阀恢复
*/
websocketStore.sendCommandMsg(airCompressorSetValve1JSON([1]))
websocketStore.sendCommandMsg(airCompressorSetValve2JSON([1]))
websocketStore.sendCommandMsg(airCompressorChannelSelectJSON([1]))
//
websocketStore.sendCommandMsg(
AirInletProportionalValve_setStateJSON([
sealStore.airInletProportionalInitVal,
]),
)
websocketStore.sendCommandMsg(
AirOutletProportionalValve_setStateJSON([
sealStore.airOutletProportionalInitVal,
]),
)
//
stopTimer()
}
}
@ -291,6 +288,7 @@ onBeforeUnmount(() => {
clearInterval(timerStart.value)
})
onMounted(() => {
//
sealCharts.value = echarts.init(document.getElementById('seal_echarts'))
sealCharts.value.setOption(sealOptions.value)
timer.value = setInterval(() => {
@ -360,6 +358,8 @@ onMounted(() => {
],
})
}, 1000)
websocketStore.sendCommandMsg(airInletProportionalValve_getStateJSON)
websocketStore.sendCommandMsg(AirOutletProportionalValve_getStateJSON)
})
</script>
@ -513,7 +513,7 @@ onMounted(() => {
padding: 20px;
.emp_box {
width: 300px;
height: 162px;
height: 198px;
border-radius: 12px;
background: #fff;
margin-bottom: 20px;

15
src/components/dialogs/LeaveModal.vue

@ -32,7 +32,13 @@
<script setup>
import { useSealStore, useWebSocketStore } from '@/store'
import { airCompressor_channelCtrlJSON } from '@/mock/command'
import {
airCompressorSetValve1JSON,
airCompressorSetValve2JSON,
AirInletProportionalValve_setStateJSON,
airCompressorChannelSelectJSON,
AirOutletProportionalValve_setStateJSON,
} from '@/mock/command'
const sealStore = useSealStore()
const websocketStore = useWebSocketStore()
@ -60,7 +66,12 @@ const handleStart = () => {
//
sealStore.updateIsStartTest(false)
sealStore.updateOldAirPressure(null)
websocketStore.sendCommandMsg(airCompressor_channelCtrlJSON([1]))
websocketStore.sendCommandMsg(airCompressorSetValve1JSON([1]))
websocketStore.sendCommandMsg(airCompressorSetValve2JSON([1]))
websocketStore.sendCommandMsg(airCompressorChannelSelectJSON([1]))
//
websocketStore.sendCommandMsg(AirInletProportionalValve_setStateJSON([40]))
websocketStore.sendCommandMsg(AirOutletProportionalValve_setStateJSON([40]))
//
props.hiddenLeaveModal()
if (props.clickType != -1) {

35
src/mock/command.js

@ -374,3 +374,38 @@ export const AirOutletProportionalValve_getStateJSON = {
command: 'DeviceIOControlService.AirOutletProportionalValve_getState',
messageId: 'airOutletProportionalValve_getState',
}
// 新接口
// 空压机选通阀切换到通道2(空气) 空压机选通阀切换到通道1 (入气口)
export const airCompressorChannelSelectJSON = params => {
return {
command: 'DeviceIOControlService.airCompressor_channelSelect',
messageId: 'airCompressor_channelSelect',
params,
}
}
// 空压机电子阀1 0关闭通道 1打开通道
export const airCompressorSetValve1JSON = params => {
return {
command: 'DeviceIOControlService.airCompressor_setValve1',
messageId: 'airCompressor_setValve1',
params,
}
}
// 空压机电子阀2 0关闭通道 1打开通道
export const airCompressorSetValve2JSON = params => {
return {
command: 'DeviceIOControlService.airCompressor_setValve2',
messageId: 'airCompressor_setValve2',
params,
}
}
// 获取当前压力值
export const airCompressorGetPressureDirectJSON = {
command: 'DeviceIOControlService.airCompressor_getPressureDirect',
messageId: 'airCompressor_getPressureDirect',
}

9
src/store/modules/websocket.js

@ -183,6 +183,15 @@ export const useWebSocketStore = defineStore({
sealStore.updateAirOutletProportionalInitVal(outAck || 0)
}
break
case 'airCompressor_getPressureDirect':
const { ackcode: getPressureCode, ack: pressureAck } = JSON.parse(
ev.data,
)
if (getPressureCode == 0) {
// 值初始化
sealStore.updateOldAirPressure(pressureAck || 0)
}
break
case 'chpasswd':
const { ackcode: chpasswdCode } = JSON.parse(ev.data)
if (chpasswdCode != 0) {

Loading…
Cancel
Save