瀏覽代碼

fix:调研

zqbao 6 月之前
父節點
當前提交
63cb43054a
共有 2 個文件被更改,包括 16 次插入8 次删除
  1. 1 0
      models/data_manage/excel/request/mixed_table.go
  2. 15 8
      services/data/excel/mixed_table.go

+ 1 - 0
models/data_manage/excel/request/mixed_table.go

@@ -136,6 +136,7 @@ type MixCellShowStyle struct {
 	Pn              int         `description:"小数点位数增加或减少,正数表述增加,负数表示减少" json:"pn"`
 	Nt              string      `description:"变换类型:number 小数点位数改变,percent百分比," json:"nt"`
 	GlObj           interface{} `description:"公式对象:1:数值,2:百分比,3:文本" json:"glObj"`
+	Width           float64     `description:"单元格宽度" json:"width"`
 	Decimal         *int        `description:"小数点位数"`
 	Last            string      `description:"起始操作:nt|decimal"`
 	Color           string      `description:"颜色值,#RRG" json:"color"`

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

@@ -1202,11 +1202,15 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 				// 前端传过来的json中有可能有glObj,需要去掉
 				if styleConf.GlObj != nil {
 					styleConf.GlObj = nil
-					tmpStyleConf, err := json.Marshal(styleConf)
-					if err == nil {
-						cell.ShowStyle = string(tmpStyleConf)
-					}
 				}
+				if styleConf.Width == 0 {
+					styleConf.Width = 140
+				}
+				tmpStyleConf, err := json.Marshal(styleConf)
+				if err == nil {
+					cell.ShowStyle = string(tmpStyleConf)
+				}
+
 				config[cellPosition.Column][cellPosition.Row] = cell
 				continue
 			}
@@ -1225,10 +1229,13 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 			// 前端传过来的json中有可能有glObj,需要去掉
 			if styleConf.GlObj != nil {
 				styleConf.GlObj = nil
-				tmpStyleConf, err := json.Marshal(styleConf)
-				if err == nil {
-					cell.ShowStyle = string(tmpStyleConf)
-				}
+			}
+			if styleConf.Width == 0 {
+				styleConf.Width = 140
+			}
+			tmpStyleConf, err := json.Marshal(styleConf)
+			if err == nil {
+				cell.ShowStyle = string(tmpStyleConf)
 			}
 			config[cellPosition.Column][cellPosition.Row] = cell
 		}