|
@@ -465,12 +465,41 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
+ config = setDefaultCellWidth(config)
|
|
|
|
|
|
newMixedTableCellDataList = config
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func setDefaultCellWidth(config [][]request.MixedTableCellDataReq) (newConfig [][]request.MixedTableCellDataReq) {
|
|
|
+ newConfig = config
|
|
|
+ for i, row := range config {
|
|
|
+ for j, cell := range row {
|
|
|
+ var styleConf request.MixCellShowStyle
|
|
|
+ if cell.ShowStyle == `` {
|
|
|
+ styleConf = request.MixCellShowStyle{
|
|
|
+ Width: 140,
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ err := json.Unmarshal([]byte(cell.ShowStyle), &styleConf)
|
|
|
+ if err != nil {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if styleConf.Width == 0 {
|
|
|
+ styleConf.Width = 140
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tmpStyleConf, err := json.Marshal(styleConf)
|
|
|
+ if err == nil {
|
|
|
+ cell.ShowStyle = string(tmpStyleConf)
|
|
|
+ }
|
|
|
+ newConfig[i][j] = cell
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// getCalculateValue 获取公式计算的结果
|
|
|
func getCalculateValueByCell(calculateCellMap map[string]Cell, key string, cellKeyValMap map[string]float64) (val float64, has bool, err error, errMsg string) {
|
|
|
// 单元格的标签名
|
|
@@ -1211,11 +1240,12 @@ 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)
|
|
|
- }
|
|
|
}
|
|
|
+ tmpStyleConf, err := json.Marshal(styleConf)
|
|
|
+ if err == nil {
|
|
|
+ cell.ShowStyle = string(tmpStyleConf)
|
|
|
+ }
|
|
|
+
|
|
|
config[cellPosition.Column][cellPosition.Row] = cell
|
|
|
continue
|
|
|
}
|