实施测试特性曲线与结果展示特性曲线不一致问题

This commit is contained in:
caozehui
2026-05-08 11:32:45 +08:00
parent 121829a4bd
commit 448687115c
2 changed files with 26 additions and 30 deletions

View File

@@ -82,7 +82,6 @@ const CHARACTERISTIC_POINT_COLOR = '#ff4d4f'
const chartPoints = ref<ChartPoint[]>([])
const characteristicCurveData = ref<CharacteristicCurvePoint[]>([])
const drawnCharacteristicCurveData = ref<CharacteristicCurvePoint[]>([])
const characteristicCurveVisible = ref(false)
const chartRef = ref<any>(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
}
)