Browse Source

fix:去除表格样式上的globj

zqbao 6 months ago
parent
commit
9baba609c8

+ 2 - 2
models/data_manage/excel/excel_info_rule_mapping.go

@@ -31,10 +31,10 @@ type ExcelInfoRuleMappingView struct {
 	ExcelInfoId            int    `description:"Excel信息ID"`
 	RuleType               int    `description:"规则类型"`
 	LeftValue              string `description:"左值"`
-	LeftValueBack          string `description:"左值后端存储"`
+	LeftValueBack          string `description:"左值后端存储" json:"-"`
 	LeftValueType          int    `description:"左值类型"`
 	RightValue             string `description:"右值"`
-	RightValueBack         string `description:"右值后端存储"`
+	RightValueBack         string `description:"右值后端存储" json:"-"`
 	RightValueType         int    `description:"右值类型"`
 	FontColor              string `description:"字体颜色"`
 	BackgroundColor        string `description:"背景颜色"`

+ 15 - 0
services/data/excel/mixed_table.go

@@ -1193,6 +1193,21 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 			}
 			_, e := strconv.ParseFloat(val, 64) // 将字符串转换成float类型
 			if e != nil {                       // 如果没有错误发生则返回true,说明该字符串是一个合法的数字
+				var styleConf request.MixCellShowStyle
+				err = json.Unmarshal([]byte(cell.ShowStyle), &styleConf)
+				if err != nil {
+					err = fmt.Errorf("日期计算配置json解析失败失败: %s, Err:%s", config, err.Error())
+					return
+				}
+				// 前端传过来的json中有可能有glObj,需要去掉
+				if styleConf.GlObj != nil {
+					styleConf.GlObj = nil
+					tmpStyleConf, err := json.Marshal(styleConf)
+					if err == nil {
+						cell.ShowStyle = string(tmpStyleConf)
+					}
+				}
+				config[cellPosition.Column][cellPosition.Row] = cell
 				continue
 			}
 			var styleConf request.MixCellShowStyle