Browse Source

Merge branch 'bzq1/excel_size' of eta_server/eta_api into debug

baoziqiang 3 months ago
parent
commit
d0c47cacdd

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

@@ -110,6 +110,7 @@ type TableDataReq struct {
 	Data          []EdbInfoData     `description:"数据列表"`
 	TextRowData   [][]ManualDataReq `description:"文本列表"`
 	DecimalConfig []DecimalConfig   `description:"小数位数配置"`
+	DateSize      interface{}       `description:"日期列的大小"`
 }
 type DecimalConfig struct {
 	Row     string `description:"行上的索引, 目前仅保存指标的日期"`

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

@@ -137,6 +137,7 @@ type MixCellShowStyle struct {
 	Nt              string      `description:"变换类型:number 小数点位数改变,percent百分比," json:"nt"`
 	GlObj           interface{} `description:"公式对象:1:数值,2:百分比,3:文本" json:"glObj"`
 	Width           float64     `description:"单元格宽度" json:"width"`
+	Height          float64     `description:"单元格高度" json:"height"`
 	Decimal         *int        `description:"小数点位数" json:"decimal"`
 	Last            string      `description:"起始操作:nt|decimal" json:"last"`
 	Color           string      `description:"颜色值,#RRG" json:"color"`

+ 15 - 0
services/data/excel/excel_info.go

@@ -158,6 +158,7 @@ func formatExcelInfo2Detail(excelInfo *excel.ExcelInfo, sysUserId int, lang stri
 					result.Data[i].HaveOperaAuth = data_manage_permission.CheckEdbPermissionByPermissionIdList(v.IsJoinPermission, currClassify.IsJoinPermission, v.EdbInfoId, v.ClassifyId, permissionEdbIdList, permissionClassifyIdList)
 				}
 			}
+			setTextCellDefaultSize(result.TextRowData)
 		}
 
 		excelDetail.TableData = result
@@ -186,6 +187,20 @@ func formatExcelInfo2Detail(excelInfo *excel.ExcelInfo, sysUserId int, lang stri
 	return
 }
 
+// 设置默认的文本单元格大小
+func setTextCellDefaultSize(textRowData [][]request.ManualDataReq) {
+	for i := range textRowData {
+		for j := range textRowData[i] {
+			if textRowData[i][j].Width == 0 {
+				textRowData[i][j].Width = 140
+			}
+			if textRowData[i][j].Height == 0 {
+				textRowData[i][j].Height = 35
+			}
+		}
+	}
+}
+
 // SetExcelByDecimalConfig 设置表格的小数位
 func SetExcelByDecimalConfig(tableData request.TableDataReq, config []request.DecimalConfig) request.TableDataReq {
 	excelData := tableData.Data

+ 7 - 3
services/data/excel/mixed_table.go

@@ -465,21 +465,22 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 	if err != nil {
 		return
 	}
-	config = setDefaultCellWidth(config)
+	config = setDefaultCellSize(config)
 
 	newMixedTableCellDataList = config
 
 	return
 }
 
-func setDefaultCellWidth(config [][]request.MixedTableCellDataReq) (newConfig [][]request.MixedTableCellDataReq) {
+func setDefaultCellSize(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,
+					Width:  140,
+					Height: 35,
 				}
 			} else {
 				err := json.Unmarshal([]byte(cell.ShowStyle), &styleConf)
@@ -489,6 +490,9 @@ func setDefaultCellWidth(config [][]request.MixedTableCellDataReq) (newConfig []
 				if styleConf.Width == 0 {
 					styleConf.Width = 140
 				}
+				if styleConf.Height == 0 {
+					styleConf.Height = 35
+				}
 			}
 			tmpStyleConf, err := json.Marshal(styleConf)
 			if err == nil {

+ 3 - 0
services/data/excel/time_table.go

@@ -28,6 +28,7 @@ type TableDataConfig struct {
 	TableEdbInfoList []TableEdbInfo            `description:"表格内指标信息"`
 	TextRowData      [][]request.ManualDataReq `description:"文本列表"`
 	DecimalConfig    []request.DecimalConfig   `description:"小数位数配置"`
+	DateSize         interface{}               `description:"日期列大小"`
 }
 
 // TableEdbInfo
@@ -340,6 +341,7 @@ func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp reque
 		Sort:          tableDataConfig.Sort,
 		TextRowData:   textRowListDataResp,
 		Data:          data,
+		DateSize:      tableDataConfig.DateSize,
 	}
 
 	return
@@ -491,6 +493,7 @@ func GetTableDataConfig(reqData request.TableDataReq) (tableDataConfig TableData
 	tableDataConfig.Data = manualDataList
 	tableDataConfig.TableEdbInfoList = tableEdbInfoList
 	tableDataConfig.TextRowData = reqData.TextRowData
+	tableDataConfig.DateSize = reqData.DateSize
 
 	return
 }