diff --git a/src/views/finance/paymentRegistrationList.vue b/src/views/finance/paymentRegistrationList.vue index 6185b30..296ccb6 100644 --- a/src/views/finance/paymentRegistrationList.vue +++ b/src/views/finance/paymentRegistrationList.vue @@ -779,23 +779,39 @@ export default { return } - // 获取付款登记的项目名称 - const projectName = this.currentAuditRow.contract_id - ? (this.currentAuditRow.contract ? this.currentAuditRow.contract.name : '') - : (this.currentAuditRow.away ? this.currentAuditRow.away.title : this.currentAuditRow.name) - // 检查每个付款记录是否至少选择了一条预算计划,并构建contract_plan_act_links数组 const contract_plan_act_links = [] for (const fundLog of this.currentAuditRow.fund_logs) { + // 获取这一条付款记录的项目名称 + const fundLogProjectName = fundLog.contract_id + ? (fundLog.contract ? fundLog.contract.name : '') + : (fundLog.away ? fundLog.away.title : fundLog.name) + const planLinkData = this.planLinkDataMap[fundLog.id] || [] const selectedItems = planLinkData.filter(item => item.selected) if (selectedItems.length === 0) { - // 提示的项目名称应该是付款登记的项目名称 + // 提示的项目名称应该是付款记录的项目名称 + Message({ + type: 'warning', + message: `付款登记"${fundLogProjectName}"未选择预算计划` + }) + return + } + + // 计算选中的预算计划的使用金额之和 + const totalUseMoney = selectedItems.reduce((sum, item) => sum + (parseFloat(item.use_money) || 0), 0) + + // 获取该付款记录的实际支付金额 + const actualMoney = parseFloat(fundLog.act_money) || 0 + + // 校验:选中的预算计划使用金额之和要等于实际支付金额(完全相等,不允许误差) + if (totalUseMoney !== actualMoney) { + // 提示的项目名称应该是付款记录的项目名称 Message({ type: 'warning', - message: `项目"${projectName}"未选择预算计划` + message: `项目"${fundLogProjectName}"的预算计划金额与实际支付金额不相等` }) return }