实施测试特性曲线与结果展示特性曲线不一致问题
This commit is contained in:
@@ -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
|
||||
}
|
||||
)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user