mirror of https://github.com/jumpserver/jumpserver
授权修改
parent
80d4272ee5
commit
546393d9c3
|
@ -108,11 +108,11 @@ def test_add_log():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# test_add_dept()
|
||||
# test_add_group()
|
||||
# test_add_user()
|
||||
# test_add_idc()
|
||||
# test_add_asset_group()
|
||||
test_add_dept()
|
||||
test_add_group()
|
||||
test_add_user()
|
||||
test_add_idc()
|
||||
test_add_asset_group()
|
||||
test_add_asset()
|
||||
# test_add_log()
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@ from jasset.models import Asset, BisGroup
|
|||
|
||||
|
||||
class Perm(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
user_group = models.ManyToManyField(UserGroup)
|
||||
user_group = models.ForeignKey(UserGroup)
|
||||
asset_group = models.ManyToManyField(BisGroup)
|
||||
comment = models.CharField(max_length=100)
|
||||
|
||||
|
|
|
@ -42,8 +42,6 @@ def perm_add(request):
|
|||
if request.method == 'GET':
|
||||
user_groups = UserGroup.objects.filter(id__gt=2)
|
||||
asset_groups = BisGroup.objects.all()
|
||||
users = User.objects.all()
|
||||
assets = Asset.objects.all()
|
||||
|
||||
else:
|
||||
name = request.POST.get('name', '')
|
||||
|
@ -62,39 +60,51 @@ def perm_add(request):
|
|||
return render_to_response('jperm/perm_add.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def dept_add_asset(dept_list, asset_list):
|
||||
for dept_id in dept_list:
|
||||
dept = DEPT.objects.filter(id=dept_id)
|
||||
if dept:
|
||||
dept = dept[0]
|
||||
for asset_id in asset_list:
|
||||
asset = Asset.objects.filter(id=asset_id)
|
||||
if asset:
|
||||
asset = asset[0]
|
||||
DeptPerm(dept=dept, asset=asset).save()
|
||||
def dept_add_asset(dept_id, asset_list):
|
||||
dept = DEPT.objects.filter(id=dept_id)
|
||||
if dept:
|
||||
dept = dept[0]
|
||||
old_perm_asset = [perm.asset for perm in dept.deptperm_set.all()]
|
||||
new_perm_asset = []
|
||||
for asset_id in asset_list:
|
||||
asset = Asset.objects.filter(id=asset_id)
|
||||
new_perm_asset.extend(asset)
|
||||
|
||||
asset_add = [asset for asset in new_perm_asset if asset not in old_perm_asset]
|
||||
asset_del = [asset for asset in old_perm_asset if asset not in new_perm_asset]
|
||||
|
||||
for asset in asset_del:
|
||||
DeptPerm.objects.filter(dept=dept, asset=asset).delete()
|
||||
for asset in asset_add:
|
||||
DeptPerm(dept=dept, asset=asset).save()
|
||||
|
||||
|
||||
def dept_perm_edit(request):
|
||||
header_title, path1, path2 = u'閮ㄩ棬鎺堟潈娣诲姞', u'鎺堟潈绠$悊', u'閮ㄩ棬鎺堟潈娣诲姞'
|
||||
|
||||
depts = DEPT.objects.all()
|
||||
assets = Asset.objects.all()
|
||||
if request.method == 'POST':
|
||||
dept_select = request.POST.getlist('dept_select')
|
||||
if request.method == 'GET':
|
||||
dept_id = request.GET.get('id', '')
|
||||
dept = DEPT.objects.filter(id=dept_id)
|
||||
if dept:
|
||||
dept = dept[0]
|
||||
asset_all = Asset.objects.all()
|
||||
asset_select = [perm.asset for perm in dept.deptperm_set.all()]
|
||||
assets = [asset for asset in asset_all if asset not in asset_select]
|
||||
else:
|
||||
dept_id = request.POST.get('dept_id')
|
||||
asset_select = request.POST.getlist('asset_select')
|
||||
|
||||
dept_add_asset(dept_select, asset_select)
|
||||
msg = '娣诲姞鎴愬姛'
|
||||
dept_add_asset(dept_id, asset_select)
|
||||
return HttpResponseRedirect('/jperm/dept_perm_list/')
|
||||
return render_to_response('jperm/dept_perm_edit.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def perm_list(request):
|
||||
header_title, path1, path2 = u'涓绘満鎺堟潈', u'鎺堟潈绠$悊', u'鎺堟潈璇︽儏'
|
||||
header_title, path1, path2 = u'灏忕粍鎺堟潈', u'鎺堟潈绠$悊', u'鎺堟潈璇︽儏'
|
||||
keyword = request.GET.get('search', '')
|
||||
if keyword:
|
||||
contact_list = Perm.objects.filter(name__icontains=keyword)
|
||||
contact_list = UserGroup.objects.filter(Q(name__icontains=keyword) | Q(comment__icontains=keyword))
|
||||
else:
|
||||
contact_list = Perm.objects.all()
|
||||
contact_list = UserGroup.objects.all().order_by('name')
|
||||
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(contact_list, request)
|
||||
return render_to_response('jperm/perm_list.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
|
|
@ -99,6 +99,15 @@ def perm_count(group_id):
|
|||
return group.perm_set.count()
|
||||
|
||||
|
||||
@register.filter(name='dept_perm_count')
|
||||
def dept_perm_count(dept_id):
|
||||
dept = DEPT.objects.filter(id=dept_id)
|
||||
if dept:
|
||||
dept = dept[0]
|
||||
return dept.deptperm_set.all().count()
|
||||
return 0
|
||||
|
||||
|
||||
@register.filter(name='group_type_to_str')
|
||||
def group_type_to_str(type_name):
|
||||
group_types = {
|
||||
|
|
|
@ -39,30 +39,10 @@
|
|||
<div class="row">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="col-sm-2 control-label">閮ㄩ棬<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-4">
|
||||
<div>
|
||||
<select id="depts" name="depts" class="form-control" size="12" multiple>
|
||||
{% for dept in depts %}
|
||||
<option value="{{ dept.id }}">{{ dept.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 60px;">
|
||||
<button type="button" class="btn btn-white" onclick="move('depts', 'dept_select')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move('dept_select', 'depts')"><i class="fa fa-chevron-left"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div>
|
||||
<select id="dept_select" name="dept_select" class="form-control m-b" size="12" multiple>
|
||||
</select>
|
||||
</div>
|
||||
<label for="group_name" class="col-sm-2 control-label">閮ㄩ棬</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="dept_id" name="dept_id" type="text" class="form-control" value="{{ dept.id }}" style="display: none">
|
||||
<input id="dept_name" name="dept_name" type="text" class="form-control" value="{{ dept.name }}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -90,6 +70,9 @@
|
|||
<div class="col-sm-3">
|
||||
<div>
|
||||
<select id="asset_select" name="asset_select" class="form-control m-b" size="12" multiple>
|
||||
{% for asset in asset_select %}
|
||||
<option value="{{ asset.id }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<tr>
|
||||
|
||||
<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>
|
||||
|
@ -59,7 +59,7 @@
|
|||
<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_member }} </td>
|
||||
<td class="text-center"> {{ dept.id | dept_perm_count }} </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>
|
||||
|
|
|
@ -36,43 +36,21 @@
|
|||
{% if msg %}
|
||||
<div class="alert alert-success text-center">{{ msg }}</div>
|
||||
{% endif %}
|
||||
<select multiple="multiple" id="user_all" style="display: none;">
|
||||
{% for user in users %}
|
||||
<option value="{{ user.id }}">{{ user.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<select multiple="multiple" id="user_group_all" style="display: none;">
|
||||
{% for user_group in user_groups %}
|
||||
<option value="{{ user_group.id }}">{{ user_group.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<select multiple="multiple" id="asset_all" style="display: none;">
|
||||
{% for asset in assets %}
|
||||
<option value="{{ asset.id }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<select multiple="multiple" id="asset_group_all" style="display: none;" >
|
||||
{% for asset_group in asset_groups %}
|
||||
<option value="{{ asset_group.id }}">{{ asset_group.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
</select>
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<label for="name" class="col-sm-2 control-label">鎺堟潈鍚<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="name" name="name" placeholder="鎺堟潈鍚嶇О" type="text" class="form-control">
|
||||
<span class="help-block m-b-none">鍙栦釜鍚嶅瓧鏂逛究杈ㄨ瘑</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="col-sm-2 control-label" >
|
||||
<select id="user_type" name="user_type" onchange="userChoice(this.value)">
|
||||
<option value="1">鐢ㄦ埛缁</option>
|
||||
<option value="0">鐢ㄦ埛</option>
|
||||
</select>
|
||||
</label>
|
||||
<label for="" class="col-sm-2 control-label">鐢ㄦ埛缁<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-4">
|
||||
<div>
|
||||
<select id="user_groups" name="user_groups" class="form-control" size="10" multiple>
|
||||
<select id="user_groups" name="user_groups" class="form-control" size="12" multiple>
|
||||
{% for user_group in user_groups %}
|
||||
<option value="{{ user_group.id }}">{{ user_group.name }}</option>
|
||||
{% endfor %}
|
||||
|
@ -90,7 +68,7 @@
|
|||
|
||||
<div class="col-sm-3">
|
||||
<div>
|
||||
<select id="user_groups_select" name="user_groups_select" class="form-control m-b" size="10" multiple>
|
||||
<select id="user_groups_select" name="user_groups_select" class="form-control m-b" size="12" multiple>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -99,23 +77,10 @@
|
|||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="col-sm-2 control-label">
|
||||
|
||||
</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="comment" name="comment" placeholder="杩囨护" type="text" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="" class="col-sm-2 control-label">
|
||||
<select id="asset_type" name="user_type" onchange="assetChoice(this.value)" >
|
||||
<option value="1">涓绘満缁</option>
|
||||
<option value="0">涓绘満</option>
|
||||
</select>
|
||||
</label>
|
||||
<label for="" class="col-sm-2 control-label">涓绘満缁<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-4">
|
||||
<div>
|
||||
<select id="asset_groups" name="asset_groups" class="form-control m-b" size="10" multiple>
|
||||
<select id="asset_groups" name="asset_groups" class="form-control m-b" size="12" multiple>
|
||||
{% for asset_group in asset_groups %}
|
||||
<option value="{{ asset_group.id }}">{{ asset_group.name }}</option>
|
||||
{% endfor %}
|
||||
|
@ -132,7 +97,7 @@
|
|||
|
||||
<div class="col-sm-3">
|
||||
<div>
|
||||
<select id="asset_groups_select" name="asset_groups_select" class="form-control m-b" size="10" multiple>
|
||||
<select id="asset_groups_select" name="asset_groups_select" class="form-control m-b" size="12" multiple>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -198,43 +163,14 @@ $('#sudoPerm').validator({
|
|||
|
||||
$(document).ready(function(){
|
||||
$("#submit_button").click(function(){
|
||||
$('#users_selected option').each(function(){
|
||||
$('#user_groups_select option').each(function(){
|
||||
$(this).prop('selected', true)
|
||||
})
|
||||
$('#asset_groups_select option').each(function(){
|
||||
$(this).prop('selected', true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
function userChoice(value){
|
||||
if (value == "1"){
|
||||
$("#user_groups").children().each(function(){$(this).remove()});
|
||||
$("#user_groups_select").children().each(function(){$(this).remove()});
|
||||
$("#user_group_all").children().each(function(){
|
||||
$("#user_groups").append($(this).clone())
|
||||
})
|
||||
}
|
||||
else
|
||||
$("#user_groups").children().each(function(){$(this).remove()});
|
||||
$("#user_groups_select").children().each(function(){$(this).remove()});
|
||||
$("#user_all").children().each(function(){
|
||||
$("#user_groups").append($(this).clone())
|
||||
})
|
||||
}
|
||||
|
||||
function assetChoice(value){
|
||||
if (value == "1"){
|
||||
$("#asset_groups").children().each(function(){$(this).remove()});
|
||||
$("#asset_groups_select").children().each(function(){$(this).remove()});
|
||||
$("#asset_group_all").children().each(function(){
|
||||
$("#asset_groups").append($(this).clone())
|
||||
})
|
||||
}
|
||||
else
|
||||
$("#asset_groups").children().each(function(){$(this).remove()});
|
||||
$("#asset_groups_select").children().each(function(){$(this).remove()});
|
||||
$("#asset_all").children().each(function(){
|
||||
$("#asset_groups").append($(this).clone())
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -8,7 +8,7 @@
|
|||
<div class="col-lg-10">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>鎺堟潈鍒楄〃</h5>
|
||||
<h5> 鏌ョ湅灏忕粍</h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
|
@ -29,142 +29,57 @@
|
|||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="panel blank-panel">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li id="tab1" class="active"><a href="/jperm/perm_list/">鎺堟潈鏌ョ湅</a></li>
|
||||
<li style="float: right">
|
||||
<form method="get" action="" class="pull-right mail-search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" id="search_input" name="search" placeholder="Search">
|
||||
<div class="input-group-btn">
|
||||
<button id='search_btn' type="submit" class="btn btn-sm btn-primary">
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="">
|
||||
<a target="_blank" href="/juser/group_add/" class="btn btn-sm btn-primary "> 娣诲姞灏忕粍 </a>
|
||||
<form id="search_form" method="get" action="" class="pull-right mail-search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" id="search_input" name="search" placeholder="Search">
|
||||
<div class="input-group-btn">
|
||||
<button id='search_btn' type="submit" class="btn btn-sm btn-primary">
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="tab-1" class="tab-pane active">
|
||||
<table class="table table-striped table-bordered table-hover " id="editable" >
|
||||
<thead>
|
||||
<tr>
|
||||
<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>
|
||||
</thead>
|
||||
<tbody id="perm_edit">
|
||||
{% for perm in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center"> {{ perm.name }} </td>
|
||||
<td class="text-center">
|
||||
{{ perm.user_group.all | group_str2 }}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{{ perm.asset_group.all | group_str2 }}
|
||||
</td>
|
||||
<td class="text-center"> {{ perm.comment }} </td>
|
||||
<td class="text-center">
|
||||
<a title="[ {{ group.name }} 鎺堟潈璇︽儏 ]" href="../perm_detail/?id={{ perm.id }}" class=" btn btn-xs btn-primary">璇︽儏</a>
|
||||
<a href="../perm_edit/?id={{ perm.id }}" class="btn btn-xs btn-info">缂栬緫</a>
|
||||
<a href="../perm_del/?id={{ perm.id }}" class="btn btn-xs btn-danger">鍒犻櫎</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
|
||||
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
|
||||
</div>
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# <div id="tab-2" class="tab-pane">#}
|
||||
{# <table class="table table-striped table-bordered table-hover " id="editable" >#}
|
||||
{# <thead>#}
|
||||
{# <tr>#}
|
||||
{# <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>#}
|
||||
{# </thead>#}
|
||||
{# <tbody id="perm_list">#}
|
||||
{# {% for user in contacts2.object_list %}#}
|
||||
{# <tr class="gradeX">#}
|
||||
{# <td class="text-center"> {{ user.name }} </td>#}
|
||||
{# <td class="text-center"> {{ user.id | get_role }} </td>#}
|
||||
{# <td class="text-center"> {{ user.username | groups_str }} </td>#}
|
||||
{# <td class="text-center"> {{ user.id | perm_asset_count }} </td>#}
|
||||
{# <td class="text-center">#}
|
||||
{# <a title="[ {{ user.name }} ] 鎺堟潈璇︽儏" href="#" class="btn btn-xs btn-primary">璇︽儏</a>#}
|
||||
{# </td>#}
|
||||
{# </tr>#}
|
||||
{# {% endfor %}#}
|
||||
{# </tbody>#}
|
||||
{# </table>#}
|
||||
{# <div class="row">#}
|
||||
{# <div class="col-sm-6">#}
|
||||
{# <div class="dataTables_info" id="editable_info" role="status" aria-live="polite">#}
|
||||
{# Showing {{ contacts2.start_index }} to {{ contacts2.end_index }} of {{ p2.count }} entries#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# <div class="col-sm-6">#}
|
||||
{# <div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">#}
|
||||
{# <ul class="pagination" style="margin-top: 0; float: right">#}
|
||||
{# {% if contacts2.has_previous %}#}
|
||||
{# <li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">#}
|
||||
{# <a href="?page={{ contacts2.previous_page_number }}">Previous</a>#}
|
||||
{# </li>#}
|
||||
{# {% else %}#}
|
||||
{# <li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">#}
|
||||
{# <a href="#">Previous</a>#}
|
||||
{# </li>#}
|
||||
{# {% endif %}#}
|
||||
{# {% for page in page_range2 %}#}
|
||||
{# {% ifequal current_page page %}#}
|
||||
{# <li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="绗瑊{ page }}椤">{{ page }}</a></li>#}
|
||||
{# {% else %}#}
|
||||
{# <li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="绗瑊{ page }}椤">{{ page }}</a></li>#}
|
||||
{# {% endifequal %}#}
|
||||
{# {% endfor %}#}
|
||||
{# {% if contacts2.has_next %}#}
|
||||
{# <li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">#}
|
||||
{# <a href="?page={{ contacts2.next_page_number }}">Next</a>#}
|
||||
{# </li>#}
|
||||
{# {% else %}#}
|
||||
{# <li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">#}
|
||||
{# <a href="#">Next</a>#}
|
||||
{# </li>#}
|
||||
{# {% endif %}#}
|
||||
{# </ul>#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{##}
|
||||
{# </div>#}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-bordered table-hover " id="editable" >
|
||||
<thead>
|
||||
<tr>
|
||||
<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>
|
||||
<th class="text-center">鎿嶄綔</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for group in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center"> {{ group.name }} </td>
|
||||
<td class="text-center"> {{ group.dept.name }} </td>
|
||||
<td class="text-center"> {{ group.id | member_count }} </td>
|
||||
<td class="text-center"> {{ group.id | member_count }} </td>
|
||||
<td class="text-center"> {{ group.id | member_count }} </td>
|
||||
<td class="text-center"> {{ group.comment }} </td>
|
||||
<td class="text-center">
|
||||
<a href="../perm_edit/?id={{ group.id }}" class="btn btn-xs btn-info">鎺堟潈缂栬緫</a>
|
||||
{# <a href="../group_del/?id={{ group.id }}" class="btn btn-xs btn-danger">鍒犻櫎</a>#}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
|
||||
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
|
||||
</div>
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -174,30 +89,20 @@
|
|||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".iframe").colorbox({iframe:true, width:"70%", height:"70%"});
|
||||
var check_array = []
|
||||
$('#del_btn').click(function(){
|
||||
$(".gradeX input:checked").each(function() {check_array.push($(this).attr("value")) })
|
||||
$(".gradeX input:checked").closest("tr").remove()
|
||||
$.post("/juser/group_del_ajax/",
|
||||
{group_ids: check_array.join(",")},
|
||||
function(data){
|
||||
alert(data)
|
||||
}
|
||||
)
|
||||
})
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#search_btn').click(function(){
|
||||
if ($('#tab2').attr('class') == 'active'){
|
||||
var tab='tab2'
|
||||
} else {
|
||||
var tab='tab1'
|
||||
}
|
||||
|
||||
var search=$('#search_input').val()
|
||||
|
||||
$.post('/jperm/perm_list_ajax/',
|
||||
{'tab': tab, 'search': search},
|
||||
function(data){
|
||||
if ($('#tab2').attr('class') == 'active'){
|
||||
$('#tab-2').html(data)
|
||||
} else {
|
||||
$('#tab-1').html(data)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -36,17 +36,15 @@
|
|||
<li id="jperm">
|
||||
<a href="#"><i class="fa fa-edit"></i> <span class="nav-label">鎺堟潈绠$悊</span><span class="fa arrow"></span></a>
|
||||
<ul class="nav nav-second-level">
|
||||
<li id="dept_perm_add">
|
||||
<a href="/jperm/dept_perm_add/">閮ㄩ棬鎺堟潈</a>
|
||||
</li>
|
||||
<li id="dept_perm_list">
|
||||
<a href="/jperm/dept_perm_list/">鎺堟潈鏌ョ湅</a>
|
||||
<a href="/jperm/dept_perm_list/">閮ㄩ棬鎺堟潈</a>
|
||||
</li>
|
||||
|
||||
<li id="perm_add">
|
||||
<a href="/jperm/perm_add/">鎺堟潈娣诲姞</a>
|
||||
</li>
|
||||
<li id="perm_list">
|
||||
<a href="/jperm/perm_list/">鎺堟潈鏌ョ湅</a>
|
||||
<a href="/jperm/perm_list/">灏忕粍鎺堟潈</a>
|
||||
</li>
|
||||
|
||||
<li id="sudo_add">
|
||||
|
|
Loading鈥
Reference in New Issue