vue循环发送四个请求,为什么最后的参数永远是最后一分

fbqycxdc() { 
        debugger;                 
         var data = {};            
         data.year = this.year1,
          data.month = this.month2-1+"",
          data.total = "500";
              if((data.month-1)<=0){
                data.month=12+"",
                data.year-=1
            }
          for(var index=0; index<=this.va1200List.length-1;index++){
              data.va1200=this.va1200List[index]
              
              
              this.ids = "",       
              data.account = JSON.parse(localStorage.getItem("SsoUser") || '{}').userName;
              post(baseUrl + "/added/getstatisticNum", data).then(response => {

            this.curmonth = data.month+"";
            this.curyear = data.year+"";
            var res = response.data;
            this.curCou = res.NUM;
            this.perCou = res.NUM;
            // this.yearList.total = res.total;
            this.showCou = true;
          }).catch(e => {
            this.$alert("数据加载错误,请与管理员联系", '提示');
          });

          post(baseUrl + "/added/getstatisticSoo", data).then(response => {
            this.curmonth = data.month+"";
            this.curyear = data.year+"";
            var res = response.data;
            this.rou = res.NUM;
            // this.yearList.total = res.total;
            this.showCou = true;
          }).catch(e => {
            this.$alert("数据加载错误,请与管理员联系", '提示');
          });

          this.saveStatisticsDisabled = true;        
          post(baseUrl + "/added/statistics", data).then(response => {
          this.pageData.loading = false;
          this.saveStatisticsDisabled = false;
          var res = response.data;
          const result = (res.data[0] || {});
          let curObj = {};
          let perObj = {};
          for(let itemName in result) {
            if(itemName.lastIndexOf('Y') > -1) { // 上年同期(当年累计值)
              // this.pertableData[itemName] = result[itemName];
              perObj[itemName] = result[itemName];
            } else { // 本年本期累计
              // this.curtableData[itemName] = result[itemName];
              curObj[itemName] = result[itemName];
            }
            if(!this.pertableData['VA3000Y']) {
              this.pertableData['VA3000Y'] = result['VA3000'] || '';
            }
          }
          this.$set(this, 'curtableData', curObj);
          this.$set(this, 'pertableData', perObj);
          this.calculate();
          this.calculateCon();
          // this.protableData;
        });
        // .catch(e => {
        //   // alert(跳出+index);
        //   // break;
        //     this.$alert("数据加载错误,请与管理员联系", '提示');
        //   });
            // location.href = baseUrl + "/added/Fbqycxdc?map=" + this.data;
          // this.download('/added/Fbqycxdc', '分标签一次性导出.xlsx',data);
          //保存
          let params = {curtable: this.curtableData, pretable: this.pertableData};
          params.pretable.ZA3000Y =this.pertableData.ZA3000Y;
          params.curtable.year = data.year+"";
          params.curtable.month = data.month+"";
         
          params.curtable.id = this.id;  
          // data.curtable.id = this.id;
          // post(baseUrl + "/added/addStatistics", params).then(response => {
          
          post(baseUrl + "/added/addStatistics", params).then(response => {
          var res = response.data;
         
          this.id = res;       
            //导出
           
           location.href = baseUrl + "/added/saveTotalAsExcel2021?id=" +this.id;
          
        });       
         }   
      },

为什么location.href = baseUrl + "/added/saveTotalAsExcel2021?id=" +this.id;的this.id总是最后一个,前面三个方法循环完.lenth的长度后才循环最后的post(baseUrl + "/added/addStatistics", params).then(response => {}而且也是循环.lenth的次数,也就是一个for循环了.lenthX2的次数,特急!!!

循环里面写异步逻辑,循环会先遍历完,再去执行异步回调,建议了解一下js的宏任务微任务的相关知识