From 3f6952612dc81b00615a0ef3402c2705c6e69253 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Thu, 7 May 2026 08:52:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BB=98=E5=88=B6=E7=89=B9?= =?UTF-8?q?=E6=80=A7=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/freqConverterDipChart.vue | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/frontend/src/views/machine/freqConverter/components/freqConverterDipChart.vue b/frontend/src/views/machine/freqConverter/components/freqConverterDipChart.vue index 7d5d77a..d716224 100644 --- a/frontend/src/views/machine/freqConverter/components/freqConverterDipChart.vue +++ b/frontend/src/views/machine/freqConverter/components/freqConverterDipChart.vue @@ -73,6 +73,7 @@ const CHARACTERISTIC_POINT_COLOR = '#ff4d4f' const chartPoints = ref([]) const characteristicCurveData = ref>([]) +const drawnCharacteristicCurveData = ref>([]) const characteristicCurveVisible = ref(false) const chartRef = ref(null) @@ -84,13 +85,6 @@ const selectedMappingText = computed(() => { return `变频器:${props.selectedMapping.freqConverterName || '-'}` }) -const positiveDurations = computed(() => { - return [ - ...chartPoints.value.map(item => item.duration), - ...characteristicCurveData.value.map(item => item[0]) - ].filter(item => Number.isFinite(item) && item > 0) -}) - const xAxisMin = computed(() => { return 0.001 // if (!positiveDurations.value.length) { @@ -131,12 +125,23 @@ const sortedCharacteristicCurveData = computed(() => { }) }) +const sortedDrawnCharacteristicCurveData = computed(() => { + return [...drawnCharacteristicCurveData.value].sort((a, b) => { + if (a[0] !== b[0]) { + return a[0] - b[0] + } + + return a[1] - b[1] + }) +}) + const solidCharacteristicCurveSeriesData = computed(() => { if (!characteristicCurveVisible.value) { return [] as Array<[number, number, string]> } - return sortedCharacteristicCurveData.value.map(item => [item[0], item[1], '特性曲线']) + const curveSource = props.autoDrawCurve ? sortedCharacteristicCurveData.value : sortedDrawnCharacteristicCurveData.value + return curveSource.map(item => [item[0], item[1], '特性曲线']) }) const characteristicCurvePointSeriesData = computed(() => { @@ -409,11 +414,13 @@ const updateCharacteristicCurveVisibility = () => { const drawCharacteristicCurve = () => { if (!sortedCharacteristicCurveData.value.length) { + drawnCharacteristicCurveData.value = [] characteristicCurveVisible.value = false ElMessage.warning('暂无特性曲线点') return } + drawnCharacteristicCurveData.value = [...sortedCharacteristicCurveData.value] characteristicCurveVisible.value = true } @@ -630,6 +637,7 @@ watch( () => props.autoDrawCurve, newValue => { characteristicCurveVisible.value = newValue ? characteristicCurveData.value.length > 0 : false + drawnCharacteristicCurveData.value = newValue ? [...characteristicCurveData.value] : [] }, { immediate: true } ) @@ -680,6 +688,7 @@ watch( () => { chartPoints.value = [] characteristicCurveData.value = [] + drawnCharacteristicCurveData.value = [] characteristicCurveVisible.value = false } )