From cf9c3675774cb82fcb039e55ae0b04430881b98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98wangjiuyun?= <‘1595161655@qq.com> Date: Wed, 13 Nov 2024 16:42:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E9=87=91=E8=AE=A1=E5=88=92=E8=A1=A8?= =?UTF-8?q?=20=E4=BB=98=E6=AC=BE=E5=92=8C=E6=94=B6=E6=AC=BE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=85=AC=E5=BC=8F=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/assets/js/project_budget.js | 57 +++++++++++++++---- .../assets/js/project_budget_income_plan.js | 18 ++++++ .../static/assets/js/project_budget_plan.js | 8 +-- .../templates/admin/project_budget_edit.ftl | 2 +- 4 files changed, 68 insertions(+), 17 deletions(-) diff --git a/src/main/resources/static/assets/js/project_budget.js b/src/main/resources/static/assets/js/project_budget.js index 713abbd..30235af 100644 --- a/src/main/resources/static/assets/js/project_budget.js +++ b/src/main/resources/static/assets/js/project_budget.js @@ -92,7 +92,10 @@ $(function () { $("#collaboratorUrl").val($("#collaboratorUrl_span").text()); // checkIfFillIn(); - + if(!checkprojectPlan()){ + $("#saveDraft").attr('disabled', false); + return; + } var dataIncome = collectData("am-modal-prompt-input-income"); if (dataIncome.length <= 0) { window.confirm('请填写收入明细表'); @@ -211,7 +214,10 @@ $(function () { $("#saveApprove").click(function () { $("#saveApprove").attr('disabled', true); $("#collaboratorUrl").val($("#collaboratorUrl_span").text()); - + if(!checkprojectPlan()){ + $("#saveApprove").attr('disabled', false); + return + } checkIfFillIn(); if (check === 1) { $("#saveApprove").attr('disabled', false); @@ -274,17 +280,17 @@ $(function () { dataManage = prepareAjaxDataVerify(dataManage, COST_PROJECT_MANAGE_DETAIL, $("#id").val()); var totalTotal = dataManage.details.reduce((total, now) => { - return now.total + total + return now.total + total }, 0) var limitTotal = dataManage.details.reduce((total, now) => { if (now.type == 2 && (now.name == '5' || now.name == '4')) - return + total + return +total else return total }, 0) var projectGrossProfitA = $('[name="projectGrossProfitA"]').val() - console.log(limitTotal , projectGrossProfitA.replace(/,/g, ''),totalTotal,limitTotal) + console.log(limitTotal, projectGrossProfitA.replace(/,/g, ''), totalTotal, limitTotal) - if (limitTotal > ((parseFloat(projectGrossProfitA.replace(/,/g, ''))-(totalTotal-limitTotal)) * 0.1)) { + if (limitTotal > ((parseFloat(projectGrossProfitA.replace(/,/g, '')) - (totalTotal - limitTotal)) * 0.1)) { $("#saveApprove").attr('disabled', false); layuiAlert(`差旅费+业务费总金额不超过【毛利A(${projectGrossProfitA})-(项目管理费用-差旅费-业务费)】*10%`); return @@ -388,8 +394,6 @@ function checkIfFillIn() { var calculationCollectionBudget = $("#calculationCollectionBudget").val(); - - if (name.length <= 0) { window.confirm('项目名称不能为空'); check = 1; @@ -519,17 +523,17 @@ function checkIfFillIn() { check = 1; return; } - if(!isSecondBudget){ + if (!isSecondBudget) { window.confirm('是否二次合作不能为空'); check = 1; return; } - if(!signTypeBudget){ + if (!signTypeBudget) { window.confirm('是否汇智中标不能为空'); check = 1; return; } - if(!calculationCollectionBudget){ + if (!calculationCollectionBudget) { window.confirm('计收计划不能为空'); check = 1; return; @@ -543,7 +547,7 @@ function checkName() { var name = $("#nameBudget").val(); var id = $("#id").val(); $.ajax({ - url: base+"/project/checkName", + url: base + "/project/checkName", data: {name: name, id: id}, type: "post", dataType: "json", @@ -1020,3 +1024,32 @@ function updateBudgetPlanDetailDataUnsubmit(data, returnData) { updateCashFlow(); } +// 校验资金计划表 +function checkprojectPlan() { + // 付款总计 + let planPayTotal = f2($('.input-total-title-total-cost-budget-plan').val()) + // 保证金付款总计 + let planPayEarnest = f2($('.input-total-title-earnest-money-cost-budget-plan').val()) + // 项目管理付款总计 + let planPayProject = f2($('.input-total-title-project-manage-cost-budget-plan').val()) + // 采购成本明细总计 + let costTatol = f2($('.input-changeable-total-total-tax-include-cost').val()) + if (planPayTotal != (planPayEarnest + planPayProject + costTatol)) { + layuiAlert('资金计划表的付款合计需=保证金付款+项目管理费用表总计+采购成本明细表总计') + return false; + } +// 收款总计 + let saleTatol = f2($('.input-total-title-total-income-budget-plan').val()) +// 保证金收款 + let saleEarnest=f2($('.input-total-title-earnest-money-income-budget-plan').val()) +// 收入明细表总计 + let incomeTotal=f2($('.input-changeable-total-total-tax-include-income').val()) + if (saleTatol != (saleEarnest + incomeTotal)) { + layuiAlert('资金计划表的收款合计需= 保证金收款+收入明细表总计') + return false; + } + + return true + +} + diff --git a/src/main/resources/static/assets/js/project_budget_income_plan.js b/src/main/resources/static/assets/js/project_budget_income_plan.js index f565b87..32c2cf4 100644 --- a/src/main/resources/static/assets/js/project_budget_income_plan.js +++ b/src/main/resources/static/assets/js/project_budget_income_plan.js @@ -48,6 +48,8 @@ $(function () { bindNum(); updateTotal("input-changeable-receive-income-plan", "input-changeable-total-receive-income-plan"); }); + bindIncomePlanTotal(); + }); @@ -56,7 +58,23 @@ $(function () { */ function updateIncomePlanData(data,returnData) { layuiAlert("保存成功"); + $('.input-changeable-sale-income-budget-plan').val(0) + $('.input-changeable-sale-income-budget-plan').each( (index,ele) =>{ + let time=$(ele).parent().parent().find('.input-changeable-month-budget-plan').val() + let total=0 + data.details.forEach((ele)=>{ + + if(time==ele.receiveTime.slice(0, 7)) + total+=ele.receiveAmount + }) + $(ele).val(total) + var eventChange= new Event('change',{bubbles:true}); + ele.dispatchEvent(eventChange); + updateTotal('input-changeable-sale-income-budget-plan','input-total-title-sale-income-budget-plan') + + }) $('#my-prompt-income-plan-detail').modal('close'); + } 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 40c1e28..3ef724b 100644 --- a/src/main/resources/static/assets/js/project_budget_plan.js +++ b/src/main/resources/static/assets/js/project_budget_plan.js @@ -6,7 +6,7 @@ BUDGET_PLAN_DETAIL2={ "month":[true,"月份"], "deviceCost":[false,"设备付款","number"], "projectCost":[false,"工程付款","number"], - "serviceCost ":[false,"服务付款","number"], + "serviceCost":[false,"服务付款","number"], "otherCost":[false,"其他付款","number"], "projectManageCost":[false,"经营性开支","number"], "earnestMoneyCost":[false,"保证金付款","number"], @@ -24,7 +24,7 @@ BUDGET_PLAN_DETAIL={ "month":[true,"月份"], "deviceCost":[true,"设备付款","number"], "projectCost":[false,"工程付款","number"], - "serviceCost ":[false,"服务付款","number"], + "serviceCost":[false,"服务付款","number"], "otherCost":[false,"其他付款","number"], "projectManageCost":[true,"经营性开支","number"], "earnestMoneyCost":[true,"保证金付款","number"], @@ -395,7 +395,7 @@ function appendTrBudgetPlan() { '