From a1786e882de8bfaa598db2f8f3cb950f2f8a72e1 Mon Sep 17 00:00:00 2001 From: xxssyyyyssxx Date: Thu, 11 Nov 2021 14:20:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E7=B1=BB=E5=92=8C=E7=B1=BB=E5=88=AB?= =?UTF-8?q?=E7=9A=84select=E8=81=94=E5=8A=A8=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/assets/js/project_budget_cost.js | 71 +++++++++++++++++-- .../templates/admin/project_budget_edit.ftl | 4 +- 2 files changed, 69 insertions(+), 6 deletions(-) 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 9065897..1531c3f 100644 --- a/src/main/resources/static/assets/js/project_budget_cost.js +++ b/src/main/resources/static/assets/js/project_budget_cost.js @@ -22,12 +22,14 @@ $(function () { //绑定其他其他的输入框 bindOtherOtherChangeable(); + //绑定采购明细中select联动事件 + bindTypeSelectChange(); }); /** * 采购成本增加一行 */ function appendTrCost() { - var template = ''+ ''+ ''+ ''+ @@ -35,7 +37,7 @@ function appendTrCost() { ''+ ''+ ''+ - ''+ ''+ ''+ ''+ @@ -58,7 +60,10 @@ function appendTrCost() { $("#costTable").append(template); //重新绑定删除事件和input修改事件 bindDeleteBtn(); - //bindChangeableInput(); + //重新绑定 + bindChangeableInput(); + //绑定采购明细中select联动事件 + bindTypeSelectChange(); } /** * 更新页面收入的数据【累加】 @@ -140,4 +145,62 @@ function bindOtherOtherChangeable() { updateProjectContributionProfitRate(); }); -} \ No newline at end of file +} + +SELECT_DATA={ + "1":[ + { + "value":"1", + "name":"华智产品" + }, + { + "value":"2", + "name":"紫光其他产品" + }, + { + "value":"3", + "name":"外购产品" + } + ], + "2":[ + { + "value":"4", + "name":"外购工程" + } + ], + "3":[ + { + "value":"5", + "name":"华智服务" + }, + { + "value":"6", + "name":"紫光其他服务" + }, + { + "value":"7", + "name":"外购服务" + } + ], + "4":[ + { + "value":"8", + "name":"其他" + } + ] +}; + +/** + * 大类类别联动效果 + */ +function bindTypeSelectChange() { + $(".am-modal-prompt-input-cost-type").on('change',function () { + var categorySelect = $(this).parent().parent().find(".am-modal-prompt-input-cost-category"); + var type = $(this).val(); + categorySelect.empty(); + SELECT_DATA[type].forEach(function (d) { + categorySelect.append(""); + }) + }); +} + diff --git a/src/main/resources/templates/admin/project_budget_edit.ftl b/src/main/resources/templates/admin/project_budget_edit.ftl index 46e6ffc..12b2c0b 100644 --- a/src/main/resources/templates/admin/project_budget_edit.ftl +++ b/src/main/resources/templates/admin/project_budget_edit.ftl @@ -486,7 +486,7 @@ <#list costDetails as costDetail> - @@ -494,7 +494,7 @@ -