diff --git a/jasset/views.py b/jasset/views.py index 7fce97d34..a3eef0801 100644 --- a/jasset/views.py +++ b/jasset/views.py @@ -285,9 +285,13 @@ def asset_list(request): if user_perm != 0: asset_find = Asset.objects.all() else: + asset_id_all = [] user = get_object(User, username=username) asset_perm = get_group_user_perm(user) if user else {'asset': ''} - asset_find = asset_perm['asset'].keys() + user_asset_perm = asset_perm['asset'].keys() + for asset in user_asset_perm: + asset_id_all.append(asset.id) + asset_find = Asset.objects.filter(pk__in=asset_id_all) asset_group_all = list(asset_perm['asset_group']) if idc_name: @@ -309,10 +313,16 @@ def asset_list(request): Q(ip__contains=keyword) | Q(remote_ip__contains=keyword) | Q(comment__contains=keyword) | + Q(username__contains=keyword) | Q(group__name__contains=keyword) | Q(cpu__contains=keyword) | Q(memory__contains=keyword) | - Q(disk__contains=keyword)) + Q(disk__contains=keyword) | + Q(brand__contains=keyword) | + Q(cabinet__contains=keyword) | + Q(sn__contains=keyword) | + Q(system_type__contains=keyword) | + Q(system_version__contains=keyword)) if export: if asset_id_all: diff --git a/templates/jasset/asset_cu_list.html b/templates/jasset/asset_cu_list.html index 24e6144c4..c10989191 100644 --- a/templates/jasset/asset_cu_list.html +++ b/templates/jasset/asset_cu_list.html @@ -24,7 +24,61 @@
-
+
+{# #} + + + + + + +
+ +
@@ -70,7 +124,7 @@ {# {{ asset.cpu }}|{{ asset.memory }}|{{ asset.disk }}#} {{ asset.system_type|default_if_none:"" }}{{ asset.system_version|default_if_none:"" }} {{ asset.cpu|get_cpu_core|default_if_none:"" }} - {{ asset.memory }}{% if asset.memory %}G{% endif %} + {{ asset.memory|default_if_none:"" }}{% if asset.memory %}G{% endif %} {{ asset.disk|get_disk_info }}{% if asset.memory %}G{% endif %} 连接 @@ -285,19 +339,10 @@ }); }); - - -{# $('#asset_update_all').click(function () {#} -{# layer.msg('玩命更新中...', {time: 200000});#} -{# $.ajax({#} -{# type: "post",#} -{# url: "/jasset/asset_update_batch/?arg=all",#} -{# success: function () {#} -{# parent.location.reload();#} -{# }#} -{# });#} -{# });#} - + function change_info(){ + var args = $("#asset_form").serialize(); + window.location = "{% url 'asset_list' %}?" + args + } $("#search_input").keydown(function(e){ if(e.keyCode==13){