Kaynağa Gözat

异步修改

pengyh 1 yıl önce
ebeveyn
işleme
2dcf828c7d

+ 14 - 9
src/views/engineeringMaintenance/basicData/detail.vue

@@ -479,7 +479,9 @@
 					this.historyList = res.data.operatorLogList
 					this.formData.dateList = [res.data.startTime,res.data.endTime]
 					for(var item of res.data.productList){
-						item.smallList = await this.filterChildren(item.mainId)
+						item.smallList = await this.filterChildren(item.mainId).then(ress=>{
+							return ress
+						})
 						item.brand = {id: item.brandId,brandName: item.brandName}
 						item.main = {categoryId: item.mainId,name: item.mainName}
 						item.small = {categoryId: item.smallId,name: item.smallName}
@@ -492,20 +494,23 @@
 						this.formData.checkTypeList.push(item.id)
 					})
 					this.formData2.byList = res.data.byList
-					this.formData1.productList = res.data.productList
 					this.formData3.websitList = res.data.websitList
+					this.formData1.productList = res.data.productList
 					
 					console.log(this.formData.checkTypeList,'123123123')
 				})
 			},
 			async filterChildren(id){
-				let data = []
-				this.mainList.forEach(item=>{
-					if(item.categoryId == id){
-						data = item.children?[...[{categoryId: '0', name: '不限'}],...item.children]:[]
-					}
-				})
-				return data
+				return new Promise((resolve, reject) => {
+				    // 对 arr 进行处理...
+				    let data = []
+				    this.mainList.forEach(async item=>{
+				    	if(item.categoryId == id){
+				    		data = item.children?[...[{categoryId: '0', name: '不限'}],...item.children]:[]
+				    	}
+				    })
+					resolve(data);
+				});
 			},
 			initData(){
 				this.getOrderType()