|
@@ -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) {
|
|
|
// 单元格的标签名
|
|
@@ -1203,9 +1232,6 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
|
|
|
if styleConf.GlObj != nil {
|
|
|
styleConf.GlObj = nil
|
|
|
}
|
|
|
- if styleConf.Width == 0 {
|
|
|
- styleConf.Width = 140
|
|
|
- }
|
|
|
tmpStyleConf, err := json.Marshal(styleConf)
|
|
|
if err == nil {
|
|
|
cell.ShowStyle = string(tmpStyleConf)
|
|
@@ -1230,9 +1256,6 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
|
|
|
if styleConf.GlObj != nil {
|
|
|
styleConf.GlObj = nil
|
|
|
}
|
|
|
- if styleConf.Width == 0 {
|
|
|
- styleConf.Width = 140
|
|
|
- }
|
|
|
tmpStyleConf, err := json.Marshal(styleConf)
|
|
|
if err == nil {
|
|
|
cell.ShowStyle = string(tmpStyleConf)
|