diff --git a/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd.vue b/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd.vue index 56e8fbc5..76154d0c 100644 --- a/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd.vue +++ b/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd.vue @@ -258,7 +258,7 @@ /> - + @@ -715,6 +716,7 @@ this.$set(this.form, "expenditureAmount", total); }, goAdd(){ + let _this = this if(this.chargeItme.length<1){ this.$notify({ type: 'danger', message: '请添加收款方信息' }); return; @@ -803,70 +805,317 @@ this.infoForm.transferId = response.data.id this.$set(this.projectForm, "ynType", '1'); if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ - this.uploadFiles1.map(rr => { - let params = new FormData(); - params.append("tableId", response.data.id); - params.append("tableName", "t_yinnong_transfer"); - params.append("bizPath", "transfer"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", response.data.id); + params1.append("tableName", "t_yinnong_transfer"); + params1.append("bizPath", "transfer"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", response.data.id); + params2.append("tableName", "t_yinnong_transfer"); + params2.append("bizPath", "transfer"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + } }) - })} - if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ - this.uploadFiles2.map(rr => { + }) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { let params = new FormData(); params.append("tableId", response.data.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + } }) - })} - if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ - this.uploadFiles3.map(rr => { + }) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { let params = new FormData(); params.append("tableId", response.data.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { - }) - })} - if(this.form.capitalExpenditureType==2){ - addProjectto(this.projectForm).then(res => { - customSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } }) }) - } else if(this.form.capitalExpenditureType==4){ - addInfoto(this.infoForm).then(res => { + }else{ + if(this.form.capitalExpenditureType==2){ + addProjectto(this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(this.form.capitalExpenditureType==4){ + addInfoto(this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ customSubmit(response.data.id).then(res => { this.$toast.success('提交成功'); setTimeout(function(){ history.go(-1) },2000) }) - }) - }else{ - customSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) + } } }); } - - }, goUpdate(){ + let _this = this if(this.chargeItme.length<1){ this.$notify({ type: 'danger', message: '请添加收款方信息' }); return; @@ -903,43 +1152,248 @@ this.$set(this.form, "bankTypeList", this.chargeItme); this.$set(this.form, "accountTypeList", this.chargeItme); this.$set(this.form, "transferStatusList", this.chargeItme); - addTransfer(this.form).then((response) => { + addTransfer(this.form).then(response => { this.projectForm.outId = response.data.id this.infoForm.transferId = response.data.id this.$set(this.projectForm, "ynType", '1'); if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ - this.uploadFiles1.map(rr => { - let params = new FormData(); - params.append("tableId", response.data.id); - params.append("tableName", "t_yinnong_transfer"); - params.append("bizPath", "transfer"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", response.data.id); + params1.append("tableName", "t_yinnong_transfer"); + params1.append("bizPath", "transfer"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", response.data.id); + params2.append("tableName", "t_yinnong_transfer"); + params2.append("bizPath", "transfer"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + } }) - })} - if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ - this.uploadFiles2.map(rr => { + }) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { let params = new FormData(); params.append("tableId", response.data.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + } }) - })} - if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ - this.uploadFiles3.map(rr => { + }) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { let params = new FormData(); params.append("tableId", response.data.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } }) - })} + }) + }else{ if(this.form.capitalExpenditureType==2){ addProjectto(this.projectForm).then(res => { this.$toast.success('保存成功'); @@ -947,7 +1401,7 @@ history.go(-1) },2000) }) - }else if(this.form.capitalExpenditureType==4){ + } else if(this.form.capitalExpenditureType==4){ addInfoto(this.infoForm).then(res => { this.$toast.success('保存成功'); setTimeout(function(){ @@ -960,6 +1414,7 @@ history.go(-1) },2000) } + } }); }, payeeSelectChange(select, i) { diff --git a/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd11.vue b/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd11.vue index 6aa6e20d..8e9f5c0d 100644 --- a/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd11.vue +++ b/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd11.vue @@ -220,8 +220,8 @@
- - + +
@@ -613,6 +613,7 @@ }); }, goAdd(){ + let _this = this if(this.form.payerAccount==0){ this.$notify({ type: 'danger', message: '申请使用金额不能等于0!' }); return false; @@ -624,37 +625,38 @@ this.$set(this.form, "expenditureAmount", total); if(parseFloat(this.form.payerAccount) { this.chargeItme.map(res => { res.cashId = response.data.id - addCashdetail(res).then(r => {}) + addCashdetail(res).then((r,idx) => { + if(idx == (_this.chargeItme.length - 1)){ + if(_this.form.capitalExpenditureType==2){ + _this.projectForm.outId = response.data.id + _this.$set(_this.projectForm, "ynType", '2'); + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else if(_this.form.capitalExpenditureType==4){ + _this.infoForm.transferId = response.data.id + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) }) - if(this.form.capitalExpenditureType==2){ - this.projectForm.outId = response.data.id - this.$set(this.projectForm, "ynType", '2'); - addProjectto(this.projectForm).then(res => { - cashSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - }) - }else if(this.form.capitalExpenditureType==4){ - this.infoForm.transferId = response.data.id - addInfoto(this.infoForm).then(res => { - cashSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - }) - }else{ - cashSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - } + }); }) }else{ addCash(this.form).then((response) => { - this.uploadFiles1.map(rr => { - const params = new FormData(); - params.append("tableId", response.data.id); - params.append("tableName", "t_yinnong_cash"); - params.append("bizPath", "yinnong"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { - }) - }) - this.uploadFiles2.map(rr => { - const params = new FormData(); - params.append("tableId", response.data.id); - params.append("tableName", "t_yinnong_cash"); - params.append("bizPath", "yinnong"); - params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { - }) - }) - this.uploadFiles3.map(rr => { - const params = new FormData(); - params.append("tableId", response.data.id); - params.append("tableName", "t_yinnong_cash"); - params.append("bizPath", "yinnong"); - params.append("fileType", "3"); - params.append("file", rr); - commonAttach(params).then((r) => { - }) - }) this.chargeItme.map(res => { res.cashId = response.data.id addCashdetail(res).then(r => {}) }) - if(this.form.capitalExpenditureType==2){ - this.projectForm.outId = response.data.id - this.$set(this.projectForm, "ynType", '2'); - addProjectto(this.projectForm).then(res => { - cashSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + this.projectForm.outId = response.data.id + this.infoForm.transferId = response.data.id + this.$set(this.projectForm, "ynType", '2'); + if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", response.data.id); + params1.append("tableName", "t_yinnong_cash"); + params1.append("bizPath", "yinnong"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", response.data.id); + params2.append("tableName", "t_yinnong_cash"); + params2.append("bizPath", "yinnong"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + } }) }) - }else if(this.form.capitalExpenditureType==4){ - this.infoForm.transferId = response.data.id - addInfoto(this.infoForm).then(res => { - cashSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); + params.append("tableId", response.data.id); + params.append("tableName", "t_yinnong_cash"); + params.append("bizPath", "yinnong"); + params.append("fileType", "2"); + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + } }) }) - }else{ - cashSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); + params.append("tableId", response.data.id); + params.append("tableName", "t_yinnong_cash"); + params.append("bizPath", "yinnong"); + params.append("fileType", "3"); + params.append("file", rr3); + commonAttach(params).then((r) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) }) + }else{ + if(this.form.capitalExpenditureType==2){ + addProjectto(this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(this.form.capitalExpenditureType==4){ + addInfoto(this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } } }); } @@ -771,6 +1196,7 @@ } }, goUpdate(){ + let _this = this if(this.form.payerAccount==0){ this.$notify({ type: 'danger', message: '申请使用金额不能等于0!' });; return false; @@ -786,95 +1212,468 @@ }else{ if(this.chargeItme.length<1){ this.$notify({ type: 'danger', message: '请添加收款方信息' }); - return; + return false; } if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){ this.$notify({ type: 'danger', message: '付款事由禁止包含!' }); - return; + return false; } if(this.form.capitalExpenditureType==2){ if(this.projectForm.projectName==""||this.projectForm.projectName==null){ this.$notify({ type: 'danger', message: '请选择项目名称!' }); - return; + return false; } if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){ this.$notify({ type: 'danger', message: '请输入工程发票号!' }); - return; + return false; } } if(this.form.capitalExpenditureType==4){ if(this.infoForm.name==""||this.infoForm.name==null){ this.$notify({ type: 'danger', message: '请选择合同名称!' }); - return; + return false; } if(this.infoForm.code==""||this.infoForm.code==null){ this.$notify({ type: 'danger', message: '请输入合同编码!' }); - return; + return false; } if(this.infoForm.totalAmount==""||this.infoForm.totalAmount==null){ this.$notify({ type: 'danger', message: '请输入合同价款!' }); - return; + return false; } } - addCash(this.form).then((response) => { - this.uploadFiles1.map(rr => { - const params = new FormData(); - params.append("tableId", response.data.id); - params.append("tableName", "t_yinnong_cash"); - params.append("bizPath", "yinnong"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { + addCash(this.form).then(response => { + this.projectForm.outId = response.data.id + this.infoForm.transferId = response.data.id + this.$set(this.projectForm, "ynType", '2'); + if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", response.data.id); + params1.append("tableName", "t_yinnong_cash"); + params1.append("bizPath", "yinnong"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", response.data.id); + params2.append("tableName", "t_yinnong_cash"); + params2.append("bizPath", "yinnong"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + } }) }) - this.uploadFiles2.map(rr => { - const params = new FormData(); + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); params.append("tableId", response.data.id); params.append("tableName", "t_yinnong_cash"); params.append("bizPath", "yinnong"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + } }) }) - this.uploadFiles3.map(rr => { - const params = new FormData(); + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); params.append("tableId", response.data.id); params.append("tableName", "t_yinnong_cash"); params.append("bizPath", "yinnong"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } }) }) - this.chargeItme.map(res => { - res.cashId = response.data.id - addCashdetail(res).then(r => {}) - }) + }else{ if(this.form.capitalExpenditureType==2){ - this.projectForm.outId = response.data.id - this.$set(this.projectForm, "ynType", '2'); addProjectto(this.projectForm).then(res => { - this.$toast.success('保存成功'); - setTimeout(function(){ - history.go(-1) - },2000) + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) }) - }else if(this.form.capitalExpenditureType==4){ - this.infoForm.transferId = response.data.id + } else if(this.form.capitalExpenditureType==4){ addInfoto(this.infoForm).then(res => { - this.$toast.success('保存成功'); - setTimeout(function(){ - history.go(-1) - },2000) + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) }) }else{ - this.$toast.success('保存成功'); - setTimeout(function(){ - history.go(-1) - },2000) + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) } - }); + } + }); } } }, diff --git a/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd12.vue b/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd12.vue index 0e66aad0..7abd733f 100644 --- a/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd12.vue +++ b/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd12.vue @@ -707,6 +707,7 @@ this.$set(this.form, "expenditureAmount", total); }, goAdd(){ + let _this = this if(this.chargeItme.length<1){ this.$notify({ type: 'danger', message: '请添加收款方信息' }); return; @@ -748,109 +749,533 @@ addCash(this.form).then((response) => { this.chargeItme.map(res => { res.cashId = response.data.id - addCashdetail(res).then(r => {}) + addCashdetail(res).then((r,idx) => { + if(idx == (_this.chargeItme.length - 1)){ + if(_this.form.capitalExpenditureType==2){ + _this.projectForm.outId = response.data.id + _this.$set(_this.projectForm, "ynType", '2'); + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else if(_this.form.capitalExpenditureType==4){ + _this.infoForm.transferId = response.data.id + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) }) - if(this.form.capitalExpenditureType==2){ - this.projectForm.outId = response.data.id - this.$set(this.projectForm, "ynType", '2'); - addProjectto(this.projectForm).then(res => { - cashSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - }) - }else if(this.form.capitalExpenditureType==4){ - this.infoForm.transferId = response.data.id - addInfoto(this.infoForm).then(res => { - cashSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - }) - }else{ - cashSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - } + }); }) }else{ addCash(this.form).then((response) => { - this.uploadFiles1.map(rr => { - const params = new FormData(); - params.append("tableId", response.data.id); - params.append("tableName", "t_yinnong_cash"); - params.append("bizPath", "yinnong"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { - }) - }) - this.uploadFiles2.map(rr => { - const params = new FormData(); - params.append("tableId", response.data.id); - params.append("tableName", "t_yinnong_cash"); - params.append("bizPath", "yinnong"); - params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { - }) - }) - this.uploadFiles3.map(rr => { - const params = new FormData(); - params.append("tableId", response.data.id); - params.append("tableName", "t_yinnong_cash"); - params.append("bizPath", "yinnong"); - params.append("fileType", "3"); - params.append("file", rr); - commonAttach(params).then((r) => { - }) - }) this.chargeItme.map(res => { res.cashId = response.data.id addCashdetail(res).then(r => {}) }) - if(this.form.capitalExpenditureType==2){ - this.projectForm.outId = response.data.id - this.$set(this.projectForm, "ynType", '2'); - addProjectto(this.projectForm).then(res => { - cashSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + this.projectForm.outId = response.data.id + this.infoForm.transferId = response.data.id + this.$set(this.projectForm, "ynType", '2'); + if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", response.data.id); + params1.append("tableName", "t_yinnong_cash"); + params1.append("bizPath", "yinnong"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", response.data.id); + params2.append("tableName", "t_yinnong_cash"); + params2.append("bizPath", "yinnong"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + } }) }) - }else if(this.form.capitalExpenditureType==4){ - this.infoForm.transferId = response.data.id - addInfoto(this.infoForm).then(res => { - cashSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); + params.append("tableId", response.data.id); + params.append("tableName", "t_yinnong_cash"); + params.append("bizPath", "yinnong"); + params.append("fileType", "2"); + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + } }) }) - }else{ - cashSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); + params.append("tableId", response.data.id); + params.append("tableName", "t_yinnong_cash"); + params.append("bizPath", "yinnong"); + params.append("fileType", "3"); + params.append("file", rr3); + commonAttach(params).then((r) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) }) + }else{ + if(this.form.capitalExpenditureType==2){ + addProjectto(this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(this.form.capitalExpenditureType==4){ + addInfoto(this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } } }); } }, goUpdate(){ + let _this = this if(this.chargeItme.length<1){ this.$notify({ type: 'danger', message: '请添加收款方信息' }); return; @@ -883,72 +1308,439 @@ return; } } - let length1 = 0 - let length2 = 0 - let length3 = 0 - addCash(this.form).then((response) => { - this.uploadFiles1.map((rr,index) => { - const params = new FormData(); - params.append("tableId", response.data.id); - params.append("tableName", "t_yinnong_cash"); - params.append("bizPath", "yinnong"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { - length1 = index+1 - console.log(length1) + + addCash(this.form).then(response => { + this.projectForm.outId = response.data.id + this.infoForm.transferId = response.data.id + this.$set(this.projectForm, "ynType", '2'); + if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", response.data.id); + params1.append("tableName", "t_yinnong_cash"); + params1.append("bizPath", "yinnong"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", response.data.id); + params2.append("tableName", "t_yinnong_cash"); + params2.append("bizPath", "yinnong"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + } }) }) - this.uploadFiles2.map((rr,index) => { - const params = new FormData(); + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); params.append("tableId", response.data.id); params.append("tableName", "t_yinnong_cash"); params.append("bizPath", "yinnong"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { - length2 = index+1 + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + } }) }) - this.uploadFiles3.map((rr,index) => { - const params = new FormData(); + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); params.append("tableId", response.data.id); params.append("tableName", "t_yinnong_cash"); params.append("bizPath", "yinnong"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { - length3 = index+1 + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } }) }) - this.chargeItme.map(res => { - res.cashId = response.data.id - addCashdetail(res).then(r => {}) - }) + }else{ if(this.form.capitalExpenditureType==2){ - this.projectForm.outId = response.data.id - this.$set(this.projectForm, "ynType", '2'); addProjectto(this.projectForm).then(res => { - this.$toast.success('保存成功'); - setTimeout(function(){ - history.go(-1) - },2000) + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) }) - }else if(this.form.capitalExpenditureType==4){ - this.infoForm.transferId = response.data.id + } else if(this.form.capitalExpenditureType==4){ addInfoto(this.infoForm).then(res => { - this.$toast.success('保存成功'); - setTimeout(function(){ - history.go(-1) - },2000) + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) }) }else{ - this.$toast.success('保存成功'); - setTimeout(function(){ - history.go(-1) - },2000) + _this.chargeItme.map((resD,b) => { + resD.cashId = response.data.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) } - }); + } + }); }, payeeSelectChange(select, i) { let obj = {}; diff --git a/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd2.vue b/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd2.vue index 8a09c12b..7500598e 100644 --- a/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd2.vue +++ b/src/views/yinnong/bankAgriculture/paymentApproval/approvalAdd2.vue @@ -704,6 +704,7 @@ this.$set(this.form, "expenditureAmount", total); }, goAdd(){ + let _this = this if(this.chargeItme.length<1){ this.$notify({ type: 'danger', message: '请添加收款方信息' }); return; @@ -747,6 +748,7 @@ this.$set(this.form, "accountTypeList", this.chargeItme); this.$set(this.form, "transferStatusList", this.chargeItme); addTransfer(this.form).then(response => { + console.log(response.data.id) this.projectForm.outId = response.data.id this.infoForm.transferId = response.data.id this.$set(this.projectForm, "ynType", '1'); @@ -791,68 +793,317 @@ this.infoForm.transferId = response.data.id this.$set(this.projectForm, "ynType", '1'); if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ - this.uploadFiles1.map(rr => { - const params = new FormData(); - params.append("tableId", response.data.id); - params.append("tableName", "t_yinnong_transfer"); - params.append("bizPath", "transfer"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", response.data.id); + params1.append("tableName", "t_yinnong_transfer"); + params1.append("bizPath", "transfer"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", response.data.id); + params2.append("tableName", "t_yinnong_transfer"); + params2.append("bizPath", "transfer"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + } }) - })} - if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ - this.uploadFiles2.map(rr => { - const params = new FormData(); + }) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); params.append("tableId", response.data.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + } }) - })} - if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ - this.uploadFiles3.map(rr => { - const params = new FormData(); + }) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); params.append("tableId", response.data.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { - }) - })} - if(this.form.capitalExpenditureType==2){ - addProjectto(this.projectForm).then(res => { - customSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } }) }) - } else if(this.form.capitalExpenditureType==4){ - addInfoto(this.infoForm).then(res => { + }else{ + if(this.form.capitalExpenditureType==2){ + addProjectto(this.projectForm).then(res => { + customSubmit(response.data.id).then(res => { + this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(this.form.capitalExpenditureType==4){ + addInfoto(this.infoForm).then(res => { + customSubmit(response.data.id).then(res => { + this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ customSubmit(response.data.id).then(res => { this.$toast.success('提交成功'); setTimeout(function(){ history.go(-1) },2000) }) - }) - }else{ - customSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) + } } }); } }, goUpdate(){ + let _this = this if(this.chargeItme.length<1){ this.$notify({ type: 'danger', message: '请添加收款方信息' }); return; @@ -889,64 +1140,269 @@ this.$set(this.form, "bankTypeList", this.chargeItme); this.$set(this.form, "accountTypeList", this.chargeItme); this.$set(this.form, "transferStatusList", this.chargeItme); - addTransfer(this.form).then((response) => { + addTransfer(this.form).then(response => { this.projectForm.outId = response.data.id this.infoForm.transferId = response.data.id this.$set(this.projectForm, "ynType", '1'); if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ - this.uploadFiles1.map(rr => { - const params = new FormData(); - params.append("tableId", response.data.id); - params.append("tableName", "t_yinnong_transfer"); - params.append("bizPath", "transfer"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", response.data.id); + params1.append("tableName", "t_yinnong_transfer"); + params1.append("bizPath", "transfer"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", response.data.id); + params2.append("tableName", "t_yinnong_transfer"); + params2.append("bizPath", "transfer"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + } }) - })} - if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ - this.uploadFiles2.map(rr => { - const params = new FormData(); + }) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); params.append("tableId", response.data.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", response.data.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + } }) - })} - if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ - this.uploadFiles3.map(rr => { - const params = new FormData(); + }) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); params.append("tableId", response.data.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } }) - })} - if(this.form.capitalExpenditureType==2){ - addProjectto(this.projectForm).then(res => { - this.$toast.success('保存成功'); - setTimeout(function(){ - history.go(-1) - },2000) }) - }else if(this.form.capitalExpenditureType==4){ - addInfoto(this.infoForm).then(res => { + }else{ + if(this.form.capitalExpenditureType==2){ + addProjectto(this.projectForm).then(res => { + this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(this.form.capitalExpenditureType==4){ + addInfoto(this.infoForm).then(res => { + this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ this.$toast.success('保存成功'); setTimeout(function(){ history.go(-1) },2000) - }) - }else{ - this.$toast.success('保存成功'); - setTimeout(function(){ - history.go(-1) - },2000) + } } - }); }, payeeSelectChange(select, i) { diff --git a/src/views/yinnong/bankAgriculture/paymentApproval/approvalDetail11.vue b/src/views/yinnong/bankAgriculture/paymentApproval/approvalDetail11.vue index b5ca8b39..08f9a036 100644 --- a/src/views/yinnong/bankAgriculture/paymentApproval/approvalDetail11.vue +++ b/src/views/yinnong/bankAgriculture/paymentApproval/approvalDetail11.vue @@ -60,8 +60,8 @@
- - + +
diff --git a/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify.vue b/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify.vue index 68ba24bf..515d9e4d 100644 --- a/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify.vue +++ b/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify.vue @@ -700,6 +700,7 @@ this.$set(this.form, "expenditureAmount", total); }, goAdd(){ + let _this = this if(this.chargeItme.length<1){ this.$notify({ type: 'danger', message: '请添加收款方信息' }); return; @@ -732,7 +733,12 @@ return; } } - if((this.uploadFiles1==null||this.uploadFiles1.length==0)&&(this.uploadFiles2==null||this.uploadFiles2.length==0)&&(this.uploadFiles3==null||this.uploadFiles3.length==0)){ + if((this.uploadFiles1==null||this.uploadFiles1.length==0)&& + (this.uploadFiles2==null||this.uploadFiles2.length==0)&& + (this.uploadFiles3==null||this.uploadFiles3.length==0)&& + this.fileList1.length==0&& + this.fileList2.length==0&& + this.fileList3.length==0){ Dialog.confirm({ title: '提示', message: '此申请单中未上传任何附件,是否确认提交?', @@ -783,67 +789,315 @@ this.$set(this.form, "accountTypeList", this.chargeItme); this.$set(this.form, "transferStatusList", this.chargeItme); updateTransfer(this.form).then(response => { - this.projectForm.outId = this.form.id - this.infoForm.transferId = this.form.id + this.projectForm.outId = _this.form.id + this.infoForm.transferId = _this.form.id this.$set(this.projectForm, "ynType", '1'); if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ - this.uploadFiles1.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); - params.append("tableName", "t_yinnong_transfer"); - params.append("bizPath", "transfer"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", _this.form.id); + params1.append("tableName", "t_yinnong_transfer"); + params1.append("bizPath", "transfer"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", _this.form.id); + params2.append("tableName", "t_yinnong_transfer"); + params2.append("bizPath", "transfer"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + } }) - })} - if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ - this.uploadFiles2.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + } }) - })} - if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ - this.uploadFiles3.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { - }) - })} - if(this.form.capitalExpenditureType==2){ - addProjectto(this.projectForm).then(res => { - customSubmit(this.form.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } }) }) - } else if(this.form.capitalExpenditureType==4){ - addInfoto(this.infoForm).then(res => { - customSubmit(this.form.id).then(res => { + }else{ + if(this.form.capitalExpenditureType==2){ + addProjectto(this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(this.form.capitalExpenditureType==4){ + addInfoto(this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { this.$toast.success('提交成功'); setTimeout(function(){ history.go(-1) },2000) }) - }) - }else{ - customSubmit(this.form.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) + } } }); } @@ -851,6 +1105,7 @@ }, goUpdate(){ + let _this = this if(this.chargeItme.length<1){ this.$notify({ type: 'danger', message: '请添加收款方信息' }); return; @@ -887,43 +1142,248 @@ this.$set(this.form, "bankTypeList", this.chargeItme); this.$set(this.form, "accountTypeList", this.chargeItme); this.$set(this.form, "transferStatusList", this.chargeItme); - updateTransfer(this.form).then((response) => { + updateTransfer(this.form).then(response => { this.projectForm.outId = this.form.id this.infoForm.transferId = this.form.id this.$set(this.projectForm, "ynType", '1'); if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ - this.uploadFiles1.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); - params.append("tableName", "t_yinnong_transfer"); - params.append("bizPath", "transfer"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", _this.form.id); + params1.append("tableName", "t_yinnong_transfer"); + params1.append("bizPath", "transfer"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", _this.form.id); + params2.append("tableName", "t_yinnong_transfer"); + params2.append("bizPath", "transfer"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + } }) - })} - if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ - this.uploadFiles2.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + } }) - })} - if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ - this.uploadFiles3.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } }) - })} + }) + }else{ if(this.form.capitalExpenditureType==2){ addProjectto(this.projectForm).then(res => { this.$toast.success('保存成功'); @@ -931,7 +1391,7 @@ history.go(-1) },2000) }) - }else if(this.form.capitalExpenditureType==4){ + } else if(this.form.capitalExpenditureType==4){ addInfoto(this.infoForm).then(res => { this.$toast.success('保存成功'); setTimeout(function(){ @@ -944,7 +1404,7 @@ history.go(-1) },2000) } - + } }); }, payeeSelectChange(select, i) { diff --git a/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify11.vue b/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify11.vue index d3f80b3c..5620fd37 100644 --- a/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify11.vue +++ b/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify11.vue @@ -221,8 +221,8 @@
- - + +
@@ -439,6 +439,7 @@ // 分页 pageNum: 1, pageSize: 999, + type:'3' }; listTemplate(templateQueryParams).then(rrr => { this.templateList = rrr.rows; @@ -606,6 +607,7 @@ }); }, goAdd(){ + let _this = this if(this.form.payerAccount==0){ this.$notify({ type: 'danger', message: '申请使用金额不能等于0!' }); return false; @@ -655,7 +657,12 @@ this.$set(this.form, "bankTypeList", this.chargeItme); this.$set(this.form, "accountTypeList", this.chargeItme); this.$set(this.form, "transferStatusList", this.chargeItme); - if((this.uploadFiles1==null||this.uploadFiles1.length==0)&&(this.uploadFiles2==null||this.uploadFiles2.length==0)&&(this.uploadFiles3==null||this.uploadFiles3.length==0)){ + if((this.uploadFiles1==null||this.uploadFiles1.length==0)&& + (this.uploadFiles2==null||this.uploadFiles2.length==0)&& + (this.uploadFiles3==null||this.uploadFiles3.length==0&& + this.fileList1.length==0&& + this.fileList2.length==0&& + this.fileList3.length==0)){ Dialog.confirm({ title: '提示', message: '此申请单中未上传任何附件,是否确认提交?', @@ -663,109 +670,523 @@ .then(() => { updateCash(this.form).then((response) => { this.chargeItme.map(res => { - res.cashId = this.form.id - addCashdetail(res).then(r => { + res.cashId = response.data.id + addCashdetail(res).then((r,idx) => { + if(idx == (_this.chargeItme.length - 1)){ + if(_this.form.capitalExpenditureType==2){ + _this.projectForm.outId = response.data.id + _this.$set(_this.projectForm, "ynType", '2'); + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else if(_this.form.capitalExpenditureType==4){ + _this.infoForm.transferId = response.data.id + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } }) }) - if(this.form.capitalExpenditureType==2){ - this.projectForm.outId = this.form.id - this.$set(this.projectForm, "ynType", '2'); - addProjectto(this.projectForm).then(res => { - cashSubmit(this.form.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - }) - }else if(this.form.capitalExpenditureType==4){ - this.infoForm.transferId = this.form.id - addInfoto(this.infoForm).then(res => { - customSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - }) - }else{ - cashSubmit(this.form.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - } }); }) }else { updateCash(this.form).then((response) => { + this.projectForm.outId = _this.form.id + this.infoForm.transferId = _this.form.id + this.$set(this.projectForm, "ynType", '2'); if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ - this.uploadFiles1.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); - params.append("tableName", "t_yinnong_cash"); - params.append("bizPath", "yinnong"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", _this.form.id); + params1.append("tableName", "t_yinnong_cash"); + params1.append("bizPath", "yinnong"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", _this.form.id); + params2.append("tableName", "t_yinnong_cash"); + params2.append("bizPath", "yinnong"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + } }) - })} - if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ - this.uploadFiles2.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_cash"); params.append("bizPath", "yinnong"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + } }) - })} - if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ - this.uploadFiles3.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_cash"); params.append("bizPath", "yinnong"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } }) - })} - this.chargeItme.map(res => { - res.cashId = this.form.id - addCashdetail(res).then(r => { }) - }) - if(this.form.capitalExpenditureType==2){ - this.projectForm.outId = this.form.id - this.$set(this.projectForm, "ynType", '2'); - addProjectto(this.projectForm).then(res => { - cashSubmit(this.form.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + }else{ + if(this.form.capitalExpenditureType==2){ + addProjectto(this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) }) - }) - }else if(this.form.capitalExpenditureType==4){ - this.infoForm.transferId = this.form.id - addInfoto(this.infoForm).then(res => { - customSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + } else if(this.form.capitalExpenditureType==4){ + addInfoto(this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) }) - }) - }else{ - cashSubmit(this.form.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } } }); } @@ -774,6 +1195,7 @@ }, goUpdate(){ + let _this = this if(this.form.payerAccount==0){ this.$notify({ type: 'danger', message: '申请使用金额不能等于0!' }); return false; @@ -820,69 +1242,436 @@ } } this.projectForm.outId = this.form.id - updateCash(this.form).then((response) => { + updateCash(this.form).then(response => { + this.projectForm.outId = _this.form.id + this.infoForm.transferId = _this.form.id + this.$set(this.projectForm, "ynType", '2'); if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ - this.uploadFiles1.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); - params.append("tableName", "t_yinnong_cash"); - params.append("bizPath", "yinnong"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", _this.form.id); + params1.append("tableName", "t_yinnong_cash"); + params1.append("bizPath", "yinnong"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", _this.form.id); + params2.append("tableName", "t_yinnong_cash"); + params2.append("bizPath", "yinnong"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + } }) - })} - if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ - this.uploadFiles2.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_cash"); params.append("bizPath", "yinnong"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + } }) - })} - if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ - this.uploadFiles3.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_cash"); params.append("bizPath", "yinnong"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { - }) - })} - this.chargeItme.map(res => { - res.cashId = this.form.id - addCashdetail(res).then(r => { - }) - }) - if(this.form.capitalExpenditureType==2){ - this.projectForm.outId = this.form.id - this.$set(this.projectForm, "ynType", '2'); - addProjectto(this.projectForm).then(res => { - this.$toast.success('保存成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - }else if(this.form.capitalExpenditureType==4){ - this.infoForm.transferId = this.form.id - addInfoto(this.infoForm).then(res => { - customSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } }) }) }else{ - this.$toast.success('保存成功'); - setTimeout(function(){ - history.go(-1) - },2000) + if(this.form.capitalExpenditureType==2){ + addProjectto(this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(this.form.capitalExpenditureType==4){ + addInfoto(this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } } }); } diff --git a/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify12.vue b/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify12.vue index f6a3e4c9..52f9be59 100644 --- a/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify12.vue +++ b/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify12.vue @@ -495,6 +495,7 @@ // 分页 pageNum: 1, pageSize: 999, + type:'4', }; listTemplate(templateQueryParams).then(rrr => { this.templateList = rrr.rows; @@ -704,6 +705,7 @@ this.$set(this.form, "expenditureAmount", total); }, goAdd(){ + let _this = this if(this.chargeItme.length<1){ this.$notify({ type: 'danger', message: '请添加收款方信息' }); return; @@ -740,7 +742,12 @@ this.$set(this.form, "bankTypeList", this.chargeItme); this.$set(this.form, "accountTypeList", this.chargeItme); this.$set(this.form, "transferStatusList", this.chargeItme); - if((this.uploadFiles1==null||this.uploadFiles1.length==0)&&(this.uploadFiles2==null||this.uploadFiles2.length==0)&&(this.uploadFiles3==null||this.uploadFiles3.length==0)){ + if((this.uploadFiles1==null||this.uploadFiles1.length==0)&& + (this.uploadFiles2==null||this.uploadFiles2.length==0)&& + (this.uploadFiles3==null||this.uploadFiles3.length==0&& + this.fileList1.length==0&& + this.fileList2.length==0&& + this.fileList3.length==0)){ Dialog.confirm({ title: '提示', message: '此申请单中未上传任何附件,是否确认提交?', @@ -748,114 +755,529 @@ .then(() => { updateCash(this.form).then((response) => { this.chargeItme.map(res => { - res.cashId = this.form.id - addCashdetail(res).then(r => { + res.cashId = response.data.id + addCashdetail(res).then((r,idx) => { + if(idx == (_this.chargeItme.length - 1)){ + if(_this.form.capitalExpenditureType==2){ + _this.projectForm.outId = response.data.id + _this.$set(_this.projectForm, "ynType", '2'); + addProjectto(_this.projectForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else if(_this.form.capitalExpenditureType==4){ + _this.infoForm.transferId = response.data.id + addInfoto(_this.infoForm).then(res => { + cashSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + cashSubmit(response.data.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } }) }) - if(this.form.capitalExpenditureType==2){ - this.projectForm.outId = this.form.id - this.$set(this.projectForm, "ynType", '2'); - addProjectto(this.projectForm).then(res => { - cashSubmit(this.form.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - }) - }else if(this.form.capitalExpenditureType==4){ - this.infoForm.transferId = this.form.id - addInfoto(this.infoForm).then(res => { - customSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - }) - }else{ - cashSubmit(this.form.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - } }); }) }else { updateCash(this.form).then((response) => { + this.projectForm.outId = _this.form.id + this.infoForm.transferId = _this.form.id + this.$set(this.projectForm, "ynType", '2'); if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ - this.uploadFiles1.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); - params.append("tableName", "t_yinnong_cash"); - params.append("bizPath", "yinnong"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", _this.form.id); + params1.append("tableName", "t_yinnong_cash"); + params1.append("bizPath", "yinnong"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", _this.form.id); + params2.append("tableName", "t_yinnong_cash"); + params2.append("bizPath", "yinnong"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + } }) - })} - if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ - this.uploadFiles2.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_cash"); params.append("bizPath", "yinnong"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } + } }) - })} - if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ - this.uploadFiles3.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_cash"); params.append("bizPath", "yinnong"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } + } }) - })} - this.chargeItme.map(res => { - res.cashId = this.form.id - addCashdetail(res).then(r => { }) - }) - if(this.form.capitalExpenditureType==2){ - this.projectForm.outId = this.form.id - this.$set(this.projectForm, "ynType", '2'); - addProjectto(this.projectForm).then(res => { - cashSubmit(this.form.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + }else{ + if(this.form.capitalExpenditureType==2){ + addProjectto(this.projectForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) }) - }) - }else if(this.form.capitalExpenditureType==4){ - this.infoForm.transferId = this.form.id - addInfoto(this.infoForm).then(res => { - customSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + } else if(this.form.capitalExpenditureType==4){ + addInfoto(this.infoForm).then(res => { + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) }) - }) - }else{ - cashSubmit(this.form.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) + }else{ + cashSubmit(_this.form.id).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } } }); } }, goUpdate(){ + let _this = this if(this.chargeItme.length<1){ this.$notify({ type: 'danger', message: '请添加收款方信息' }); return; @@ -889,69 +1311,436 @@ } } this.projectForm.outId = this.form.id - updateCash(this.form).then((response) => { + updateCash(this.form).then(response => { + this.projectForm.outId = _this.form.id + this.infoForm.transferId = _this.form.id + this.$set(this.projectForm, "ynType", '2'); if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ - this.uploadFiles1.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); - params.append("tableName", "t_yinnong_cash"); - params.append("bizPath", "yinnong"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", _this.form.id); + params1.append("tableName", "t_yinnong_cash"); + params1.append("bizPath", "yinnong"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", _this.form.id); + params2.append("tableName", "t_yinnong_cash"); + params2.append("bizPath", "yinnong"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + } }) - })} - if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ - this.uploadFiles2.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_cash"); params.append("bizPath", "yinnong"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_cash"); + params3.append("bizPath", "yinnong"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } + } }) - })} - if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ - this.uploadFiles3.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_cash"); params.append("bizPath", "yinnong"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { - }) - })} - this.chargeItme.map(res => { - res.cashId = this.form.id - addCashdetail(res).then(r => { - }) - }) - if(this.form.capitalExpenditureType==2){ - this.projectForm.outId = this.form.id - this.$set(this.projectForm, "ynType", '2'); - addProjectto(this.projectForm).then(res => { - this.$toast.success('保存成功'); - setTimeout(function(){ - history.go(-1) - },2000) - }) - }else if(this.form.capitalExpenditureType==4){ - this.infoForm.transferId = this.form.id - addInfoto(this.infoForm).then(res => { - customSubmit(response.data.id).then(res => { - this.$toast.success('提交成功'); - setTimeout(function(){ - history.go(-1) - },2000) + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } + } }) }) }else{ - this.$toast.success('保存成功'); - setTimeout(function(){ - history.go(-1) - },2000) + if(this.form.capitalExpenditureType==2){ + addProjectto(this.projectForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + } else if(this.form.capitalExpenditureType==4){ + addInfoto(this.infoForm).then(res => { + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + }) + }else{ + _this.chargeItme.map((resD,b) => { + resD.cashId = _this.form.id + addCashdetail(resD).then((a,rD) => { + if(b == (_this.chargeItme.length-1)){ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + }) + }) + } } }); diff --git a/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify2.vue b/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify2.vue index 99069a2c..96e3d23b 100644 --- a/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify2.vue +++ b/src/views/yinnong/bankAgriculture/paymentApproval/approvalModify2.vue @@ -485,6 +485,7 @@ // 分页 pageNum: 1, pageSize: 999, + type:'name' }; listTemplate(templateQueryParams).then(rrr => { this.templateList = rrr.rows; @@ -685,6 +686,7 @@ this.$set(this.form, "expenditureAmount", total); }, goAdd(){ + let _this = this if(this.chargeItme.length<1){ this.$notify({ type: 'danger', message: '请添加收款方信息' }); return; @@ -717,7 +719,12 @@ return; } } - if((this.uploadFiles1==null||this.uploadFiles1.length==0)&&(this.uploadFiles2==null||this.uploadFiles2.length==0)&&(this.uploadFiles3==null||this.uploadFiles3.length==0)){ + if((this.uploadFiles1==null||this.uploadFiles1.length==0)&& + (this.uploadFiles2==null||this.uploadFiles2.length==0)&& + (this.uploadFiles3==null||this.uploadFiles3.length==0&& + this.fileList1.length==0&& + this.fileList2.length==0&& + this.fileList3.length==0)){ Dialog.confirm({ title: '提示', message: '此申请单中未上传任何附件,是否确认提交?', @@ -728,12 +735,12 @@ this.$set(this.form, "accountTypeList", this.chargeItme); this.$set(this.form, "transferStatusList", this.chargeItme); updateTransfer(this.form).then(response => { - this.projectForm.outId = this.form.id - this.infoForm.transferId = this.form.id + this.projectForm.outId = _this.form.id + this.infoForm.transferId = _this.form.id this.$set(this.projectForm, "ynType", '1'); if(this.form.capitalExpenditureType==2){ addProjectto(this.projectForm).then(res => { - customSubmit(this.form.id).then(res => { + customSubmit(_this.form.id).then(res => { this.$toast.success('提交成功'); setTimeout(function(){ history.go(-1) @@ -742,7 +749,7 @@ }) }else if(this.form.capitalExpenditureType==4){ addInfoto(this.infoForm).then(res => { - customSubmit(this.form.id).then(res => { + customSubmit(_this.form.id).then(res => { this.$toast.success('提交成功'); setTimeout(function(){ history.go(-1) @@ -750,7 +757,7 @@ }) }) }else{ - customSubmit(this.form.id).then(res => { + customSubmit(_this.form.id).then(res => { this.$toast.success('提交成功'); setTimeout(function(){ history.go(-1) @@ -768,45 +775,292 @@ this.$set(this.form, "accountTypeList", this.chargeItme); this.$set(this.form, "transferStatusList", this.chargeItme); updateTransfer(this.form).then(response => { - this.projectForm.outId = this.form.id - this.infoForm.transferId = this.form.id + this.projectForm.outId = _this.form.id + this.infoForm.transferId = _this.form.id this.$set(this.projectForm, "ynType", '1'); if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ - this.uploadFiles1.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); - params.append("tableName", "t_yinnong_transfer"); - params.append("bizPath", "transfer"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", _this.form.id); + params1.append("tableName", "t_yinnong_transfer"); + params1.append("bizPath", "transfer"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", _this.form.id); + params2.append("tableName", "t_yinnong_transfer"); + params2.append("bizPath", "transfer"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + } }) - })} - if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ - this.uploadFiles2.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } + } }) - })} - if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ - this.uploadFiles3.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }) + }else{ + customSubmit(_this.form.id).then(res => { + _this.$toast.success('提交成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } + } }) - })} + }) + }else{ if(this.form.capitalExpenditureType==2){ addProjectto(this.projectForm).then(res => { - customSubmit(this.form.id).then(res => { + customSubmit(_this.form.id).then(res => { this.$toast.success('提交成功'); setTimeout(function(){ history.go(-1) @@ -815,7 +1069,7 @@ }) } else if(this.form.capitalExpenditureType==4){ addInfoto(this.infoForm).then(res => { - customSubmit(this.form.id).then(res => { + customSubmit(_this.form.id).then(res => { this.$toast.success('提交成功'); setTimeout(function(){ history.go(-1) @@ -823,17 +1077,19 @@ }) }) }else{ - customSubmit(this.form.id).then(res => { + customSubmit(_this.form.id).then(res => { this.$toast.success('提交成功'); setTimeout(function(){ history.go(-1) },2000) }) } + } }); } }, goUpdate(){ + let _this = this if(this.chargeItme.length<1){ this.$notify({ type: 'danger', message: '请添加收款方信息' }); return; @@ -870,43 +1126,248 @@ this.$set(this.form, "bankTypeList", this.chargeItme); this.$set(this.form, "accountTypeList", this.chargeItme); this.$set(this.form, "transferStatusList", this.chargeItme); - updateTransfer(this.form).then((response) => { - this.projectForm.outId = this.form.id - this.infoForm.transferId = this.form.id + updateTransfer(this.form).then(response => { + this.projectForm.outId = _this.form.id + this.infoForm.transferId = _this.form.id this.$set(this.projectForm, "ynType", '1'); if(this.uploadFiles1!=null&&this.uploadFiles1.length>0){ - this.uploadFiles1.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); - params.append("tableName", "t_yinnong_transfer"); - params.append("bizPath", "transfer"); - params.append("fileType", "1"); - params.append("file", rr); - commonAttach(params).then((r) => { + this.uploadFiles1.map((rr1,idx1) => { + let params1 = new FormData(); + params1.append("tableId", _this.form.id); + params1.append("tableName", "t_yinnong_transfer"); + params1.append("bizPath", "transfer"); + params1.append("fileType", "1"); + params1.append("file", rr1); + commonAttach(params1).then((r1) => { + if(idx1 == (_this.uploadFiles1.length-1)){ + if(_this.uploadFiles2!=null&&_this.uploadFiles2.length>0){ + _this.uploadFiles2.map((rr2,idx2) => { + let params2 = new FormData(); + params2.append("tableId", _this.form.id); + params2.append("tableName", "t_yinnong_transfer"); + params2.append("bizPath", "transfer"); + params2.append("fileType", "2"); + params2.append("file", rr2); + commonAttach(params2).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + } + }) + }) + }else if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params3).then((r3) => { + if(idx3 ==(_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + } }) - })} - if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ - this.uploadFiles2.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles2!=null&&this.uploadFiles2.length>0){ + this.uploadFiles2.map((rr2,idx2) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "2"); - params.append("file", rr); - commonAttach(params).then((r) => { + params.append("file", rr2); + commonAttach(params).then((r2) => { + if(idx2 == (_this.uploadFiles2.length-1)){ + if(_this.uploadFiles3!=null&&_this.uploadFiles3.length>0){ + _this.uploadFiles3.map((rr3,idx3) => { + let params3 = new FormData(); + params3.append("tableId", _this.form.id); + params3.append("tableName", "t_yinnong_transfer"); + params3.append("bizPath", "transfer"); + params3.append("fileType", "3"); + params3.append("file", rr3); + commonAttach(params).then((r3) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + }) + }) + }else{ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } + } }) - })} - if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ - this.uploadFiles3.map(rr => { - const params = new FormData(); - params.append("tableId", this.form.id); + }) + }else if(this.uploadFiles3!=null&&this.uploadFiles3.length>0){ + this.uploadFiles3.map((rr3,idx3) => { + let params = new FormData(); + params.append("tableId", _this.form.id); params.append("tableName", "t_yinnong_transfer"); params.append("bizPath", "transfer"); params.append("fileType", "3"); - params.append("file", rr); + params.append("file", rr3); commonAttach(params).then((r) => { + if(idx3 == (_this.uploadFiles3.length-1)){ + if(_this.form.capitalExpenditureType==2){ + addProjectto(_this.projectForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + } else if(_this.form.capitalExpenditureType==4){ + addInfoto(_this.infoForm).then(res => { + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + }) + }else{ + _this.$toast.success('保存成功'); + setTimeout(function(){ + history.go(-1) + },2000) + } + } }) - })} + }) + }else{ if(this.form.capitalExpenditureType==2){ addProjectto(this.projectForm).then(res => { this.$toast.success('保存成功'); @@ -914,7 +1375,7 @@ history.go(-1) },2000) }) - }else if(this.form.capitalExpenditureType==4){ + } else if(this.form.capitalExpenditureType==4){ addInfoto(this.infoForm).then(res => { this.$toast.success('保存成功'); setTimeout(function(){ @@ -927,6 +1388,7 @@ history.go(-1) },2000) } + } }); }, accountTypeChange1(e){