问题是,未按顺序执行已分派的动作。下面是我的代码。请建议需要进行哪些更改以使分派的动作按顺序执行
@Effect()
NTSPrintOrder$: Observable<any> = this.actions$.pipe(
ofType(listOrderActions.NTSPrintAll),
withLatestFrom(this.store$.select(state => state['listorder'])),
mergeMap(([action, listOrderState]: any) => {
let obs =[];
var orders = listOrderState.listOrders.filter(x => x.selected)
orders.forEach(order => {
obs.push(listOrderActions.editOrder({'payload': {order_number : order.order_number}}))
obs.push(listOrderActions.loadNTSDocument())
});
obs.push(listOrderActions.printNTSDocument())
return obs;
})
)
}
您只能在editOrder
之内发送NTSPrintAll
。然后,editOrder
的效果将分派loadNTSDocument
,loadNTSDocument
的效果将分派printNTSDocument
。