xyxie 7 months ago
parent
commit
4be6920e3c
1 changed files with 18 additions and 3 deletions
  1. 18 3
      services/data/chart_extra_config.go

+ 18 - 3
services/data/chart_extra_config.go

@@ -13,7 +13,7 @@ import (
 	"time"
 )
 
-func HandleExtraConfig(chartType int, extraConfigStr string) (newExtraConfigStr string, newAllExtraConfigStr string, err error, errMsg string) {
+func HandleExtraConfig(chartInfoId int, chartType int, extraConfigStr string) (newExtraConfigStr string, newAllExtraConfigStr string, err error, errMsg string) {
 	newExtraConfigStr = extraConfigStr
 	switch chartType {
 	case 10: // 截面散点图
@@ -46,7 +46,7 @@ func HandleExtraConfig(chartType int, extraConfigStr string) (newExtraConfigStr
 			err = errors.New(errMsg)
 			return
 		}
-		newAllExtraConfig, e, msg := handleChartSectionCombineData(sectionExtraConfig)
+		newAllExtraConfig, e, msg := handleChartSectionCombineData(chartInfoId, sectionExtraConfig)
 		if e != nil {
 			err = e
 			errMsg = msg
@@ -244,7 +244,7 @@ func GetEnNameMapByCnNameList(cnNameList []string) (contentEnMap map[string]stri
 }
 
 // handleSectionScatterChartData 截面组合图的英文文案处理
-func handleChartSectionCombineData(extraConfig data_manage.ChartSectionAllExtraConf) (newExtraConfig data_manage.ChartSectionAllExtraConf, err error, errMsg string) {
+func handleChartSectionCombineData(chartInfoId int, extraConfig data_manage.ChartSectionAllExtraConf) (newExtraConfig data_manage.ChartSectionAllExtraConf, err error, errMsg string) {
 	dateConfListMapSave := make(map[string]bool)
 	for k, v := range extraConfig.DateConfList {
 		if v.DateConfNameEn == "" {
@@ -277,6 +277,21 @@ func handleChartSectionCombineData(extraConfig data_manage.ChartSectionAllExtraC
 			}
 		}
 	}
+
+	if chartInfoId > 0 {
+		// 查询表里的系列信息
+		chartSectionCombineEdbList, e := data_manage.GetChartSeriesEdbByChartInfoId(chartInfoId)
+		if e != nil {
+			err = e
+			errMsg = "查询图表系列信息失败"
+			return
+		}
+		for _, info := range chartSectionCombineEdbList {
+			if info.DateConfType == 1 && info.DateConfName != "" {
+				dateConfListMapSave[info.DateConfName] = true
+			}
+		}
+	}
 	newExtraConfig = extraConfig
 	// 去掉没有被引用的配置
 	newExtraConfig.DateConfList = make([]*data_manage.ChartSectionDateConfItem, 0)