在提交表单时,可以通过调用计算属性的方法来获取最新的值,并将其赋值给相应的表单字段,然后传递给后台处理逻辑。以下是代码的修改部分:

submitForm() {
  this.$refs['form'].validate((valid) => {
    if (valid) {
      if (this.form.personId != null) {
        // 更新操作
        updateReportingRoyaltiesIncome(this.form).then((response) => {
          this.msgSuccess('修改成功');
          this.open = false;
          this.getList();
        });
      } else {
        // 新增操作
        this.form.acTaxPiPersonCalculationSchedule.acTaxableIncome = this.acTaxableincome();
        this.form.acTaxPiPersonCalculationSchedule.payableTaxAmount = this.acTaxableamount();
        this.form.acTaxPiPersonCalculationSchedule.acTaxableAmount = this.payableTaxamount();
        this.form.acTaxPiPersonCalculationSchedule.acDeductiblePaymentAmount = this.acDeductibleAmount();
        this.form.personId = this.form.acTaxPiPersonVo.personId;
        this.form.reportingPeriodDate = this.collection;
        this.form.companyId = this.companyId;

        addReportingRoyaltiesIncome(this.form).then((response) => {
          console.log(response, 'resssssssssss');
          this.msgSuccess('新增成功');
          this.open = false;
          this.getList();
        });
      }
    }
  });
},

在新增操作中,通过调用计算属性的方法来获取最新的值,并将其赋值给相应的表单字段:

this.form.acTaxPiPersonCalculationSchedule.acTaxableIncome = this.acTaxableincome();
this.form.acTaxPiPersonCalculationSchedule.payableTaxAmount = this.acTaxableamount();
this.form.acTaxPiPersonCalculationSchedule.acTaxableAmount = this.payableTaxamount();
this.form.acTaxPiPersonCalculationSchedule.acDeductiblePaymentAmount = this.acDeductibleAmount();

这样,在提交表单时,就会将最新的计算属性值传递给后台处理逻辑。


原文地址: https://www.cveoy.top/t/topic/b3ip 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录