|
|
|
@ -36,18 +36,40 @@
|
|
|
|
|
{% 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">用户组<span class="red-fonts">*</span></label>
|
|
|
|
|
<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>
|
|
|
|
|
<div class="col-sm-4">
|
|
|
|
|
<div>
|
|
|
|
|
<select id="user_groups" name="user_groups" class="form-control" size="10" multiple>
|
|
|
|
@ -68,7 +90,7 @@
|
|
|
|
|
|
|
|
|
|
<div class="col-sm-3">
|
|
|
|
|
<div>
|
|
|
|
|
<select id="user_groups_select" name="user_groups_select" class="form-control m-b" size="5" multiple>
|
|
|
|
|
<select id="user_groups_select" name="user_groups_select" class="form-control m-b" size="10" multiple>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -77,7 +99,20 @@
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="" class="col-sm-2 control-label">主机组<span class="red-fonts">*</span></label>
|
|
|
|
|
<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>
|
|
|
|
|
<div class="col-sm-4">
|
|
|
|
|
<div>
|
|
|
|
|
<select id="asset_groups" name="asset_groups" class="form-control m-b" size="10" multiple>
|
|
|
|
@ -97,7 +132,7 @@
|
|
|
|
|
|
|
|
|
|
<div class="col-sm-3">
|
|
|
|
|
<div>
|
|
|
|
|
<select id="asset_groups_select" name="asset_groups_select" class="form-control m-b" size="5" multiple>
|
|
|
|
|
<select id="asset_groups_select" name="asset_groups_select" class="form-control m-b" size="10" multiple>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -168,6 +203,38 @@ $(document).ready(function(){
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
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 %}
|