소스 검색

fix: 科学计数法

hsun 8 달 전
부모
커밋
ed562d48da
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      services/data/excel/mixed_table.go

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

@@ -1258,7 +1258,8 @@ func changePointDecimalPlaces(str string, changeNum int, numberType string, isPe
 		val, _ = decimal.NewFromFloat(val).Round(int32(decimalPlaces)).Float64()
 		newStr = strconv.FormatFloat(val, 'f', decimalPlaces, 64)
 	} else {
-		newStr = fmt.Sprintf("%v", val)
+		// 此处用%.f避免科学计数法, 从而导致后面出现很多位0
+		newStr = fmt.Sprintf("%.f", val)
 	}
 	// 计算小数位数
 	decimalPlaces = 0