submitDetail 函数中,将 acTaxPiIncomeReportingDetail 的值存储到 submitForm 函数中的 form.acTaxPiIncomeReportingDetail,可以直接将 form.acTaxPiIncomeReportingDetail 赋值给 this.form.acTaxPiIncomeReportingDetail,无需重新创建一个对象。

代码示例如下:

submitDetail() {
  console.log(this.form.acTaxPiIncomeReportingDetail, 'ddddd');
  this.isViewMode = false;
  const formitems = [
    'gregorianCalendarDays',
    'domesticWorkDays',
    'abroadWorkDays',
    'totalRevenue',
    'domesticPayment',
    'abroadPayment',
  ];
  this.form.acTaxPiIncomeReportingDetail = this.form.acTaxPiIncomeReportingDetail; // 将acTaxPiIncomeReportingDetail的值存储到form.acTaxPiIncomeReportingDetail
  const income = this.calculateIncome();
  this.form.equityIncentiveIncome = income;
  this.dialogVisible = false;
}

另外,代码中有多个重复的 submitDetail 函数,应该保留其中一个,删除其他重复的函数。

Vue.js 代码优化:直接赋值,简化 acTaxPiIncomeReportingDetail 存储

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

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