<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %>
|
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
|
<%
|
String path = request.getContextPath();
|
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
|
+ path + "/";
|
%>
|
|
<!DOCTYPE HTML>
|
<html>
|
<head>
|
<base href="<%=basePath%>">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<title>用户管理</title>
|
<!--[if !IE]><!-->
|
<link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
|
<!--<![endif]-->
|
<!--[if gte IE 8]>
|
<link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
|
<![endif]-->
|
<link href="static/plugins/jquery-easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css">
|
<link rel="stylesheet" href="static/styles/initialize.css" type="text/css">
|
<link rel="stylesheet" href="static/styles/common.css" type="text/css">
|
<link rel="stylesheet" href="static/plugins/layer/skin/default/layer.css" type="text/css">
|
<script type="text/javascript" src="static/plugins/jquery/jquery.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui/jquery.easyui.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
|
<script type="text/javascript" src="static/plugins/slimScroll/jquery.slimscroll.min.js"></script>
|
<script type="text/javascript" src="static/plugins/layer/layer.js"></script>
|
|
<script type="text/javascript" src="static/plugins/spinjs/spin.js"></script>
|
<script type="text/javascript" src="static/plugins/spinjs/jquery.spin.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery.blockUI.js"></script>
|
|
<script type="text/javascript" src="static/wcp/scripts/wcp.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.layer.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.blockUI.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.spin.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.jquery.js"></script>
|
|
<!--[if lt IE 9]>
|
<script type="text/javascript" src="static/plugins/json2.js"></script>
|
<![endif]-->
|
|
<style>
|
html, body {
|
height: 100%;
|
width: 100%;
|
overflow: hidden;
|
}
|
</style>
|
</head>
|
<div>
|
<div class="pt-main-top clear">
|
<div class="pt-nav">
|
<span class="pt-title-icon"> <i class="fa fa-user-circle"></i>
|
</span>
|
<div class="pt-title">
|
<div>
|
<h4>用户管理</h4>
|
</div>
|
</div>
|
</div>
|
<div class="pt-search">
|
<p class="pt-retrieval">
|
<input id="txtKeySearch" type="text" placeholder="请输入用户名或真实姓名进行搜索">
|
<button id="btnKeySearch">
|
<i class="fa fa-search"></i>
|
</button>
|
</p>
|
<shiro:hasPermission name="SYS_MANAGE.ORGANIZATION.USER.OPERATION.ADD">
|
<button id="btnAdd" class="pt-btn pt-btn-primary">
|
<i class="fa fa-plus"></i> 新增
|
</button>
|
</shiro:hasPermission>
|
<shiro:hasPermission name="SYS_MANAGE.ORGANIZATION.USER.OPERATION.SAVE">
|
<button id="initPassword" class="pt-btn pt-btn-success">
|
<i class="fa fa-pencil-square-o"></i> 初始化密码
|
</button>
|
</shiro:hasPermission>
|
<shiro:hasPermission name="SYS_MANAGE.ORGANIZATION.USER.OPERATION.DELETE">
|
<button id="btnDelete" class="pt-btn pt-btn-danger">
|
<i class="fa fa-trash-o"></i> 删除
|
</button>
|
</shiro:hasPermission>
|
</div>
|
</div>
|
<div class="pt-left-menu pt-tree" style="padding:0px 10px;">
|
<div class="easyui-panel">
|
<ul id="ul_dept"></ul>
|
</div>
|
</div>
|
<div class="pt-right-main">
|
<div id="right">
|
<div>
|
<table id="dg_user" style="width:100%;">
|
</table>
|
</div>
|
</div>
|
</div>
|
</div>
|
</body>
|
<script type="text/javascript" src="static/scripts/ResizeScroll.js"></script>
|
<script>
|
//定义页面全局变量
|
var NowSelectedDeptId = null;
|
|
$(function () {
|
//初始化部门树
|
$("#ul_dept").tree({
|
method: "get",
|
url: "management/dept/listDeptByTree",
|
animate: true,
|
onBeforeLoad: function (node, param) {
|
new ResizeScroll({
|
"id": "#ul_dept",
|
fun: function () {
|
|
var wh = $(window).height();
|
//$("#ul_dept").height(wh-79-39);
|
return (wh - 79 - 20);
|
}
|
});
|
|
wcp.ui.setBusy("#ul_dept");
|
},
|
onLoadSuccess: function (node, data) {
|
wcp.ui.clearBusy("#ul_dept");
|
new ResizeScroll({
|
"id": "#ul_dept",
|
"fun": function () {
|
|
var wh = $(window).height();
|
//$("#ul_dept").height(wh-79-39);
|
return (wh - 79 - 20);
|
|
}
|
});
|
},
|
onLoadError: function (args) {
|
wcp.ui.clearBusy("#ul_dept");
|
},
|
onClick: function (node) {
|
NowSelectedDeptId = node.id;
|
$('#dg_user').datagrid('load', {
|
deptId: NowSelectedDeptId
|
});
|
}
|
})
|
|
var wh = $(window).height();
|
var dgHeight = wh - 98;
|
//初始化表格
|
$('#dg_user').datagrid({
|
url: 'management/user/getUserList',
|
fitColumns: true,
|
striped: true,
|
idField: "userId",
|
rownumbers: true,
|
pagination: true,
|
checkOnSelect: false,
|
selectOnCheck: false,
|
singleSelect: true,
|
sortName: "sort_num",
|
sortOrder: "asc",
|
height: dgHeight,
|
pageSize: 50,
|
columns: [[
|
{
|
field: 'ck',
|
checkbox: true
|
},
|
{
|
field: 'userName',
|
title: '用户名',
|
width: 100,
|
sortable: true
|
},
|
{
|
field: 'trueName',
|
title: '真实姓名',
|
width: 100,
|
sortable: true
|
},
|
{
|
field: 'employeeNum',
|
title: '工号',
|
width: 100
|
},
|
{
|
field: 'deptName',
|
title: '所属部门',
|
width: 100
|
},
|
{
|
field: 'mobilePhone',
|
title: '手机号码',
|
width: 100
|
},
|
{
|
field: 'enableLogin',
|
title: '是否允许登录',
|
width: 100,
|
align: 'center',
|
formatter: function (value, row, index) {
|
return value == 1 ? "是" : "否";
|
}
|
},
|
{
|
field: 'securityLevel',
|
title: '密级',
|
width: 100,
|
align: 'center',
|
formatter: function (value, row, index) {
|
// if(value == 0){
|
// return '公开'
|
// }else if(value == 1){
|
// return '内部'
|
// }else if(value == 2){
|
// return '秘密'
|
// }else if(value == 3){
|
// return '机密'
|
// }else if(value == 4){
|
// return '绝密'
|
// }
|
if (value == 2) {
|
return '一般';
|
} else if (value == 3) {
|
return '重要';
|
}
|
}
|
},
|
{
|
field: 'createTime',
|
title: '创建时间',
|
width: 120,
|
align: 'center',
|
sortable: true
|
},
|
{
|
field: 'userId',
|
title: '操作',
|
width: 100,
|
align: 'center',
|
formatter: function (value, row, index) {
|
var ret = "";
|
<shiro:hasPermission name="SYS_MANAGE.ORGANIZATION.USER.OPERATION.SAVE">
|
ret += "<a onclick=\"editUser('" + value + "');\" class='pt-color-success'><i class='fa fa-pencil' title='编辑'></i></a>";
|
</shiro:hasPermission>
|
<shiro:hasPermission name="SYS_MANAGE.ORGANIZATION.USER.OPERATION.DELETE">
|
ret += "<a onclick=\"deleteUser('" + value + "');\" class='pt-color-danger'><i class='fa fa-trash-o' title='删除'></i></a>";
|
</shiro:hasPermission>
|
<shiro:hasPermission name="SYS_MANAGE.ORGANIZATION.USER.OPERATION.LOGINPOWERSET">
|
var iconCls = "fa-toggle-on";
|
var colorCls = "pt-color-success";
|
var title = "允许用户登录";
|
if (row.enableLogin == 1) {
|
iconCls = "fa-toggle-off";
|
colorCls = "pt-color-danger";
|
title = "不允许用户登录";
|
}
|
ret += "<a onclick=\"changeLoginPower('" + value + "');\" class='" + colorCls + "'><i class='fa " + iconCls + "' title='" + title + "'></i></a>";
|
</shiro:hasPermission>
|
return ret;
|
}
|
}
|
]]
|
});
|
|
new ResizeScroll({
|
"id": ".right",
|
"fun": function () {
|
var wh = $(window).height();
|
//$(".pt-form").height(wh-79-48);
|
return (wh - 81 - 20);
|
}
|
});
|
|
//绑定按钮事件
|
//新增按钮事件
|
$("#btnAdd").click(function () {
|
editUser(0, NowSelectedDeptId);
|
});
|
|
//删除按钮事件
|
$("#btnDelete").click(function () {
|
//获取dg选中的数据行
|
var checkRows = $("#dg_user").datagrid("getChecked");
|
if (checkRows.length == 0) {
|
wcp.message.info("请选择需要删除的用户!");
|
} else {
|
var ids = new Array();
|
$.each(checkRows, function (index, value) {
|
ids.push(value.userId);
|
});
|
|
deleteUsers(ids);
|
}
|
});
|
|
//初始化密码事件
|
$("#initPassword").click(function () {
|
//获取dg选中的数据行
|
var checkRows = $("#dg_user").datagrid("getChecked");
|
if (checkRows.length == 0) {
|
wcp.message.info("请选择需要初始化的用户!");
|
} else {
|
var ids = new Array();
|
$.each(checkRows, function (index, value) {
|
ids.push(value.userId);
|
});
|
|
initPassword(ids);
|
}
|
});
|
|
|
//绑定关键字检索输入框回车事件
|
$("#btnKeySearch").click(function () {
|
SearchKey();
|
});
|
|
//关键字检索按钮事件
|
$('#txtKeySearch').bind('keypress', function (event) {
|
if (event.keyCode == "13") {
|
SearchKey();
|
}
|
});
|
})
|
|
//关键字搜索方法
|
function SearchKey() {
|
var keyValue = $("#txtKeySearch").val();
|
$('#dg_user').datagrid('load', {
|
deptId: NowSelectedDeptId,
|
searchText: keyValue
|
});
|
}
|
|
//用户信息编辑方法
|
function editUser(userId, deptId) {
|
if (!deptId) {
|
deptId = 0;
|
}
|
var url = "management/user/editUser?userId=" + userId + "&deptId=" + deptId;
|
var title = userId == 0 ? "新增用户" : "编辑用户";
|
|
//openUrlByTab(url, title, null, "yes")
|
top.layer.open({
|
title: title,
|
type: 2,
|
area: ["850px", "680px"],
|
fixed: false,
|
content: url,
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
|
//将回调函数传给子页面
|
iframeWin.params.callBack = refreshData;
|
}
|
});
|
}
|
|
function changeLoginPower(userId) {
|
layer.confirm("确定要修改用户的登录权限吗?", {
|
icon: 3,
|
title: '提示'
|
}, function (index) {
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: "management/user/changeLoginPower?userId=" + userId
|
}).done(function (result) {
|
wcp.notify.success('用户登录权限修改成功!');
|
|
//刷新数据
|
refreshData();
|
}));
|
|
layer.close(index);
|
});
|
}
|
|
//刷新表格数据
|
function refreshData() {
|
$('#dg_user').datagrid('reload');
|
|
//清除已经选择的数据
|
$('#dg_user').datagrid('clearSelections');
|
$('#dg_user').datagrid('clearChecked');
|
}
|
|
//删除单个用户事件
|
function deleteUser(userId) {
|
deleteUsers([userId]);
|
}
|
|
//删除多个用户事件
|
function deleteUsers(userIds) {
|
layer.confirm("确定要删除选择的用户吗?", {
|
icon: 3,
|
title: '提示'
|
}, function (index) {
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: "management/user/deleteUser",
|
data: JSON.stringify(userIds),
|
}).done(function (result) {
|
wcp.notify.success('删除成功!');
|
//刷新数据
|
refreshData();
|
}));
|
|
layer.close(index);
|
});
|
}
|
|
//通过Tab页签打开窗口//scrolling 扩展,是否显示滚动条 ,yes no
|
function openUrlByTab(pageUrl, title, ids, scrolling) {
|
if (top.addPanel) {
|
top.addPanel(pageUrl, title, scrolling);
|
var curTabWin = null;
|
var curTab = top.$('#tt').tabs('getSelected');
|
if (curTab && curTab.find('iframe').length > 0) {
|
curTabWin = curTab.find('iframe')[0].contentWindow;
|
//将回调函数传给子页面
|
$(curTabWin).load(function () {
|
if (curTabWin.params) {
|
//将回调函数传给子页面
|
if (ids) {
|
curTabWin.params.ids = ids;
|
}
|
|
curTabWin.params.parent = window;
|
curTabWin.params.callBack = refreshData;
|
}
|
});
|
}
|
} else {
|
openUrlByWindow(pageUrl);
|
}
|
}
|
|
function initPassword(userIds) {
|
layer.prompt({
|
formType: 1,
|
value: '',
|
title: '请输入初始密码'
|
}, function (value, index, elem) {
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: "management/user/initPassword?value=" + value,
|
data: JSON.stringify(userIds),
|
}).done(function (result) {
|
top.wcp.notify.success("保存成功!");
|
refreshData();
|
layer.close(index);
|
}));
|
});
|
}
|
</script>
|
</html>
|