Quellcode durchsuchen

fix:百分号进位

zqbao vor 6 Monaten
Ursprung
Commit
0af8682f3f
1 geänderte Dateien mit 3 neuen und 1 gelöschten Zeilen
  1. 3 1
      services/data/excel/mixed_table.go

+ 3 - 1
services/data/excel/mixed_table.go

@@ -1264,8 +1264,10 @@ func getDecimalLen(str string, isPercent bool) (decimalPlaces int) {
 
 func roundNumber(num string, decimalPlaces int, hasPercent bool) string {
 	numFloat, _ := strconv.ParseFloat(num, 64)
+	if hasPercent {
+		numFloat = numFloat * 100
+	}
 	numFloat, _ = decimal.NewFromFloat(numFloat).Round(int32(decimalPlaces)).Float64()
-
 	numStr := strconv.FormatFloat(numFloat, 'f', decimalPlaces, 64)
 	if hasPercent {
 		numStr += "%"