From 042ca40998e570436c915bdbf1c52b0452e28c68 Mon Sep 17 00:00:00 2001 From: SikongJueluo Date: Fri, 18 Jul 2025 21:56:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E7=A4=BA=E6=B3=A2?= =?UTF-8?q?=E5=99=A8=E5=89=8D=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OscilloscopeWaveformDisplay.vue | 48 +++++-- src/views/Project/Oscilloscope.vue | 132 +++++++++++++++++- 2 files changed, 170 insertions(+), 10 deletions(-) diff --git a/src/components/Oscilloscope/OscilloscopeWaveformDisplay.vue b/src/components/Oscilloscope/OscilloscopeWaveformDisplay.vue index 0960d64..e0264ea 100644 --- a/src/components/Oscilloscope/OscilloscopeWaveformDisplay.vue +++ b/src/components/Oscilloscope/OscilloscopeWaveformDisplay.vue @@ -1,11 +1,40 @@ @@ -37,6 +66,7 @@ import type { GridComponentOption, } from "echarts/components"; import { useRequiredInjection } from "@/utils/Common"; +import { Play, Square } from "lucide-vue-next"; use([ TooltipComponent, @@ -58,7 +88,9 @@ type EChartsOption = ComposeOption< >; // 使用 manager 获取 oscilloscope 数据 -const { oscData } = useRequiredInjection(useOscilloscopeState); +const oscManager = useRequiredInjection(useOscilloscopeState); + +const oscData = computed(() => oscManager.oscData.value); const hasData = computed(() => { return ( @@ -66,11 +98,9 @@ const hasData = computed(() => { oscData.value.x && oscData.value.y && oscData.value.x.length > 0 && - ( - Array.isArray(oscData.value.y[0]) - ? oscData.value.y.some((channel: any) => channel.length > 0) - : oscData.value.y.length > 0 - ) + (Array.isArray(oscData.value.y[0]) + ? oscData.value.y.some((channel: any) => channel.length > 0) + : oscData.value.y.length > 0) ); }); diff --git a/src/views/Project/Oscilloscope.vue b/src/views/Project/Oscilloscope.vue index 3c5f801..9da0ae1 100644 --- a/src/views/Project/Oscilloscope.vue +++ b/src/views/Project/Oscilloscope.vue @@ -1,5 +1,5 @@ @@ -17,7 +139,15 @@ import { Activity } from "lucide-vue-next"; import { OscilloscopeWaveformDisplay } from "@/components/Oscilloscope"; import { useEquipments } from "@/stores/equipments"; +import { useOscilloscopeState } from "@/components/Oscilloscope/OscilloscopeManager"; +import { useRequiredInjection } from "@/utils/Common"; // 使用全局设备配置 const equipments = useEquipments(); + +// 获取示波器状态和操作 +const osc = useRequiredInjection(useOscilloscopeState); + +// 应用配置 +const applyConfiguration = () => osc.applyConfiguration();