From 448687115cbf8a32cfc6c92c296b18320d87fefb Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Fri, 8 May 2026 11:32:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E6=96=BD=E6=B5=8B=E8=AF=95=E7=89=B9?= =?UTF-8?q?=E6=80=A7=E6=9B=B2=E7=BA=BF=E4=B8=8E=E7=BB=93=E6=9E=9C=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E7=89=B9=E6=80=A7=E6=9B=B2=E7=BA=BF=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/freqConverterDipChart.vue | 30 +------------------ .../components/freqConverterTestPopup.vue | 26 +++++++++++++++- 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/frontend/src/views/machine/freqConverter/components/freqConverterDipChart.vue b/frontend/src/views/machine/freqConverter/components/freqConverterDipChart.vue index 6a91668..32c9a3f 100644 --- a/frontend/src/views/machine/freqConverter/components/freqConverterDipChart.vue +++ b/frontend/src/views/machine/freqConverter/components/freqConverterDipChart.vue @@ -82,7 +82,6 @@ const CHARACTERISTIC_POINT_COLOR = '#ff4d4f' const chartPoints = ref([]) const characteristicCurveData = ref([]) -const drawnCharacteristicCurveData = ref([]) const characteristicCurveVisible = ref(false) const chartRef = ref(null) @@ -146,35 +145,12 @@ const sortedCharacteristicCurveData = computed(() => { }) }) -const sortedDrawnCharacteristicCurveData = computed(() => { - return [...drawnCharacteristicCurveData.value].sort((a, b) => { - if (a.timeMs !== null && b.timeMs !== null && a.timeMs !== b.timeMs) { - return a.timeMs - b.timeMs - } - - if (a.timeMs !== null && b.timeMs === null) { - return -1 - } - - if (a.timeMs === null && b.timeMs !== null) { - return 1 - } - - if (a.duration !== b.duration) { - return a.duration - b.duration - } - - return a.residualVoltage - b.residualVoltage - }) -}) - const solidCharacteristicCurveSeriesData = computed(() => { if (!characteristicCurveVisible.value) { return [] as Array<[number, number, string]> } - const curveSource = props.autoDrawCurve ? sortedCharacteristicCurveData.value : sortedDrawnCharacteristicCurveData.value - return curveSource.map(item => [item.duration, item.residualVoltage, '特性曲线']) + return sortedCharacteristicCurveData.value.map(item => [item.duration, item.residualVoltage, '特性曲线']) }) const characteristicCurvePointSeriesData = computed(() => { @@ -511,13 +487,11 @@ const updateCharacteristicCurveVisibility = () => { const drawCharacteristicCurve = () => { if (!sortedCharacteristicCurveData.value.length) { - drawnCharacteristicCurveData.value = [] characteristicCurveVisible.value = false ElMessage.warning('暂无特性曲线点') return } - drawnCharacteristicCurveData.value = [...sortedCharacteristicCurveData.value] characteristicCurveVisible.value = true } @@ -735,7 +709,6 @@ watch( () => props.autoDrawCurve, newValue => { characteristicCurveVisible.value = newValue ? characteristicCurveData.value.length > 0 : false - drawnCharacteristicCurveData.value = newValue ? [...characteristicCurveData.value] : [] }, { immediate: true } ) @@ -786,7 +759,6 @@ watch( () => { chartPoints.value = [] characteristicCurveData.value = [] - drawnCharacteristicCurveData.value = [] characteristicCurveVisible.value = false } ) diff --git a/frontend/src/views/machine/freqConverter/components/freqConverterTestPopup.vue b/frontend/src/views/machine/freqConverter/components/freqConverterTestPopup.vue index 25d6aa4..0a64dd7 100644 --- a/frontend/src/views/machine/freqConverter/components/freqConverterTestPopup.vue +++ b/frontend/src/views/machine/freqConverter/components/freqConverterTestPopup.vue @@ -123,6 +123,30 @@ const normalizeFormalRealPayload = (payload: any) => { } } +const extractResultArray = (payload: any) => { + if (Array.isArray(payload)) { + return payload + } + + if (Array.isArray(payload?.data)) { + return payload.data + } + + if (Array.isArray(payload?.data?.records)) { + return payload.data.records + } + + if (Array.isArray(payload?.records)) { + return payload.records + } + + if (Array.isArray(payload?.list)) { + return payload.list + } + + return [] as any[] +} + const handleSocketMessage = (payload: any) => { const requestId = `${payload?.requestId ?? ''}` const normalizedRequestId = requestId.trim().toLowerCase() @@ -289,7 +313,7 @@ const handleStart = async () => { const historyResult = await getFreqConverterResult({ converterId: mapping.freqConverterId }) - historyResultData.value = historyResult?.data ?? historyResult + historyResultData.value = extractResultArray(historyResult?.data ?? historyResult) } else { historyResultData.value = null }