diff --git a/src/assets/img/seal/dis_start.png b/src/assets/img/seal/dis_start.png deleted file mode 100644 index 128eb55..0000000 Binary files a/src/assets/img/seal/dis_start.png and /dev/null differ diff --git a/src/assets/img/seal/dis_stop.png b/src/assets/img/seal/dis_stop.png deleted file mode 100644 index a6a4fc2..0000000 Binary files a/src/assets/img/seal/dis_stop.png and /dev/null differ diff --git a/src/assets/img/seal/start.png b/src/assets/img/seal/start.png deleted file mode 100644 index ef10467..0000000 Binary files a/src/assets/img/seal/start.png and /dev/null differ diff --git a/src/assets/img/seal/starttest.png b/src/assets/img/seal/starttest.png index 0b0a172..43cfc93 100644 Binary files a/src/assets/img/seal/starttest.png and b/src/assets/img/seal/starttest.png differ diff --git a/src/assets/img/seal/stop.png b/src/assets/img/seal/stop.png deleted file mode 100644 index 0578dd8..0000000 Binary files a/src/assets/img/seal/stop.png and /dev/null differ diff --git a/src/assets/img/seal/stoptest.png b/src/assets/img/seal/stoptest.png index 34dd864..ea33c60 100644 Binary files a/src/assets/img/seal/stoptest.png and b/src/assets/img/seal/stoptest.png differ diff --git a/src/components/SealTest.vue b/src/components/SealTest.vue index 5234d38..0f3b25e 100644 --- a/src/components/SealTest.vue +++ b/src/components/SealTest.vue @@ -20,22 +20,16 @@ - @@ -65,20 +59,6 @@ }} - - @@ -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为测试前气压值 - // 也就是将getState中获取的当前值currentAirPressure赋予 - // 开始测试需要记录时间 +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) }) @@ -513,7 +513,7 @@ onMounted(() => { padding: 20px; .emp_box { width: 300px; - height: 162px; + height: 198px; border-radius: 12px; background: #fff; margin-bottom: 20px; diff --git a/src/components/dialogs/LeaveModal.vue b/src/components/dialogs/LeaveModal.vue index 3c70436..c1c0123 100644 --- a/src/components/dialogs/LeaveModal.vue +++ b/src/components/dialogs/LeaveModal.vue @@ -32,7 +32,13 @@