From b65457f0ecfa832b34e796560d5b3851aeb1fc30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98wangjiuyun?= <‘1595161655@qq.com> Date: Mon, 28 Oct 2024 20:03:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E9=83=A8=E5=88=86=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/assets/js/project_budget.js | 7 +- .../static/assets/js/project_budget_cost.js | 36 +- .../static/assets/js/project_budget_income.js | 22 +- .../static/assets/js/project_budget_pay.js | 340 ++++++++++++++++++ .../static/assets/js/project_budget_plan.js | 6 +- .../templates/admin/project_approve.ftl | 1 + .../templates/admin/project_budget_edit.ftl | 114 ++++-- 7 files changed, 449 insertions(+), 77 deletions(-) create mode 100644 src/main/resources/static/assets/js/project_budget_pay.js diff --git a/src/main/resources/static/assets/js/project_budget.js b/src/main/resources/static/assets/js/project_budget.js index 46e77a6..38e595d 100644 --- a/src/main/resources/static/assets/js/project_budget.js +++ b/src/main/resources/static/assets/js/project_budget.js @@ -185,7 +185,12 @@ $(function () { // return; // } // console.log(message); - + // 保存付款计划表 + var dataPay = collectData("am-modal-prompt-input-pay"); + dataPay = prepareAjaxDataVerify(dataPay, pay_DETAIL2, $("#id").val()); + if(dataPay){ + postAjax(base+"/project/budgetEditSaveBudgetPayPlan", dataPay); + } var startTime = $("#startDate").val(); var endTime = $("#endDate").val(); if (startTime > endTime) { diff --git a/src/main/resources/static/assets/js/project_budget_cost.js b/src/main/resources/static/assets/js/project_budget_cost.js index 8f3c8b7..b21e529 100644 --- a/src/main/resources/static/assets/js/project_budget_cost.js +++ b/src/main/resources/static/assets/js/project_budget_cost.js @@ -4,43 +4,25 @@ //COST_DETAIL_ARR=["type","category","name","unit","amount","price","taxRate","totalTaxInclude","totalTaxExclude"]; COST_DETAIL2={ "num":[false,"序号","string"], - "type":[false,"费用项目","string"], - "category":[false,"采购类别","string"], - // "name":[false,"名称","string"], - // "unit":[false,"单位","string"], - // "amount":[false,"数量","number"], - // "price":[false,"单价","price"], + "type":[false,"采购成本项目","string"], + "category":[false,"产品大类","string"], "taxRate":[false,"税率","number"], "totalTaxInclude":[false,"含税总金额","number"], "totalTaxExclude":[false,"不含税金额","number"], "totalTax":[false,"税金","number"], - // "contractParty":[false,"签约方","string"], - // "isUnderwritten":[false,"是否垫资","string"], - // "underwrittenAmount":[false,"预估垫资金额","number"], - // "payTime":[false,"支出时间","string"], - // "payAmount":[false,"支出金额","number"], - // "payWay":[false,"付款方式","string"], + "contractParty":[false,"供应商","string"], "remark":[false,"备注","string"] }; COST_DETAIL={ "num":[false,"序号","string"], - "type":[true,"费用项目","string"], - "category":[true,"产品大类","string"], - "name":[true,"名称","string"], - // "unit":[true,"单位","string"], - // "amount":[true,"数量","number"], - // "price":[true,"单价","price"], - "taxRate":[true,"税率","number"], - "totalTaxInclude":[true,"含税总金额","number"], - "totalTaxExclude":[true,"不含税金额","number"], - "totalTax":[true,"税金","number"], + "type":[false,"采购成本项目","string"], + "category":[false,"产品大类","string"], + "taxRate":[false,"税率","number"], + "totalTaxInclude":[false,"含税总金额","number"], + "totalTaxExclude":[false,"不含税金额","number"], + "totalTax":[false,"税金","number"], "contractParty":[false,"供应商","string"], - // "isUnderwritten":[false,"是否垫资","string"], - // "underwrittenAmount":[false,"预估垫资金额","number"], - // "payTime":[false,"支出时间","string"], - // "payAmount":[false,"支出金额","number"], - // "payWay":[false,"付款方式","string"], "remark":[false,"备注","string"] }; /* diff --git a/src/main/resources/static/assets/js/project_budget_income.js b/src/main/resources/static/assets/js/project_budget_income.js index e6b58aa..06f8767 100644 --- a/src/main/resources/static/assets/js/project_budget_income.js +++ b/src/main/resources/static/assets/js/project_budget_income.js @@ -6,11 +6,6 @@ INCOME_DETAIL2={ "num":[false,"序号","string"], "type":[false,"类别","string"], "name":[false,"产品大类","string"], - // "spec":[false,"规格类型","string"], - // "param":[false,"参数","string"], - // "unit":[false,"单位","string"], - // "amount":[false,"数量","number"], - // "price":[false,"单价","price"], "taxRate":[false,"税率","number"], "totalTaxInclude":[false,"含税总金额","number"], "totalTaxExclude":[false,"不含税金额","number"], @@ -19,17 +14,12 @@ INCOME_DETAIL2={ INCOME_DETAIL={ "num":[false,"序号","string"], - "type":[true,"类别","string"], - "name":[true,"名称","string"], - "spec":[true,"规格类型","string"], - "param":[true,"参数","string"], - "unit":[true,"单位","string"], - "amount":[true,"数量","number"], - "price":[true,"单价","price"], - "taxRate":[true,"税率","number"], - "totalTaxInclude":[true,"含税总金额","number"], - "totalTaxExclude":[true,"不含税金额","number"], - "totalTax":[true,"税金","number"] + "type":[false,"类别","string"], + "name":[false,"产品大类","string"], + "taxRate":[false,"税率","number"], + "totalTaxInclude":[false,"含税总金额","number"], + "totalTaxExclude":[false,"不含税金额","number"], + "totalTax":[false,"税金","number"] }; /*$(function () { diff --git a/src/main/resources/static/assets/js/project_budget_pay.js b/src/main/resources/static/assets/js/project_budget_pay.js new file mode 100644 index 0000000..7f3c174 --- /dev/null +++ b/src/main/resources/static/assets/js/project_budget_pay.js @@ -0,0 +1,340 @@ +/** + * 一个采购成本详情的字段 + */ +//COST_DETAIL_ARR=["type","category","name","unit","amount","price","taxRate","totalTaxInclude","totalTaxExclude"]; +pay_DETAIL2={ + "num":[false,"序号","string"], + "payPoint":[false,"付款节点","string"], + "payTime":[false,"付款时间","string"], + "payProject":[false,"采购成本项目","number"], + "payAmount":[false,"付款金额","number"], + "supplier":[false,"供应商","number"], +}; + +pay_DETAIL={ + "num":[false,"序号","string"], + "payPoint":[false,"付款节点","string"], + "payTime":[false,"付款时间","string"], + "payProject":[false,"采购成本项目","number"], + "payAmount":[false,"付款金额","number"], + "supplier":[false,"供应商","number"], +}; +/* +[ + {"id":"1","name":"xxx1"},{"id":"2","name":"xxx2"} +] + */ +SELECT_TYPE_CATEGORY_DATA=[]; +/*{ + "1":[ + { + "id":"1", + "name":"华智产品" + }, + { + "id":"2", + "name":"紫光其他产品" + }, + { + "id":"3", + "name":"外购产品" + } + ], + "2":[ + { + "id":"4", + "name":"外购工程" + } + ], + "3":[ + { + "id":"5", + "name":"华智服务" + }, + { + "id":"6", + "name":"紫光其他服务" + }, + { + "id":"7", + "name":"外购服务" + } + ], + "4":[ + { + "id":"8", + "name":"其他" + } + ] +};*/ +SELECT_TYPE_CATEGORY_MAP_DATA={}; +/*{ + "1":"1", + "2":"1", + "3":"1", + "4":"2", + "5":"3", + "6":"3", + "7":"3", + "8":"4" +}; +*/ +SELECT_CATEGORY_TYPE_MAP_DATA={}; + +/*$(function () { + $("#cost-detail").click(function () { + $('#my-prompt-cost-detail').modal({ + relatedTarget: this, + closeOnConfirm:false, + onConfirm: function(e) { + //不能使用e.data,因为无法获取动态添加的 + var data = collectData("am-modal-prompt-input-cost"); + //data = prepareAjaxData(data, COST_DETAIL_ARR, $("#id").val(),false); + data = prepareAjaxDataVerify(data, COST_DETAIL, $("#id").val()); + if(data){ + postAjax(base+"/project/budgetEditSaveCostDetail", data, updateCostData); + } + }, + onCancel: function(e) { + } + }); + }); + $("#costAddBtn").click(function () { + appendTrCost(); + }); + + + + //初始化大类和类别的数据 + getAjax(base+"/procurement/type/map", null, initTypeCategory); +});*/ + +$(function () { +}); + +//保存采购成本明细表 +$(function () { + $("#payTableSave").click(function () { + //不能使用e.data,因为无法获取动态添加的 + var data = collectData("am-modal-prompt-input-pay"); + //data = prepareAjaxData(data, COST_DETAIL_ARR, $("#id").val(),false); + data = prepareAjaxDataVerify(data, pay_DETAIL2, $("#id").val()); + if(data){ + postAjax(base+"/project/budgetEditSaveBudgetPayPlan", data, updateCostData); + } + }); + + $("#payAddBtn").click(function () { + appendTrPay(); + $("#payAddBtn").blur(); + }); + + //绑定删除按钮 + bindDeleteBtnPay(); + + //初始化大类和类别的数据 + getAjax(base+"/procurement/type/map", null, initTypeCategory); +}); + +/** + * 采购成本增加一行 + */ +function appendTrPay() { + //console.log(SELECT_TYPE_CATEGORY_DATA); + var options = '\r\n'; + SELECT_TYPE_CATEGORY_DATA.forEach(function (e) { + options+='\r\n'; + }); + + var template = '' + + '' + + ''+ + ''+ + ''+ + ''+ + ''+ + '' + + '' + + ''+ + + ''; + + $("#payTotal").before(template); + //重新绑定删除事件和input修改事件 + bindDeleteBtnPay(); + //绑定序号 + bindNum(); + //绑定时间 + bindTime(); + //绑定总计值 + bindPayTotal(); + //绑定数字输入框保留两位小数 + bindNumberInput(); + + if ($('#costTable').find('tbody') && $('#costTable').find('tbody')[0]) { + $('#costTable').find('tbody')[0].scrollTop = $('#costTable').find('tbody')[0].scrollHeight + } +} + +/** + * 绑定时间选择器 + */ +function bindTime() { + $('[data-am-datepicker]').datepicker(); +} + +/** + * 绑定每一行的删除事件,删除当前的一行tr,修改总计值 + */ +function bindDeleteBtnPay() { + $(".am-modal-line-delete").click(function () { + //删除自己对应的tr + $(this).parent().parent().remove(); + bindNum(); + updateTotal("input-changeable-pay-amount", "input-changeable-pay-amount-total"); + }); +} + +/** + * 绑定每个可改变的输入框,修改后改变对应输入框的值 + */ +function bindPayTotal() { + //数量改变 + $(".input-changeable-pay-amount").change(function () { + updateTotal("input-changeable-pay-amount", "input-changeable-pay-amount-total"); + }); +} + +/** + * 更新页面收入的数据【累加】 + */ +function updateCostData(data, returnData) { + var details = data.details; + var deviceTaxInclude = 0; + var deviceTaxExclude = 0; + var deviceTax = 0; + var buildTaxInclude = 0; + var buildTaxExclude = 0; + var buildTax = 0; + var serviceTaxInclude = 0; + var serviceTaxExclude = 0; + var serviceTax = 0; + var otherTaxInclude = 0; + var otherTaxExclude = 0; + var otherTax = 0; + var costTaxRates = ""; + var set = new Set(); + details.forEach(function (t, number, ts) { + if(t["type"] == "1"){ + //设备类 + deviceTaxInclude += f2(t["totalTaxInclude"]); + deviceTaxExclude += f2(t["totalTaxExclude"]); + deviceTax += f2(t["totalTax"]); + }else if(t["type"] == "2"){ + //施工类 + buildTaxInclude += f2(t["totalTaxInclude"]); + buildTaxExclude += f2(t["totalTaxExclude"]); + buildTax += f2(t["totalTax"]); + }else if(t["type"] == "3"){ + //服务类 + serviceTaxInclude += f2(t["totalTaxInclude"]); + serviceTaxExclude += f2(t["totalTaxExclude"]); + serviceTax += f2(t["totalTax"]); + }else if(t["type"] == "4"){ + //其他类 + otherTaxInclude += f2(t["totalTaxInclude"]); + otherTaxExclude += f2(t["totalTaxExclude"]); + otherTax += f2(t["totalTax"]); + } + if (!set.has(t["taxRate"])) { + costTaxRates += f2Fixed(t["taxRate"]) + "%,"; + set.add(t["taxRate"]); + } + }); + $("input[name='costPurchaseDeviceTaxInclude']").val(f2Fixed(deviceTaxInclude)); + $("input[name='costPurchaseDeviceTaxExclude']").val(f2Fixed(deviceTaxExclude)); + $("input[name='costPurchaseDeviceTax']").val(f2Fixed(deviceTax)); + $("input[name='costPurchaseBuildTaxInclude']").val(f2Fixed(buildTaxInclude)); + $("input[name='costPurchaseBuildTaxExclude']").val(f2Fixed(buildTaxExclude)); + $("input[name='costPurchaseBuildTax']").val(f2Fixed(buildTax)); + $("input[name='costPurchaseServiceTaxInclude']").val(f2Fixed(serviceTaxInclude)); + $("input[name='costPurchaseServiceTaxExclude']").val(f2Fixed(serviceTaxExclude)); + $("input[name='costPurchaseServiceTax']").val(f2Fixed(serviceTax)); + $("input[name='costPurchaseOtherTaxInclude']").val(f2Fixed(otherTaxInclude)); + $("input[name='costPurchaseOtherTaxExclude']").val(f2Fixed(otherTaxExclude)); + $("input[name='costPurchaseOtherTax']").val(f2Fixed(otherTax)); + + + //资金计划表中的 + $(".input-total-title-device-cost-budget-plan").val(f2Fixed(deviceTaxInclude)); + $(".input-total-title-engineer-cost-budget-plan").val(f2Fixed(f2(serviceTaxInclude)+f2(buildTaxInclude)+f2(otherTaxInclude))); + $(".input-total-title-total-cost-budget-plan").val(f2Fixed(f2(deviceTaxInclude)+f2(buildTaxInclude)+f2(serviceTaxInclude)+f2(otherTaxInclude) + +f2($(".input-total-title-project-manage-cost-budget-plan").val()) + +f2($(".input-total-title-earnest-money-cost-budget-plan").val()))); + + /* var costOtherOtherTaxInclude = f2($("input[name='costOtherOtherTaxInclude']").val()); + var costOtherOtherTaxExclude = f2($("input[name='costOtherOtherTaxExclude']").val()); + + var costProjectManageTaxInclude = f2($("input[name='costProjectManageTaxInclude']").val()); + var costProjectManageTaxExclude = f2($("input[name='costProjectManageTaxExclude']").val()); + + $("input[name='costTotalTaxInclude']").val(f2(deviceTaxInclude+buildTaxInclude+serviceTaxInclude+otherTaxInclude+costOtherOtherTaxInclude+costProjectManageTaxInclude)); + $("input[name='costTotalTaxExclude']").val(f2(deviceTaxExclude+buildTaxExclude+serviceTaxExclude+otherTaxExclude+costOtherOtherTaxExclude+costProjectManageTaxExclude));*/ + + calCostExclude(); + calCostInclude(); + calCostTotalTax(); + updateProjectContributionProfitRate(); + if (costTaxRates.length > 0) { + $(".costTaxRates").text(costTaxRates.substr(0, costTaxRates.length - 1)); + } + + layuiAlert("保存成功"); + $('#my-prompt-cost-detail').modal('close'); +} + +/** + * 大类类别联动效果 + */ +/** + * 初始化数据 + * SELECT_TYPE_CATEGORY_MAP_DATA + * SELECT_CATEGORY_TYPE_MAP_DATA + * SELECT_TYPE_CATEGORY_DATA + */ +function initTypeCategory(params, data) { + var d = data.data; + var map = d.map; + + Object.keys(map).forEach(function (t, number) { + var temp = []; + map[t].forEach(function (g) { + temp.push({ + name:g.name, + id:g.id+"" + }); + }); + SELECT_TYPE_CATEGORY_MAP_DATA[t]= temp; + }); + + var procurementTypes = d.procurementTypes; + procurementTypes.forEach(function (e) { + SELECT_TYPE_CATEGORY_DATA.push({ + id:e.id+"", + name:e.name + }); + SELECT_CATEGORY_TYPE_MAP_DATA[e.id]=e.type; + }); + //--请选择--的映射 + //SELECT_CATEGORY_TYPE_MAP_DATA["xxxx"]="xxxx"; + + // console.log(SELECT_TYPE_CATEGORY_MAP_DATA); + // console.log(SELECT_TYPE_CATEGORY_DATA); + // console.log(SELECT_CATEGORY_TYPE_MAP_DATA); +} 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 219d5ba..0a28620 100644 --- a/src/main/resources/static/assets/js/project_budget_plan.js +++ b/src/main/resources/static/assets/js/project_budget_plan.js @@ -421,9 +421,9 @@ function appendTrBudgetPlan2() { ' \n' + ' \n' + // ' \n' + - ' \n' + - ' \n' + - ' \n' + + ' \n' + + ' \n' + + ' \n' + ' \n' + ' \n' + diff --git a/src/main/resources/templates/admin/project_approve.ftl b/src/main/resources/templates/admin/project_approve.ftl index 99e2c48..c900859 100644 --- a/src/main/resources/templates/admin/project_approve.ftl +++ b/src/main/resources/templates/admin/project_approve.ftl @@ -3113,6 +3113,7 @@ + diff --git a/src/main/resources/templates/admin/project_budget_edit.ftl b/src/main/resources/templates/admin/project_budget_edit.ftl index 7d95f91..beedf50 100644 --- a/src/main/resources/templates/admin/project_budget_edit.ftl +++ b/src/main/resources/templates/admin/project_budget_edit.ftl @@ -107,7 +107,8 @@
  • 项目基本信息
  • 收入明细表
  • 收款计划表
  • -
  • 采购成本项目
  • +
  • 采购成本明细表
  • +
  • 付款计划表
  • 项目管理费用表
  • 资金计划表
  • 项目预算信息
  • @@ -833,7 +834,7 @@
    - +
    @@ -901,20 +902,11 @@ -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- --> @@ -947,26 +939,11 @@ -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- --> @@ -1201,9 +1178,9 @@ - - - + + + @@ -1501,6 +1478,82 @@
    序号序号 采购成本项目 产品大类名称单位数量单价税率(%) 含税总金额(元) 不含税金额(元) 税金(元) 供应商是否垫资预估垫资金额(元)支出时间支出金额(元)付款方式备注 操作
    --> -<#-- --> -<#--
    +
    +
    +
    +
    +<#--
    --> +<#--
    --> +<#--
    --> +<#-- --> +<#-- --> +<#--
    --> + +<#-- --> +<#--
    --> +<#--
    --> +
    +
    + + + + + + + + + + + + + + <#if budgetPayPlan??> + <#list budgetPayPlan as payDetail> + + + + + + + + + + + + + + + + + + + + + +
    序号付款节点付款时间采购成本项目付款金额供应商操作
    + +
    +
    + +
    + +
    + +
    +
    @@ -1522,7 +1575,8 @@ - +