Procházet zdrojové kódy

库存管理 bug修复

bsj před 2 roky
rodič
revize
0b0017fe94
1 změnil soubory, kde provedl 9 přidání a 5 odebrání
  1. 9 5
      routers/api/report.go

+ 9 - 5
routers/api/report.go

@@ -701,6 +701,7 @@ func getAccuracyV4(queryList []map[string]interface{}, queryListSum []map[string
 	}
 
 	for i := 0; i < len(queryList); i++ {
+
 		a = mapc2[queryList[i]["feedname"]].(int) * 4
 		if i == 0 {
 			datamap2["label"] = "饲料名称"
@@ -752,10 +753,12 @@ func getAccuracyV4(queryList []map[string]interface{}, queryListSum []map[string
 				datamap2child = make(map[string]interface{})
 			}
 			// datamap2 = make(map[string]interface{})
-			datamap2["children"] = data3
-			data2 = append(data2, datamap2)
-			datamap2 = make(map[string]interface{})
-			data3 = []interface{}{}
+			if i != len(queryList)-1 {
+				datamap2["children"] = data3
+				data2 = append(data2, datamap2)
+				datamap2 = make(map[string]interface{})
+				data3 = []interface{}{}
+			}
 		}
 
 		datamap1["A"] = queryList[i]["fname"]
@@ -786,8 +789,9 @@ func getAccuracyV4(queryList []map[string]interface{}, queryListSum []map[string
 			data3 = append(data3, datamap2child)
 
 			//	###########################
-
 			datamap2["children"] = data3
+			data2 = append(data2, datamap2)
+			datamap2 = make(map[string]interface{})
 			data3 = []interface{}{}
 		}
 	}