From 480c2300074b2a2695caa781ab22e31e7d293e92 Mon Sep 17 00:00:00 2001 From: xxssyyyyssxx Date: Thu, 4 Nov 2021 16:19:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E9=87=91=E8=AE=A1=E5=88=92=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E4=B8=80=E8=A1=8C=E6=9B=B4=E6=96=B0=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=90=88=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/assets/js/project_budget_plan.js | 35 +++++++++++++------ .../templates/admin/project_budget_edit.ftl | 4 ++- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/main/resources/static/assets/js/project_budget_plan.js b/src/main/resources/static/assets/js/project_budget_plan.js index 9ace3a2..729da2c 100644 --- a/src/main/resources/static/assets/js/project_budget_plan.js +++ b/src/main/resources/static/assets/js/project_budget_plan.js @@ -38,14 +38,37 @@ function appendTrBudgetPlan() { ' \n' + ' \n' + ' \n' + - ' \n' + + ' \n' + ' '; $("#budgetPlanDetailTable").append(template); //重新绑定删除事件和input修改事件 - bindDeleteBtn(); + bindBudgetPlanDeleteBtn(); bindChangeableInputBudgetPlanDetail(); } +/** + * 绑定删除删除按钮,不仅删除还需要重新计算统计的数据 + */ +function bindBudgetPlanDeleteBtn() { + $(".am-modal-line-delete-budget-plan").click(function () { + //删除自己对应的tr + $(this).parent().parent().remove(); + //还需要更新每一列的合计数据 + updateBudgetPlanTotal("input-changeable-device-cost-budget-plan","input-total-device-cost-budget-plan"); + updateBudgetPlanTotal("input-changeable-engineer-cost-budget-plan","input-total-engineer-cost-budget-plan"); + updateBudgetPlanTotal("input-changeable-project-manage-cost-budget-plan","input-total-project-manage-cost-budget-plan"); + updateBudgetPlanTotal("input-changeable-earnest-money-cost-budget-plan","input-total-earnest-money-cost-budget-plan"); + updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-total-cost-budget-plan"); + updateBudgetPlanTotal("input-changeable-sale-income-budget-plan","input-total-sale-income-budget-plan"); + updateBudgetPlanTotal("input-changeable-earnest-money-income-budget-plan","input-total-earnest-money-income-budget-plan"); + updateBudgetPlanTotal("input-changeable-total-income-budget-plan","input-total-total-income-budget-plan"); + updateBudgetPlanTotal("input-changeable-fund-balance-budget-plan","input-total-fund-balance-budget-plan"); + updateBudgetPlanTotal("input-changeable-capital-interest-budget-plan","input-total-capital-interest-budget-plan"); + updateBudgetPlanTotal("input-changeable-underwritten-plan-budget-plan","input-total-underwritten-plan-budget-plan"); + updateBudgetPlanTotal("input-changeable-repayment-plan-budget-plan","input-total-repayment-plan-budget-plan"); + }); +} + function bindChangeableInputBudgetPlanDetail() { //设备支出改变 $(".input-changeable-device-cost-budget-plan").change(function () { @@ -147,14 +170,6 @@ function bindChangeableInputBudgetPlanDetail() { $(".input-changeable-repayment-plan-budget-plan").change(function () { updateBudgetPlanTotal("input-changeable-repayment-plan-budget-plan","input-total-repayment-plan-budget-plan"); }); - /*//支出合计改变 - $(".input-changeable-total-cost-budget-plan").change(function () { - updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-total-cost-budget-plan"); - }); - //收款合计改变 - $(".input-total-total-income-budget-plan").change(function () { - updateBudgetPlanTotal("input-changeable-total-income-budget-plan","input-total-total-income-budget-plan"); - });*/ } /** diff --git a/src/main/resources/templates/admin/project_budget_edit.ftl b/src/main/resources/templates/admin/project_budget_edit.ftl index 5a6d926..39d9cba 100644 --- a/src/main/resources/templates/admin/project_budget_edit.ftl +++ b/src/main/resources/templates/admin/project_budget_edit.ftl @@ -639,7 +639,7 @@ - + @@ -689,6 +689,8 @@ bindChangeableInputProjectManage(); //绑定资金计划明细输入框 bindChangeableInputBudgetPlanDetail(); + //绑定资金计划的删除按钮 + bindBudgetPlanDeleteBtn(); $("#saveDraft").click(function () {