Browse Source

Merge branch 'feature/eta_1.9.9' into debug

hsun 8 tháng trước cách đây
mục cha
commit
30af6d18c3

+ 1 - 1
controllers/data_manage/excel/balance_table.go

@@ -1412,7 +1412,7 @@ func downloadBalanceTable(excelInfo *excel.ExcelInfo, lang string) (savePath, zi
 				errMsg = msg
 				return
 			}
-			tableData, er := excel2.GetTableDataByMixedTableData(newResult)
+			tableData, er := excel2.GetTableDataByMixedTableData(newResult, false)
 			if er != nil {
 				errMsg = "获取失败"
 				err = fmt.Errorf("转换成table失败,Err:" + err.Error())

+ 2 - 2
controllers/data_manage/excel/excel_info.go

@@ -1609,7 +1609,7 @@ func (c *ExcelInfoController) GetExcelTableData() {
 			br.ErrMsg = "获取最新的数据失败,Err:" + err.Error()
 			return
 		}
-		tableData, err = excel.GetTableDataByMixedTableData(newResult)
+		tableData, err = excel.GetTableDataByMixedTableData(newResult, true)
 		if err != nil {
 			br.Msg = "获取失败"
 			br.ErrMsg = "转换成table失败,Err:" + err.Error()
@@ -2467,7 +2467,7 @@ func (c *ExcelInfoController) Download() {
 			br.ErrMsg = "获取最新的数据失败,Err:" + err.Error()
 			return
 		}
-		tableData, err = excel.GetTableDataByMixedTableData(newResult)
+		tableData, err = excel.GetTableDataByMixedTableData(newResult, false)
 		if err != nil {
 			br.Msg = "获取失败"
 			br.ErrMsg = "转换成table失败,Err:" + err.Error()

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

@@ -45,6 +45,16 @@ type MixedTableCellDataReq struct {
 	Extra           string      `description:"额外参数"`
 	ShowStyle       string      `description:"展示的样式配置"`
 	ShowFormatValue interface{} `description:"样式处理后的值"`
+	MerData         *struct {
+		Type string `json:"type"`
+		Mer  struct {
+			SKey    string `json:"sKey"`
+			Rowspan int    `json:"rowspan"`
+			Colspan int    `json:"colspan"`
+			Row     int    `json:"row"`
+			Col     int    `json:"col"`
+		} `json:"mer"`
+	} `json:"merData" description:"合并单元格"`
 }
 
 // CellRelationConf

+ 12 - 1
services/excel/lucky_sheet.go

@@ -1713,7 +1713,7 @@ func GetTableDataByCustomData(excelType int, data request.TableDataReq, lang str
 }
 
 // GetTableDataByMixedTableData 通过混合表格数据获取表格数据
-func GetTableDataByMixedTableData(config [][]request.MixedTableCellDataReq) (selfTableData TableData, err error) {
+func GetTableDataByMixedTableData(config [][]request.MixedTableCellDataReq, hideMerged bool) (selfTableData TableData, err error) {
 	tableDataList := make([][]LuckySheetDataValue, 0)
 	mergeList := make([]TableDataMerge, 0)
 
@@ -1727,6 +1727,17 @@ func GetTableDataByMixedTableData(config [][]request.MixedTableCellDataReq) (sel
 					Monitor:   cell.ShowValue,
 					MergeCell: LuckySheetDataConfigMerge{},
 				}
+				// TODO: 混合表格/平衡表-合并单元格
+				// 前端需要隐藏被合并的单元格, 混合表格/平衡表通过这个字段判断, 不通过HandleTableCell方法隐藏
+				if cell.MerData != nil {
+					if hideMerged && cell.MerData.Type == "merged" {
+						continue
+					}
+					tmp.MergeCell.Rs = cell.MerData.Mer.Rowspan
+					tmp.MergeCell.Cs = cell.MerData.Mer.Colspan
+					tmp.MergeCell.Row = cell.MerData.Mer.Row
+					tmp.MergeCell.Column = cell.MerData.Mer.Col
+				}
 				if cell.ShowStyle != "" {
 					showFormatValue := fmt.Sprintf("%v", cell.ShowFormatValue)
 					tmp.Monitor = showFormatValue