Commit 4b379e1d by fsn

用户管理加上搜索条件 详情界面些别显示不正确bug修复

parent d4c20cc1
...@@ -118,8 +118,8 @@ public class UserMgrController extends BaseController { ...@@ -118,8 +118,8 @@ public class UserMgrController extends BaseController {
*/ */
@RequestMapping("/list") @RequestMapping("/list")
@ResponseBody @ResponseBody
public Object list() { public Object list(@RequestParam(required = false) String name, @RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime) {
List<Map<String, Object>> users = managerDao.selectUsers(super.getPara("condition")); List<Map<String, Object>> users = managerDao.selectUsers(name,beginTime,endTime);
return new UserWarpper(users).warp(); return new UserWarpper(users).warp();
} }
...@@ -181,7 +181,7 @@ public class UserMgrController extends BaseController { ...@@ -181,7 +181,7 @@ public class UserMgrController extends BaseController {
*/ */
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@RequestMapping("/delete/{userId}") @RequestMapping("/delete/{userId}")
@BussinessLog(value = "删除管理员",key = "userId") @BussinessLog(value = "删除管理员", key = "userId")
@ResponseBody @ResponseBody
public Tip delete(@PathVariable Integer userId) { public Tip delete(@PathVariable Integer userId) {
if (ToolUtil.isEmpty(userId)) { if (ToolUtil.isEmpty(userId)) {
...@@ -208,7 +208,7 @@ public class UserMgrController extends BaseController { ...@@ -208,7 +208,7 @@ public class UserMgrController extends BaseController {
*/ */
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@RequestMapping("/reset/{userId}") @RequestMapping("/reset/{userId}")
@BussinessLog(value = "重置管理员密码",key = "userId") @BussinessLog(value = "重置管理员密码", key = "userId")
@ResponseBody @ResponseBody
public Tip reset(@PathVariable Integer userId) { public Tip reset(@PathVariable Integer userId) {
if (ToolUtil.isEmpty(userId)) { if (ToolUtil.isEmpty(userId)) {
...@@ -226,7 +226,7 @@ public class UserMgrController extends BaseController { ...@@ -226,7 +226,7 @@ public class UserMgrController extends BaseController {
*/ */
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@RequestMapping("/freeze/{userId}") @RequestMapping("/freeze/{userId}")
@BussinessLog(value = "冻结用户",key = "userId") @BussinessLog(value = "冻结用户", key = "userId")
@ResponseBody @ResponseBody
public Tip freeze(@PathVariable Integer userId) { public Tip freeze(@PathVariable Integer userId) {
if (ToolUtil.isEmpty(userId)) { if (ToolUtil.isEmpty(userId)) {
...@@ -241,7 +241,7 @@ public class UserMgrController extends BaseController { ...@@ -241,7 +241,7 @@ public class UserMgrController extends BaseController {
*/ */
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@RequestMapping("/unfreeze/{userId}") @RequestMapping("/unfreeze/{userId}")
@BussinessLog(value = "解除冻结用户",key = "userId") @BussinessLog(value = "解除冻结用户", key = "userId")
@ResponseBody @ResponseBody
public Tip unfreeze(@PathVariable Integer userId) { public Tip unfreeze(@PathVariable Integer userId) {
if (ToolUtil.isEmpty(userId)) { if (ToolUtil.isEmpty(userId)) {
...@@ -256,7 +256,7 @@ public class UserMgrController extends BaseController { ...@@ -256,7 +256,7 @@ public class UserMgrController extends BaseController {
*/ */
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@RequestMapping("/setRole") @RequestMapping("/setRole")
@BussinessLog(value = "分配角色",key = "userId") @BussinessLog(value = "分配角色", key = "userId")
@ResponseBody @ResponseBody
public Tip setRole(@RequestParam("userId") Integer userId, @RequestParam("roleIds") String roleIds) { public Tip setRole(@RequestParam("userId") Integer userId, @RequestParam("roleIds") String roleIds) {
if (ToolUtil.isOneEmpty(userId, roleIds)) { if (ToolUtil.isOneEmpty(userId, roleIds)) {
......
...@@ -38,7 +38,7 @@ public interface UserMgrDao { ...@@ -38,7 +38,7 @@ public interface UserMgrDao {
* @return * @return
* @date 2017年2月12日 下午9:14:34 * @date 2017年2月12日 下午9:14:34
*/ */
public List<Map<String, Object>> selectUsers(@Param("condition") String condition); public List<Map<String, Object>> selectUsers(@Param("name") String name, @Param("beginTime") String beginTime, @Param("endTime") String endTime);
/** /**
* 设置用户的角色 * 设置用户的角色
......
...@@ -21,10 +21,13 @@ ...@@ -21,10 +21,13 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from _user from _user
where status != 5 where status != 5
<if test="condition != null and condition != ''"> <if test="name != null and name != ''">
and (phone like CONCAT('%',#{condition},'%') and (phone like CONCAT('%',#{name},'%')
or account like CONCAT('%',#{condition},'%') or account like CONCAT('%',#{name},'%')
or name like CONCAT('%',#{condition},'%')) or name like CONCAT('%',#{name},'%'))
</if>
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
</if> </if>
</select> </select>
......
...@@ -10,5 +10,5 @@ ...@@ -10,5 +10,5 @@
type="button">${name} type="button">${name}
</button> </button>
</div> </div>
<input type="text" class="form-control" id="${id}" /> <input type="text" class="form-control" id="${id}" placeholder="${placeholder!}" />
</div> </div>
\ No newline at end of file
...@@ -10,7 +10,13 @@ ...@@ -10,7 +10,13 @@
<div class="col-sm-12"> <div class="col-sm-12">
<div class="row"> <div class="row">
<div class="col-sm-3"> <div class="col-sm-3">
<#NameCon id="userName" name="用户名称" /> <#NameCon id="name" name="用户名称" placeholder="帐号/姓名/手机号"/>
</div>
<div class="col-sm-3">
<#TimeCon id="beginTime" name="注册开始日期" isTime="false" pattern="YYYY-MM-DD"/>
</div>
<div class="col-sm-3">
<#TimeCon id="endTime" name="注册结束日期" isTime="false" pattern="YYYY-MM-DD"/>
</div> </div>
<div class="col-sm-3"> <div class="col-sm-3">
<#button name="搜索" icon="fa-search" clickFun="MgrUser.search()"/> <#button name="搜索" icon="fa-search" clickFun="MgrUser.search()"/>
......
...@@ -4,12 +4,14 @@ ...@@ -4,12 +4,14 @@
<div class="form-horizontal"> <div class="form-horizontal">
<input type="hidden" id="id" value="${user.id}"> <input type="hidden" id="id" value="${user.id}">
<input type="hidden" id="sexValue" value="${user.sex}">
<div class="row"> <div class="row">
<div class="col-sm-6 b-r"> <div class="col-sm-6 b-r">
<#input id="account" name="账户" underline="true" value="${user.account}"/> <#input id="account" name="账户" underline="true" value="${user.account}"/>
<#select id="sex" name="性别" underline="true" value="${user.sex}"> <#select id="sex" name="性别" underline="true">
<option value="1"></option> <option value="1"></option>
<option value="2"></option> <option value="2"></option>
</#select> </#select>
......
...@@ -2,184 +2,187 @@ ...@@ -2,184 +2,187 @@
* 系统管理--用户管理的单例对象 * 系统管理--用户管理的单例对象
*/ */
var MgrUser = { var MgrUser = {
id : "managerTable",//表格id id: "managerTable",//表格id
seItem : null, //选中的条目 seItem: null, //选中的条目
table : null, table: null,
layerIndex : -1 layerIndex: -1
}; };
/** /**
* 初始化表格的列 * 初始化表格的列
*/ */
MgrUser.initColumn = function(){ MgrUser.initColumn = function () {
var columns = [ var columns = [
{field: 'selectItem',radio:true}, {field: 'selectItem', radio: true},
{title: 'id',field: 'id', visible: false, align: 'center',valign: 'middle'}, {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '账号',field: 'account',align: 'center',valign: 'middle'}, {title: '账号', field: 'account', align: 'center', valign: 'middle'},
{title: '姓名',field: 'name',align: 'center',valign: 'middle'}, {title: '姓名', field: 'name', align: 'center', valign: 'middle'},
{title: '性别',field: 'sexName',align: 'center',valign: 'middle'}, {title: '性别', field: 'sexName', align: 'center', valign: 'middle'},
{title: '角色',field: 'roleName',align: 'center',valign: 'middle'}, {title: '角色', field: 'roleName', align: 'center', valign: 'middle'},
{title: '部门',field: 'deptName',align: 'center',valign: 'middle'}, {title: '部门', field: 'deptName', align: 'center', valign: 'middle'},
{title: '邮箱',field: 'email',align: 'center',valign: 'middle'}, {title: '邮箱', field: 'email', align: 'center', valign: 'middle'},
{title: '电话',field: 'phone',align: 'center',valign: 'middle'}, {title: '电话', field: 'phone', align: 'center', valign: 'middle'},
{title: '创建时间',field: 'createtime',align: 'center',valign: 'middle'}, {title: '创建时间', field: 'createtime', align: 'center', valign: 'middle'},
{title: '状态',field: 'statusName',align: 'center',valign: 'middle'}]; {title: '状态', field: 'statusName', align: 'center', valign: 'middle'}];
return columns; return columns;
}; };
/** /**
* 绑定表格的事件 * 绑定表格的事件
*/ */
MgrUser.bindEvent = function(){ MgrUser.bindEvent = function () {
$('#' + this.id).on('click-row.bs.table', function(e, row, $element) { $('#' + this.id).on('click-row.bs.table', function (e, row, $element) {
MgrUser.seItem = row; MgrUser.seItem = row;
}); });
}; };
/** /**
* 检查是否选中 * 检查是否选中
*/ */
MgrUser.check = function(){ MgrUser.check = function () {
if(this.seItem == null){ if (this.seItem == null) {
Feng.info("请先选中表格中的某一记录!"); Feng.info("请先选中表格中的某一记录!");
return false; return false;
}else{ } else {
return true; return true;
} }
}; };
/** /**
* 点击添加管理员 * 点击添加管理员
*/ */
MgrUser.openAddMgr = function(){ MgrUser.openAddMgr = function () {
var index = layer.open({ var index = layer.open({
type: 2, type: 2,
title: '添加管理员', title: '添加管理员',
area: ['800px', '550px'], //宽高 area: ['800px', '550px'], //宽高
fix: false, //不固定 fix: false, //不固定
maxmin: true, maxmin: true,
content :Feng.ctxPath + '/mgr/user_add' content: Feng.ctxPath + '/mgr/user_add'
}); });
this.layerIndex = index; this.layerIndex = index;
}; };
/** /**
* 点击修改按钮时 * 点击修改按钮时
* @param userId 管理员id * @param userId 管理员id
*/ */
MgrUser.openChangeUser = function(){ MgrUser.openChangeUser = function () {
if(this.check()){ if (this.check()) {
var index = layer.open({ var index = layer.open({
type: 2, type: 2,
title: '编辑管理员', title: '编辑管理员',
area: ['800px', '450px'], //宽高 area: ['800px', '450px'], //宽高
fix: false, //不固定 fix: false, //不固定
maxmin: true, maxmin: true,
content :Feng.ctxPath + '/mgr/user_edit/' + this.seItem.id content: Feng.ctxPath + '/mgr/user_edit/' + this.seItem.id
}); });
this.layerIndex = index; this.layerIndex = index;
} }
}; };
/** /**
* 点击角色分配 * 点击角色分配
* @param * @param
*/ */
MgrUser.roleAssign = function(){ MgrUser.roleAssign = function () {
if(this.check()){ if (this.check()) {
var index = layer.open({ var index = layer.open({
type: 2, type: 2,
title: '角色分配', title: '角色分配',
area: ['300px', '400px'], //宽高 area: ['300px', '400px'], //宽高
fix: false, //不固定 fix: false, //不固定
maxmin: true, maxmin: true,
content :Feng.ctxPath + '/mgr/role_assign/' + this.seItem.id content: Feng.ctxPath + '/mgr/role_assign/' + this.seItem.id
}); });
this.layerIndex = index; this.layerIndex = index;
} }
}; };
/** /**
* 删除用户 * 删除用户
*/ */
MgrUser.delMgrUser = function(){ MgrUser.delMgrUser = function () {
if(this.check()){ if (this.check()) {
var userId = this.seItem.id; var userId = this.seItem.id;
var ajax = new $ax(Feng.ctxPath + "/mgr/delete/" + userId, function(data){ var ajax = new $ax(Feng.ctxPath + "/mgr/delete/" + userId, function (data) {
Feng.success("删除成功!"); Feng.success("删除成功!");
MgrUser.table.refresh(); MgrUser.table.refresh();
},function(data){ }, function (data) {
Feng.error("删除失败!"); Feng.error("删除失败!");
}); });
ajax.start(); ajax.start();
} }
}; };
/** /**
* 冻结用户账户 * 冻结用户账户
* @param userId * @param userId
*/ */
MgrUser.freezeAccount = function(){ MgrUser.freezeAccount = function () {
if(this.check()){ if (this.check()) {
var userId = this.seItem.id; var userId = this.seItem.id;
var ajax = new $ax(Feng.ctxPath + "/mgr/freeze/" + userId, function(data){ var ajax = new $ax(Feng.ctxPath + "/mgr/freeze/" + userId, function (data) {
Feng.success("冻结成功!"); Feng.success("冻结成功!");
MgrUser.table.refresh(); MgrUser.table.refresh();
},function(data){ }, function (data) {
Feng.error("冻结失败!"); Feng.error("冻结失败!");
}); });
ajax.start(); ajax.start();
} }
}; };
/** /**
* 解除冻结用户账户 * 解除冻结用户账户
* @param userId * @param userId
*/ */
MgrUser.unfreeze = function(){ MgrUser.unfreeze = function () {
if(this.check()){ if (this.check()) {
var userId = this.seItem.id; var userId = this.seItem.id;
var ajax = new $ax(Feng.ctxPath + "/mgr/unfreeze/" + userId, function(data){ var ajax = new $ax(Feng.ctxPath + "/mgr/unfreeze/" + userId, function (data) {
Feng.success("解除冻结成功!"); Feng.success("解除冻结成功!");
MgrUser.table.refresh(); MgrUser.table.refresh();
},function(data){ }, function (data) {
Feng.error("解除冻结失败!"); Feng.error("解除冻结失败!");
}); });
ajax.start(); ajax.start();
} }
} }
/** /**
* 重置密码 * 重置密码
*/ */
MgrUser.resetPwd = function(){ MgrUser.resetPwd = function () {
if(this.check()){ if (this.check()) {
var userId = this.seItem.id; var userId = this.seItem.id;
parent.layer.confirm('是否重置密码为111111?', { parent.layer.confirm('是否重置密码为111111?', {
btn: ['确定','取消'], btn: ['确定', '取消'],
shade: false //不显示遮罩 shade: false //不显示遮罩
}, function(){ }, function () {
var ajax = new $ax(Feng.ctxPath + "/mgr/reset/" + userId, function(data){ var ajax = new $ax(Feng.ctxPath + "/mgr/reset/" + userId, function (data) {
Feng.success("重置密码成功!"); Feng.success("重置密码成功!");
},function(data){ }, function (data) {
Feng.error("重置密码失败!"); Feng.error("重置密码失败!");
}); });
ajax.start(); ajax.start();
}); });
} }
}; };
MgrUser.search = function(){ MgrUser.search = function () {
alert("abcd"); var queryData = {};
queryData['name'] = $("#name").val();
queryData['beginTime'] = $("#beginTime").val();
queryData['endTime'] = $("#endTime").val();
MgrUser.table.refresh({query: queryData});
} }
$(function(){ $(function () {
var defaultColunms = MgrUser.initColumn(); var defaultColunms = MgrUser.initColumn();
var table = new BSTable("managerTable","/mgr/list",defaultColunms); var table = new BSTable("managerTable", "/mgr/list", defaultColunms);
table.setPaginationType("client"); table.setPaginationType("client");
table.init(); MgrUser.table = table.init();
MgrUser.bindEvent(); MgrUser.bindEvent();
MgrUser.table = table;
//默认收起来查询条件
$(".collapse-link").click();
}); });
...@@ -137,4 +137,7 @@ $(function() { ...@@ -137,4 +137,7 @@ $(function() {
ztree.bindOnClick(UserInfoDlg.onClickDept); ztree.bindOnClick(UserInfoDlg.onClickDept);
ztree.init(); ztree.init();
instance = ztree; instance = ztree;
//初始化性别选项
$("#sex").val($("#sexValue").val());
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment