parent
96238e8ecc
commit
b2c0272b18
@ -1,48 +1,69 @@ |
||||
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> |
||||
<form id="theFrm"> |
||||
<input type="hidden" name="id" value="<?=$info->id?>">
|
||||
<tr> |
||||
<td width="100" height="25" class="td_bg">城市</td> |
||||
<td height="25" class="td_bg"> |
||||
<input name="city_name" type="text" id="city_name" value="<?= $info->city_name ?>" style="width:400px;"/>
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td width="100" height="25" class="td_bg">IP</td> |
||||
<td height="25" class="td_bg"> |
||||
<input name="ip" type="text" id="ip" value="<?= $info->ip ?>" style="width:400px;"/>
|
||||
</td> |
||||
</tr> |
||||
</form> |
||||
<tr> |
||||
<td height="22" colspan="2" align="center" class="td_bg"> |
||||
<input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 提交 "/> |
||||
|
||||
<input id="back-btn" type="button" class="ACT_btn" name="Submit2" value=" 返回 "> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script> |
||||
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script> |
||||
<script type="text/javascript" language="javascript" src="/js/func.js"></script> |
||||
<?php |
||||
use \common\libs\MyLib; |
||||
?> |
||||
<?php $this->beginBlock('header_css'); ?> |
||||
<link href="/assets/css/plugins/iCheck/custom.css" rel="stylesheet"> |
||||
<?php $this->endBlock(); ?> |
||||
|
||||
<div class="wrapper wrapper-content animated fadeInRight"> |
||||
<div class="ibox float-e-margins"> |
||||
<div class="ibox-content"> |
||||
<div class="row"> |
||||
<div class="col-sm-12"> |
||||
<form role="form" class="form-horizontal data-from" id="theFrm"> |
||||
<input type="hidden" name="id" value="<?=intval($info->id)?>">
|
||||
<div class="form-group"> |
||||
<label class="col-sm-1 control-label">城市</label> |
||||
<div class="col-sm-6"> |
||||
<input type="text" name="city_name" value="<?=$info->city_name?>" class="form-control">
|
||||
</div> |
||||
</div> |
||||
<div class="form-group"> |
||||
<label class="col-sm-1 control-label">IP</label> |
||||
<div class="col-sm-6"> |
||||
<input type="text" name="ip" value="<?=$info->ip?>" class="form-control">
|
||||
</div> |
||||
</div> |
||||
<div> |
||||
<div class="row"> |
||||
<div class="col-sm-5 col-sm-offset-5"> |
||||
<button class="btn btn-primary btn-save" type="button"> |
||||
<strong><?=$info ? '保 存':'添 加'?></strong>
|
||||
</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<?php $this->beginBlock('footer_js'); ?> |
||||
<script type="text/javascript" language="javascript"> |
||||
$(function () { |
||||
//提交按钮 |
||||
$("#submit-btn").click(function(){ |
||||
if(confirm('是否确认提交?')) { |
||||
$(".btn-save").click(function(){ |
||||
parent.layer.confirm('是否确认提交?', { |
||||
btn: ['确认','取消'], //按钮 |
||||
shade: false //不显示遮罩 |
||||
}, function(){ |
||||
var params = $("#theFrm").serialize(); |
||||
$.post('/system/ip-save',params,function(obj){ |
||||
alert(obj.msg); |
||||
if(obj.success) { |
||||
$('#back-btn').click(); |
||||
parent.layer.msg('保存成功'); |
||||
parent.refreshList(); |
||||
layer_close(); |
||||
} else { |
||||
parent.layer.msg(data.msg); |
||||
} |
||||
},'json'); |
||||
} |
||||
}); |
||||
|
||||
//返回按钮 |
||||
$('#back-btn').click(function(){ |
||||
window.location.href='/system/ip'; |
||||
}, function(){ |
||||
// |
||||
}); |
||||
}); |
||||
}) |
||||
</script> |
||||
<?php $this->endBlock('footer_js'); ?> |
||||
|
||||
|
@ -1,76 +1,98 @@ |
||||
<?php |
||||
use \common\libs\MyLib; |
||||
?> |
||||
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script> |
||||
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script> |
||||
<script type="text/javascript" language="javascript" src="/js/func.js"></script> |
||||
<script type="text/javascript" language="javascript"> |
||||
$(function(){ |
||||
$('#add-btn').click(function(){ |
||||
edit(0); |
||||
}); |
||||
$("#search-btn").click(function(){ |
||||
var params = $('#searchForm').serialize(); |
||||
window.location.href = "/system/ip?" + params; |
||||
}); |
||||
}); |
||||
//编辑 |
||||
<?php $this->beginBlock('header_css'); ?> |
||||
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"> |
||||
<?php $this->endBlock(); ?> |
||||
|
||||
<div class="wrapper wrapper-content animated fadeInRight"> |
||||
<div class="ibox float-e-margins"> |
||||
<div class="ibox-title"> |
||||
<h5>外网IP管理</h5> |
||||
<div class="ibox-tools"> |
||||
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="create(0)"> |
||||
<i class="fa fa-plus"></i> 添加 |
||||
</a> |
||||
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');"> |
||||
<i class="fa fa-refresh"></i> 刷新 |
||||
</a> |
||||
</div> |
||||
</div> |
||||
<div class="ibox-content"> |
||||
<div class="row"> |
||||
<div class="col-md-12"> |
||||
<table id="listTable"> |
||||
<thead> |
||||
<tr> |
||||
<th width="50" data-field="id">ID</th> |
||||
<th data-field="city_name">城市</th> |
||||
<th data-field="ip">IP</th> |
||||
<th data-formatter="opFormatter">操作</th> |
||||
</tr> |
||||
</thead> |
||||
</table> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<?php $this->beginBlock('footer_js'); ?> |
||||
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script> |
||||
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script> |
||||
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script> |
||||
<script> |
||||
function opFormatter(value, row, index) { |
||||
var opStr = []; |
||||
opStr.push('<a href="javascript:void(0);" onclick="edit(' + row.id + ')">'); |
||||
opStr.push('<i class="fa fa-edit" title="编辑"></i>'); |
||||
opStr.push('</a>'); |
||||
opStr.push('<a href="javascript:void(0);" onclick="del(' + row.id + ')">'); |
||||
opStr.push('<i class="fa fa-trash" title="删除"></i>'); |
||||
opStr.push('</a>'); |
||||
|
||||
return opStr.join(' '); |
||||
} |
||||
function create() { |
||||
title = '新增IP'; |
||||
layer_show(title, '/system/edit?id=0'); |
||||
} |
||||
function edit(id) { |
||||
window.location.href = '/system/edit?id=' + id; |
||||
var title = '编辑IP'; |
||||
layer_show(title, '/system/edit?id=' + id); |
||||
} |
||||
//删除 |
||||
function del(id) { |
||||
if(confirm('是否确认删除?')) { |
||||
$.post('/system/del',{id:id},function(obj){ |
||||
alert(obj.msg); |
||||
if(obj.success) { |
||||
window.location.reload(); |
||||
} |
||||
},'json'); |
||||
} |
||||
parent.layer.confirm('是否确认删除?', { |
||||
btn: ['删除','取消'], //按钮 |
||||
shade: false //不显示遮罩 |
||||
}, function(){ |
||||
$.post('/system/delete',{id:id},function(data) { |
||||
parent.layer.msg(data.msg); |
||||
refreshList(); |
||||
}, 'json'); |
||||
}, function(){ |
||||
// |
||||
}); |
||||
} |
||||
</script> |
||||
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> |
||||
<form id="searchForm"> |
||||
<tr> |
||||
<td class="td_bg"> |
||||
名称:<input name="name" type="text" value="<?= $name ?>">
|
||||
<input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索"> |
||||
<input type="button" class="act_btn" id="add-btn" name="add-btn" value="添加"> |
||||
</td> |
||||
</tr> |
||||
</form> |
||||
</table> |
||||
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table"> |
||||
<?php |
||||
if($info){ |
||||
?> |
||||
<tr> |
||||
<td width="10%" align="center" align="center" class="bg_tr" nowrap>序列号</td> |
||||
<td width="30%" align="center" align="center" class="bg_tr">城市</td> |
||||
<td width="20%" align="center" align="center" class="bg_tr">IP</td> |
||||
<td width="40%" align="center" class="bg_tr">操作</td> |
||||
</tr> |
||||
<?php |
||||
foreach($info as $index => $item){ |
||||
?> |
||||
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)> |
||||
<td align="center" class="td_bg" nowrap ><?= $index+1 ?></td>
|
||||
<td align="left" class="td_bg" nowrap ><?= $item->city_name ?></td>
|
||||
<td align="left" class="td_bg" nowrap ><?= $item->ip ?></td>
|
||||
<td align="center" class="td_bg" nowrap> |
||||
[<a href="javascript:void(0);" onclick="edit(<?= $item->id ?>)">修改</a>]
|
||||
[<a href="javascript:void(0);" onclick="del(<?= $item->id ?>)">删除</a>]
|
||||
</td> |
||||
</tr> |
||||
<?php |
||||
} |
||||
?> |
||||
<?php |
||||
}else{ |
||||
?> |
||||
<tr>没有查到数据</tr> |
||||
<?php |
||||
function refreshList() { |
||||
$('#listTable').bootstrapTable('refresh'); |
||||
} |
||||
|
||||
function search() { |
||||
$('#listTable').bootstrapTable('destroy'); |
||||
$('#listTable').bootstrapTable({ |
||||
url: "/system/ip-json", |
||||
pagination: false, |
||||
sidePagination: 'server', |
||||
queryParams: function(params) { |
||||
return params; |
||||
} |
||||
}); |
||||
} |
||||
?> |
||||
</table> |
||||
|
||||
$(function() { |
||||
search(); |
||||
}); |
||||
</script> |
||||
<?php $this->endBlock(); ?> |
||||
|
Loading…
Reference in new issue