|
@@ -134,25 +134,42 @@ func (c *ChartThemeController) GetThemePreviewData() {
|
|
|
extraConfigStr := ``
|
|
|
var barConfig data_manage.BarChartInfoReq
|
|
|
|
|
|
+ // 开始时间,结束时间
|
|
|
+ var tmpStartDate, tmpEndDate string
|
|
|
+
|
|
|
edbInfoIdList := make([]int, 0) // 指标列表
|
|
|
switch chartType {
|
|
|
- case 1, 4, 6: // 曲线图、堆积柱状图、组合图
|
|
|
+ case 1: // 曲线图
|
|
|
+ edbInfoIdList = []int{1, 2, 3, 4, 5}
|
|
|
+ chartInfo.ChartName = "曲线图"
|
|
|
+ case 4: // 堆积柱状图
|
|
|
+ edbInfoIdList = []int{1, 2, 3, 4, 5}
|
|
|
+ chartInfo.ChartName = "堆积柱状图"
|
|
|
+ dateType = 5
|
|
|
+ tmpStartDate = `2021-03-05`
|
|
|
+ case 6: // 组合图
|
|
|
edbInfoIdList = []int{1, 2, 3, 4, 5}
|
|
|
+ chartInfo.ChartName = "组合图"
|
|
|
+ dateType = 5
|
|
|
+ tmpStartDate = `2021-03-05`
|
|
|
case 2: // 季节性
|
|
|
dateType = 20 // 季节性图
|
|
|
edbInfoIdList = []int{6}
|
|
|
+ chartInfo.ChartName = "季节性图"
|
|
|
case 5: // 散点图
|
|
|
edbInfoIdList = []int{7, 8}
|
|
|
+ chartInfo.ChartName = "散点图"
|
|
|
case 7: // 柱形图
|
|
|
edbInfoIdList = []int{1, 2, 3, 4, 5}
|
|
|
chartInfo.LeftMin = "260"
|
|
|
chartInfo.LeftMax = "430"
|
|
|
extraConfigStr = `{"EdbInfoIdList":[{"EdbInfoId":1,"Name":"指标1","NameEn":"","Source":0},{"EdbInfoId":2,"Name":"指标2","NameEn":"","Source":0},{"EdbInfoId":3,"Name":"指标3","NameEn":"","Source":0},{"EdbInfoId":4,"Name":"指标4","NameEn":"","Source":0},{"EdbInfoId":5,"Name":"指标5","NameEn":"","Source":0}],"DateList":[{"Type":2,"Date":"","Value":100,"Color":"#00f","Name":""},{"Type":1,"Date":"","Value":0,"Color":"#f00","Name":""}],"Sort":{"Sort":0,"DateIndex":0},"XEdbList":null,"YEdbList":null,"Unit":"千桶","UnitEn":""}`
|
|
|
- err = json.Unmarshal([]byte(extraConfigStr), &barConfig)
|
|
|
+ chartInfo.ChartName = "柱形图"
|
|
|
case 10: // 截面散点图
|
|
|
edbInfoIdList = []int{9, 10, 11, 12, 13, 14, 15, 16, 17, 18}
|
|
|
extraConfigStr = `{"XName":"123","XNameEn":"123","XUnitName":"无","XUnitNameEn":"none","YName":"321","YNameEn":"321","YUnitName":"无","YUnitNameEn":"none","XMinValue":"250","XMaxValue":"371","YMinValue":"400","YMaxValue":"821","SeriesList":[{"Name":"2021-11-21","NameEn":"2021-11-21","IsNameDefault":true,"Color":"#00f","EdbInfoList":[{"XEdbInfoId":9,"YEdbInfoId":14,"Name":"指标1","NameEn":"","XDateType":1,"XDate":"","XDateValue":0,"YDateType":1,"YDate":"","YDateValue":0,"IsShow":false},{"XEdbInfoId":10,"YEdbInfoId":15,"Name":"指标2","NameEn":"指标2","XDateType":1,"XDate":"","XDateValue":0,"YDateType":1,"YDate":"","YDateValue":0,"IsShow":false},{"XEdbInfoId":11,"YEdbInfoId":16,"Name":"指标3","NameEn":"","XDateType":1,"XDate":"","XDateValue":0,"YDateType":1,"YDate":"","YDateValue":0,"IsShow":false},{"XEdbInfoId":12,"YEdbInfoId":17,"Name":"指标4","NameEn":"指标4","XDateType":1,"XDate":"","XDateValue":0,"YDateType":1,"YDate":"","YDateValue":0,"IsShow":false},{"XEdbInfoId":13,"YEdbInfoId":18,"Name":"指标5","NameEn":"","XDateType":1,"XDate":"","XDateValue":0,"YDateType":1,"YDate":"","YDateValue":0,"IsShow":false}],"ShowTrendLine":false,"ShowFitEquation":false,"ShowRSquare":false}]}`
|
|
|
- default:
|
|
|
+ chartInfo.ChartName = "截面散点图"
|
|
|
+ default:
|
|
|
br.Msg = "暂不支持该类型"
|
|
|
br.IsSendEmail = false
|
|
|
return
|
|
@@ -193,7 +210,7 @@ func (c *ChartThemeController) GetThemePreviewData() {
|
|
|
}
|
|
|
}
|
|
|
// 开始/结束日期
|
|
|
- startDate, endDate := utils.GetDateByDateTypeV2(dateType, ``, ``, startYear, yearMax)
|
|
|
+ startDate, endDate := utils.GetDateByDateTypeV2(dateType, tmpStartDate, tmpEndDate, startYear, yearMax)
|
|
|
|
|
|
// 获取图表中的指标数据
|
|
|
edbList, xEdbIdValue, yDataList, dataResp, err, errMsg := data.GetThemePreviewChartEdbData(chartType, calendar, startDate, endDate, mappingList, extraConfigStr, chartInfo.SeasonExtraConfig)
|
|
@@ -422,6 +439,22 @@ func (c *ChartThemeController) Delete() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ // 根据给定的图表主题类型ID获取图表主题类型
|
|
|
+ chartThemeType, err := chart_theme.GetChartThemeTypeById(chartTheme.ChartThemeTypeId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取图表主题类型信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断是否是配置为默认设置,如果已经设置了,那么不能删除
|
|
|
+ if chartThemeType.DefaultChartThemeId == 1 {
|
|
|
+ br.Msg = "该主题已经配置为默认设置,无法删除"
|
|
|
+ br.ErrMsg = "该主题已经配置为默认设置,无法删除"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
// 更新
|
|
|
chartTheme.IsDelete = 1
|
|
|
err = chartTheme.Update([]string{"IsDelete"})
|