[更新]用户列表搜索demo更新

This commit is contained in:
邹景立 2017-03-29 19:02:47 +08:00
parent ce95ea7960
commit 709dbd844b
2 changed files with 18 additions and 4 deletions

View File

@ -37,12 +37,20 @@ class User extends BasicAdmin {
* 用户列表
*/
public function index() {
// 设置页面标题
$this->title = '系统用户管理';
// 获取到所有GET参数
$get = $this->request->get();
// 实例Query对象
$db = Db::name($this->table)->where('is_deleted', '0');
if ($this->request->get('username')) {
$db->where('username', 'like', '%' . $this->request->get('username') . '%');
// 应用搜索条件
if (isset($get['username']) && $get['username'] !== '') {
$db->where('username', 'like', "%{$get['username']}%");
}
if (isset($get['phone'] && $get['phone'] !== '')) {
$db->where('phone', 'like', "%{$get['phone']}%");
}
// 实例化并显示
parent::_list($db);
}

View File

@ -24,6 +24,13 @@
</div>
</div>
<div class="col-xs-3">
<div class="form-group">
<input type="text" name="phone" value="{$Think.get.phone|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>
@ -31,7 +38,6 @@
</div>
</div>
</form>
<!-- 表单搜索 结束 -->
<form onsubmit="return false;" data-auto="" method="POST">