init
This commit is contained in:
+91
@@ -0,0 +1,91 @@
|
||||
<style>
|
||||
.forx {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
{{$role:=.role}}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal ajaxform" ajaxSuccess="success" ajaxAlways="always" method="post" action="/web/role/{{.action}}">
|
||||
<input type="hidden" name="role_id" value="{{$role.role_id}}">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label"><span class="text-danger"> * </span>角色名称</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="name" class="form-control" value="{{$role.name}}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<span class="text-danger"> * 请将汉字限制在15个以内</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label"><span class="text-danger"> * </span>带宽</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="bandwidth" class="form-control bytes_limit" value="{{$role.bandwidth}}">
|
||||
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<span class="text-danger"> * 带宽限制,单位字节byte,0不限制</span>
|
||||
<br>
|
||||
<span class="bytes_limit_human"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><span class="text-danger"> * </span>Server登录区域</label>
|
||||
<div class="col-md-4">
|
||||
<select class="form-control" name="server_area" size="1" default="{{$role.server_area}}">
|
||||
<option value="all">全部</option>
|
||||
<option value="china">中国</option>
|
||||
<option value="foreign">国外</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><span class="text-danger"> * </span>Client登录区域</label>
|
||||
<div class="col-md-4">
|
||||
<select id="roles_selector" class="form-control" name="client_area" size="1" default="{{$role.client_area}}">
|
||||
<option value="all">全部</option>
|
||||
<option value="china">中国</option>
|
||||
<option value="foreign">国外</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><span class="text-danger"> * </span>隧道模式</label>
|
||||
<div class="col-md-4">
|
||||
<label for="tunnel_mode01">普通
|
||||
<input {{if $.tunnel_mode_arr}} {{range $v:=$.tunnel_mode_arr}} {{if eq $v "0"}}checked{{end}} {{end}} {{end}} type="checkbox" id="tunnel_mode01" value="0" class="form-control" name="tunnel_mode">
|
||||
</label>
|
||||
<label for="tunnel_mode02">特殊
|
||||
<input {{if $.tunnel_mode_arr}} {{range $v:=$.tunnel_mode_arr}} {{if eq $v "2"}}checked{{end}} {{end}} {{end}} type="checkbox" id="tunnel_mode02" value="2" class="form-control" name="tunnel_mode">
|
||||
</label>
|
||||
<label for="tunnel_mode03">高级
|
||||
<input {{if $.tunnel_mode_arr}} {{range $v:=$.tunnel_mode_arr}} {{if eq $v "1"}}checked{{end}} {{end}} {{end}} type="checkbox" id="tunnel_mode03" value="1" class="form-control" name="tunnel_mode">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button type="submit" class="btn btn-success">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
var format = function() {
|
||||
var val = $(".bytes_limit").val();
|
||||
$(".bytes_limit_human").html(humanFileSize(val ? parseInt(val) : 0));
|
||||
};
|
||||
$(".bytes_limit").keyup(function() {
|
||||
format();
|
||||
});
|
||||
format();
|
||||
});
|
||||
|
||||
function humanFileSize(size) {
|
||||
var i = parseInt(Math.floor(Math.log(size) / Math.log(1024)));
|
||||
i = size > 0 ? i : 0;
|
||||
return (size / Math.pow(1024, i)).toFixed(2) * 1 + ['B', 'KB', 'MB', 'GB', 'TB'][i];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,48 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="center w10p">ID</th>
|
||||
<th class="center w10p">角色名</th>
|
||||
<th class="center w10p">带宽限制</th>
|
||||
<th class="center w10p">Server区域</th>
|
||||
<th class="center w10p">Client区域</th>
|
||||
<th class="center w10p">隧道模式</th>
|
||||
<th class="center w15p">创建时间</th>
|
||||
<th class="center w20p">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $role := .roles}}
|
||||
<tr>
|
||||
<td class="center">{{$role.role_id}}</td>
|
||||
<td class="center">{{$role.name}}</td>
|
||||
<td class="center">{{$role.bandwidth_human}}</td>
|
||||
<td class="center">
|
||||
{{if eq $role.server_area "china"}}中国{{end}} {{if eq $role.server_area "foreign"}}国外{{end}} {{if eq $role.server_area "all"}}全部{{end}}
|
||||
</td>
|
||||
<td class="center">
|
||||
{{if eq $role.client_area "china"}}中国{{end}} {{if eq $role.client_area "foreign"}}国外{{end}} {{if eq $role.client_area "all"}}全部{{end}}
|
||||
</td>
|
||||
<td class="center">
|
||||
{{$role.tunnel_mode_human}}
|
||||
</td>
|
||||
<td class="center">
|
||||
{{dateFormat $role.create_time "Y-m-d H:i:s"}}
|
||||
</td>
|
||||
<td class="center">
|
||||
<a name="privilege" href="/web/role/regions?role_id={{$role.role_id}}"><i class="glyphicon glyphicon-lock"> </i>区域</a>
|
||||
<a name="edit" href="/web/role/edit?role_id={{$role.role_id}}"><i class="glyphicon glyphicon-pencil"> </i>修改</a>
|
||||
<a name="delete" data-toggle="confirmation" data-placement="left" data-title="确定删除吗?" href="/web/role/delete?role_id={{$role.role_id}}"><i class="glyphicon glyphicon-remove"> </i>删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,44 @@
|
||||
<script src="/static/style/plugins/jquery.form.min.js"></script>
|
||||
<script src="/static/style/common/form.js"></script>
|
||||
{{$regions:=.regions}}
|
||||
<form method="post" class="ajaxform" action="/web/role/regions" ajaxPre="checkForm">
|
||||
<input type="hidden" name="role_id" value="{{.roleId}}">
|
||||
<div class="panel panel-default" style="margin-bottom:80px;">
|
||||
<div class="panel-body">
|
||||
{{range $region := $regions}} {{if eq $region.parent_id "0"}}
|
||||
<ul class="list-group w240 inline-group">
|
||||
<li class="list-group-item">
|
||||
<strong><input type="checkbox" class="region-group" style="margin-bottom:3px;" />
|
||||
{{$region.name}}</strong> <span class="pull-right"><a name='edit' href='/web/region/edit?region_id={{$region.region_id}}'>改</a> | <a data-toggle="confirmation" data-placement="bottom" data-title="确定删除吗?" href='/web/region/delete?region_id={{$region.region_id}}'>删</a></span>
|
||||
</li>
|
||||
{{range $item := $regions}} {{if eq $item.parent_id $region.region_id}}
|
||||
<li class="list-group-item">
|
||||
<input type="checkbox" class="region-id" {{range $k,$v:=$.regionIds}} {{if eq $v $item.region_id}}checked="checked" {{end}} {{end}} name="region-ids" style="margin-bottom:3px;" value="{{$item.region_id}}" /> {{$item.name}}
|
||||
|
||||
<span class="pull-right"><a name='edit' href='/web/region/edit?region_id={{$item.region_id}}'>改</a> | <a data-toggle="confirmation" data-placement="bottom" data-title="确定删除吗?" href='/web/region/delete?region_id={{$item.region_id}}'>删</a></span></li>
|
||||
{{end}} {{end}}
|
||||
</ul>
|
||||
{{end}} {{end}}
|
||||
<div style="width:90%;text-align:center;"><input type="submit" class="btn btn-primary save" value="保存"></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
function checkForm() {
|
||||
var regionIds = [];
|
||||
$(".region-id").each(function() {
|
||||
if (this.checked) {
|
||||
regionIds.push(this.value)
|
||||
}
|
||||
});
|
||||
return true
|
||||
}
|
||||
$(".region-group").click(function() {
|
||||
$(this).parent().parent().parent().find(".region-id").prop("checked", this.checked);
|
||||
});
|
||||
$(".region-group").each(function() {
|
||||
if ($(this).parent().parent().parent().find(".region-id").not(":checked").length == 0) {
|
||||
$(this).prop("checked", true)
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user