Эх сурвалжийг харах

fix:混合表格小数位数

zqbao 6 сар өмнө
parent
commit
d49f47088b

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

@@ -1222,8 +1222,8 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 				hasPercent = true
 			}
 			if styleConf.Pn != 0 || styleConf.Nt != "" {
-				val = changePointDecimalPlaces(val, styleConf.Pn, styleConf.Nt, hasPercent)
-				cell.ShowFormatValue = val
+				// val = changePointDecimalPlaces(val, styleConf.Pn, styleConf.Nt, hasPercent)
+				// cell.ShowFormatValue = val
 				// 修复历史数据,没有保存小数位数,重置小数位数
 				if styleConf.Pn != 0 {
 					if styleConf.Decimal == nil {
@@ -1233,6 +1233,7 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 					if *styleConf.Decimal < 0 {
 						*styleConf.Decimal = 0
 					}
+					cell.ShowFormatValue = utils.RoundNumber(cell.ShowValue, *styleConf.Decimal, hasPercent)
 					styleConf.Pn = 0
 				} else if styleConf.Decimal != nil {
 					cell.ShowFormatValue = utils.RoundNumber(cell.ShowValue, *styleConf.Decimal, hasPercent)
@@ -1247,7 +1248,6 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 				}
 			} else if styleConf.Decimal != nil {
 				cell.ShowFormatValue = utils.RoundNumber(cell.ShowValue, *styleConf.Decimal, hasPercent)
-
 			} else {
 				cell.ShowFormatValue = cell.ShowValue
 			}