| | |
| | | <div v-else class="pdfimgmins">{{ hintitle }}</div> |
| | | </div> |
| | | </el-dialog> |
| | | <el-dialog title="提示" :visible.sync="Savereminder" width="30%"> |
| | | <el-alert |
| | | :title=" |
| | | '您已添加' + |
| | | totalquantity + |
| | | '条数据,为防止数据丢失是否提交保存再继续添加。' |
| | | " |
| | | type="warning" |
| | | > |
| | | </el-alert> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="unsave">取 消</el-button> |
| | | <el-button type="primary" @click="Savenow">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | label: "" |
| | | }, |
| | | pdfimgsrcList: [], |
| | | Savereminder: false, //提醒保存弹框 |
| | | Reminderquantity: 0, //提醒数量 |
| | | totalquantity: 0, //总数量 |
| | | |
| | | hintitle: "选中左侧已上传文件预览查看", |
| | | atpresent: "", |
| | |
| | | }) |
| | | .catch(() => {}); |
| | | }, |
| | | // 取消提醒 |
| | | unsave() { |
| | | this.Savereminder = false; |
| | | this.Reminderquantity = 0; |
| | | }, |
| | | // 接受提醒立刻保存 |
| | | Savenow() { |
| | | this.Savereminder = false; |
| | | this.Reminderquantity = 0; |
| | | this.totalquantity = 0; |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | //票据文件处理 |
| | | let list = this.fileListto; |
| | | console.log(list); |
| | | |
| | | //校验请款金额合计是否等于报销单金额 |
| | | if ( |
| | | this.form.amountrequested != |
| | | this.rbPayees.reduce( |
| | | (amount, item) => amount + Number(item.amount), |
| | | 0.0 |
| | | ) |
| | | ) { |
| | | this.$message({ |
| | | message: |
| | | "报销请款表中合计金额不等于报销单的报销金额,请更正后再保存!", |
| | | type: "warning" |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | const rbDetails = [...this.rbDetails]; |
| | | const rbPayees = [...this.rbPayees]; |
| | | if (this.form.id != null) { |
| | | console.log(this.form); |
| | | updateReimbursement(this.form); |
| | | // .then(res => { |
| | | //保存明细 |
| | | for (let i = 0; i < rbDetails.length; i++) { |
| | | if (rbDetails[i].rbid != null) { |
| | | updateReimbursementdetail(rbDetails[i]); |
| | | } else { |
| | | //rbid关联主表Id |
| | | rbDetails[i].rbid = this.form.id; |
| | | addReimbursementdetail(rbDetails[i]); |
| | | } |
| | | } |
| | | |
| | | //保存账户 |
| | | for (let i = 0; i < rbPayees.length; i++) { |
| | | if (rbPayees[i].rbid != null) { |
| | | updateReimbursementpayee(rbPayees[i]); |
| | | } else { |
| | | //rbid关联主表Id |
| | | rbPayees[i].rbid = this.form.id; |
| | | addReimbursementpayee(rbPayees[i]); |
| | | } |
| | | } |
| | | |
| | | this.$modal.msgSuccess("修改报销单保存成功!"); |
| | | |
| | | // this.getList(); |
| | | // }) |
| | | // .catch(err => { |
| | | // this.$modal.msgError("修改报销单保存失败!"); |
| | | // }); |
| | | } else { |
| | | this.form.recordstatus = -1; |
| | | addReimbursement(this.form) |
| | | .then(response => { |
| | | //保存明细 |
| | | for (let i = 0; i < rbDetails.length; i++) { |
| | | //rbid关联主表Id |
| | | rbDetails[i].rbid = response.data; |
| | | addReimbursementdetail(rbDetails[i]); |
| | | } |
| | | |
| | | //保存账号 |
| | | for (let i = 0; i < rbPayees.length; i++) { |
| | | //rbid关联主表Id |
| | | rbPayees[i].rbid = response.data; |
| | | addReimbursementpayee(rbPayees[i]); |
| | | } |
| | | |
| | | this.$modal.msgSuccess("新增报销单保存成功!"); |
| | | }) |
| | | .catch(err => { |
| | | this.$modal.msgError("新增报销单保存失败!"); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | //新增一行 |
| | | addDetailRow(rowIndex) { |
| | |
| | | personname: null, |
| | | destination: null |
| | | }; |
| | | if (this.Reminderquantity >= 5) { |
| | | this.Savereminder = true; |
| | | return; |
| | | } |
| | | if (rowIndex == undefined || rowIndex == null || rowIndex < 0) { |
| | | this.rbDetails.push(rowData); |
| | | } else { |
| | | this.rbDetails.splice(rowIndex + 1, 0, rowData); |
| | | } |
| | | this.Reminderquantity++; |
| | | this.totalquantity++; |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | this.rbDetails[i].orderno = i + 1; |
| | | } |
| | |
| | | personname: null, |
| | | amount: null |
| | | }; |
| | | if (this.Reminderquantity >= 5) { |
| | | this.Savereminder = true; |
| | | return; |
| | | } |
| | | if (rowIndex == undefined || rowIndex == null || rowIndex <= 0) { |
| | | this.rbPayees.push(rowData); |
| | | } else { |
| | | this.rbPayees.splice(rowIndex + 1, 0, rowData); |
| | | } |
| | | this.Reminderquantity++; |
| | | this.totalquantity++; |
| | | for (let i = 0; i < this.rbPayees.length; i++) { |
| | | this.rbPayees[i].orderno = i + 1; |
| | | } |