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 1531c3f..619da2a 100644 --- a/src/main/resources/static/assets/js/project_budget_cost.js +++ b/src/main/resources/static/assets/js/project_budget_cost.js @@ -147,7 +147,7 @@ function bindOtherOtherChangeable() { }); } -SELECT_DATA={ +SELECT_TYPE_CATEGORY_MAP_DATA={ "1":[ { "value":"1", @@ -190,17 +190,37 @@ SELECT_DATA={ ] }; +SELECT_CATEGORY_TYPE_MAP_DATA={ + "1":"1", + "2":"1", + "3":"1", + "4":"2", + "5":"3", + "6":"3", + "7":"3", + "8":"4" +}; + /** * 大类类别联动效果 */ 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) { + SELECT_TYPE_CATEGORY_MAP_DATA[type].forEach(function (d) { categorySelect.append(""); }) }); + //类别变化联动大类 + $(".am-modal-prompt-input-cost-category").on('change',function () { + var typeSelect = $(this).parent().parent().find(".am-modal-prompt-input-cost-type"); + var category = $(this).val(); + //设置他选中类别对应的大类 + typeSelect.val(SELECT_CATEGORY_TYPE_MAP_DATA[category]); + }); }