From f6f3fc6718f9eacdace25d6b0e17b4422ef07beb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=A2=A6=E8=BF=9C?= <1063331231@qq.com> Date: Sun, 13 Jul 2025 19:53:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=96=B7=E5=A4=B4=E5=8A=A0?= =?UTF-8?q?=E7=83=AD=20=E8=BD=BD=E7=8E=BB=E5=8F=B0=E5=8A=A0=E7=83=AD=20?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E6=B8=A9=E5=BA=A6=20=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E6=8C=89=E9=92=AE=20=E5=A2=9E=E5=8A=A0=E6=B8=85=E6=B4=97?= =?UTF-8?q?=E7=AE=A1=E9=81=93=E5=92=8C=E9=A2=84=E5=85=85=E7=9A=84=E6=AD=A3?= =?UTF-8?q?=E5=90=91=E8=AE=A1=E6=97=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/env.d.ts | 2 +- src/stores/useSystemStore.ts | 56 ++++++++++++++++++ src/views/debug/index.vue | 133 +++++++++++++++++++++++++++++++++++++++---- src/views/spraySet/index.vue | 83 ++++++++++++++++++--------- 4 files changed, 234 insertions(+), 40 deletions(-) diff --git a/src/env.d.ts b/src/env.d.ts index 91c2d53..03dc67e 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -10,7 +10,7 @@ interface ImportMeta { readonly env: ImportMetaEnv } -declare const __APP_VERSION__: string; +declare const __APP_VERSION__: string declare module '*.vue' { import type { DefineComponent } from 'vue' diff --git a/src/stores/useSystemStore.ts b/src/stores/useSystemStore.ts index 8ecdec6..a7ceefc 100644 --- a/src/stores/useSystemStore.ts +++ b/src/stores/useSystemStore.ts @@ -12,6 +12,8 @@ export const useSystemStore = defineStore('system', { dehumidifierRunning: false, // 是否正在除湿 selfTestCompleted: false, // 是否完成自检 stopPressed: false, // 是否按下急停 + nozzleHeating: false, // 是否正在加热喷嘴 + slidePlatHeating: false, // 是否正在加热载玻台 }, systemSensor: { humidity: 0, @@ -20,6 +22,12 @@ export const useSystemStore = defineStore('system', { streamVisible: false, systemList: [{ cmdCode: '' }], targetHumidity: 0, + cleanRemainingTime: '', // 清洗管道用时 + cleanTimerId: null, // 清洗管道定时器 + cleanStartTs: 0, // 清洗管道开始时间 + preRemainingTime: '', // 预充用时 + preTimerId: null, // 预充定时器 + preStartTs: 0, // 预充开始时间 }), actions: { updateTargetHumidity(humidity: number) { @@ -40,5 +48,53 @@ export const useSystemStore = defineStore('system', { pushSystemList(text: any) { this.systemList.push(text) }, + startCleanTimer() { + if (this.cleanTimerId) + return + this.cleanStartTs = Date.now() + this.cleanRemainingTime = '00:00:00' + this.cleanTimerId = window.setInterval(() => { + const diff = Date.now() - this.cleanStartTs + const secs = Math.floor(diff / 1000) + const h = Math.floor(secs / 3600) + const m = Math.floor((secs % 3600) / 60) + const s = secs % 60 + const hh = String(h).padStart(2, '0') + const mm = String(m).padStart(2, '0') + const ss = String(s).padStart(2, '0') + this.cleanRemainingTime = `${hh}:${mm}:${ss}` + }, 1000) + }, + stopCleanTimer() { + if (this.cleanTimerId) { + window.clearInterval(this.cleanTimerId) + this.cleanTimerId = null + } + }, + startPreTimer() { + if (this.preTimerId) + return + this.preStartTs = Date.now() + this.preRemainingTime = '00:00:00' + this.preTimerId = window.setInterval(() => { + const diff = Date.now() - this.preStartTs + const secs = Math.floor(diff / 1000) + const h = Math.floor(secs / 3600) + const m = Math.floor((secs % 3600) / 60) + const s = secs % 60 + const hh = String(h).padStart(2, '0') + const mm = String(m).padStart(2, '0') + const ss = String(s).padStart(2, '0') + this.preRemainingTime = `${hh}:${mm}:${ss}` + }, 1000) + }, + stopPreTimer() { + if (this.preTimerId) { + window.clearInterval(this.preTimerId) + this.preTimerId = undefined + } + // this.preRemainingTime = '' + this.preStartTs = 0 + }, }, }) diff --git a/src/views/debug/index.vue b/src/views/debug/index.vue index d499b1b..558d627 100644 --- a/src/views/debug/index.vue +++ b/src/views/debug/index.vue @@ -25,7 +25,77 @@ const form = reactive({ direction: 'forward', speed: undefined, voltage: undefined, + nozzle: { + temperature: undefined, + }, + slidePlat: { + temperature: undefined, + }, }) +const nozzleHeatOpen = async () => { + if (!form.nozzle.temperature) { + FtMessage.error('请输入设置温度') + return + } + const params = { + cmdCode: 'nozzle_heat_open', + cmdId: '', + params: { + temperature: form.nozzle.temperature, + }, + } + await sendControl(params, 'debug') +} +const nozzleHeatClose = async () => { + const params = { + cmdCode: 'nozzle_heat_close', + cmdId: '', + params: { + }, + } + await sendControl(params, 'debug') +} +const nozzleHeatGet = async () => { + const params = { + cmdCode: 'nozzle_heat_get', + cmdId: '', + params: { + }, + } + await sendControl(params, 'debug') +} +const slidePlatHeatOpen = async () => { + if (!form.nozzle.temperature) { + FtMessage.error('请输入设置温度') + return + } + const params = { + cmdCode: 'slide_plat_heat_open', + cmdId: '', + params: { + temperature: form.nozzle.temperature, + }, + } + await sendControl(params, 'debug') +} +const slidePlatHeatClose = async () => { + const params = { + cmdCode: 'slide_plat_heat_close', + cmdId: '', + params: { + }, + } + await sendControl(params, 'debug') +} +const slidePlatHeatGet = async () => { + const params = { + cmdCode: 'slide_plat_heat_get', + cmdId: '', + params: { + }, + } + await sendControl(params, 'debug') +} const motorMove = async (device: 'x' | 'y' | 'z') => { if (!form[device].position || !form[device].speed) { FtMessage.error('请补全参数') @@ -197,7 +267,7 @@ const highVoltageClose = async () => { -
+
移动 @@ -232,7 +302,7 @@ const highVoltageClose = async () => {
-
+
移动 @@ -267,7 +337,7 @@ const highVoltageClose = async () => {
-
+
移动 @@ -307,7 +377,7 @@ const highVoltageClose = async () => {
- + ul/min
@@ -330,7 +400,7 @@ const highVoltageClose = async () => {
- + V 开启 @@ -342,16 +412,51 @@ const highVoltageClose = async () => { + + + +
+ + + + 开启 + + + 关闭 + + + 读取 + +
+
+ + +
+ + + + 开启 + + + 关闭 + + + 读取 + +
+
+
+
- + 开启照明灯 关闭照明灯 -
+
@@ -365,7 +470,7 @@ const highVoltageClose = async () => { - + 打开清洗阀 @@ -375,7 +480,7 @@ const highVoltageClose = async () => { 打开除湿阀 -
+
关闭清洗阀 @@ -398,13 +503,16 @@ const highVoltageClose = async () => { border-radius: 20px; color: var(--el-color-primary); } + :deep(.el-card__body) { padding: 50px; } + .card-header { display: flex; align-items: center; } + .num-box { margin: 0 20px; width: 50px; @@ -417,11 +525,13 @@ const highVoltageClose = async () => { justify-content: center; align-items: center; } + .button-footer { display: flex; justify-content: flex-end; margin: 50px; } + .hint-text { display: flex; height: 400px; @@ -431,6 +541,7 @@ const highVoltageClose = async () => { font-size: 50px; color: var(--el-color-primary); } + .num-text { color: var(--el-color-primary); font-weight: 900; @@ -439,10 +550,10 @@ const highVoltageClose = async () => { :deep(.el-form-item) { --font-size: 40px; - margin-bottom: 10px + margin-bottom: 10px; } .el-input { - margin: 0 15px + margin: 0 15px; } diff --git a/src/views/spraySet/index.vue b/src/views/spraySet/index.vue index f96723f..79c9567 100644 --- a/src/views/spraySet/index.vue +++ b/src/views/spraySet/index.vue @@ -3,7 +3,7 @@ import { ElMessageBox } from 'element-plus' import { FtMessage } from 'libs/message' import { sendControl } from 'libs/utils' import { useSystemStore } from 'stores/useSystemStore' -import { h, ref } from 'vue' +import { computed, h, ref } from 'vue' import { useRouter } from 'vue-router' const router = useRouter() @@ -72,7 +72,7 @@ const dehumidifierStart = () => { FtMessage.error('取消除湿') }) } - +const cleanRemainingTime = computed(() => systemStore.cleanRemainingTime) const syringePipelineWashRef = ref() const syringePipelineWash = async () => { if (!clearSpeed.value) { @@ -103,9 +103,11 @@ const syringePipelineWash = async () => { console.log('sendControl', params) await sendControl(params) syringePipelineWashRef.value.setLoading(false) + systemStore.startCleanTimer() }) .catch(() => { FtMessage.error('取消清洗') + systemStore.stopCleanTimer() }) } @@ -126,26 +128,25 @@ const nozzlePipelineWash = () => { cancelButtonText: '取消', showCancelButton: true, showClose: false, + }).then(async () => { + nozzlePipelineWashRef.value.setLoading(true) + const params = { + cmdCode: 'nozzle_pipeline_wash', + cmdId: '', + params: { + speed: clearSpeed.value, + }, + } + try { + await sendControl(params) + } + finally { + nozzlePipelineWashRef.value.setLoading(false) + } }) - .then(async () => { - nozzlePipelineWashRef.value.setLoading(true) - const params = { - cmdCode: 'nozzle_pipeline_wash', - cmdId: '', - params: { - speed: clearSpeed.value, - }, - } - try { - await sendControl(params) - } - finally { - nozzlePipelineWashRef.value.setLoading(false) - } - }) } console.log(nozzlePipelineWash) - +const preRemainingTime = computed(() => systemStore.preRemainingTime) const matrixPrefillRef = ref() const matrixPrefill = () => { if (!speed.value) { @@ -173,11 +174,13 @@ const matrixPrefill = () => { speed: speed.value, }, } + systemStore.startPreTimer() await sendControl(params) matrixPrefillRef.value.setLoading(false) }) .catch(() => { FtMessage.error('取消预充') + systemStore.stopPreTimer() }) } @@ -186,6 +189,7 @@ const pipelineWashStop = async () => { cmdCode: 'syringe_pipeline_wash_stop', cmdId: '', } + systemStore.stopCleanTimer() await sendControl(params) } @@ -194,6 +198,7 @@ const matrixPrefillStop = async () => { cmdCode: 'matrix_prefill_stop', cmdId: '', } + systemStore.stopPreTimer() await sendControl(params) } @@ -227,10 +232,12 @@ const dehumidifierStop = async () => { ref="syringePipelineWashRef" type="primary" :click-handle="syringePipelineWash" - :disabled="systemStore.systemStatus.spraying - || systemStore.systemStatus.cleaningSyringePipeline - || systemStore.systemStatus.cleaningNozzlePipeline - || systemStore.systemStatus.prefilling" + :disabled=" + systemStore.systemStatus.spraying + || systemStore.systemStatus.cleaningSyringePipeline + || systemStore.systemStatus.cleaningNozzlePipeline + || systemStore.systemStatus.prefilling + " > 清洗注射器管路 @@ -242,9 +249,15 @@ const dehumidifierStop = async () => { - + 停止清洗 + 清洗计时: {{ cleanRemainingTime }}
@@ -263,16 +276,22 @@ const dehumidifierStop = async () => { uL/min
开始预充 结束预充 + 预充计时: {{ preRemainingTime }}
@@ -317,13 +336,16 @@ const dehumidifierStop = async () => { color: var(--el-color-primary); border-radius: 20px; } + :deep(.el-card__body) { padding: 50px; } + .card-header { display: flex; align-items: center; } + .num-box { margin: 0 20px; width: 50px; @@ -336,11 +358,13 @@ const dehumidifierStop = async () => { justify-content: center; align-items: center; } + .button-footer { display: flex; justify-content: center; margin: 50px; } + .hint-text { display: flex; height: 400px; @@ -350,13 +374,16 @@ const dehumidifierStop = async () => { font-size: 50px; color: var(--el-color-primary); } + .num-text { color: var(--el-color-primary); font-weight: 900; font-size: 70px; } + :deep(.set-button) { margin-top: 50px; + .my-button { width: 500px; height: 150px;