解决“Cannot read properties of null (reading 'gregorianCalendarDays')”错误的完整代码
submitForm() { const acTaxPiIncomeReportingDetail = this.form.acTaxPiIncomeReportingDetail; // this.form = { ...formdata } console.log(this.form.incomePeriodDateEnd, 'person'); this.$refs["form"].validate((valid) => { if (valid) { this.$refs.form.validateField(); this.form.acTaxPiPersonCalculationSchedule.acTaxableIncome = this.acTaxableincome; this.form.acTaxPiPersonCalculationSchedule.acTaxableAmount = this.acTaxableamount; this.form.acTaxPiPersonCalculationSchedule.acDeductiblePaymentAmount = this.acDeductibleAmount; this.form.acTaxPiPersonCalculationSchedule.payableTaxAmount = this.payableTaxamount; this.form.reportingPeriodDate = this.collection; // const existperson = this.personInfo.find( // (item) => item.personId === this.form.acTaxPiPersonVo.personId // ); // if (existperson) { // this.$message.error('person 已存在'); // return; // } this.form.acTaxPiIncomeReportingDetail = acTaxPiIncomeReportingDetail; if (this.form.personId != null) { this.form.companyId = this.companyId; updateReportingEquityIncentive(this.form).then((response) => { console.log(this.form.incomePeriodDateEnd, 'edit'); this.msgSuccess('修改成功'); this.open = false; this.getList(); }); } else { this.form.acTaxPiPersonCalculationSchedule.taxRate = this.defaultTax; this.form.personId = this.form.acTaxPiPersonVo.personId; // this.form.reportingPeriodDate = this.collection; this.form.companyId = this.companyId; console.log(this.form.personId, 'acTaxPiPersonVo'); addReportingEquityIncentive(this.form).then((response) => { console.log(response, 'resssssssssss'); this.msgSuccess('新增成功'); this.open = false; this.getList(); }); } } else { console.log('error submit!!'); return false; } }); },
// 明细对话框 submitDetail() { console.log(this.form.acTaxPiIncomeReportingDetail, 'ddddd'); this.isViewMode = false; if (!this.form.acTaxPiIncomeReportingDetail) { this.form.acTaxPiIncomeReportingDetail = {}; // 初始化为空对象 } const acTaxPiIncomeReportingDetail = this.form.acTaxPiIncomeReportingDetail; const formitems = [ 'gregorianCalendarDays', 'domesticWorkDays', 'abroadWorkDays', 'totalRevenue', 'domesticPayment', 'abroadPayment', ]; // this.form.acTaxPiIncomeReportingDetail = { // ...this.form.acTaxPiIncomeReportingDetail, // }; const formdata = this.form; console.log(formdata, 'fffffff'); formitems.forEach((item) => { if (formdata.acTaxPiIncomeReportingDetail.hasOwnProperty(item)) { acTaxPiIncomeReportingDetail[item] = formdata.acTaxPiIncomeReportingDetail[item]; } }); const income = this.calculateIncome(); this.form.equityIncentiveIncome = income; this.dialogVisible = false; this.submitForm(); },
原文地址: https://www.cveoy.top/t/topic/pdw7 著作权归作者所有。请勿转载和采集!