Browse Source

百分数变换

xyxie 1 year ago
parent
commit
70fce38998
2 changed files with 6 additions and 10 deletions
  1. 2 6
      models/request/mixed_table.go
  2. 4 4
      services/data/table/mixed_table.go

+ 2 - 6
models/request/mixed_table.go

@@ -150,12 +150,8 @@ type MixDateCalculateTagReq struct {
 
 // MixCellShowStyle 混合表格 单元格样式展示计算
 type MixCellShowStyle struct {
-	NumberStyle MixNumberShowStyle `description:"小数点位数增加或减少,百分比"`
-}
-
-type MixNumberShowStyle struct {
-	AddPointNum int `description:"显示的计算类型:小数点位数增加或减少,正数表述增加,负数表示减少"`
-	IsPercent   int `description:"是否是百分比1 是,0否, 将选中的单元格的样式设置成百分比"`
+	Pn int    `description:"小数点位数增加或减少,正数表述增加,负数表示减少" json:"pn"`
+	Nt string `description:"变换类型:number 小数点位数改变,percent百分比," json:"nt"`
 }
 
 type DateDataBeforeAfterReq struct {

+ 4 - 4
services/data/table/mixed_table.go

@@ -1197,12 +1197,12 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 				return
 			}
 
-			if styleConf.NumberStyle.AddPointNum != 0 {
+			if styleConf.Pn != 0 {
 				//val = CountDecimalPlaces(val)
-				val = changePointDecimalPlaces(cell.ShowStyle, styleConf.NumberStyle.AddPointNum)
+				val = changePointDecimalPlaces(cell.ShowValue, styleConf.Pn)
 			}
-			if styleConf.NumberStyle.IsPercent == 1 {
-				val = changeToPercent(cell.ShowStyle)
+			if styleConf.Nt == "percent" {
+				val = changeToPercent(cell.ShowValue)
 			}
 			cell.ShowFormatValue = val
 			config[cellPosition.Column][cellPosition.Row] = cell