Browse Source

fix:修复密封测试功能

master
白凤吉 2 weeks ago
parent
commit
58f73d0674
  1. 20
      src/stores/sealStore.ts
  2. 38
      src/views/seal/index.vue

20
src/stores/sealStore.ts

@ -15,16 +15,16 @@ export const useSealStore = defineStore('seal', () => {
})
const leakRemainingTime = ref('')
const _leakTimerId = ref<number | undefined>(undefined)
const _leakStartTs = ref(0)
const leakTimerId = ref<number | undefined>(undefined)
const leakStartTs = ref(0)
function startLeakTimer() {
if (_leakTimerId.value)
if (leakTimerId.value)
return
_leakStartTs.value = Date.now()
leakStartTs.value = Date.now()
leakRemainingTime.value = '00:00:00'
_leakTimerId.value = window.setInterval(() => {
const diff = Date.now() - _leakStartTs.value
leakTimerId.value = window.setInterval(() => {
const diff = Date.now() - leakStartTs.value
const secs = Math.floor(diff / 1000)
const h = Math.floor(secs / 3600)
const m = Math.floor((secs % 3600) / 60)
@ -37,12 +37,12 @@ export const useSealStore = defineStore('seal', () => {
}
function stopLeakTimer() {
if (_leakTimerId.value) {
clearInterval(_leakTimerId.value)
_leakTimerId.value = undefined
if (leakTimerId.value) {
clearInterval(leakTimerId.value)
leakTimerId.value = undefined
}
leakRemainingTime.value = ''
_leakStartTs.value = 0
leakStartTs.value = 0
}
function updateSealInfo(dataInfo: SealStateItem) {

38
src/views/seal/index.vue

@ -6,7 +6,7 @@ import SealInstrumentSvg from 'assets/images/seal/seal-instrument.svg'
import SoftKeyboard from 'components/common/SoftKeyboard/index.vue'
import DashboardChart from 'components/seal/DashboardChart.vue'
import { roundNumber } from 'libs/utils'
import { computed, onMounted, ref } from 'vue'
import { computed, onMounted, ref, watch } from 'vue'
import { getDeviceStatus } from '@/libs/deviceComm'
import { FtMessage } from '@/libs/message'
@ -17,13 +17,18 @@ defineOptions({ name: 'Seal' })
const sealStore = useSealStore()
const initialPressure = ref<string>('0')
const sealInfo = computed(() => sealStore.sealInfo)
const leakRemainingTime = computed(() => sealStore.leakRemainingTime)
const currentPressure = computed(() => sealStore.currentPressure)
const diffPressure = computed(() =>
Number(sealStore.currentPressure) - Number(sealStore.sealInfo.pressure),
)
const diffPressure = computed<number>(() => {
if (sealInfo.value.workState === 'leakTesting') {
return Math.abs(
Number(currentPressure.value) - Number(initialPressure.value),
)
}
return 0
})
const inputValue = ref('')
const keyboardVisible = ref(false)
const keyboardType = ref<'text' | 'number'>('number')
@ -31,6 +36,15 @@ const softKeyboardRef = ref()
const inflationTime = ref<number>()
const loading = ref(false)
watch(
() => sealInfo.value.workState,
(newState, oldState) => {
if (oldState === 'stabilizingPressure' && newState === 'leakTesting') {
initialPressure.value = sealInfo.value.pressure
}
},
)
onMounted(async () => {
const res = await sendCmd({ className: 'AirLeakDetectTest', fnName: 'getServiceConfig' })
inflationTime.value = res.inflationTimeMs
@ -105,11 +119,17 @@ function handleConfirm(value: string) {
<div class="seal-diff-text">
测试前气压
</div>
<div v-if="sealInfo.workState === 'idle'" class="seal-diff-statue seal-diff-text">
未开始
<div v-if="sealInfo.workState === 'inflating'" class="seal-diff-statue seal-diff-text">
打压中
</div>
<div v-else class="seal-test-time">
{{ currentPressure }}
<div v-else-if="sealInfo.workState === 'stabilizingPressure'" class="seal-diff-statue seal-diff-text">
稳压中
</div>
<div v-else-if="sealInfo.workState === 'leakTesting'" class="seal-test-time">
{{ initialPressure }}Kp
</div>
<div v-else class="seal-diff-statue seal-diff-text">
未开始
</div>
</div>
</div>

Loading…
Cancel
Save