mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]简化代码,优化结构
This commit is contained in:
parent
4f70cf2527
commit
590e148f36
@ -39,6 +39,12 @@ class Log extends BasicAdmin {
|
|||||||
public function index() {
|
public function index() {
|
||||||
$this->title = '系统操作日志';
|
$this->title = '系统操作日志';
|
||||||
$db = Db::name($this->table)->order('id desc');
|
$db = Db::name($this->table)->order('id desc');
|
||||||
|
$get = $this->request->get();
|
||||||
|
foreach (['action', 'content', 'username'] as $key) {
|
||||||
|
if (isset($get[$key]) && $get[$key] !== '') {
|
||||||
|
$db->where($key, 'like', "%{$get[$key]}%");
|
||||||
|
}
|
||||||
|
}
|
||||||
parent::_list($db);
|
parent::_list($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,41 @@
|
|||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="content"}
|
{block name="content"}
|
||||||
|
|
||||||
|
<!-- 表单搜索 开始 -->
|
||||||
|
<form class="animated form-search" action="__SELF__" onsubmit="return false" method="get">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" name="username" value="{$Think.get.username|default=''}" placeholder="操作者"
|
||||||
|
class="input-sm form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" name="action" value="{$Think.get.action|default=''}" placeholder="行为"
|
||||||
|
class="input-sm form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" name="content" value="{$Think.get.content|default=''}" placeholder="操作内容"
|
||||||
|
class="input-sm form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-1">
|
||||||
|
<div class="form-group">
|
||||||
|
<button type="submit" class="btn btn-sm btn-white"><i class="fa fa-search"></i> 搜索</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<!-- 表单搜索 结束 -->
|
||||||
|
|
||||||
<form onsubmit="return false;" data-auto="" method="POST">
|
<form onsubmit="return false;" data-auto="" method="POST">
|
||||||
<input type="hidden" value="resort" name="action"/>
|
<input type="hidden" value="resort" name="action"/>
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
|
@ -31,11 +31,12 @@ define(['jquery', 'admin.plugs'], function () {
|
|||||||
|
|
||||||
/*! 注册 data-serach 表单搜索行为 */
|
/*! 注册 data-serach 表单搜索行为 */
|
||||||
this.$body.on('submit', 'form.form-search', function () {
|
this.$body.on('submit', 'form.form-search', function () {
|
||||||
var split = this.action.indexOf('?') === -1 ? '?' : '&';
|
var url = $(this).attr('action');
|
||||||
|
var split = url.indexOf('?') === -1 ? '?' : '&';
|
||||||
if ((this.method || 'get').toLowerCase() === 'get') {
|
if ((this.method || 'get').toLowerCase() === 'get') {
|
||||||
window.location.href = '#' + parseUri(this.action + split + $(this).serialize());
|
window.location.href = '#' + parseUri(url + split + $(this).serialize());
|
||||||
} else {
|
} else {
|
||||||
$.form.load(this.action, this, 'post');
|
$.form.load(url, this, 'post');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -46,8 +47,7 @@ define(['jquery', 'admin.plugs'], function () {
|
|||||||
|
|
||||||
/*! 注册 data-open 事件行为 */
|
/*! 注册 data-open 事件行为 */
|
||||||
this.$body.on('click', '[data-open]', function () {
|
this.$body.on('click', '[data-open]', function () {
|
||||||
var url = $(this).attr('data-open');
|
$.form.href($(this).attr('data-open'), this);
|
||||||
$.form.href(url, this);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/*! 注册 data-reload 事件行为 */
|
/*! 注册 data-reload 事件行为 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user