From 549b028809cf1dd5a31f28e3e923bf3dc73d6e1c Mon Sep 17 00:00:00 2001 From: caiyiling <1321909229@qq.com> Date: Tue, 3 Jun 2025 14:27:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=9Edicom=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../visit-review/components/FileViewer.vue | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/src/views/trials/trials-panel/reading/visit-review/components/FileViewer.vue b/src/views/trials/trials-panel/reading/visit-review/components/FileViewer.vue index 7ec2136d..4ffde6d0 100644 --- a/src/views/trials/trials-panel/reading/visit-review/components/FileViewer.vue +++ b/src/views/trials/trials-panel/reading/visit-review/components/FileViewer.vue @@ -1038,26 +1038,26 @@ export default { if (area) { const areaLine = isEmptyArea ? `Area: Oblique not supported` - : `Area: ${ps ? parseFloat(area * ps * ps).toFixed(this.digitPlaces) : parseFloat(area).toFixed(this.digitPlaces)} ${ps ? 'mm' + '\xb2' : areaUnit}` + : `Area: ${ps ? this.reRound(csUtils.roundNumber(area * ps * ps), this.digitPlaces) : this.reRound(csUtils.roundNumber(area), this.digitPlaces)} ${ps ? 'mm' + '\xb2' : areaUnit}` textLines.push(areaLine) } if (mean) { - textLines.push(`Mean: ${parseFloat(mean).toFixed(this.digitPlaces)} ${modalityUnit}`) + textLines.push(`Mean: ${this.reRound(csUtils.roundNumber(mean), this.digitPlaces)} ${modalityUnit}`) } if (Number.isFinite(max)) { - textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`) + textLines.push(`Max: ${this.reRound(csUtils.roundNumber(max), this.digitPlaces)} ${modalityUnit}`) } if (stdDev) { - textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`) + textLines.push(`Std Dev: ${this.reRound(csUtils.roundNumber(stdDev), this.digitPlaces)} ${modalityUnit}`) } if (perimeter) { if (ps) { - textLines.push(`Perimeter: ${parseFloat(perimeter * ps).toFixed(this.digitPlaces)} mm`) + textLines.push(`Perimeter: ${this.reRound(csUtils.roundNumber(perimeter * ps), this.digitPlaces)} mm`) } else { - textLines.push(`Perimeter: ${parseFloat(perimeter).toFixed(this.digitPlaces)} ${unit}`) + textLines.push(`Perimeter: ${this.reRound(csUtils.roundNumber(perimeter), this.digitPlaces)} ${unit}`) } } @@ -1084,17 +1084,33 @@ export default { ps = parseFloat(this.psArr[i].PS).toFixed(3) } if (ps) { - textLines.push(`Area: ${parseFloat(area * ps * ps).toFixed(this.digitPlaces)} ${'mm' + '\xb2'}`) + textLines.push(`Area: ${this.reRound(csUtils.roundNumber(area * ps * ps), this.digitPlaces)} ${'mm' + '\xb2'}`) } else { - textLines.push(`Area: ${parseFloat(area).toFixed(this.digitPlaces)} ${areaUnit}`) + textLines.push(`Area: ${this.reRound(csUtils.roundNumber(area), this.digitPlaces)} ${areaUnit}`) } - - textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`) - textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`) - textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`) + textLines.push(`Mean: ${this.reRound(csUtils.roundNumber(mean), this.digitPlaces)} ${modalityUnit}`) + textLines.push(`Max: ${this.reRound(csUtils.roundNumber(max), this.digitPlaces)} ${modalityUnit}`) + textLines.push(`Std Dev: ${this.reRound(csUtils.roundNumber(stdDev), this.digitPlaces)} ${modalityUnit}`) return textLines }, + reRound(result, finalPrecision) { + if (result.includes(', ')) { + const numStrs = result.split(', ') + const processed = numStrs.map(str => this.processSingle(str, finalPrecision)) + return processed.join(', ') + } + return this.processSingle(result, finalPrecision) + }, + processSingle(str, precision) { + const num = parseFloat(str) + if (isNaN(num)) return 'NaN' + + // 保留原极小值处理逻辑 + if (Math.abs(num) < 0.0001) return str + const factor = 10 ** precision + return (Math.round(num * factor + 0.0000001) / factor).toFixed(precision) + }, debounce(callback, delay) { let timerId return function() {