优化系统日志搜索

This commit is contained in:
Anyon 2020-12-24 14:23:13 +08:00
parent 02772bd410
commit 0e41a67984
3 changed files with 21 additions and 13 deletions

View File

@ -44,6 +44,7 @@ class Oplog extends Controller
{
$this->title = '系统日志管理';
$this->isSupper = AdminService::instance()->isSuper();
$this->actions = $this->app->db->name($this->table)->distinct(true)->column('action');
$query = $this->_query($this->table)->order('id desc');
$query->like('action,node,content,username,geoip')->dateBetween('create_at');
if (input('output') === 'json') {

View File

@ -38,8 +38,8 @@
操作节点:<span class="color-desc">{$vo.node|default='-'}</span>
</td>
<td class='text-left nowrap padding-row-0 padding-right-0'>
<p class="color-text layui-elip" style="max-width:550px">{$vo.action|default='-'}</p>
<span class="color-desc" style="white-space:normal">{$vo.content|default='-'}</span>
<p class="color-text layui-elip">{$vo.action|default='-'}</p>
<span class="color-desc">{$vo.content|default='-'}</span>
</td>
<td class='text-left nowrap'>
<p class="color-text">{$vo.geoip|default='-'}</p>

View File

@ -3,39 +3,46 @@
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
<div class="layui-form-item layui-inline">
<label class="layui-form-label">操作账号</label>
<div class="layui-input-inline">
<label class="layui-input-inline">
<input name="username" value="{:input('get.username')}" placeholder="请输入操作账号" class="layui-input">
</div>
</label>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">操作节点</label>
<div class="layui-input-inline">
<label class="layui-input-inline">
<input name="node" value="{:input('get.node')}" placeholder="请输入操作节点" class="layui-input">
</div>
</label>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">操作行为</label>
<div class="layui-input-inline">
<input name="action" value="{:input('get.action')}" placeholder="请输入操作行为" class="layui-input">
<select name="action" class="layui-select">
<option value="">--全部--</option>
{foreach $actions as $action}{if $action eq input('action')}
<option selected value="{$action}">{$action}</option>
{else}
<option value="{$action}">{$action}</option>
{/if}{/foreach}
</select>
</div>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">操作描述</label>
<div class="layui-input-inline">
<label class="layui-input-inline">
<input name="content" value="{:input('get.content')}" placeholder="请输入操作内容" class="layui-input">
</div>
</label>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">位置地址</label>
<div class="layui-input-inline">
<label class="layui-input-inline">
<input name="geoip" value="{:input('get.geoip')}" placeholder="请输入位置地址" class="layui-input">
</div>
</label>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">操作时间</label>
<div class="layui-input-inline">
<label class="layui-input-inline">
<input data-date-range name="create_at" value="{:input('get.create_at')}" placeholder="请选择操作时间" class="layui-input">
</div>
</label>
</div>
<div class="layui-form-item layui-inline">
<button type="submit" class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>