-
![]()
-
实时压力表
+
+
+
![]()
+
实时压力表
+
+
+
+
+
+
测试前气压
+
+ {{
+ sealStore.oldAirPressure != null
+ ? sealStore.oldAirPressure
+ : '--'
+ }}KPa
+
+
+
![]()
+
![]()
+
-
-
-
![]()
-
![]()
+
+
+
+
+
测试时间
+
{{ resultTime ? resultTime : '未开始' }}
+
+
+
气压差值
+
+ {{
+ sealStore.differenceValue ? sealStore.differenceValue : '未开始'
+ }}
+
+
+
![]()
+
![]()
+
@@ -17,12 +79,16 @@ import * as echarts from 'echarts'
import { ref, onMounted, onBeforeUnmount } from 'vue'
import SealPng from '@/assets/img/seal/seal.png'
import StartAir from '@/assets/img/seal/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 DisStart from '@/assets/img/seal/dis_start.png'
-import DisStop from '@/assets/img/seal/dis_stop.png'
-import { useSealStore } from '@/store'
+import { someAirSwitchJSON } from '@/mock/command'
+import { useSealStore, useTestStore, useWebSocketStore } from '@/store'
const sealStore = useSealStore()
+const testStore = useTestStore()
+const websocketStore = useWebSocketStore()
const sealCharts = ref(null)
const sealOptions = ref({
@@ -91,9 +157,85 @@ const sealOptions = ref({
],
})
+const n_sec = ref(0) // 秒
+const n_min = ref(0) // 分
+const n_hour = ref(0) // 时
+
+const resultTime = ref('')
+const timerStart = ref(null)
+
+const timerFunc = () => {
+ timerStart.value = setInterval(() => {
+ var str_sec = n_sec.value
+ var str_min = n_min.value
+ var str_hour = n_hour.value
+ if (n_sec.value < 10) {
+ str_sec = '0' + n_sec.value
+ }
+ if (n_min.value < 10) {
+ str_min = '0' + n_min.value
+ }
+ if (n_hour.value < 10) {
+ str_hour = '0' + n_hour.value
+ }
+ resultTime.value = str_hour + ':' + str_min + ':' + str_sec
+ n_sec.value = n_sec.value + 1
+ if (n_sec.value > 59) {
+ n_sec.value = 0
+ n_min.value = n_min.value + 1
+ }
+ if (n_min.value > 59) {
+ n_min.value = 0
+ n_hour.value = n_hour.value + 1
+ }
+ }, 1000)
+}
+
+const changeAirStatus = flag => {
+ if (flag == 1) {
+ if (!testStore.airCompressor) {
+ websocketStore.sendCommandMsg(someAirSwitchJSON(0, 1))
+ websocketStore.sendCommandMsg(someAirSwitchJSON(1, 1))
+ testStore.updateAirCompressor(true)
+ }
+ } else {
+ if (testStore.airCompressor) {
+ websocketStore.sendCommandMsg(someAirSwitchJSON(0, 0))
+ websocketStore.sendCommandMsg(someAirSwitchJSON(1, 0))
+ testStore.updateAirCompressor(false)
+ }
+ }
+}
+
+const handleStartTest = flag => {
+ if (flag == '1') {
+ // 改变测试前oldAirPressure为测试前气压值
+ // 也就是将getState中获取的当前值currentAirPressure赋予
+
+ // 开始测试需要记录时间
+ timerFunc()
+ sealStore.updateIsStartTest(true)
+ }
+ if (flag == '2') {
+ // 改变测试前oldAirPressure为null
+ sealStore.updateOldAirPressure(null)
+ // 结束测试时将时间重置null
+ clearInterval(timerStart.value)
+ timerStart.value = null
+ resultTime.value = null
+ n_sec.value = 0
+ n_min.value = 0
+ n_hour.value = 0
+ sealStore.updateIsStartTest(false)
+ }
+}
+
const timer = ref(null)
onBeforeUnmount(() => {
timer.value = null
+ timerStart.value = null
+ clearInterval(timer.value)
+ clearInterval(timerStart.value)
})
onMounted(() => {
sealCharts.value = echarts.init(document.getElementById('seal_echarts'))
@@ -176,59 +318,185 @@ onMounted(() => {
border-radius: 16px;
display: flex;
align-items: center;
- margin-right: 30px;
- width: 1220px;
- height: 580px;
- box-sizing: border-box;
- border-radius: 16px;
- background: #ffffff;
- position: relative;
- .title_wrap {
- position: absolute;
- left: 28px;
- top: 28px;
- width: 141px;
- height: 31px;
+ .left_container {
+ margin-right: 30px;
+ width: 766px;
+ height: 580px;
box-sizing: border-box;
- display: flex;
- align-items: center;
- .title {
- font-family: 思源黑体;
- font-size: 20px;
- font-weight: bold;
- line-height: normal;
- letter-spacing: 0.02em;
- font-feature-settings: 'kern' on;
- color: #000000;
- margin-left: 9px;
+ border-radius: 16px;
+ background: #ffffff;
+ position: relative;
+ .title_wrap {
+ position: absolute;
+ left: 28px;
+ top: 28px;
+ width: 141px;
+ height: 31px;
+ box-sizing: border-box;
+ display: flex;
+ align-items: center;
+ .title {
+ font-family: 思源黑体;
+ font-size: 20px;
+ font-weight: bold;
+ line-height: normal;
+ letter-spacing: 0.02em;
+ font-feature-settings: 'kern' on;
+ color: #000000;
+ margin-left: 9px;
+ }
+ .icon {
+ width: 30px;
+ height: 30px;
+ }
}
- .icon {
- width: 30px;
- height: 30px;
- }
- }
- .oper_box {
- position: absolute;
- left: 28px;
- bottom: 28px;
- width: 1164px;
- box-sizing: border-box;
- padding: 0 120px;
- height: 110px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .air_img {
- width: 341px;
+ .oper_box {
+ position: absolute;
+ left: 28px;
+ bottom: 28px;
+ width: 710px;
height: 110px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ .air_img {
+ width: 341px;
+ height: 110px;
+ }
+ .air_box {
+ width: 341px;
+ height: 110px;
+ border-radius: 16px;
+ background: #f6f6f6;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ .box {
+ width: 16px;
+ height: 16px;
+ background: #4359b9;
+ margin-right: 6px;
+ }
+ .tit {
+ font-family: 思源黑体;
+ font-size: 20px;
+ font-weight: normal;
+ line-height: normal;
+ letter-spacing: 0.06em;
+ font-feature-settings: 'kern' on;
+ color: #3d3d3d;
+ margin-right: 8px;
+ }
+ .num {
+ font-family: Source Han Sans;
+ font-size: 30px;
+ font-weight: bold;
+ line-height: normal;
+ letter-spacing: 0.06em;
+ font-feature-settings: 'kern' on;
+ color: #4359b9;
+ }
+ }
+ }
+ .echarts_box {
+ height: 580px;
+ position: absolute;
+ left: 0;
+ top: -36px;
+ width: 100%;
}
}
- .echarts_box {
+ .right_container {
height: 580px;
- position: absolute;
- left: 0;
- top: -36px;
- width: 1220px;
+ box-sizing: border-box;
+ border-radius: 16px;
+ background: #ffffff;
+ flex: 1;
+ padding: 32px 42px;
+ .header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ box-sizing: border-box;
+ width: 340px;
+ height: 45px;
+ border-radius: 245px;
+ background: #06518b;
+ padding-left: 17px;
+ padding-right: 24px;
+ margin-bottom: 20px;
+ .left {
+ display: flex;
+ align-items: center;
+ .icon {
+ width: 16px;
+ height: 16px;
+ }
+ .title {
+ font-family: 思源黑体;
+ font-size: 14px;
+ font-weight: normal;
+ line-height: normal;
+ letter-spacing: 0.1em;
+ margin-left: 9px;
+ color: #ffffff;
+ }
+ }
+ .en {
+ font-family: 思源黑体;
+ font-size: 12px;
+ font-weight: normal;
+ line-height: normal;
+ letter-spacing: 0.1em;
+ color: #ffffff;
+ }
+ }
+ .oper_box {
+ width: 340px;
+ height: 455px;
+ border-radius: 16px;
+ background: #f6f6f6;
+ box-sizing: border-box;
+ padding: 20px;
+ .emp_box {
+ width: 300px;
+ height: 162px;
+ border-radius: 12px;
+ background: #fff;
+ margin-bottom: 20px;
+ box-sizing: border-box;
+ padding-top: 16px;
+ padding-left: 27px;
+ padding-right: 27px;
+ display: flex;
+ flex-direction: column;
+ .title {
+ font-family: Source Han Sans;
+ font-size: 16px;
+ font-weight: 500;
+ line-height: normal;
+ letter-spacing: 0.06em;
+ font-feature-settings: 'kern' on;
+ color: #06518b;
+ }
+ .num {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-family: 思源黑体;
+ font-size: 30px;
+ font-weight: bold;
+ line-height: normal;
+ letter-spacing: 0.1em;
+ color: #000000;
+ }
+ }
+ .test_png {
+ width: 300px;
+ height: 50px;
+ }
+ }
}
}
diff --git a/src/components/SealTest_bak.vue b/src/components/SealTest_bak.vue
deleted file mode 100644
index 3a901c0..0000000
--- a/src/components/SealTest_bak.vue
+++ /dev/null
@@ -1,279 +0,0 @@
-
-
-
-
-
![]()
-
实时压力表
-
-
-
-
-
![]()
-
-
-
-
-
-
-
-
![]()
-
-
-
-
-
-
-
-
diff --git a/src/store/modules/seal.js b/src/store/modules/seal.js
index 5695f61..ee8010c 100644
--- a/src/store/modules/seal.js
+++ b/src/store/modules/seal.js
@@ -6,6 +6,8 @@ export const useSealStore = defineStore({
return {
// 0~800kPa
currentAirPressure: 0,
+ isStartTest: false,
+ oldAirPressure: null,
}
},
// actions
@@ -13,5 +15,21 @@ export const useSealStore = defineStore({
updateCurrentAirPressure(currentAirPressure) {
this.currentAirPressure = currentAirPressure
},
+ updateIsStartTest(isStartTest) {
+ this.isStartTest = isStartTest
+ },
+ updateOldAirPressure(oldAirPressure) {
+ this.oldAirPressure = oldAirPressure
+ },
+ },
+ getters: {
+ differenceValue(state) {
+ if (state.isStartTest) {
+ if (state.oldAirPressure != null && state.currentAirPressure) {
+ return Math.abs(state.oldAirPressure - state.currentAirPressure)
+ }
+ }
+ return null
+ },
},
})