Selaa lähdekoodia

fix:不支持手动输入的%

zqbao 4 kuukautta sitten
vanhempi
commit
487a12942f
1 muutettua tiedostoa jossa 8 lisäystä ja 7 poistoa
  1. 8 7
      services/data/excel/mixed_table.go

+ 8 - 7
services/data/excel/mixed_table.go

@@ -1186,11 +1186,12 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 
 			cell := config[cellPosition.Column][cellPosition.Row]
 			val := cell.ShowValue
-			isPercent := false
-			if strings.Contains(val, "%") {
-				isPercent = true
-				val = strings.Trim(val, "%")
-			}
+			// 前端暂不支持不支持手动输入的%
+			// isPercent := false
+			// if strings.Contains(val, "%") {
+			// 	isPercent = true
+			// 	val = strings.Trim(val, "%")
+			// }
 			_, e := strconv.ParseFloat(val, 64) // 将字符串转换成float类型
 			if e != nil {                       // 如果没有错误发生则返回true,说明该字符串是一个合法的数字
 				var styleConf request.MixCellShowStyle
@@ -1217,11 +1218,11 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 				return
 			}
 			hasPercent := false
-			if styleConf.Nt == "percent" || isPercent {
+			if styleConf.Nt == "percent" {
 				hasPercent = true
 			}
 			if styleConf.Pn != 0 || styleConf.Nt != "" {
-				val := changePointDecimalPlaces(val, styleConf.Pn, styleConf.Nt, isPercent)
+				val := changePointDecimalPlaces(val, styleConf.Pn, styleConf.Nt, hasPercent)
 				cell.ShowFormatValue = val
 				// 修复历史数据,没有保存小数位数, 重置小数位数
 				if styleConf.Pn > 0 {