Promise 应用

let list = [
        this.$refs.jwryIndex.checkForm('form'),
        this.$refs.jwryCommonDialog.checkForm('form'),
      ];
  Promise.all(list).then((res) => {
    let param = {
      basicInfo: JSON.stringify(this.formData),
      jwInfo: res[1].jwInfo,
      addressObj: res[1].addressObj,
      type: 'jwry'
    }
      if(this.family){
        param. familyRelations = this.formData.familyRelations
        this.$emit('addJwry', param);
         this.$refs.rsDialog.close();
      }else {

        addObj(param).then(res => {
          this.$message.success('添加成功')
          this.$refs.rsDialog.close()
          this.$emit('refreshDataList')
        })
      }
  }, (err) => {
    console.log(err)
  })
posted @ 2022-07-15 11:15  寒冷的雨呢  阅读(28)  评论(0编辑  收藏  举报