From f9276332725b0f7262001e4dc66c9858aa77f724 Mon Sep 17 00:00:00 2001 From: xxssyyyyssxx Date: Wed, 3 Nov 2021 18:45:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86=E6=88=90?= =?UTF-8?q?=E6=9C=AC=E6=98=8E=E7=BB=86=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/project_budget_cost_project_manage.js | 91 +++++++++++++++++++ .../templates/admin/project_budget_edit.ftl | 56 +++++++++++- 2 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/static/assets/js/project_budget_cost_project_manage.js diff --git a/src/main/resources/static/assets/js/project_budget_cost_project_manage.js b/src/main/resources/static/assets/js/project_budget_cost_project_manage.js new file mode 100644 index 0000000..0cddd01 --- /dev/null +++ b/src/main/resources/static/assets/js/project_budget_cost_project_manage.js @@ -0,0 +1,91 @@ +/** + * 一个采购成本详情的字段 + */ +COST_PROJECT_MANAGE_DETAIL_ARR=["type","name","detail","unit","amount","price","total","predictMethod","predictWhy","remark"]; +$(function () { + $("#cost-project-manage-detail").click(function () { + $('#my-prompt-cost-project-manage-detail').modal({ + relatedTarget: this, + onConfirm: function(e) { + //不能使用e.data,因为无法获取动态添加的 + var data = collectData("am-modal-prompt-input-cost-project-manage"); + data = prepareAjaxData(data, COST_PROJECT_MANAGE_DETAIL_ARR, $("#id").val()); + saveDetail("/fourcal/project/budgetEditSaveCostProjectManageDetail", data, updateCostProjectManageData); + }, + onCancel: function(e) { + } + }); + }); + $("#costProjectManageAddBtn").click(function () { + appendTrCostProjectManage(); + }); +}); +/** + * 采购成本增加一行 + */ +function appendTrCostProjectManage() { + var template = '\n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' '; + $("#costProjectManageTable").append(template); + //重新绑定删除事件和input修改事件 + bindDeleteBtn(); + bindChangeableInputProjectManage(); +} + +function bindChangeableInputProjectManage() { + //数量改变 + $(".input-changeable-amount0").change(function () { + var amount = parseFloat($(this).val()); + //找到对应的单价 + var price = parseFloat($(this).parent().parent().find(".input-changeable-price-project-manage").val()); + console.log(amount,price); + + $(this).parent().parent().find(".input-changeable-total-project-manage").val(amount*price); + }); + //单价改变 + $(".input-changeable-price0").change(function () { + var price = parseFloat($(this).val()); + //找到对应的数量 + var amount = parseFloat($(this).parent().parent().find(".input-changeable-amount-project-manage").val()); + console.log(amount,price); + + $(this).parent().parent().find(".input-changeable-total-project-manage").val(amount*price); + }); +} +/** + * 更新页面收入的数据【累加】 + */ +function updateCostProjectManageData(details) { + var total = 0; + details.forEach(function (t, number, ts) { + total += parseFloat(t["total"]); + }); + + $("input[name='costProjectManageTaxExclude']").val(total); + + var costPurchaseDeviceTaxExclude = parseFloat($("input[name='costPurchaseDeviceTaxExclude']").val()); + var costPurchaseBuildTaxExclude = parseFloat($("input[name='costPurchaseBuildTaxExclude']").val()); + var costPurchaseServiceTaxExclude = parseFloat($("input[name='costPurchaseServiceTaxExclude']").val()); + var costPurchaseOtherTaxExclude = parseFloat($("input[name='costPurchaseOtherTaxExclude']").val()); + + var costOtherOtherTaxExclude = parseFloat($("input[name='costOtherOtherTaxExclude']").val()); + + $("input[name='costTotalTaxExclude']").val(costPurchaseDeviceTaxExclude+costPurchaseBuildTaxExclude+costPurchaseServiceTaxExclude+costPurchaseOtherTaxExclude+total+costOtherOtherTaxExclude); +} \ No newline at end of file diff --git a/src/main/resources/templates/admin/project_budget_edit.ftl b/src/main/resources/templates/admin/project_budget_edit.ftl index a609923..3f98da2 100644 --- a/src/main/resources/templates/admin/project_budget_edit.ftl +++ b/src/main/resources/templates/admin/project_budget_edit.ftl @@ -522,9 +522,61 @@ + <#--项目管理明细表弹窗--> +
+
+
新增项目管理成本明细表——${project.name}
+
+ + + + + + + + + + + + + + + + <#if costProjectManageDetails??> + <#list costProjectManageDetails as costProjectManageDetail> + + + + + + + + + + + + + + + - + +
财务费用类别业务项目项目明细单位数量单价总金额(元)预估计算方法预估依据备注操作
+ +
+ +
+ +
+
@@ -545,12 +597,14 @@ +