Prechádzať zdrojové kódy

库存管理 bug修复

bsj 2 rokov pred
rodič
commit
0b0017fe94
1 zmenil súbory, kde vykonal 9 pridanie a 5 odobranie
  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{}{}
 		}
 	}