From 18ba3451851705757c764fc544b969450eb3d45b Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Tue, 6 Jan 2026 13:24:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E7=BB=B4=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/paymentRegistration.vue | 49 +++++++++++-------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/src/views/contract/components/paymentRegistration.vue b/src/views/contract/components/paymentRegistration.vue index e535615..d26a5be 100644 --- a/src/views/contract/components/paymentRegistration.vue +++ b/src/views/contract/components/paymentRegistration.vue @@ -1020,7 +1020,7 @@ export default { // 如果已经在第二步,立即填充到DOM;否则先在HTML字符串中填充值 if (this.currentStep === 2) { this.$nextTick(() => { - this.initTemplateFields(res) + this.initTemplateFields(res) }) } else { // 在第一步时,先在HTML字符串中填充值 @@ -1205,7 +1205,14 @@ export default { // 遍历模板字段,先设置字段值 fields.forEach(field => { // 特殊字段处理:从 paymentRegistrationForm 中获取值 - if (field.field === 'auditAmount') { + if (field.field === 'previousPayment') { + // 前期累计已付款:从 link_field 获取,如果没有值则填充为 0.00 + let value = 0 + if (field.link_field && contextData && contextData.other_data_fill && contextData.other_data_fill[field.link_field]) { + value = parseFloat(contextData.other_data_fill[field.link_field]) || 0 + } + field.value = value.toFixed(2) + } else if (field.field === 'auditAmount') { // 审计金额:从 paymentRegistrationForm.audit_money 获取,如果没有则为 0 const value = parseFloat(this.paymentRegistrationForm.audit_money) || 0 field.value = value.toFixed(2) @@ -1265,7 +1272,7 @@ export default { const radioGroups = new Set() fields.forEach(field => { if (field.field === 'currentPaymentRemark') { - const input = dom.querySelector(`[data-field="${field.field}"]`) + const input = dom.querySelector(`[data-field="${field.field}"]`) if (input && input.type === 'radio' && input.name) { radioGroups.add(input.name) } @@ -1318,13 +1325,13 @@ export default { if (!input) return // 处理单选框和复选框 - if (input.type === 'checkbox' || input.type === 'radio') { + if (input.type === 'checkbox' || input.type === 'radio') { // 检查值是否匹配 if (field.value !== undefined && field.value !== null && field.value !== '') { const fieldValueStr = String(field.value).trim() const inputValueStr = String(input.value).trim() if (fieldValueStr === inputValueStr) { - input.checked = true + input.checked = true input.setAttribute('checked', 'checked') } } @@ -1332,28 +1339,28 @@ export default { // 处理文本域 if (field.value !== undefined && field.value !== null) { input.textContent = field.value - } - } else { + } + } else { // 处理普通输入框 // 特殊字段即使值为0也要填充 - if (field.field === 'auditAmount' || field.field === 'currentDuePayment' || + if (field.field === 'previousPayment' || field.field === 'auditAmount' || field.field === 'currentDuePayment' || field.field === 'currentPayment' || field.field === 'totalPaid' || field.field === 'totalPlanned') { - input.value = field.value || '0' + input.value = field.value || '0.00' } else if (field.value !== undefined && field.value !== null && field.value !== '') { - input.value = field.value - } - } - } - }) + input.value = field.value + } + } + } + }) - // 更新对应tab的数据源 - const updatedForms = syncFormDomToHtml(dom, fields) - if (tableIndex === 1) { - this.forms1 = updatedForms - this.forms = this.forms1 // 默认使用第一个表格的数据 - } else if (tableIndex === 2) { - this.forms2 = updatedForms + // 更新对应tab的数据源 + const updatedForms = syncFormDomToHtml(dom, fields) + if (tableIndex === 1) { + this.forms1 = updatedForms + this.forms = this.forms1 // 默认使用第一个表格的数据 + } else if (tableIndex === 2) { + this.forms2 = updatedForms } } })