7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
418 lines
13 KiB
HTML
418 lines
13 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="renderer" content="webkit">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||
<title>负载管理-e订通后台</title>
|
||
<link rel="stylesheet" href="layuiadmin/layui/css/layui.css">
|
||
<link rel="stylesheet" href="index.css">
|
||
<script src="layuiadmin/layui/layui.js"></script>
|
||
<script src="js/function.js"></script>
|
||
</head>
|
||
<body>
|
||
<form class="layui-form">
|
||
<div class="layui-tab" lay-filter="tab1">
|
||
<div class="layui-inline layui-tab-brief"><ul class="layui-tab-title"></ul></div>
|
||
<div class="layui-tab-content">
|
||
<div class="layui-tab-item layui-show">
|
||
<div id="zu" class="zu"></div><div id="anniu" class="anniu"></div><div id="anniu2" class="anniu2"></div>
|
||
<div style="width:100%;" id="tb1"><table id="layui_table" lay-filter="layui_table"></table></div>
|
||
<div style="width:100%;" id="tb2"><table id="layui_table1" lay-filter="layui_table1"></table></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</body>
|
||
</html>
|
||
<!--操作-->
|
||
<script type="text/html" id="ip_add">
|
||
<a lay-event="edit" style="color:blue;">{{ d.ip }}</a>
|
||
</script>
|
||
<script type="text/html" id="fwq_ip_add">
|
||
<a lay-event="edit2" style="color:blue;">{{ d.fwq_ip }}</a>
|
||
</script>
|
||
<script type="text/html" id="tc">
|
||
<a lay-event="edit3" style="color:blue;">踢出</a>
|
||
</script>
|
||
<script>
|
||
var tableIns={};
|
||
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
|
||
//时间
|
||
var form = layui.form,
|
||
layer = parent.layer === undefined ? layui.layer : top.layer,
|
||
$=layui.jquery,
|
||
laydate = layui.laydate,
|
||
laytpl = layui.laytpl,
|
||
table = layui.table;
|
||
var element = layui.element;
|
||
//取得url传递参数
|
||
var query_str=location.search.substring(1);
|
||
if(query_str)
|
||
query_str="&"+query_str;
|
||
//根据url取得搜索条件的默认值
|
||
var s_ip=s_live="";
|
||
var pairs=query_str.split("&");//在逗号处断开
|
||
for(var i=0;i<pairs.length;i++){
|
||
var pos=pairs[i].indexOf('=');//查找name=value
|
||
if(pos>=0){
|
||
var argname=pairs[i].substring(0,pos);
|
||
var value=pairs[i].substring(pos+1);
|
||
//alert(argname+"|"+unescape(value));
|
||
if(argname && value)
|
||
eval(argname+"=\""+unescape(value)+"\";");
|
||
}
|
||
}
|
||
var url='./?_m=servers'+query_str;
|
||
|
||
var html2=' <div class="layui-inline"><a class="layui-btn layui-btn-warm btn_qkall">清空</a></div> <div class="layui-inline"><a class="layui-btn layui-btn-warm btn_qk30">清空半小时未操作</a></div> <div class="layui-inline"><a class="layui-btn layui-btn-warm btn_qk60">清空1小时未操作</a></div> <div class="layui-inline"><a class="layui-btn layui-btn-warm btn_pltc">批量踢出</a></div> <br><br><div class="layui-input-inline" style="padding-left:250px;">客户端IP:</div><div class="layui-input-inline" style="width:200px;"> <input type="text" class="layui-input" id="s_ip" name="s_ip"></div><span id="xuanxiang1"></span> <div class="layui-input-inline"><a class="layui-btn layui-btn-normal btn_search">搜索</a></div> <div class="layui-inline"><a class="layui-btn layui-btn-normal btn_ref2">刷新数据表</a></div>';
|
||
$(".anniu2").html(html2);
|
||
|
||
var html2='<div class="layui-inline"><a class="layui-btn layui-btn-normal btn_add">新增</a></div> <div class="layui-inline"><a class="layui-btn layui-btn-danger btn_del">删除</a></div> <div class="layui-inline"><a class="layui-btn layui-btn-normal btn_ref1">刷新数据表</a></div>';
|
||
$(".anniu").html(html2);
|
||
|
||
var s_cate="";
|
||
var s_fz="";
|
||
|
||
|
||
tableIns = table.render({
|
||
even:false,
|
||
elem: '#layui_table',
|
||
url : url,
|
||
cellMinWidth : 80,
|
||
page : false,
|
||
height : "full-200",
|
||
id : "ListTable",
|
||
totalRow: true,
|
||
cols : [[
|
||
{type: "checkbox", fixed:"left", width:50},
|
||
{field: 'ord', title: '优先级别', width:100,sort: true,totalRowText: '合计'},
|
||
{field: 's_group', title: '分组', width:100},
|
||
{field: 'ip', title: '服务器地址', templet: '#ip_add'},
|
||
{field: 'zx', title: '在线数', width:150, align:'center', minWidth:110,sort: true, totalRow: true},
|
||
{field: 'lj', title: '连接数', width:200,sort: true, totalRow: true},
|
||
{field: 'limit', title: '最大限制数', align:'center', totalRow: true}
|
||
]],
|
||
done: function(res, curr, count){
|
||
//去掉合计里的小数
|
||
var a = $(".layui-table-total div:eq(5)").html();
|
||
if(a>0)
|
||
a = a.substr(0,a.indexOf("."));
|
||
$(".layui-table-total div:eq(5)").html(a);
|
||
var b = $(".layui-table-total div:eq(4)").html();
|
||
if(b>0)
|
||
b = b.substr(0,b.indexOf("."));
|
||
$(".layui-table-total div:eq(4)").html(b);
|
||
var c = $(".layui-table-total div:eq(6)").html();
|
||
if(c>0)
|
||
c = c.substr(0,c.indexOf("."));
|
||
$(".layui-table-total div:eq(6)").html(c);
|
||
var html1="";
|
||
arr_tab=res.tab;
|
||
for(var i=0;i<arr_tab.length;i++){
|
||
html1+='<li';
|
||
if(arr_tab[i].no==res.s_cate){
|
||
html1+=' class="layui-this"';
|
||
this_tab_title=arr_tab[i].title;
|
||
}
|
||
html1+='>'+arr_tab[i].title+'</li>';
|
||
}
|
||
$(".layui-tab-title").html(html1);
|
||
var fz=res.fz;
|
||
//alert(JSON.stringify(res));
|
||
if(res.fz){
|
||
if(fz[0].value){
|
||
var html_search_fz="<div class='layui-inline' style='width:200px;'>";
|
||
html_search_fz+='<select id="s_fz" name="s_fz" lay-filter="s_fz"><option value="">-负载分组-</option>';
|
||
for(var j=0;j<fz.length;j++){
|
||
html_search_fz+='<option value="'+fz[j].value+'"';
|
||
if(fz[j].value==res.s_fz)
|
||
html_search_fz+=' selected';
|
||
html_search_fz+='>'+fz[j].title+'</option>';
|
||
}
|
||
html_search_fz+='</select></div>';
|
||
$("#zu").html(html_search_fz);
|
||
}
|
||
}
|
||
if(res.s_cate=="fwq"){
|
||
$("#anniu").show();
|
||
$("#anniu2").hide();
|
||
}
|
||
s_cate=res.s_cate;
|
||
s_fz=res.s_fz;
|
||
form.render();
|
||
|
||
}
|
||
});
|
||
|
||
|
||
var tableIns1 = table.render({
|
||
even:false,
|
||
elem: '#layui_table1',
|
||
url : url,
|
||
cellMinWidth : 80,
|
||
page : true,
|
||
height : "full-100",
|
||
id : "ListTable1",
|
||
limit : 20,
|
||
limits : [10,20,30,50,100],
|
||
totalRow: true,
|
||
cols : [[
|
||
{type: "checkbox", fixed:"left", width:50},
|
||
{field: 'list', title: '编号', width:100,sort: true},
|
||
{field: 's_ip', title: '客户ip'},
|
||
{field: 'user', title: '用户', width:150, align:'center', minWidth:110,sort: true},
|
||
{field: 'fwq_ip', title: '服务器', width:200,sort: true,templet: '#fwq_ip_add'},
|
||
{field: 'add_date', title: '最后操作', align:'center',sort: true},
|
||
{title: '操作',templet: '#tc'}
|
||
]],
|
||
done: function(res, curr, count){
|
||
//加载tab
|
||
var html1="";
|
||
arr_tab=res.tab;
|
||
for(var i=0;i<arr_tab.length;i++){
|
||
html1+='<li';
|
||
if(arr_tab[i].no==res.s_cate){
|
||
html1+=' class="layui-this"';
|
||
this_tab_title=arr_tab[i].title;
|
||
}
|
||
html1+='>'+arr_tab[i].title+'</li>';
|
||
}
|
||
$(".layui-tab-title").html(html1);
|
||
if(res.fz){
|
||
var fz=res.fz;
|
||
if(fz[0].value){
|
||
var html_search_fz="<div class='layui-inline' style='width:200px;'>";
|
||
html_search_fz+='<select id="s_fz" name="s_fz" lay-filter="s_fz"><option value="">-负载分组-</option>';
|
||
for(var j=0;j<fz.length;j++){
|
||
html_search_fz+='<option value="'+fz[j].value+'"';
|
||
if(fz[j].value==res.s_fz)
|
||
html_search_fz+=' selected';
|
||
html_search_fz+='>'+fz[j].title+'</option>';
|
||
}
|
||
html_search_fz+='</select></div>';
|
||
$("#zu").html(html_search_fz);
|
||
}
|
||
}
|
||
//自定义选项
|
||
if(res.s_cate=="fz"){
|
||
var html1='<div class="layui-inline" style="width:150px;"><select name="s_server_ip" id="s_server_ip"><option value="">-服务器-</option>';
|
||
for(var i=0;i<res.xuanxiang1.length;i++){
|
||
html1+='<option value="'+res.xuanxiang1[i].ip+'"';
|
||
if(res.xx1==res.xuanxiang1[i].ip)
|
||
html1+='selected';
|
||
html1+='>'+res.xuanxiang1[i].ip+'</option>';
|
||
}
|
||
html1+='</select></div>';
|
||
$("#xuanxiang1").html(html1);
|
||
|
||
$("#anniu2").show();
|
||
$("#anniu").hide();
|
||
}
|
||
s_cate=res.s_cate;
|
||
s_fz=res.s_fz;
|
||
form.render();
|
||
//layer.close(index);
|
||
|
||
}
|
||
});
|
||
|
||
|
||
if(!s_cate){
|
||
$("#tb1").show();
|
||
$("#tb2").hide();
|
||
$("#anniu").show();
|
||
$("#anniu2").hide();
|
||
}
|
||
|
||
form.on('select(s_fz)', function(data){
|
||
if(s_cate){
|
||
var url='./?_m=servers&s_cate='+s_cate+'&s_fz='+encodeURIComponent(data.value);
|
||
if(s_cate=="fwq"){
|
||
tableIns.reload({url:url});
|
||
}
|
||
if(s_cate=="fz"){
|
||
tableIns1.reload({url:url});
|
||
}
|
||
}else{
|
||
var url='./?_m=servers&s_cate=fwq&s_fz='+data.value;
|
||
tableIns.reload({url:url});
|
||
}
|
||
$('#form1_search').submit();
|
||
});
|
||
|
||
element.on('tab(tab1)', function(data){
|
||
//alert(JSON.stringify(arr_tab));
|
||
//alert(this.innerHTML);
|
||
this_tab_title=this.innerHTML;
|
||
for(var i=0;i<arr_tab.length;i++){
|
||
if(arr_tab[i].title==this_tab_title){
|
||
this_tab_no=arr_tab[i].no;
|
||
}
|
||
}
|
||
var s_fz=$("#s_fz").val();
|
||
console.log(s_fz);
|
||
if(s_fz){
|
||
var url='./?_m=servers&s_cate='+this_tab_no+'&s_fz='+s_fz;
|
||
}else{
|
||
var url='./?_m=servers&s_cate='+this_tab_no;
|
||
}
|
||
if(this_tab_no=="fwq"){
|
||
tableIns.reload({url:url});
|
||
$("#tb1").show();
|
||
$("#tb2").hide();
|
||
$("#anniu").show();
|
||
$("#anniu2").hide();
|
||
}else{
|
||
tableIns1.reload({url:url});
|
||
$("#tb1").hide();
|
||
$("#tb2").show();
|
||
$("#anniu2").show();
|
||
$("#anniu").hide();
|
||
}
|
||
///tableIns.reload({url:url});
|
||
//alert(url);
|
||
//location.href=url;
|
||
});
|
||
//查看详情
|
||
function add(id){
|
||
var t1=(id>0)?"编辑":"新增";
|
||
var index = layui.layer.open({
|
||
title : t1+"负载",
|
||
type : 2,
|
||
area: ['700px', '500px'],
|
||
content : "servers_add.htm?id="+id,
|
||
success : function(layero, index){
|
||
}
|
||
})
|
||
}
|
||
//查看详情2
|
||
function add2(id){
|
||
var t1=(id>0)?"编辑":"新增";
|
||
var index = layui.layer.open({
|
||
title : t1+"管理",
|
||
type : 2,
|
||
area: ['700px', '500px'],
|
||
content : "servers_add2.htm?id="+id,
|
||
success : function(layero, index){
|
||
var body = layui.layer.getChildFrame('body', index);
|
||
if(id>0){
|
||
body.find("#id").val(id);
|
||
form.render();
|
||
}
|
||
}
|
||
})
|
||
}
|
||
$(".btn_qkall").click(function(){
|
||
layer.confirm('确定清空所有的客户?', {icon: 3, title: '提示信息'}, function (index) {
|
||
$.get("./?_m=servers&_a=kickout_all",function(data){
|
||
tableIns1.reload();
|
||
layer.close(index);
|
||
})
|
||
})
|
||
})
|
||
|
||
$(".btn_ref1").click(function(){
|
||
tableIns.reload();
|
||
})
|
||
$(".btn_ref2").click(function(){
|
||
tableIns1.reload();
|
||
})
|
||
|
||
|
||
$(".btn_qk30").click(function(){
|
||
layer.confirm('确定清空30分钟没操作的客户?', {icon: 3, title: '提示信息'}, function (index) {
|
||
$.get("./?_m=servers&_a=kickout_30",function(data){
|
||
tableIns1.reload();
|
||
layer.close(index);
|
||
})
|
||
})
|
||
})
|
||
$(".btn_qk60").click(function(){
|
||
layer.confirm('确定清空一小时没操作的客户?', {icon: 3, title: '提示信息'}, function (index) {
|
||
$.get("./?_m=servers&_a=kickout_60",function(data){
|
||
tableIns1.reload();
|
||
layer.close(index);
|
||
})
|
||
})
|
||
})
|
||
//批量踢出
|
||
$(".btn_pltc").click(function(){
|
||
var checkStatus = table.checkStatus('ListTable1'),
|
||
data = checkStatus.data,
|
||
check_id = [];
|
||
if(data.length > 0) {
|
||
for (var i in data) {
|
||
check_id.push(data[i].id);
|
||
}
|
||
layer.confirm('确定踢出所选的客户吗?', {icon: 3, title: '提示信息'}, function (index) {
|
||
$.get("./?_m=servers&_a=kickout_pl",{id:check_id},function(data){
|
||
tableIns1.reload();
|
||
layer.close(index);
|
||
})
|
||
})
|
||
}else{
|
||
layer.msg("请选择需要删除的记录");
|
||
}
|
||
})
|
||
$(".btn_search").click(function(){
|
||
var url='./?_m=servers&s_cate=fz';
|
||
tableIns1.reload({
|
||
url:url,
|
||
where: {
|
||
s_ip: $("#s_ip").val()
|
||
,s_server_ip: $("#s_server_ip").val()
|
||
//…
|
||
}
|
||
});
|
||
});
|
||
//新增
|
||
$(".btn_add").click(function(){
|
||
add(0);
|
||
})
|
||
//批量删除
|
||
$(".btn_del").click(function(){
|
||
var checkStatus = table.checkStatus('ListTable'),
|
||
data = checkStatus.data,
|
||
check_id = [];
|
||
if(data.length > 0) {
|
||
for (var i in data) {
|
||
check_id.push(data[i].id);
|
||
}
|
||
layer.confirm('确定删除吗?', {icon: 3, title: '提示信息'}, function (index) {
|
||
$.get("./?_m=servers&_a=del",{id:check_id},function(data){
|
||
tableIns.reload();
|
||
layer.close(index);
|
||
})
|
||
})
|
||
}else{
|
||
layer.msg("请选择需要删除的记录");
|
||
}
|
||
})
|
||
//列表操作
|
||
table.on('tool(layui_table)', function(obj){
|
||
var layEvent = obj.event,
|
||
data = obj.data;
|
||
if(layEvent === 'edit'){
|
||
//编辑
|
||
add(data.id);
|
||
}
|
||
});
|
||
table.on('tool(layui_table1)', function(obj){
|
||
var layEvent = obj.event,
|
||
data = obj.data;
|
||
if(layEvent === 'edit2'){
|
||
//编辑2
|
||
add2(data.id);
|
||
}
|
||
if(layEvent === 'edit3'){
|
||
layer.confirm('确定踢出吗?',{icon:3, title:'提示信息'},function(index){
|
||
$.get("./?_m=servers&_a=kickout",{id:data.id},function(data){
|
||
tableIns1.reload();
|
||
layer.close(index);
|
||
})
|
||
});
|
||
}
|
||
});
|
||
})
|
||
</script> |