谐波次数切换时,原始数据显示为T项NaN问题

This commit is contained in:
caozehui
2025-01-13 22:05:46 +08:00
parent 52968d9aaa
commit 6de9e22b4c

View File

@@ -167,7 +167,7 @@ const checkResultData = reactive<CheckData.CheckResult[]>([])
const popoverWidth: ComputedRef<string> = computed(() => {
// return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (harmNumList.length || checkList.length ? 160 : 0)}px`
return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (checkList.length ? 230 : 0)}px`
return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (checkList.length ? 220 : 0)}px`
})
// 原始数据表格数据
@@ -486,7 +486,7 @@ const formatHarmNum = (num: string) => {
}
const setRawData = (data: CheckData.RawDataItem[]) => {
console.log("原始数据", data)
data.forEach((item: CheckData.RawDataItem) => {
item.dataA = stringToFixed(item.dataA)
item.dataB = stringToFixed(item.dataB)
@@ -494,6 +494,7 @@ const setRawData = (data: CheckData.RawDataItem[]) => {
item.dataT = stringToFixed(item.dataT)
})
Object.assign(rawTableData, data)
console.log("原始数据", rawTableData)
}
const numberToFixed = (num: number): string => {
@@ -512,13 +513,18 @@ const stringToFixed = (str: string): string => {
if (str == null || str == undefined) {
return '/'
} else {
let result = Number(str).toFixed(fixed)
let num = Number(str)
if (isNaN(num)) {
return '/'
}else{
let result = num.toFixed(fixed)
if (result === "-0.0000") {
return result.replace(/-/g, "")
}
return result
}
}
}
const getError = (num1: number, num2: number): string => {
if (num1 == null || num1 == undefined || num2 == null || num2 == undefined) {