/** 提交按钮 */ submitForm() { const formCopy = { ...this.form }; delete formCopy.acTaxPiPersonVo; delete formCopy.acTaxPiPersonCalculationSchedule; this.$refs['form'].validate((valid) => { if (valid) { if (this.form.personId != null) { updateReportingRoyaltiesIncome(formCopy).then((response) => { this.msgSuccess('修改成功'); this.open = false; this.getList(); }); } else { addReportingRoyaltiesIncome(formCopy) .then((response) => { console.log(response, 'resssssssssss') this.msgSuccess('新增成功'); this.open = false; this.getList(); }); } } }); }, form: { personId: '', other: '', // 应纳税额 cost: '', // 应纳税额 taxExemptIncome: '', // 备注 remark: '', // 小计 subtotal: '', // 减免税额 reductionTaxAmount: '', // companyId: null, // incomeReportingCode: null, // 所得期间起 incomePeriodDateStart: '', // 所得期间至 incomePeriodDateEnd: '', // 应纳税额 acTaxPiPersonVo: { // 人员id personId: '', // 姓名 name: '', // 收入 income: '', // 证件号码 identificationNum: '', // 证件类型 identifiIcationType: '', // 工号 employeed: '', // 其他 }, acTaxPiPersonCalculationSchedule: { acTaxableAmount: '', // 减免税额 acTaxSavings: '', // 应纳税所得额 acTaxableIncome: '', // 已预缴税额 prepaidTaxAmount: '', // 税率/预扣率 taxRate: '', // 速算扣除数 quickCalculationDeduction: '', // 应补(退)税额 payableTaxAmount: '', // 累计应扣缴税额 acDeductiblePaymentAmount: '', }, }, 将数据传给接口时TypeError: Cannot read properties of undefined (reading 'name')'没有读到acTaxPiPersonVo报错 解决方法 完整代码内容:It seems that the error is occurring because the `acTaxPiPersonVo` object is not defined in the `form` object. To fix this, you need to initialize the `acTaxPiPersonVo` object before using it. Here's the updated code:
form: {
  personId: '',
  other: '',
  cost: '',
  taxExemptIncome: '',
  remark: '',
  subtotal: '',
  reductionTaxAmount: '',
  incomePeriodDateStart: '',
  incomePeriodDateEnd: '',
  acTaxPiPersonVo: {
    personId: '',
    name: '',
    income: '',
    identificationNum: '',
    identificationType: '',
    employeeId: '',
    other: ''
  },
  acTaxPiPersonCalculationSchedule: {
    acTaxableIncome: '',
    taxRate: '',
    quickCalculationDeduction: '',
    acTaxableAmount: '',
    acTaxSavings: '',
    acDeductiblePaymentAmount: '',
    prepaidTaxAmount: '',
    payableTaxAmount: ''
  }
},

Make sure to adjust the initial values of the properties according to your requirements.


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

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