xyxie před 1 rokem
rodič
revize
37e2348c3c
1 změnil soubory, kde provedl 29 přidání a 1 odebrání
  1. 29 1
      services/data/excel/mixed_table.go

+ 29 - 1
services/data/excel/mixed_table.go

@@ -290,6 +290,11 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq) (newMixedTableCe
 				calculateChainList = append(calculateChainList, cell.Uid)
 
 			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
 				// 日期关系配置不存在,则默认最新数据
@@ -558,7 +563,11 @@ func handleConfig(configList [][]request.MixedTableCellDataReq) (newConfig [][]r
 				if err != nil {
 					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)
 
 			case request.DateDT: // 日期类型
@@ -1230,3 +1239,22 @@ func changePointDecimalPlaces(str string, changeNum int, numberType string, isPe
 	}
 	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
+}