Browse Source

fix:表格在应用层调整

Roc 1 month ago
parent
commit
026ffd3e91

+ 12 - 0
controllers/excel_info.go

@@ -43,6 +43,9 @@ func (this *ExcelInfoController) GetTableDetail() {
 		return
 	}
 	fromScene, _ := this.GetInt("FromScene", 0)
+	referencedId, _ := this.GetInt("ReferencedId", 0)
+	uuid := this.GetString("Uuid")
+
 	key := utils.HZ_CHART_LIB_EXCEL_TABLE_DETAIL + ":" + uniqueCode
 	resp := new(response.ExcelTableDetailResp)
 
@@ -201,6 +204,14 @@ func (this *ExcelInfoController) GetTableDetail() {
 		}
 	}
 
+	// 获取表格引用
+	reference, err := models.GetReferencedExcelConfig(referencedId, fromScene, uniqueCode, uuid)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取表格引用失败,Err:" + err.Error()
+		return
+	}
+
 	resp.TableInfo = tableData
 	resp.Source = excelInfo.Source
 	resp.ExcelType = excelInfo.ExcelType
@@ -209,6 +220,7 @@ func (this *ExcelInfoController) GetTableDetail() {
 	resp.UniqueCode = excelInfo.UniqueCode
 	resp.Config = config
 	resp.SourcesFrom = excelInfo.SourcesFrom
+	resp.ReferencedExcelConfig = reference
 
 	if utils.Re == nil {
 		data, _ := json.Marshal(resp)

+ 29 - 0
models/referenced_excel_config.go

@@ -0,0 +1,29 @@
+package models
+
+import (
+	"eta_gn/eta_chart_lib/global"
+	"time"
+)
+
+type ReferencedExcelConfig struct {
+	ReferencedExcelConfigId int       `orm:"column(referenced_excel_config_id);pk;auto" ` // excel表格配置id
+	UniqueCode              string    // 表格唯一编码
+	ReferencedId            int       // 被引用的id,报告就是报告id,pptId
+	FromScene               int       // 引用类型 1智能研报 2研报列表 3英文研报 4PPT 5英文ppt
+	Uuid                    string    // 引用唯一标识
+	WidthList               string    // 宽度数组
+	HeightList              string    // 高度数组
+	OpUserId                int       // 当前编辑操作的用户id
+	OpUserName              string    // 当前编辑的用户名称(冗余字段,避免查表)
+	CreateTime              time.Time // 创建时间
+	Content                 string    // 内容
+	ModifyTime              time.Time // 修改时间
+}
+
+// getByCode
+func GetReferencedExcelConfig(referencedId, fromScene int, uniqueCode, uuid string) (item ReferencedExcelConfig, err error) {
+	sql := ` SELECT * FROM referenced_excel_config WHERE referenced_id = ? AND from_scene = ? AND unique_code = ? AND uuid = ? `
+	err = global.DmSQL["data"].Raw(sql, referencedId, fromScene, uniqueCode, uuid).First(&item).Error
+
+	return
+}

+ 1 - 0
models/request/mixed_table.go

@@ -168,6 +168,7 @@ type MixCellShowStyle struct {
 	Color           string      `description:"颜色值,#RRG" json:"color"`
 	BackgroundColor string      `description:"背景颜色值,#RRG" json:"background-color"`
 	Align           string      `description:"对齐方式:left|center|right" json:"align"`
+	FontSize        string      `description:"字体大小" json:"font-size"`
 }
 
 type DateDataBeforeAfterReq struct {

+ 11 - 10
models/response/excel_info.go

@@ -10,16 +10,17 @@ import (
 // ExcelTableDetailResp  excel表格详情
 type ExcelTableDetailResp struct {
 	//ChartInfo   *ChartInfo
-	UniqueCode    string `description:"表格唯一code"`
-	Source        int    `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
-	ExcelType     int    `description:"表格类型,1:指标列,2:日期列,默认:1"`
-	ExcelImage    string `description:"表格截图"`
-	ExcelName     string `description:"表格名称"`
-	SourcesFrom   string `description:"图表来源"`
-	ExcelSource   string `description:"表格来源str"`
-	ExcelSourceEn string `description:"表格来源(英文)"`
-	TableInfo     excel.TableData
-	Config        ExcelTableDetailConfigResp
+	UniqueCode            string `description:"表格唯一code"`
+	Source                int    `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
+	ExcelType             int    `description:"表格类型,1:指标列,2:日期列,默认:1"`
+	ExcelImage            string `description:"表格截图"`
+	ExcelName             string `description:"表格名称"`
+	SourcesFrom           string `description:"图表来源"`
+	ExcelSource           string `description:"表格来源str"`
+	ExcelSourceEn         string `description:"表格来源(英文)"`
+	TableInfo             excel.TableData
+	Config                ExcelTableDetailConfigResp
+	ReferencedExcelConfig models.ReferencedExcelConfig `description:"表格引用信息"`
 }
 
 // ExcelTableDetailConfigResp

+ 3 - 0
services/excel/lucky_sheet.go

@@ -1254,6 +1254,9 @@ func GetTableDataByMixedTableData(config [][]request.MixedTableCellDataReq, hide
 						tmp.HorizontalType = 2
 						tmp.Ht = 2
 					}
+					if styleConfig.FontSize != "" {
+						tmp.Fs = styleConfig.FontSize
+					}
 					_, err := strconv.ParseFloat(cell.ShowValue, 64)
 					if err == nil {
 						hasPercent := false