Browse Source

fix:时序表格数据样式修改

zqbao 5 months ago
parent
commit
3992f44281
1 changed files with 31 additions and 11 deletions
  1. 31 11
      services/excel/lucky_sheet.go

+ 31 - 11
services/excel/lucky_sheet.go

@@ -1033,12 +1033,16 @@ func GetTableDataByCustomData(excelType int, data request.TableDataReq, lang str
 					if v.Data[i].DataType == 5 {
 						background = "#ffefdd"
 					}
-					dataCol = append(dataCol, LuckySheetDataValue{
+					tmpCol := LuckySheetDataValue{
 						Value:      v.Data[i].Value,
 						Monitor:    v.Data[i].ShowValue,
 						MergeCell:  LuckySheetDataConfigMerge{},
 						Background: background,
-					})
+					}
+					if tmpCol.Monitor == `` {
+						tmpCol.Monitor = "-"
+					}
+					dataCol = append(dataCol, tmpCol)
 				}
 
 				tableDataList = append(tableDataList, dataCol)
@@ -1050,11 +1054,16 @@ func GetTableDataByCustomData(excelType int, data request.TableDataReq, lang str
 			for _, textColList := range data.TextRowData {
 				dataCol := make([]LuckySheetDataValue, 0)
 				for _, v := range textColList {
-					dataCol = append(dataCol, LuckySheetDataValue{
+					tmpCol := LuckySheetDataValue{
 						Value:     v.Value,
 						Monitor:   v.ShowValue,
 						MergeCell: LuckySheetDataConfigMerge{},
-					})
+					}
+					tmpCol.Value = v.Value
+					if tmpCol.Monitor == "" {
+						tmpCol.Monitor = "-"
+					}
+					dataCol = append(dataCol, tmpCol)
 				}
 				tableDataList = append(tableDataList, dataCol)
 			}
@@ -1100,11 +1109,15 @@ func GetTableDataByCustomData(excelType int, data request.TableDataReq, lang str
 
 			// 文本列
 			for _, textColList := range data.TextRowData {
-				firstCol = append(firstCol, LuckySheetDataValue{
+				tmpCol := LuckySheetDataValue{
 					Value:     textColList[0].Value,
 					Monitor:   textColList[0].ShowValue,
 					MergeCell: LuckySheetDataConfigMerge{},
-				})
+				}
+				if tmpCol.Monitor == `` {
+					tmpCol.Monitor = "-"
+				}
+				firstCol = append(firstCol, tmpCol)
 			}
 
 			tableDataList = append(tableDataList, firstCol)
@@ -1158,23 +1171,30 @@ func GetTableDataByCustomData(excelType int, data request.TableDataReq, lang str
 				if tmpData.DataType == 5 {
 					background = "#ffefdd"
 				}
-				dataCol = append(dataCol, LuckySheetDataValue{
+				tmpCol := LuckySheetDataValue{
 					Value:      tmpData.Value,
 					Monitor:    tmpData.ShowValue,
 					MergeCell:  LuckySheetDataConfigMerge{},
 					Background: background,
-				})
+				}
+				if tmpCol.Monitor == `` {
+					tmpCol.Monitor = "-"
+				}
+				dataCol = append(dataCol, tmpCol)
 			}
 
 			// 文本列
 			for _, textColList := range data.TextRowData {
-				dataCol = append(dataCol, LuckySheetDataValue{
+				tmpCol := LuckySheetDataValue{
 					Value:     textColList[i+1].Value,
 					Monitor:   textColList[i+1].ShowValue,
 					MergeCell: LuckySheetDataConfigMerge{},
-				})
+				}
+				if tmpCol.Monitor == `` {
+					tmpCol.Monitor = "-"
+				}
+				dataCol = append(dataCol, tmpCol)
 			}
-
 			tableDataList = append(tableDataList, dataCol)
 		}