2018-12-11 08:37:12 +00:00
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-md-12">
|
|
|
|
|
<div class="tile">
|
|
|
|
|
<div class="tile-body">
|
|
|
|
|
<table class="table table-hover table-bordered" id="sampleTable">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
2019-01-25 04:10:12 +00:00
|
|
|
|
<th>Id</th>
|
|
|
|
|
<th>备注</th>
|
|
|
|
|
<th>客户端Id</th>
|
2018-12-11 08:37:12 +00:00
|
|
|
|
<th>监听端口</th>
|
|
|
|
|
<th>内网目标</th>
|
|
|
|
|
<th>压缩方式</th>
|
2019-01-02 17:44:45 +00:00
|
|
|
|
<th>加密传输</th>
|
2019-01-05 19:16:46 +00:00
|
|
|
|
<th>TCP多路复用</th>
|
2018-12-11 08:37:12 +00:00
|
|
|
|
<th>用户名</th>
|
|
|
|
|
<th>密码</th>
|
|
|
|
|
<th>客户端状态</th>
|
|
|
|
|
<th>状态</th>
|
2019-01-25 04:10:12 +00:00
|
|
|
|
<th>出口流量</th>
|
|
|
|
|
<th>入口流量</th>
|
2018-12-11 08:37:12 +00:00
|
|
|
|
<th>操作</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2019-01-25 04:10:12 +00:00
|
|
|
|
function del(id) {
|
2018-12-11 08:37:12 +00:00
|
|
|
|
if (confirm("确定要删除数据吗?")) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
url: "/index/del",
|
2019-01-25 04:10:12 +00:00
|
|
|
|
data: {"id": id},
|
2018-12-11 08:37:12 +00:00
|
|
|
|
success: function (res) {
|
|
|
|
|
alert(res.msg)
|
|
|
|
|
if (res.status) {
|
|
|
|
|
document.location.reload();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-25 04:10:12 +00:00
|
|
|
|
function start(id) {
|
2018-12-11 08:37:12 +00:00
|
|
|
|
if (confirm("确定要开始任务吗?")) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
url: "/index/start",
|
2019-01-25 04:10:12 +00:00
|
|
|
|
data: {"id": id},
|
2018-12-11 08:37:12 +00:00
|
|
|
|
success: function (res) {
|
|
|
|
|
alert(res.msg)
|
|
|
|
|
if (res.status) {
|
|
|
|
|
document.location.reload();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-25 04:10:12 +00:00
|
|
|
|
function stop(id) {
|
2018-12-11 08:37:12 +00:00
|
|
|
|
if (confirm("确定要暂停吗?")) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
url: "/index/stop",
|
2019-01-25 04:10:12 +00:00
|
|
|
|
data: {"id": id},
|
2018-12-11 08:37:12 +00:00
|
|
|
|
success: function (res) {
|
|
|
|
|
alert(res.msg)
|
|
|
|
|
if (res.status) {
|
|
|
|
|
document.location.reload();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-25 04:10:12 +00:00
|
|
|
|
function edit(id) {
|
|
|
|
|
window.location.href = "/index/edit?id=" + id
|
2018-12-11 08:37:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function add() {
|
2019-01-25 04:10:12 +00:00
|
|
|
|
window.location.href = "/index/add?type={{.type}}" + "&client_id={{.client_id}}"
|
2018-12-11 08:37:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
var table = $('#sampleTable').DataTable({
|
2019-01-25 04:10:12 +00:00
|
|
|
|
responsive: {
|
|
|
|
|
details: {
|
|
|
|
|
display: $.fn.dataTable.Responsive.display.childRowImmediate
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-12-11 08:37:12 +00:00
|
|
|
|
dom: 'Bfrtip',
|
|
|
|
|
processing: true,
|
|
|
|
|
serverSide: true,
|
|
|
|
|
autoWidth: false,
|
|
|
|
|
ordering: false,
|
|
|
|
|
ajax: {
|
2019-01-26 09:27:28 +00:00
|
|
|
|
url: '/index/gettunnel?type={{.type}}' + "&client_id=" +{{.client_id}},
|
2018-12-11 08:37:12 +00:00
|
|
|
|
type: 'POST'
|
|
|
|
|
},
|
|
|
|
|
dom: '<"top"fl><"toolbar">rt<"bottom"ip><"clear">',
|
|
|
|
|
columns: [ //这个是显示到界面上的个数据 格式为 {data:'显示的字段名'}
|
2019-01-25 04:10:12 +00:00
|
|
|
|
{data: 'Id'},
|
|
|
|
|
{data: 'Remark'},
|
|
|
|
|
{data: 'ClientId'},
|
2018-12-11 08:37:12 +00:00
|
|
|
|
{data: 'TcpPort'},
|
|
|
|
|
{data: 'Target'},
|
|
|
|
|
{data: 'Compress'},
|
2019-01-02 17:44:45 +00:00
|
|
|
|
{data: 'Crypt'},
|
2019-01-05 19:16:46 +00:00
|
|
|
|
{data: 'Mux'},
|
2018-12-11 08:37:12 +00:00
|
|
|
|
{data: 'U'},
|
|
|
|
|
{data: 'P'},
|
|
|
|
|
{data: 'ClientStatus'},
|
2019-01-26 09:27:28 +00:00
|
|
|
|
{data: 'Status'},
|
2019-01-25 04:10:12 +00:00
|
|
|
|
{data: 'ExportFlow'},
|
|
|
|
|
{data: 'InletFlow'},
|
2018-12-11 08:37:12 +00:00
|
|
|
|
{data: "Id"}
|
|
|
|
|
],
|
|
|
|
|
bFilter: false,
|
|
|
|
|
columnDefs: [{
|
|
|
|
|
targets: -1,
|
|
|
|
|
render: function (data, type, row, meta) {
|
2019-01-26 09:27:28 +00:00
|
|
|
|
if (row.Status == 1) {
|
2019-01-25 04:10:12 +00:00
|
|
|
|
btn = "<button onclick=\"stop('" + row.Id + "')\" class=\"btn btn-secondary btn-sm\" type=\"button\">关闭</button>"
|
2018-12-11 08:37:12 +00:00
|
|
|
|
} else {
|
2019-01-25 04:10:12 +00:00
|
|
|
|
btn = "<button onclick=\"start('" + row.Id + "')\" class=\"btn btn-success btn-sm\" type=\"button\">打开</button>"
|
2018-12-11 08:37:12 +00:00
|
|
|
|
}
|
2019-01-25 04:10:12 +00:00
|
|
|
|
btn_edit = '<button onclick="edit(\'' + row.Id + '\')" type="button" class="btn btn-primary btn-sm">查看编辑</button> '
|
2018-12-11 08:37:12 +00:00
|
|
|
|
return '<div class="btn-group" role="group" aria-label="..."> ' +
|
2019-01-25 04:10:12 +00:00
|
|
|
|
'<button onclick="del(\'' + row.Id + '\')" type="button" class="btn btn-danger btn-sm">删除</button>' +
|
|
|
|
|
btn_edit + btn + ' </div>'
|
2018-12-11 08:37:12 +00:00
|
|
|
|
}
|
2019-01-26 09:27:28 +00:00
|
|
|
|
}, {
|
|
|
|
|
targets: 2,
|
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
|
return row.Client.Id
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
targets: 5,
|
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
|
if (row.UseClientCnf == true) {
|
|
|
|
|
return row.Client.Cnf.Compress
|
|
|
|
|
} else {
|
|
|
|
|
return row.Config.Compress
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
targets: 8,
|
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
|
if (row.UseClientCnf == true) {
|
|
|
|
|
return row.Client.Cnf.U
|
|
|
|
|
} else {
|
|
|
|
|
return row.Config.U
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
targets: 9,
|
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
|
if (row.UseClientCnf == true) {
|
|
|
|
|
return row.Client.Cnf.P
|
|
|
|
|
} else {
|
|
|
|
|
return row.Config.P
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-12-11 08:37:12 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
2019-01-25 04:10:12 +00:00
|
|
|
|
targets: -4,
|
2018-12-11 08:37:12 +00:00
|
|
|
|
render: function (data, type, row, meta) {
|
2019-01-26 09:27:28 +00:00
|
|
|
|
if (data == false) {
|
2018-12-11 08:37:12 +00:00
|
|
|
|
return "<span class=\"badge badge-pill badge-secondary\">暂停</span>"
|
|
|
|
|
} else {
|
|
|
|
|
return "<span class=\"badge badge-pill badge-success\">正常</span>"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2019-01-02 17:44:45 +00:00
|
|
|
|
{
|
2019-01-25 04:10:12 +00:00
|
|
|
|
targets: -9,
|
2019-01-02 17:44:45 +00:00
|
|
|
|
render: function (data, type, row, meta) {
|
2019-01-26 09:27:28 +00:00
|
|
|
|
if (row.UseClientCnf == true) {
|
|
|
|
|
crypt = row.Client.Cnf.Crypt
|
|
|
|
|
} else {
|
|
|
|
|
crypt = row.Config.Crypt
|
|
|
|
|
}
|
|
|
|
|
if (crypt == "0") {
|
2019-01-02 17:44:45 +00:00
|
|
|
|
return "不加密"
|
|
|
|
|
} else {
|
|
|
|
|
return "加密"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2019-01-05 19:16:46 +00:00
|
|
|
|
{
|
2019-01-25 04:10:12 +00:00
|
|
|
|
targets: -8,
|
2019-01-05 19:16:46 +00:00
|
|
|
|
render: function (data, type, row, meta) {
|
2019-01-26 09:27:28 +00:00
|
|
|
|
if (row.UseClientCnf == true) {
|
|
|
|
|
mux = row.Client.Cnf.Mux
|
|
|
|
|
} else {
|
|
|
|
|
mux = row.Config.Mux
|
|
|
|
|
}
|
|
|
|
|
if (mux == "0") {
|
2019-01-05 19:16:46 +00:00
|
|
|
|
return "不启用"
|
|
|
|
|
} else {
|
|
|
|
|
return "启用"
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-12-11 08:37:12 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
2019-01-25 04:10:12 +00:00
|
|
|
|
targets: -5,
|
2018-12-11 08:37:12 +00:00
|
|
|
|
render: function (data, type, row, meta) {
|
2019-01-26 09:27:28 +00:00
|
|
|
|
if (row.Client.IsConnect == false) {
|
2018-12-11 08:37:12 +00:00
|
|
|
|
return "<span class=\"badge badge-pill badge-secondary\">离线</span>"
|
|
|
|
|
} else {
|
|
|
|
|
return "<span class=\"badge badge-pill badge-success\">在线</span>"
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-01-25 04:10:12 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
targets: -2,
|
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
|
return change(row.Flow.InletFlow)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
targets: -3,
|
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
|
return change(row.Flow.ExportFlow)
|
|
|
|
|
}
|
2018-12-11 08:37:12 +00:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
buttons: []
|
|
|
|
|
});
|
|
|
|
|
$("#sampleTable_length").html('<button class="btn btn-primary" onclick="add()" type="button">新增</button>')
|
|
|
|
|
})
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|