From 52968d9aaaf49fbad40d2d038dfa8a110240ea24 Mon Sep 17 00:00:00 2001
From: caozehui <2427765068@qq.com>
Date: Mon, 13 Jan 2025 21:50:24 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A3=80=E6=B5=8B?=
=?UTF-8?q?=E7=BB=93=E6=9E=9C=EF=BC=8C=E5=8F=AF=E7=AD=9B=E9=80=89=E6=B5=8B?=
=?UTF-8?q?=E8=AF=95=E9=A1=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../dataCheckSingleChannelSingleTestPopup.vue | 156 +++++++++++-------
1 file changed, 96 insertions(+), 60 deletions(-)
diff --git a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue
index 495d4b3..7fab745 100644
--- a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue
+++ b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue
@@ -63,12 +63,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -131,9 +131,9 @@ const formContent = reactive({
chnNum: '',
})
// 当前选中的谐波次数
-const currentHarmNum = ref("-1")
+// const currentHarmNum = ref("-1")
// 谐波次数列表
-const harmNumList = reactive<{ value: string, label: string }[]>([])
+// const harmNumList = reactive<{ value: string, label: string }[]>([])
// 当前选中的检测项
const currentCheckItem = ref("")
// 检测项列表
@@ -166,7 +166,8 @@ let resTableData: { resultData: Map, rawData: Map } =
const checkResultData = reactive([])
const popoverWidth: ComputedRef = computed(() => {
- return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (harmNumList.length || checkList.length ? 160 : 0)}px`
+ // 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`
})
// 原始数据表格数据
@@ -216,30 +217,30 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
activeTab.value = 'resultTab'
})
-watch(currentHarmNum, (newVal, oldVal) => {
- console.log("谐波次数", newVal);
- if (newVal !== '-1') {
- let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal.toString())
- setCheckResultData(resCheckResult)
-
- let tempRawData = resTableData.rawData.get(newVal.toString())
- if (tempRawData) {
- setRawData(tempRawData)
- } else {
- setRawData([])
- }
- }
- activeTab.value = 'resultTab'
-})
+// watch(currentHarmNum, (newVal, oldVal) => {
+// console.log("谐波次数", newVal);
+// if (newVal !== '-1') {
+// let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal.toString())
+// setCheckResultData(resCheckResult)
+//
+// let tempRawData = resTableData.rawData.get(newVal.toString())
+// if (tempRawData) {
+// setRawData(tempRawData)
+// } else {
+// setRawData([])
+// }
+// }
+// activeTab.value = 'resultTab'
+// })
watch(currentCheckItem, (newVal, oldVal) => {
console.log("当前检测项", newVal);
if (newVal) {
- let key = newVal.toString() === 'Voltage' ? '电压幅值' : '持续时间'
- let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(key)
+ // let key = newVal.toString() === 'Voltage' ? '电压幅值' : '持续时间'
+ let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal)
setCheckResultData(resCheckResult)
- let tempRawData = resTableData.rawData.get(key)
+ let tempRawData = resTableData.rawData.get(newVal)
if (tempRawData) {
setRawData(tempRawData)
} else {
@@ -313,42 +314,59 @@ const updateTableData = async () => {
if (keys1.length === 1) {
resCheckResult = resTableData.resultData.get(keys1[0])
resRawData = resTableData.rawData.get(keys2[0])
- Object.assign(harmNumList, [])
- currentHarmNum.value = '-1'
+
+ // Object.assign(harmNumList, [])
+ // currentHarmNum.value = '-1'
resRawData = (resRawData == null || resRawData == undefined ? [] : resRawData)
resCheckResult = (resCheckResult == null || resCheckResult == undefined ? {} : resCheckResult)
setCheckResultData(resCheckResult)
setRawData(resRawData)
- } else if (resTableData.resultData.get('电压幅值') || resTableData.resultData.get('持续时间')) {
+ } else
+ // if (resTableData.resultData.get('电压幅值') || resTableData.resultData.get('持续时间')) {
+ // let tempCheckList = []
+ // if (resTableData.resultData.get('电压幅值')) {
+ // tempCheckList.push({value: 'Voltage', label: '电压幅值'})
+ // //resCheckResult = resTableData.resultData.get('电压幅值')
+ // }
+ // if (resTableData.resultData.get('持续时间')) {
+ // tempCheckList.push({value: 'Duration', label: '持续时间'})
+ // //resCheckResult = resTableData.resultData.get('持续时间')
+ // }
+ //
+ // Object.assign(checkList, tempCheckList)
+ // currentCheckItem.value = checkList[0].value
+ //
+ // Object.assign(harmNumList, [])
+ // currentHarmNum.value = '-1'
+ //
+ // //setCheckResultData(resCheckResult)
+ // } else
+ if (keys1.length != 0) {
+ // let tempHarmNumList: { value: string, label: string }[] = []
+ // for (let [key, value] of resTableData.resultData) {
+ // tempHarmNumList.push({
+ // value: key,
+ // label: value.isData === 1 ? key : value.isData === 4 ? `${formatHarmNum(key)}(/)` : `${formatHarmNum(key)}(不符合)`
+ // })
+ // }
+ //
+ // Object.assign(harmNumList, tempHarmNumList)
+ // currentHarmNum.value = harmNumList.length > 0 ? harmNumList[0].value : '-1'
+
let tempCheckList = []
- if (resTableData.resultData.get('电压幅值')) {
- tempCheckList.push({value: 'Voltage', label: '电压幅值'})
- //resCheckResult = resTableData.resultData.get('电压幅值')
- }
- if (resTableData.resultData.get('持续时间')) {
- tempCheckList.push({value: 'Duration', label: '持续时间'})
- //resCheckResult = resTableData.resultData.get('持续时间')
- }
-
- Object.assign(checkList, tempCheckList)
- currentCheckItem.value = checkList[0].value
-
- Object.assign(harmNumList, [])
- currentHarmNum.value = '-1'
-
- //setCheckResultData(resCheckResult)
- } else if (keys1.length != 0) {
- let tempHarmNumList: { value: string, label: string }[] = []
for (let [key, value] of resTableData.resultData) {
- tempHarmNumList.push({
+ let hum=formatHarmNum(key)
+ tempCheckList.push({
value: key,
- label: value.isData === 1 ? key : value.isData === 4 ? `${formatHarmNum(key)}(/)` : `${formatHarmNum(key)}(不符合)`
+ label: value.isData === 1 ? hum : value.isData === 4 ? `${hum}(/)` : `${hum}(不符合)`
})
}
- Object.assign(harmNumList, tempHarmNumList)
- currentHarmNum.value = harmNumList.length > 0 ? harmNumList[0].value : '-1'
+ // debugger
+ Object.assign(checkList, tempCheckList)
+
+ currentCheckItem.value = checkList[0].value
}
}
@@ -399,8 +417,8 @@ const close = () => {
chnNum: '',
})
treeDataAll.length = 0
- harmNumList.length = 0
- currentHarmNum.value = '-1'
+ // harmNumList.length = 0
+ // currentHarmNum.value = '-1'
currentCheckItem.value = ''
checkResultData.length = 0
rawTableData.length = 0
@@ -458,20 +476,22 @@ const setCheckResultData = (data: CheckData.ResCheckResult) => {
}
const formatHarmNum = (num: string) => {
+ // debugger
if (num.includes('.5')) {
return num
} else {
- return num.replace('.0', '')
+ num = num.replace('.0', '')
+ return num
}
}
const setRawData = (data: CheckData.RawDataItem[]) => {
console.log("原始数据", data)
data.forEach((item: CheckData.RawDataItem) => {
- item.dataA = item.dataA == null || item.dataA == undefined ? '/' : Number(item.dataA).toFixed(fixed).replace(/-/g, "")
- item.dataB = item.dataB == null || item.dataB == undefined ? '/' : Number(item.dataB).toFixed(fixed).replace(/-/g, "")
- item.dataC = item.dataC == null || item.dataC == undefined ? '/' : Number(item.dataC).toFixed(fixed).replace(/-/g, "")
- item.dataT = item.dataT == null || item.dataT == undefined ? '/' : Number(item.dataT).toFixed(fixed).replace(/-/g, "")
+ item.dataA = stringToFixed(item.dataA)
+ item.dataB = stringToFixed(item.dataB)
+ item.dataC = stringToFixed(item.dataC)
+ item.dataT = stringToFixed(item.dataT)
})
Object.assign(rawTableData, data)
}
@@ -480,7 +500,23 @@ const numberToFixed = (num: number): string => {
if (num == null || num == undefined) {
return '/'
} else {
- return num.toFixed(fixed).replace(/-/g, "")
+ let result = num.toFixed(fixed)
+ if (result === "-0.0000") {
+ return result.replace(/-/g, "")
+ }
+ return result
+ }
+}
+
+const stringToFixed = (str: string): string => {
+ if (str == null || str == undefined) {
+ return '/'
+ } else {
+ let result = Number(str).toFixed(fixed)
+ if (result === "-0.0000") {
+ return result.replace(/-/g, "")
+ }
+ return result
}
}
From 6de9e22b4c32de27f3d2363d9d0fb0911f7ae71c Mon Sep 17 00:00:00 2001
From: caozehui <2427765068@qq.com>
Date: Mon, 13 Jan 2025 22:05:46 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=90=E6=B3=A2=E6=AC=A1=E6=95=B0?=
=?UTF-8?q?=E5=88=87=E6=8D=A2=E6=97=B6=EF=BC=8C=E5=8E=9F=E5=A7=8B=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE=E6=98=BE=E7=A4=BA=E4=B8=BAT=E9=A1=B9NaN=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../dataCheckSingleChannelSingleTestPopup.vue | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue
index 7fab745..67d85dc 100644
--- a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue
+++ b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue
@@ -167,7 +167,7 @@ const checkResultData = reactive([])
const popoverWidth: ComputedRef = 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,11 +513,16 @@ const stringToFixed = (str: string): string => {
if (str == null || str == undefined) {
return '/'
} else {
- let result = Number(str).toFixed(fixed)
- if (result === "-0.0000") {
- return result.replace(/-/g, "")
+ let num = Number(str)
+ if (isNaN(num)) {
+ return '/'
+ }else{
+ let result = num.toFixed(fixed)
+ if (result === "-0.0000") {
+ return result.replace(/-/g, "")
+ }
+ return result
}
- return result
}
}