You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
198 lines
7.3 KiB
198 lines
7.3 KiB
<!DOCTYPE html>
|
|
<html lang="zh-cn">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<script src="/js/guid.js"></script>
|
|
<script type="text/javascript" src="../js/notice/xm-select.js"></script>
|
|
<script type="text/javascript" src="../js/load_realmlist.js"></script>
|
|
<!--#include file="/widget/head.html"-->
|
|
</head>
|
|
|
|
<body class="layui-layout-body" layadmin-themealias="default">
|
|
<div id="wrapper" class="layui-fluid">
|
|
<!--#include file="/widget/nav.html"-->
|
|
<div id="page-wrapper" class="layui-body layadmin-tabsbody-item layui-show layui-fluid layui-row layui-col-space15">
|
|
<div class="layui-card">
|
|
<div class="layui-card-header">
|
|
<h2>IP/设备 黑白名单管理</h2>
|
|
</div>
|
|
<div class=" layui-form layui-row layui-col-space10">
|
|
<div class="layui-col-md8">
|
|
<div class="form-group">
|
|
<div class="col-md-2">
|
|
<label for="dateType">类别:</label>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<select class="form-control" id="dateType" lay-search lay-filter>
|
|
<option value="IP">IP白名单</option>
|
|
<option value="BIP">IP黑名单</option>
|
|
<option value="Device">设备白名单</option>
|
|
<option value="BDevice">设备黑名单</option>
|
|
</select>
|
|
</div>
|
|
<button type="button" class=" layui-btn " id="sele">立刻查询</button>
|
|
<!-- <button type="button" class=" layui-btn " id="add">添加</button>-->
|
|
<!-- <button type="button" class=" layui-btn " id="delete">删除</button>-->
|
|
</div>
|
|
|
|
<div class="layui-card-body">
|
|
<pre id='preId' style="white-space: pre-line;"></pre>
|
|
<div id="dataTableDiv">
|
|
<table class="layui-table" id="dataTable"></table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!--#include file="/widget/tail.html"-->
|
|
|
|
<script type="text/javascript">
|
|
|
|
$("#sele").click(function () {
|
|
load()
|
|
});
|
|
|
|
function load() {
|
|
var dateType = $("#dateType").select().val();
|
|
var loadIndex = layer.load(0);
|
|
let timeout = true;
|
|
|
|
setTimeout(() => {
|
|
layer.close(loadIndex)
|
|
if (timeout) {
|
|
layer.msg("request timeout");
|
|
}
|
|
}, 5000);
|
|
|
|
$.get(Page.SvrIp + "/api/ip_device_limit",
|
|
{
|
|
op_type: 0,
|
|
token: cookie.get("token")
|
|
},
|
|
function (d) {
|
|
timeout = false;
|
|
layer.close(loadIndex)
|
|
if (d.code == 0) {
|
|
$("#preId").html('');
|
|
if (dateType == 'IP') {
|
|
let js = JSON.stringify(d.data.ip, null, 2);
|
|
$("#preId").html(js);
|
|
}
|
|
if (dateType == "Device") {
|
|
let js = JSON.stringify(d.data.device, null, 2);
|
|
$("#preId").html(js);
|
|
}
|
|
debugger
|
|
if (dateType == 'BIP') {
|
|
let js = JSON.stringify(d.data.bip, null, 2);
|
|
$("#preId").html(js);
|
|
}
|
|
if (dateType == "BDevice") {
|
|
let js = JSON.stringify(d.data.bdevice, null, 2);
|
|
$("#preId").html(js);
|
|
}
|
|
|
|
$("#preId").show();
|
|
} else {
|
|
layer.alert('输入错误,请检查', {icon: 2});
|
|
$("#preId").val('');
|
|
}
|
|
}
|
|
);
|
|
|
|
}
|
|
|
|
$("#add").click(function () {
|
|
var dateType = $("#dateType").select().val();
|
|
let title = "IP";
|
|
let op_type = 1;//添加ip
|
|
if (dateType == "Device") {
|
|
title = '设备'
|
|
op_type = 2;//添加设备
|
|
}
|
|
layer.prompt({title: '添加:' + title + "白名单", formType: 0}, function (name, index) {
|
|
console.dir(name, index);
|
|
$.ajax({
|
|
type: "get",
|
|
url: Page.SvrIp + "/api/ip_device_limit",
|
|
data: {
|
|
op_type: op_type,
|
|
args: name,
|
|
token: cookie.get("token")
|
|
},
|
|
dataType: "json",
|
|
success: function (d) {
|
|
|
|
if (d.code == 0) {
|
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
|
layer.msg('操作完成');
|
|
} else {
|
|
layer.msg(d.msg);
|
|
}
|
|
},
|
|
error: function (status) {
|
|
console.dir(status)
|
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
|
// parent.location.reload();
|
|
}
|
|
});
|
|
|
|
});
|
|
})
|
|
|
|
$("#delete").click(function () {
|
|
var dateType = $("#dateType").select().val();
|
|
let title = "IP";
|
|
let op_type = 3;//添加ip
|
|
if (dateType == "Device") {
|
|
title = '设备'
|
|
op_type = 4;//添加设备
|
|
}
|
|
layer.prompt({title: '删除:' + title + "白名单", formType: 0}, function (name, index) {
|
|
console.dir(name, index);
|
|
$.ajax({
|
|
type: "get",
|
|
url: Page.SvrIp + "/api/ip_device_limit",
|
|
data: {
|
|
op_type: op_type,
|
|
args: name,
|
|
token: cookie.get("token")
|
|
},
|
|
dataType: "json",
|
|
success: function (d) {
|
|
|
|
if (d.code == 0) {
|
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
|
layer.msg('操作完成');
|
|
} else {
|
|
layer.msg(d.msg);
|
|
}
|
|
load();
|
|
},
|
|
error: function (status) {
|
|
console.dir(status)
|
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
|
// parent.location.reload();
|
|
}
|
|
});
|
|
|
|
});
|
|
})
|
|
|
|
var packageIds
|
|
|
|
function getLocalTime(nS) {
|
|
return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' ');
|
|
}
|
|
</script>
|
|
<script src="../js/coupon.js"></script>
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|