zwxi hai 10 meses
pai
achega
07275f0308

+ 19 - 1
controllers/data_manage/chart_theme.go

@@ -52,6 +52,24 @@ func (c *ChartThemeController) List() {
 		br.ErrMsg = "获取图表样式类型信息失败,Err:" + err.Error()
 		return
 	}
+	var oldTheme request.OldChartOptions
+	for i, v := range list {
+		var newTheme request.NewChartOptions
+		err = json.Unmarshal([]byte(v.Config), &oldTheme)
+		if err != nil {
+			continue
+		}
+		newTheme.OldChartOptions = oldTheme
+		for i := 0; i < 10; i++ {
+			newLineOption := request.NewLineOptions{
+				LineOptions: oldTheme.LineOptions,
+				Color:       oldTheme.ColorsOptions[i],
+			}
+			newTheme.LineOptionList = append(newTheme.LineOptionList, newLineOption)
+		}
+		newThemeStr, _ := json.Marshal(newTheme)
+		list[i].Config = string(newThemeStr)
+	}
 
 	br.Ret = 200
 	br.Success = true
@@ -329,7 +347,7 @@ func (c *ChartThemeController) Add() {
 }
 
 // Edit
-// @Title 新增主题
+// @Title 编辑主题
 // @Description
 // @Param	request	body request.DeleteThemeConfReq true "type json string"
 // @Success 200 Ret=200 修改成功

+ 4 - 2
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)

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

@@ -28,3 +28,70 @@ type SetDefaultThemeReq struct {
 	ChartThemeId     int `description:"主题id"`
 	ChartThemeTypeId int `description:"主题类型id"`
 }
+
+type ColorsOptions []string
+
+type LineOptions struct {
+	DashStyle string  `json:"dashStyle"`
+	LineWidth int     `json:"lineWidth"`
+	LineType  string  `json:"lineType"`
+	Radius    float64 `json:"radius"`
+}
+
+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 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"`
+}
+
+type NewChartOptions struct {
+	OldChartOptions
+	LineOptionList []NewLineOptions `json:"lineOptionList"`
+}
+
+type NewLineOptions struct {
+	LineOptions
+	Color string `json:"color"`
+}

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

@@ -25,6 +25,7 @@ type ExcelInfo struct {
 	ModifyTime       time.Time `description:"最近修改日期"`
 	CreateTime       time.Time `description:"创建日期"`
 	IsJoinPermission int       `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
+	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表格图片请求