xyxie 9 months ago
parent
commit
654532fe2f
1 changed files with 8 additions and 6 deletions
  1. 8 6
      services/data/excel/balance_table.go

+ 8 - 6
services/data/excel/balance_table.go

@@ -162,8 +162,8 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 			}
 
 			// 长度固定,避免一直申请内存空间
-			dateList = make([]string, endColumn-startColumn+1)
-
+			//dateList = make([]string, endColumn-startColumn+1)
+			dateList = make([]string, 0)
 			i := 0
 			for currColumn := startColumn; currColumn <= endColumn; currColumn++ {
 				currCell, ok := newMixedTableCellDataListMap[startNum][currColumn]
@@ -172,7 +172,8 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 					err = errors.New(errMsg)
 					return
 				}
-				dateList[i] = currCell.ShowValue
+				dateList = append(dateList, currCell.ShowValue)
+				//dateList[i] = currCell.ShowValue
 				i++
 			}
 
@@ -257,7 +258,8 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 				endColumn = maxCol - 1
 			}
 			// 长度固定,避免一直申请内存空间
-			dataList = make([]string, endColumn-startColumn+1)
+			//dataList = make([]string, endColumn-startColumn+1)
+			dataList = make([]string, 0)
 			i := 0
 			for currColumn := startColumn; currColumn <= endColumn; currColumn++ {
 				currCell, ok := newMixedTableCellDataListMap[startNum][currColumn]
@@ -266,8 +268,8 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 					err = errors.New(errMsg)
 					return
 				}
-				//dataList = append(dataList, currCell.Value)
-				dataList[i] = currCell.ShowValue
+				dataList = append(dataList, currCell.Value)
+				//dataList[i] = currCell.ShowValue
 				i++
 			}