Explorar el Código

历史数据处理

xyxie hace 1 año
padre
commit
8a3e636a34
Se han modificado 1 ficheros con 30 adiciones y 2 borrados
  1. 30 2
      services/data/table/mixed_table.go

+ 30 - 2
services/data/table/mixed_table.go

@@ -291,6 +291,11 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq) (newMixedTableCe
 				calculateChainList = append(calculateChainList, cell.Uid)
 				calculateChainList = append(calculateChainList, cell.Uid)
 
 
 			case request.InsertEdbCalculateDataDT: // 插入指标系统计算公式生成的值
 			case request.InsertEdbCalculateDataDT: // 插入指标系统计算公式生成的值
+				// 处理value的值
+				if !strings.Contains(cell.Value, "EdbInfoId") && cell.EdbInfoId > 0 {
+					cell.Value, _ = fixCalculateValueConfig(cell.Value, cell.EdbInfoId)
+					row[i] = cell
+				}
 				// 日期
 				// 日期
 				var cellDateTime string
 				var cellDateTime string
 				// 日期关系配置不存在,则默认最新数据
 				// 日期关系配置不存在,则默认最新数据
@@ -559,7 +564,11 @@ func handleConfig(configList [][]request.MixedTableCellDataReq) (newConfig [][]r
 				if err != nil {
 				if err != nil {
 					return
 					return
 				}
 				}
-				edbInfoIdList = append(edbInfoIdList, config.EdbInfoId)
+				if config.EdbInfoId == 0 && cell.EdbInfoId > 0 {
+					edbInfoIdList = append(edbInfoIdList, cell.EdbInfoId)
+				} else {
+					edbInfoIdList = append(edbInfoIdList, config.EdbInfoId)
+				}
 				dataEdbInfoIdList = append(dataEdbInfoIdList, cell.EdbInfoId)
 				dataEdbInfoIdList = append(dataEdbInfoIdList, cell.EdbInfoId)
 
 
 			case request.DateDT: // 日期类型
 			case request.DateDT: // 日期类型
@@ -1190,7 +1199,7 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 				val = changePointDecimalPlaces(val, styleConf.Pn, styleConf.Nt, isPercent)
 				val = changePointDecimalPlaces(val, styleConf.Pn, styleConf.Nt, isPercent)
 				cell.ShowFormatValue = val
 				cell.ShowFormatValue = val
 			} else {
 			} else {
-				cell.ShowFormatValue = cell.ShowStyle
+				cell.ShowFormatValue = val
 			}
 			}
 			config[cellPosition.Column][cellPosition.Row] = cell
 			config[cellPosition.Column][cellPosition.Row] = cell
 		}
 		}
@@ -1234,3 +1243,22 @@ func changePointDecimalPlaces(str string, changeNum int, numberType string, isPe
 	}
 	}
 	return
 	return
 }
 }
+
+func fixCalculateValueConfig(conf string, edbInfoId int) (newConf string, err error) {
+	newConf = conf
+	if edbInfoId == 0 {
+		return
+	}
+	var tmpConfig request.CalculateConf
+	err = json.Unmarshal([]byte(conf), &tmpConfig)
+	if err != nil {
+		return
+	}
+	if tmpConfig.EdbInfoId == 0 {
+		tmpConfig.EdbInfoId = edbInfoId
+		newConfByte, _ := json.Marshal(tmpConfig)
+		newConf = string(newConfByte)
+		return
+	}
+	return
+}