xyxie hai 1 ano
pai
achega
c5fc3bbf98
Modificáronse 1 ficheiros con 6 adicións e 6 borrados
  1. 6 6
      services/data/excel/mixed_table.go

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

@@ -1183,9 +1183,12 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 				err = fmt.Errorf("日期计算配置json解析失败失败: %s, Err:%s", config, err.Error())
 				return
 			}
-
-			val = changePointDecimalPlaces(val, styleConf.Pn, styleConf.Nt, isPercent)
-			cell.ShowFormatValue = val
+			if styleConf.Pn != 0 || styleConf.Nt != "" {
+				val = changePointDecimalPlaces(val, styleConf.Pn, styleConf.Nt, isPercent)
+				cell.ShowFormatValue = val
+			} else {
+				cell.ShowFormatValue = cell.ShowStyle
+			}
 			config[cellPosition.Column][cellPosition.Row] = cell
 		}
 	}
@@ -1195,9 +1198,6 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 // changePointDecimalPlaces 小数点位数加减和百分比格式
 func changePointDecimalPlaces(str string, changeNum int, numberType string, isPercent bool) (newStr string) {
 	newStr = str
-	if numberType == "" && changeNum == 0 {
-		return
-	}
 	// 把字符串转成浮点数
 	val, _ := strconv.ParseFloat(str, 64)
 	if isPercent {