Browse Source

移动端图表预览

xyxie 9 months ago
parent
commit
c75b0bf924
1 changed files with 30 additions and 7 deletions
  1. 30 7
      controllers/data_manage/chart_info.go

+ 30 - 7
controllers/data_manage/chart_info.go

@@ -10,6 +10,7 @@ import (
 	"eta/eta_mobile/services"
 	"eta/eta_mobile/services/data"
 	"eta/eta_mobile/services/data/data_manage_permission"
+	"eta/eta_mobile/services/data/excel"
 	etaTrialService "eta/eta_mobile/services/eta_trial"
 	"eta/eta_mobile/utils"
 	"fmt"
@@ -1037,14 +1038,36 @@ func (this *ChartInfoController) ChartInfoDetail() {
 	}
 
 	resp := new(data_manage.ChartInfoDetailResp)
-
+	// 区分是否是来自平衡表图表的数据
+	var chartInfoDataShow data.ChartInfoDataShow
+	chartInfoDataShow = &data.BaseChartInfoDataShow{}
 	mappingList := make([]*data_manage.ChartEdbInfoMapping, 0)
 	if chartInfoId > 0 {
-		mappingList, err = data_manage.GetChartEdbMappingList(chartInfoId)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取图表,指标信息失败,Err:" + err.Error()
-			return
+		if chartInfo.Source == utils.CHART_SOURCE_BALANCE_EXCEL { //来自平衡表图表的数据
+			excelChartInfoDataShow := new(data.ExcelChartInfoDataShow)
+			// 相关联指标
+			mappingListTmp, dataListMap, err, errMsg := excel.GetBalanceExcelChartSingle(chartInfoId, 0, "")
+			if err != nil {
+				br.Msg = errMsg
+				br.ErrMsg = err.Error()
+				return
+			}
+			excelChartInfoDataShow.DataListMap = dataListMap
+			excelChartInfoDataShow.MappingListTmp = mappingListTmp
+			chartInfoDataShow = excelChartInfoDataShow
+			mappingList, err = chartInfoDataShow.GetChartEdbMappingListByEdbInfoIdList([]int{})
+			if err != nil {
+				br.Msg = "获取失败"
+				br.ErrMsg = "获取图表,指标信息失败,Err:" + err.Error()
+				return
+			}
+		} else {
+			mappingList, err = data_manage.GetChartEdbMappingList(chartInfoId)
+			if err != nil {
+				br.Msg = "获取失败"
+				br.ErrMsg = "获取图表,指标信息失败,Err:" + err.Error()
+				return
+			}
 		}
 	} else {
 		if edbInfoId != "" {
@@ -1096,7 +1119,7 @@ func (this *ChartInfoController) ChartInfoDetail() {
 
 	if chartInfo.HaveOperaAuth {
 		// 获取图表中的指标数据
-		edbList, xEdbIdValue, yDataList, dataResp, err, errMsg := data.GetChartEdbData(chartInfoId, chartType, calendar, startDate, endDate, mappingList, extraConfigStr, chartInfo.SeasonExtraConfig)
+		edbList, xEdbIdValue, yDataList, dataResp, err, errMsg := data.GetChartEdbDataV2(chartInfoId, chartType, calendar, startDate, endDate, mappingList, extraConfigStr, chartInfo.SeasonExtraConfig, chartInfoDataShow)
 		if err != nil {
 			br.Msg = "获取失败"
 			if errMsg != `` {