Browse Source

图表新增右二轴上下限字段

hsun 1 year ago
parent
commit
845fb204a6
2 changed files with 31 additions and 6 deletions
  1. 2 0
      controllers/data_manage/chart_info.go
  2. 29 6
      models/data_manage/chart_info.go

+ 2 - 0
controllers/data_manage/chart_info.go

@@ -1206,6 +1206,8 @@ func (this *ChartInfoController) CopyChartInfo() {
 		LeftMax:           oldChartInfo.LeftMax,
 		RightMin:          oldChartInfo.RightMin,
 		RightMax:          oldChartInfo.RightMax,
+		Right2Min:         oldChartInfo.Right2Min,
+		Right2Max:         oldChartInfo.Right2Max,
 		Disabled:          oldChartInfo.Disabled,
 		Source:            oldChartInfo.Source,
 		ExtraConfig:       oldChartInfo.ExtraConfig,

+ 29 - 6
models/data_manage/chart_info.go

@@ -36,6 +36,9 @@ type ChartInfo struct {
 	LeftMax           string `description:"图表左侧最大值"`
 	RightMin          string `description:"图表右侧最小值"`
 	RightMax          string `description:"图表右侧最大值"`
+	Right2Min         string `description:"图表右侧2最小值"`
+	Right2Max         string `description:"图表右侧2最大值"`
+	MinMaxSave        int    `description:"是否手动保存过上下限:0-否;1-是"`
 	Disabled          int    `description:"是否禁用,0:启用,1:禁用,默认:0"`
 	BarConfig         string `description:"柱方图的配置,json数据"`
 	Source            int    `description:"1:ETA图库;2:商品价格曲线"`
@@ -154,13 +157,15 @@ type SaveChartInfoReq struct {
 	StartDate        string           `description:"自定义开始日期"`
 	EndDate          string           `description:"自定义结束日期"`
 	Calendar         string           `description:"公历/农历"`
-	SeasonStartDate  string           `description:"季节性图开始日期"`
-	SeasonEndDate    string           `description:"季节性图开始日期"`
 	LeftMin          string           `description:"图表左侧最小值"`
 	LeftMax          string           `description:"图表左侧最大值"`
 	RightMin         string           `description:"图表右侧最小值"`
 	RightMax         string           `description:"图表右侧最大值"`
+	Right2Min        string           `description:"图表右侧最小值"`
+	Right2Max        string           `description:"图表右侧最大值"`
+	MinMaxSave       int              `description:"是否手动保存过上下限:0-否;1-是"`
 	ExtraConfig      string           `description:"图表额外配置,json数据"`
+	StartYear        int              `description:"当选择的日期类型为最近N年类型时,即date_type=20, 用start_year表示N"`
 }
 
 type ChartSaveItem struct {
@@ -229,6 +234,8 @@ type EditChartInfoReq struct {
 	LeftMax              string                  `description:"图表左侧最大值"`
 	RightMin             string                  `description:"图表右侧最小值"`
 	RightMax             string                  `description:"图表右侧最大值"`
+	Right2Min            string                  `description:"图表右侧最小值"`
+	Right2Max            string                  `description:"图表右侧最大值"`
 	BarChartInfo         BarChartInfoReq         `description:"柱方图的配置"`
 	CorrelationChartInfo CorrelationChartInfoReq `description:"相关性图表配置"`
 	ExtraConfig          string                  `description:"图表额外配置信息,json字符串"`
@@ -581,8 +588,12 @@ func ModifyChartInfoAndMapping(edbInfoIdStr string, req *SaveChartInfoReq, chart
  			  left_min=?,
 			  left_max=?,
 			  right_min=?,
-			  right_max=?`
-		pars := []interface{}{edbInfoIdStr, req.DateType, req.StartDate, req.EndDate, req.LeftMin, req.LeftMax, req.RightMin, req.RightMax}
+			  right_max=?,
+			  right2_min=?,
+			  right2_max=?,
+			  min_max_save=?,
+              start_year=?`
+		pars := []interface{}{edbInfoIdStr, req.DateType, req.StartDate, req.EndDate, req.LeftMin, req.LeftMax, req.RightMin, req.RightMax, req.Right2Min, req.Right2Max, req.MinMaxSave, req.StartYear}
 		if req.ExtraConfig != `` {
 			updateStr += `,extra_config=? `
 			pars = append(pars, req.ExtraConfig)
@@ -601,14 +612,21 @@ func ModifyChartInfoAndMapping(edbInfoIdStr string, req *SaveChartInfoReq, chart
               edb_info_ids=?,
 			  modify_time = NOW(),
 			  calendar=?,
+			  date_type=?,
+			  start_date=?,
+			  end_date=?,
 			  season_start_date=?,
 			  season_end_date=?,
 			  left_min=?,
 			  left_max=?,
 			  right_min=?,
-			  right_max=?
+			  right_max=?,
+			  right2_min=?,
+			  right2_max=?,
+			  min_max_save=?,
+			  start_year=?
 			WHERE chart_info_id = ?`
-		_, err = to.Raw(sql, edbInfoIdStr, req.Calendar, req.SeasonStartDate, req.SeasonEndDate, req.LeftMin, req.LeftMax, req.RightMin, req.RightMax, req.ChartInfoId).Exec()
+		_, err = to.Raw(sql, edbInfoIdStr, req.Calendar, req.DateType, req.StartDate, req.EndDate, req.StartDate, req.EndDate, req.LeftMin, req.LeftMax, req.RightMin, req.RightMax, req.Right2Min, req.Right2Max, req.MinMaxSave, req.StartYear, req.ChartInfoId).Exec()
 		if err != nil {
 			fmt.Println("UPDATE  chart_info Err:", err.Error())
 			return err
@@ -1061,6 +1079,8 @@ type AddChartInfoReq struct {
 	LeftMax              string                  `description:"图表左侧最大值"`
 	RightMin             string                  `description:"图表右侧最小值"`
 	RightMax             string                  `description:"图表右侧最大值"`
+	Right2Min            string                  `description:"图表右侧2最小值"`
+	Right2Max            string                  `description:"图表右侧2最大值"`
 	BarChartInfo         BarChartInfoReq         `description:"柱方图的配置"`
 	CorrelationChartInfo CorrelationChartInfoReq `description:"相关性图表配置"`
 	ExtraConfig          string                  `description:"图表额外配置信息,json字符串"`
@@ -1322,6 +1342,9 @@ type ChartInfoView struct {
 	LeftMax           string `description:"图表左侧最大值"`
 	RightMin          string `description:"图表右侧最小值"`
 	RightMax          string `description:"图表右侧最大值"`
+	Right2Min         string `description:"图表右侧最小值"`
+	Right2Max         string `description:"图表右侧最大值"`
+	MinMaxSave        int    `description:"是否手动保存过上下限:0-否;1-是"`
 	IsEdit            bool   `description:"是否有编辑权限"`
 	IsEnChart         bool   `description:"是否展示英文标识"`
 	WarnMsg           string `description:"错误信息"`