diff --git a/jperm/views.py b/jperm/views.py index 12ca395ba..da33d7ff7 100644 --- a/jperm/views.py +++ b/jperm/views.py @@ -396,9 +396,12 @@ def perm_role_push(request): # 渲染数据 header_title, path1, path2 = "系统角色", "角色管理", "角色推送" role_id = request.GET.get('id') + asset_ids = request.GET.get('asset_id') role = get_object(PermRole, id=role_id) assets = Asset.objects.all() asset_groups = AssetGroup.objects.all() + if asset_ids: + need_push_asset = [get_object(Asset, id=asset_id) for asset_id in asset_ids.split(',')] if request.method == "POST": # 获取推荐角色的名称列表 diff --git a/static/js/base.js b/static/js/base.js index a8aa99b70..b872558f3 100644 --- a/static/js/base.js +++ b/static/js/base.js @@ -16,9 +16,9 @@ function check_all(form) { } } -function checkAll(){ - var checklist = document.getElementsByName ("checked"); - if(document.getElementById("check_all").checked) +function checkAll(id, name){ + var checklist = document.getElementsByName(name); + if(document.getElementById(id).checked) { for(var i=0;i - + 主机 密钥 @@ -188,7 +188,7 @@ {% for asset, info in pushed_asset.items %} - + {{ asset.hostname }} {{ info.key | yesno:"是,否,未知" }} @@ -220,7 +220,6 @@ - @@ -229,9 +228,13 @@
- +
+ 推送 + @@ -239,6 +242,9 @@ {% for asset in need_push_asset %} + @@ -276,10 +282,11 @@ $('.del_muti').click(function(){ var check_array = []; if (confirm("确定删除")) { - $(".gradeX input:checked").each(function() { + $(".gradeX input[name='asset_id']:checked").each(function() { check_array.push($(this).attr("value")) }); var url = '/jperm/role/recycle/?role_id={{ role.id }}&asset_id=' + check_array.join(','); + console.log(check_array); $.get(url, {}, function(data){ @@ -290,6 +297,15 @@ return false; }); + $('.push_muti').click(function(){ + var check_array = []; + $(".gradeX input[name='asset_no_push_id']:checked").each(function() { + check_array.push($(this).attr("value")) + }); + var url = '/jperm/role/push/?id={{ role.id }}&asset_id=' + check_array.join(','); + $(this).attr('href', url) + }) + }) {% endblock %} \ No newline at end of file diff --git a/templates/jperm/perm_role_push.html b/templates/jperm/perm_role_push.html index dfa4a109c..480e4ef1b 100644 --- a/templates/jperm/perm_role_push.html +++ b/templates/jperm/perm_role_push.html @@ -45,7 +45,7 @@
+ + 主机 IP
+ + {{ asset.hostname }} {{ asset.ip }}