mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-07-01 17:22:11 +00:00
IJʾ
This commit is contained in:
parent
b2c72221f7
commit
d1f19a5cad
@ -83,8 +83,9 @@ def member_count(group_id):
|
||||
group = UserGroup.objects.get(id=group_id)
|
||||
return group.user_set.count()
|
||||
|
||||
@register.filter(name='dept_member')
|
||||
def dept_member(dept_id):
|
||||
|
||||
@register.filter(name='dept_user_num')
|
||||
def dept_user_num(dept_id):
|
||||
dept = DEPT.objects.filter(id=dept_id)
|
||||
if dept:
|
||||
dept = dept[0]
|
||||
@ -93,14 +94,24 @@ def dept_member(dept_id):
|
||||
return 0
|
||||
|
||||
|
||||
@register.filter(name='dept_group_num')
|
||||
def dept_group_num(dept_id):
|
||||
dept = DEPT.objects.filter(id=dept_id)
|
||||
if dept:
|
||||
dept = dept[0]
|
||||
return dept.usergroup_set.all().count()
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
@register.filter(name='perm_count')
|
||||
def perm_count(group_id):
|
||||
group = UserGroup.objects.get(id=group_id)
|
||||
return group.perm_set.count()
|
||||
|
||||
|
||||
@register.filter(name='dept_perm_count')
|
||||
def dept_perm_count(dept_id):
|
||||
@register.filter(name='dept_asset_num')
|
||||
def dept_asset_num(dept_id):
|
||||
dept = DEPT.objects.filter(id=dept_id)
|
||||
if dept:
|
||||
dept = dept[0]
|
||||
|
@ -58,8 +58,8 @@
|
||||
{% for dept in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center"> {{ dept.name }} </td>
|
||||
<td class="text-center"> {{ dept.id | dept_member }} </td>
|
||||
<td class="text-center"> {{ dept.id | dept_perm_count }} </td>
|
||||
<td class="text-center"> {{ dept.id | dept_user_num }} </td>
|
||||
<td class="text-center"> {{ dept.id | dept_asset_num }} </td>
|
||||
<td class="text-center"> {{ dept.comment }} </td>
|
||||
<td class="text-center">
|
||||
<a title="[ {{ dept.name }} ] 成员信息" href="../dept_detail/?id={{ dept.id }}" class="iframe btn btn-xs btn-primary">主机</a>
|
||||
|
@ -51,7 +51,9 @@
|
||||
<input type="checkbox" id="select_all" onclick="selectAll()" name="select_all">
|
||||
</th>
|
||||
<th class="text-center">部门名称</th>
|
||||
<th class="text-center">小组数目</th>
|
||||
<th class="text-center">成员数目</th>
|
||||
<th class="text-center">主机数目</th>
|
||||
<th class="text-center">备注</th>
|
||||
<th class="text-center">操作</th>
|
||||
</tr>
|
||||
@ -63,10 +65,11 @@
|
||||
<input type="checkbox" name="selected" value="{{ dept.id }}">
|
||||
</td>
|
||||
<td class="text-center"> {{ dept.name }} </td>
|
||||
<td class="text-center"> {{ dept.id | dept_member }} </td>
|
||||
<td class="text-center"> {{ dept.id | dept_group_num}} </td>
|
||||
<td class="text-center"> {{ dept.id | dept_user_num}} </td>
|
||||
<td class="text-center"> {{ dept.id | dept_asset_num}} </td>
|
||||
<td class="text-center"> {{ dept.comment }} </td>
|
||||
<td class="text-center">
|
||||
<a href="../user_list/dept/?did={{ dept.id }}" class="btn btn-xs btn-primary">成员</a>
|
||||
<a href="../dept_edit/?id={{ dept.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a href="../dept_del/?id={{ dept.id }}" class="btn btn-xs btn-danger">删除</a>
|
||||
</td>
|
||||
|
Loading…
Reference in New Issue
Block a user