浏览代码

Merge branch 'feature/eta_1.9.9' into custom

hsun 9 月之前
父节点
当前提交
3941fdd8a4

+ 3 - 0
controllers/data_manage/chart_info.go

@@ -1013,6 +1013,7 @@ func (this *ChartInfoController) ChartInfoDetail() {
 			br.ErrMsg = "获取主题信息失败,Err:" + err.Error()
 			return
 		}
+
 		chartInfo.ChartThemeStyle = chartTheme.Config
 		chartInfo.ChartThemeId = chartTheme.ChartThemeId
 
@@ -1508,6 +1509,7 @@ func (this *ChartInfoController) ChartInfoDetailV2() {
 		br.ErrMsg = "获取主题信息失败,Err:" + err.Error()
 		return
 	}
+
 	chartInfo.ChartThemeStyle = chartTheme.Config
 	chartInfo.ChartThemeId = chartTheme.ChartThemeId
 
@@ -2637,6 +2639,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 		errMsg = "获取主题信息失败,Err:" + err.Error()
 		return
 	}
+
 	chartInfo.ChartThemeStyle = chartTheme.Config
 	chartInfo.ChartThemeId = chartTheme.ChartThemeId
 

+ 10 - 0
controllers/data_manage/chart_theme.go

@@ -52,6 +52,16 @@ func (c *ChartThemeController) List() {
 		return
 	}
 
+	// 兼容历史数据,加入新字段LineOptionList
+	for i, v := range list {
+		newConfig, e := data.ConvertOldChartOptions(v.Config)
+		if e != nil {
+			continue
+		}
+		list[i].Config = newConfig
+	}
+
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"

+ 117 - 13
controllers/data_manage/excel/excel_info.go

@@ -229,6 +229,7 @@ func (c *ExcelInfoController) Add() {
 		IsDelete:        0,
 		ModifyTime:      time.Now(),
 		CreateTime:      time.Now(),
+		SourcesFrom:     req.SourcesFrom,
 	}
 
 	excelEdbMappingList := make([]*excel3.ExcelEdbMapping, 0)
@@ -732,13 +733,14 @@ func (c *ExcelInfoController) Edit() {
 	excelInfo.ExcelClassifyId = req.ExcelClassifyId
 	excelInfo.ExcelImage = req.ExcelImage
 	excelInfo.Content = content
+	excelInfo.SourcesFrom = req.SourcesFrom
 
 	// 自动保存时不会传缩略图,也就不更新这个字段
 	var updateExcelInfoParams []string
 	if req.ExcelImage != "" {
-		updateExcelInfoParams = []string{"ModifyTime", "ExcelName", "ExcelType", "ExcelClassifyId", "ExcelImage", "Content"}
+		updateExcelInfoParams = []string{"ModifyTime", "ExcelName", "ExcelType", "ExcelClassifyId", "ExcelImage", "Content", "SourcesFrom"}
 	} else {
-		updateExcelInfoParams = []string{"ModifyTime", "ExcelName", "ExcelType", "ExcelClassifyId", "Content"}
+		updateExcelInfoParams = []string{"ModifyTime", "ExcelName", "ExcelType", "ExcelClassifyId", "Content", "SourcesFrom"}
 	}
 
 	excelEdbMappingList := make([]*excel3.ExcelEdbMapping, 0)
@@ -1268,6 +1270,7 @@ func (c *ExcelInfoController) GetExcelTableData() {
 	}
 
 	var tableData excel.TableData
+	var excelSource, excelSourceEn string
 	switch excelInfo.Source {
 	case utils.EXCEL_DEFAULT:
 		luckySheetData, err := excel.GetLuckySheetData(excelInfo.Content)
@@ -1302,6 +1305,14 @@ func (c *ExcelInfoController) GetExcelTableData() {
 			br.ErrMsg = "转换成table失败,Err:" + err.Error()
 			return
 		}
+		sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList(result.EdbInfoIdList)
+		if err != nil {
+			br.Msg = "自定义表格数据获取失败"
+			br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
+			return
+		}
+		excelSource = strings.Join(sourceNameList, ",")
+		excelSourceEn = strings.Join(sourceNameEnList, ",")
 	case utils.MIXED_TABLE:
 		var result request.MixedTableReq
 		err = json.Unmarshal([]byte(excelInfo.Content), &result)
@@ -1319,12 +1330,32 @@ 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()
 			return
 		}
+		edbInfoIds := make([]int, 0)
+		edbInfoIdExist := make(map[int]bool)
+		if len(newResult) > 0 {
+			for _, t := range newResult {
+				for _, v := range t {
+					if v.EdbInfoId > 0 && !edbInfoIdExist[v.EdbInfoId] {
+						edbInfoIdExist[v.EdbInfoId] = true
+						edbInfoIds = append(edbInfoIds, v.EdbInfoId)
+					}
+				}
+			}
+		}
+		sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList(edbInfoIds)
+		if err != nil {
+			br.Msg = "自定义表格数据获取失败"
+			br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
+			return
+		}
+		excelSource = strings.Join(sourceNameList, ",")
+		excelSourceEn = strings.Join(sourceNameEnList, ",")
 
 	}
 
@@ -1347,11 +1378,14 @@ func (c *ExcelInfoController) GetExcelTableData() {
 	}
 
 	resp := response.ExcelTableDetailResp{
-		UniqueCode: excelInfo.UniqueCode,
-		ExcelImage: excelInfo.ExcelImage,
-		ExcelName:  excelInfo.ExcelName,
-		TableInfo:  tableData,
-		Config:     config,
+		UniqueCode:    excelInfo.UniqueCode,
+		ExcelImage:    excelInfo.ExcelImage,
+		ExcelName:     excelInfo.ExcelName,
+		TableInfo:     tableData,
+		Config:        config,
+		SourcesFrom:   excelInfo.SourcesFrom,
+		ExcelSource:   excelSource,
+		ExcelSourceEn: excelSourceEn,
 	}
 	br.Ret = 200
 	br.Success = true
@@ -1532,12 +1566,23 @@ func (c *ExcelInfoController) GetFirstEdbData() {
 		}
 	}
 
+	sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList([]int{edbInfoId})
+	if err != nil {
+		br.Msg = "自定义表格数据获取失败"
+		br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
+		return
+	}
+	excelSource := strings.Join(sourceNameList, ",")
+	excelSourceEn := strings.Join(sourceNameEnList, ",")
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
 	br.Data = response.TableDataItem{
-		EdbInfoId: edbInfoId,
-		Data:      dataList,
+		EdbInfoId:     edbInfoId,
+		Data:          dataList,
+		ExcelSource:   excelSource,
+		ExcelSourceEn: excelSourceEn,
 	}
 }
 
@@ -1600,12 +1645,23 @@ func (c *ExcelInfoController) GetOtherEdbData() {
 		}
 	}
 
+	sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList([]int{req.EdbInfoId})
+	if err != nil {
+		br.Msg = "自定义表格数据获取失败"
+		br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
+		return
+	}
+	excelSource := strings.Join(sourceNameList, ",")
+	excelSourceEn := strings.Join(sourceNameEnList, ",")
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
 	br.Data = response.TableDataItem{
-		EdbInfoId: req.EdbInfoId,
-		Data:      dataList,
+		EdbInfoId:     req.EdbInfoId,
+		Data:          dataList,
+		ExcelSource:   excelSource,
+		ExcelSourceEn: excelSourceEn,
 	}
 }
 
@@ -2133,7 +2189,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()
@@ -2527,3 +2583,51 @@ func (c *ExcelInfoController) GetBatchChartRefreshResult() {
 	br.Ret = 200
 	br.Success = true
 }
+
+// GetBatchChartRefreshResult
+// @Title 获取批量刷新表格结果
+// @Description 获取批量刷新表格结果
+// @Param   EdbInfoId   query   int  true       "edb id"
+// @Success Ret=200 刷新成功
+// @router /excel_info/get_edb_source [get]
+func (c *ExcelInfoController) GetEdbSource() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		c.Data["json"] = br
+		c.ServeJSON()
+	}()
+	sysUser := c.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	edbInfoId, _ := c.GetInt("EdbInfoId")
+	if edbInfoId <= 0 {
+		br.Msg = "请选择指标"
+		br.ErrMsg = "请选择指标"
+		br.IsSendEmail = false
+		return
+	}
+	sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList([]int{edbInfoId})
+	if err != nil {
+		br.Msg = "自定义表格数据获取失败"
+		br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
+		return
+	}
+	excelSource := strings.Join(sourceNameList, ",")
+	excelSourceEn := strings.Join(sourceNameEnList, ",")
+
+	var resp struct {
+		ExcelSource   string `description:"表格来源"`
+		ExcelSourceEn string `description:"表格来源(英文)"`
+	}
+
+	resp.ExcelSource = excelSource
+	resp.ExcelSourceEn = excelSourceEn
+
+	br.Data = resp
+	br.Ret = 200
+	br.Success = true
+}

+ 85 - 0
models/data_manage/chart_theme/request/theme.go

@@ -28,3 +28,88 @@ type SetDefaultThemeReq struct {
 	ChartThemeId     int `description:"主题id"`
 	ChartThemeTypeId int `description:"主题类型id"`
 }
+
+
+type ColorsOptions []string
+
+type LegendOptions struct {
+	VerticalAlign string `json:"verticalAlign"`
+	ItemStyle     struct {
+		Color        string `json:"color"`
+		FontSize     int    `json:"fontSize"`
+		Cursor       string `json:"cursor"`
+		FontWeight   string `json:"fontWeight"`
+		TextOverflow string `json:"textOverflow"`
+	} `json:"itemStyle"`
+}
+
+type TitleOptions struct {
+	Align string `json:"align"`
+	Style struct {
+		Color    string `json:"color"`
+		FontSize int    `json:"fontSize"`
+	} `json:"style"`
+}
+
+type MarkerOptions struct {
+	Style struct {
+		Color    string `json:"color"`
+		FontSize int    `json:"fontSize"`
+	} `json:"style"`
+}
+
+type AxisOptions struct {
+	Style struct {
+		Color    string `json:"color"`
+		FontSize int    `json:"fontSize"`
+	} `json:"style"`
+}
+
+type DrawOption struct {
+	PlotBackgroundColor string `json:"plotBackgroundColor"`
+}
+
+type LineOptions struct {
+	DashStyle string  `json:"dashStyle"`
+	LineWidth int     `json:"lineWidth"`
+	LineType  string  `json:"lineType"`
+	Radius    float64 `json:"radius"`
+}
+
+type OldChartOptions struct {
+	ColorsOptions  []string         `json:"colorsOptions"`
+	LineOptions    LineOptions      `json:"lineOptions"`
+	LegendOptions  interface{}      `json:"legendOptions"`
+	TitleOptions   interface{}      `json:"titleOptions"`
+	MarkerOptions  interface{}      `json:"markerOptions"`
+	XAxisOptions   interface{}      `json:"xAxisOptions"`
+	YAxisOptions   interface{}      `json:"yAxisOptions"`
+	DrawOption     interface{}      `json:"drawOption"`
+	LineOptionList []LineStyleOptions `json:"lineOptionList"`
+}
+
+type NewChartOptions struct {
+	OldChartOptions
+	LineOptionList []NewLineOptions `json:"lineOptionList"`
+}
+
+type NewLineOptions struct {
+	LineOptions
+	Color     string `json:"color"`
+	DataMark  string `json:"dataMark"`
+	MarkType  string `json:"markType"`
+	MarkSize  int    `json:"markSize"`
+	MarkColor string `json:"markColor"`
+}
+
+type LineStyleOptions struct {
+	DashStyle string `json:"dashStyle"`
+	Color     string `json:"color"`
+	LineWidth int    `json:"lineWidth"`
+	LineType  string `json:"lineType"`
+	Radius    int `json:"radius"`
+	DataMark  string `json:"dataMark"`
+	MarkType  string `json:"markType"`
+	MarkSize  int `json:"markSize"`
+	MarkColor string `json:"markColor"`
+}

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

@@ -31,6 +31,7 @@ type ExcelInfo struct {
 	UpdateUserRealName string    `description:"更新人真实姓名"`
 	RelExcelInfoId     int       `description:"平衡表里静态表关联的动态表excel id"`
 	VersionName        string    `description:"静态表版本名称"`
+	SourcesFrom        string    `description:"图表来源"`
 }
 
 // Update 更新 excel表格基础信息

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

@@ -23,6 +23,7 @@ type AddExcelInfoReq struct {
 	ExcelClassifyId int         `description:"分类id"`
 	Content         string      `description:"Excel表格内容"`
 	TableData       interface{} `description:"自定义表格的数据内容"`
+	SourcesFrom     string      `description:"图表来源"`
 }
 
 // EditExcelInfoReq 编辑表格请求
@@ -34,6 +35,7 @@ type EditExcelInfoReq struct {
 	ExcelClassifyId int         `description:"分类id"`
 	Content         string      `description:"Excel表格内容"`
 	TableData       interface{} `description:"自定义表格的数据内容"`
+	SourcesFrom     string      `description:"图表来源"`
 }
 
 // SetExcelInfoImageReq 设置excel表格图片请求

+ 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

+ 15 - 7
models/data_manage/excel/response/excel_info.go

@@ -22,11 +22,14 @@ type ExcelListResp struct {
 
 // ExcelTableDetailResp  excel表格详情
 type ExcelTableDetailResp struct {
-	UniqueCode string `description:"表格唯一code"`
-	ExcelImage string `description:"表格截图"`
-	ExcelName  string `description:"表格名称"`
-	TableInfo  excel.TableData
-	Config     ExcelTableDetailConfigResp
+	UniqueCode    string `description:"表格唯一code"`
+	ExcelImage    string `description:"表格截图"`
+	ExcelName     string `description:"表格名称"`
+	TableInfo     excel.TableData
+	Config        ExcelTableDetailConfigResp
+	SourcesFrom   string `description:"图表来源"`
+	ExcelSource   string `description:"表格来源str"`
+	ExcelSourceEn string `description:"表格来源(英文)"`
 }
 
 // ExcelTableDetailConfigResp
@@ -44,8 +47,10 @@ type TableCellResp struct {
 }
 
 type TableDataItem struct {
-	EdbInfoId int                     `description:"指标id"`
-	Data      []request.ManualDataReq `description:"数据列表"`
+	EdbInfoId     int                     `description:"指标id"`
+	Data          []request.ManualDataReq `description:"数据列表"`
+	ExcelSource   string                  `description:"表格来源str"`
+	ExcelSourceEn string                  `description:"表格来源(英文)"`
 }
 
 // TableDetailResp  excel表格详情
@@ -82,6 +87,9 @@ type ExcelInfoDetail struct {
 	UpdateUserId       int                          `description:"更新人id"`
 	UpdateUserRealName string                       `description:"更新人真实姓名"`
 	RelExcelInfoId     int                          `description:"平衡表里静态表关联的动态表excel id"`
+	SourcesFrom        string                       `description:"图表来源"`
+	ExcelSource        string                       `description:"表格来源str"`
+	ExcelSourceEn      string                       `description:"表格来源(英文)"`
 }
 
 // ExcelInfoDetailButton 操作按钮

+ 9 - 0
routers/commentsRouter.go

@@ -817,6 +817,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_mobile/controllers/data_manage/excel:ExcelInfoController"] = append(beego.GlobalControllerRouter["eta/eta_mobile/controllers/data_manage/excel:ExcelInfoController"],
+        beego.ControllerComments{
+            Method: "GetEdbSource",
+            Router: `/excel_info/get_edb_source`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_mobile/controllers/data_manage/excel:ExcelInfoController"] = append(beego.GlobalControllerRouter["eta/eta_mobile/controllers/data_manage/excel:ExcelInfoController"],
         beego.ControllerComments{
             Method: "GetSystemDate",

+ 50 - 0
services/data/chart_theme.go

@@ -5,6 +5,7 @@ import (
 	"errors"
 	"eta/eta_mobile/models/data_manage"
 	"eta/eta_mobile/models/data_manage/chart_theme"
+	"eta/eta_mobile/models/data_manage/chart_theme/request"
 	"eta/eta_mobile/utils"
 	"fmt"
 	"github.com/shopspring/decimal"
@@ -580,6 +581,10 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
 
 	// 如果找到了,那么就返回
 	if chartTheme != nil {
+		newConfig, e := ConvertOldChartOptions(chartTheme.Config)
+		if e == nil {
+			chartTheme.Config = newConfig
+		}
 		return
 	}
 
@@ -588,12 +593,20 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
 	// 查找主题类型id
 	chartThemeType, err := chart_theme.GetChartThemeTypeByChartTypeAndSource(chartType, source)
 	if err != nil {
+		newConfig, e := ConvertOldChartOptions(chartTheme.Config)
+		if e == nil {
+			chartTheme.Config = newConfig
+		}
 		return
 	}
 
 	// 寻找默认的主题id
 	chartTheme, err = chart_theme.GetChartThemeId(chartThemeType.DefaultChartThemeId)
 	if err != nil && err.Error() != utils.ErrNoRow() {
+		newConfig, e := ConvertOldChartOptions(chartTheme.Config)
+		if e == nil {
+			chartTheme.Config = newConfig
+		}
 		return
 	}
 
@@ -607,5 +620,42 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
 	// 如果还是没找到,那就系统的主题id
 	chartTheme, err = chart_theme.GetSystemChartTheme(chartThemeType.ChartThemeTypeId)
 
+	// 兼容历史数据,加入新字段LineOptionList
+	newConfig, e := ConvertOldChartOptions(chartTheme.Config)
+	if e == nil {
+		chartTheme.Config = newConfig
+	}
+
 	return
 }
+
+
+// 兼容历史数据,加入新字段LineOptionList
+func ConvertOldChartOptions(config string) (newConfig string, err error) {
+	var oldTheme request.OldChartOptions
+
+	var newTheme request.NewChartOptions
+	err = json.Unmarshal([]byte(config), &oldTheme)
+	if err != nil {
+		return
+	}
+	if oldTheme.LineOptionList != nil && len(oldTheme.LineOptionList) > 0 {
+		newConfig = config
+		return
+	}
+	newTheme.OldChartOptions = oldTheme
+	for i := 0; i < 10; i++ {
+		newLineOption := request.NewLineOptions{
+			LineOptions: oldTheme.LineOptions,
+			Color:       oldTheme.ColorsOptions[i],
+			DataMark:    "none",
+			MarkType:    "square",
+			MarkSize:    5,
+			MarkColor:   oldTheme.ColorsOptions[i],
+		}
+		newTheme.LineOptionList = append(newTheme.LineOptionList, newLineOption)
+	}
+	newThemeStr, _ := json.Marshal(newTheme)
+	newConfig = string(newThemeStr)
+	return
+}

+ 82 - 1
services/data/excel/excel_info.go

@@ -3,6 +3,7 @@ package excel
 import (
 	"encoding/json"
 	"errors"
+	"eta/eta_mobile/models"
 	"eta/eta_mobile/models/data_manage"
 	"eta/eta_mobile/models/data_manage/excel"
 	"eta/eta_mobile/models/data_manage/excel/request"
@@ -99,6 +100,7 @@ func formatExcelInfo2Detail(excelInfo *excel.ExcelInfo, sysUserId int, lang stri
 		CreateTime:      excelInfo.CreateTime,
 		TableData:       nil,
 		HaveOperaAuth:   haveOperaAuth,
+		SourcesFrom:     excelInfo.SourcesFrom,
 	}
 
 	// 无权限,不需要返回数据
@@ -151,7 +153,13 @@ func formatExcelInfo2Detail(excelInfo *excel.ExcelInfo, sysUserId int, lang stri
 				}
 			}
 		}
-
+		sourceNameList, sourceNameEnList, e := GetEdbSourceByEdbInfoIdList(result.EdbInfoIdList)
+		if e != nil {
+			err = errors.New("自定义表格数据获取失败,Err:" + e.Error())
+			return
+		}
+		excelDetail.ExcelSource = strings.Join(sourceNameList, ",")
+		excelDetail.ExcelSourceEn = strings.Join(sourceNameEnList, ",")
 		excelDetail.TableData = result
 	case utils.MIXED_TABLE: // 混合表格
 		var result request.MixedTableReq
@@ -171,6 +179,26 @@ func formatExcelInfo2Detail(excelInfo *excel.ExcelInfo, sysUserId int, lang stri
 		}
 		result.Data = newData
 		excelDetail.TableData = result
+
+		edbInfoIds := make([]int, 0)
+		edbInfoIdExist := make(map[int]bool)
+		if len(result.Data) > 0 {
+			for _, t := range result.Data {
+				for _, v := range t {
+					if v.EdbInfoId > 0 && !edbInfoIdExist[v.EdbInfoId] {
+						edbInfoIdExist[v.EdbInfoId] = true
+						edbInfoIds = append(edbInfoIds, v.EdbInfoId)
+					}
+				}
+			}
+		}
+		sourceNameList, sourceNameEnList, e := GetEdbSourceByEdbInfoIdList(edbInfoIds)
+		if e != nil {
+			err = errors.New("自定义表格数据获取失败,Err:" + e.Error())
+			return
+		}
+		excelDetail.ExcelSource = strings.Join(sourceNameList, ",")
+		excelDetail.ExcelSourceEn = strings.Join(sourceNameEnList, ",")
 	}
 	if excelDetail.Source == utils.BALANCE_TABLE {
 		excelDetail.Button = GetBalanceExcelInfoOpButton(sysUserId, checkExcelInfo.SysUserId, excelDetail.HaveOperaAuth, checkExcelInfo.ExcelInfoId)
@@ -1427,3 +1455,56 @@ func GetExcelEdbBatchRefreshKey(source string, reportId, chapterId int) string {
 
 	return fmt.Sprint("batch_refresh_excel_edb:", source, ":", reportId, ":", chapterId)
 }
+
+
+// GetEdbSourceByEdbInfoIdList 获取关联指标的来源
+func GetEdbSourceByEdbInfoIdList(edbInfoIdList []int) (sourceNameList, sourceNameEnList []string,err error) {
+	sourceNameList = make([]string, 0)
+	sourceNameEnList = make([]string, 0)
+	sourceMap := make(map[int]string)
+	edbInfoList, tmpErr := data_manage.GetEdbInfoByIdList(edbInfoIdList)
+	if tmpErr != nil {
+		err = tmpErr
+		return
+	}
+	for _, v := range edbInfoList {
+		// 指标类型:1:基础指标,2:计算指标
+		if v.EdbType == 2 {
+			//sourceMap[0] = "弘则研究"
+			baseEdbInfoArr, _, _ := data_manage.GetRefreshEdbInfoFromBase(v.EdbInfoId, v.Source)
+			for _, baseEdbInfo := range baseEdbInfoArr {
+				if baseEdbInfo.EdbInfoType == 0 { //普通指标才参与,预测指标不参与
+					sourceMap[baseEdbInfo.Source] = baseEdbInfo.SourceName
+				}
+			}
+		} else {
+			sourceMap[v.Source] = v.SourceName
+		}
+	}
+
+	for source, sourceName := range sourceMap {
+		if utils.InArrayByInt([]int{utils.DATA_SOURCE_MANUAL, utils.DATA_SOURCE_MYSTEEL_CHEMICAL}, source) {
+			continue
+		}
+		sourceNameList = append(sourceNameList, sourceName)
+
+		sourceNameEn, ok := utils.DataSourceEnMap[source]
+		if !ok {
+			sourceNameEn = sourceName
+		}
+		sourceNameEnList = append(sourceNameEnList, sourceNameEn)
+	}
+	//sourceNameList = append(sourceNameList, utils.ChartDefaultNameCn)
+	//sourceNameEnList = append(sourceNameEnList, utils.ChartDefaultNameEn)
+
+	// 图表来源
+	conf, e := models.GetBusinessConf()
+	if e != nil {
+		return
+	}
+	if conf[models.BusinessConfCompanyName] != "" {
+		sourceNameList = append(sourceNameList, conf[models.BusinessConfCompanyName])
+		sourceNameEnList = append(sourceNameEnList, conf[models.BusinessConfCompanyName])
+	}
+	return
+}

+ 18 - 3
services/excel/lucky_sheet.go

@@ -1685,7 +1685,7 @@ func GetTableDataByCustomData(excelType int, data request.TableDataReq) (selfTab
 }
 
 // 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)
 
@@ -1694,11 +1694,26 @@ func GetTableDataByMixedTableData(config [][]request.MixedTableCellDataReq) (sel
 		for _, row := range config {
 			dataCol := make([]LuckySheetDataValue, 0)
 			for _, cell := range row {
-				dataCol = append(dataCol, LuckySheetDataValue{
+				tmp := LuckySheetDataValue{
 					Value:     cell.Value,
 					Monitor:   cell.ShowValue,
 					MergeCell: LuckySheetDataConfigMerge{},
-				})
+				}
+				// 前端需要隐藏被合并的单元格, 混合表格/平衡表通过这个字段判断, 不通过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
+				}
+				dataCol = append(dataCol, tmp)
 			}
 			tableDataList = append(tableDataList, dataCol)
 		}