Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/user/userList.jsp
2026-01-16 14:13:44 +08:00

595 lines
27 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page import="com.sipai.entity.base.ServerObject" %>
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
<!DOCTYPE html>
<!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD -->
<head>
<!-- <style type="text/css">
.input { padding: 5px; margin: 0; border: 1px solid #beceeb; }
.clear { display: none;
position: absolute;
width: 16px;
height: 16px;
margin: 6px 0 0 -20px;
background: url(../IMG/remove-icon-small.png);}
.input::-ms-clear { display: none; }
.input:valid + .clear { display: inline; }
</style> -->
<title>
<%= ServerObject.atttable.get("TOPTITLE")%>
</title>
<!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<script type="text/javascript">
var addFun = function () {
$.post(ext.contextPath + '/user/addUser.do', {companyId: companyId}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var editFun = function (id) {
$.post(ext.contextPath + '/user/editUser.do', {id: id}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var deleteFun = function (id) {
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/work/group/delete.do', {id: id}, function (data) {
if (data == 1) {
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
});
}
});
};
var deletesFun = function () {
var checkedItems = $("#table").bootstrapTable('getSelections');
var datas = "";
$.each(checkedItems, function (index, item) {
datas += item.id + ",";
});
if (datas == "") {
showAlert('d', '请先选择记录', 'mainAlertdiv');
} else {
swal({
text: "您确定要禁用这些用户吗?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/user/deleteUsers.do', {ids: datas}, function (data) {
if (data > 0) {
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '禁用失败', 'mainAlertdiv');
}
});
}
});
}
};
//重置密码
var pwdFun = function (id) {
swal({
text: "您确定要重置密码吗?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/user/resetPassword.do', {id: id}, function (data) {
if (data == 1) {
showAlert('s', '重置成功', 'mainAlertdiv');
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '重置失败', 'mainAlertdiv');
}
});
}
});
};
var unlockFun = function (id) {
swal({
text: "您确定要解除锁定吗?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/user/unlockFun.do', {id: id}, function (data) {
if (data == 1) {
showAlert('s', '解锁成功', 'mainAlertdiv');
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '解锁失败', 'mainAlertdiv');
}
});
}
});
};
var syncFun = function () {
var checkedItems = $("#table").bootstrapTable('getSelections');
var datas = "";
$.each(checkedItems, function (index, item) {
datas += item.id + ",";
});
if (datas == "") {
showAlert('d', '请先选择记录', 'mainAlertdiv');
} else {
swal({
text: "您确定要同步所选用户至数据中心?同步前请确认已配置用户所在单位的基本数据权限!",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/user/syncUsers.do', {ids: datas}, function (data) {
if (data > 0) {
showAlert('s', '同步成功', 'mainAlertdiv');
} else {
showAlert('d', '部分用户同步失败', 'mainAlertdiv');
}
});
}
});
}
};
//人员定位
var locationFun = function (id){
stopBubbleDefaultEvent();
$.post(ext.contextPath + '/cmd/cmdController/locationUser.do', {id: id}, function (data) {
alert('已发送定位指令');
});
}
var initFun = function () {
$table = $("#table").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/user/getUsers.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 50, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
search_name: $('#search_name').val(),
search_pid: companyId,
pid: $('#listpid').val(),
lock: $('#lock').val(),
active: $('#listactive').val()
}
},
// sortName: 'id', // 要排序的字段
// sortOrder: 'desc', // 排序规则
columns: [
{
checkbox: true, // 显示一个勾选框
}, {
field: 'name', // 返回json数据中的name
title: '登录名', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'caption', // 返回json数据中的name
title: '姓名', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: '_pname', // 返回json数据中的name
title: '公司/部门', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'sex', // 返回json数据中的name
title: '性别', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
if (value == '0') {
return '女';
} else {
return '男';
}
}
}, {
field: 'insdt', // 返回json数据中的name
title: '注册时间', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return value.substring(0, 19);
}
}, {
field: 'totaltime', // 返回json数据中的name
title: '在线时长', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return value.toFixed(2);
}
}, {
field: 'lastlogintime', // 返回json数据中的name
title: '上次登录时间', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return value.substring(0, 19);
}
}, {
field: 'roles', // 返回json数据中的name
title: '角色权限', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
var res = "";
for (var i = 0; i < value.length; i++) {
res += "<a class='linkbutton' href='javascript:void(0)' onclick='showMenu(\"" + value[i].id + "\",\"" + value[i].name + "\")'>" + value[i].name + "</a>" + ", ";
}
return res.replace(/, $/g, "");
}
}, {
field: 'cardid', // 返回json数据中的name
title: '人员定位卡号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
}, {
field: 'active', // 返回json数据中的name
title: '状态', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
var lock = '';
if (row.locktime != null && row.locktime != '') {
lock = '(<i class="fa fa-lock"></i>)';
}
switch (value) {
case '0':
return '禁用' + lock;
case '1':
return '启用' + lock;
case '2':
return '退休';
case '3':
return '离职';
default:
return '';
}
}
}, {
title: "操作",
align: 'center',
valign: 'middle',
// width: 60, // 定义列的宽度单位为像素px
formatter: function (value, row, index) {
var str = '';
str += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i></button>';
str += '<button class="btn btn-default btn-sm" title="重置密码" onclick="pwdFun(\'' + row.id + '\')"><i class="fa fa-repeat"></i></button>';
if (row.locktime != null && row.locktime != '') {
str += '<button class="btn btn-default btn-sm" title="解除锁定" onclick="unlockFun(\'' + row.id + '\')"><i class="fa fa-unlock"></i></button>';
}
str += '<security:authorize buttonUrl="user/location.do">';
str += '<button class="btn btn-default btn-sm" title="定位" onclick="locationFun(\'' + row.id + '\')"><i class="fa fa-map-marker"></i><span class="hidden-md hidden-lg"> 定位</span></button>';
str += '</security:authorize>';
str = '<div class="btn-group" >' + str + '</div>';
return str;
/* return '<i class="fa fa-edit" onclick="editFun()(\'' + row.id + '\')></i>'; */
}
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("table");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
// 职位下拉
$.post(ext.contextPath + "/user/getUnitJson2.do", {unitId: unitId}, function (data) {
//console.log('data is ', data)
$("#listpid").empty();
var selelct_ = $("#listpid").select2({
data: data,
cache: false,
placeholder: '请选择',//默认文字提示
allowClear: true,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过10个显示搜索框
formatResult: function formatRepo(repo) {
console.log("repo is ", repo)
return repo.text;
}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) {
console.log("repo1 is ", repo)
return repo.text;
} // 函数用于呈现当前的选择
});
selelct_.val('').trigger("change");
selelct_.on("change", function (e) {
dosearch();
});
}, 'json');
};
var $table;
var companyId;
var dosearch = function () {
$("#table").bootstrapTable('refresh');
getLockNum();
};
$(function () {
//init();
//简易公司combotree
/* $.post(ext.contextPath + "/user/showCompanySelectTree.do", {unitId:unitId}, function (data) {
$('#companySelectTree').html(data);
}); */
companyId = unitId;
initFun();
$('#removea').click(function () {
$('#search_name').val("");
})
});
var activeChange = function () {
dosearch();
}
var getLockNum = function () {
$.post(ext.contextPath + '/user/getLockNum.do', {
search_name: $('#search_name').val(),
search_pid: companyId,
pid: $('#listpid').val(),
lock: 1,
active: $('#listactive').val()
}, function (data) {
if (data > 0) {
$("#lockLabel").html("" + data + "位)");
} else {
$("#lockLabel").empty();
}
});
}
var downFun = function() {
searchForm.action = ext.contextPath + '/user/downtemplate.do';
searchForm.submit();
};
var importFun = function() {
$.post(ext.contextPath + '/user/doimport.do', {}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var exportFun = function() {
//通过response导出用户自己选择路径
searchForm.action = ext.contextPath + '/user/exportUsersByResponse.do';
searchForm.submit();
var win = $.messager.progress({
title:'提示',
msg:'文件正在导出,请稍后...'
});
setTimeout(function(){
$.messager.progress('close');
},3000);
};
</script>
</head>
<body class="hold-transition ${cu.themeclass} sidebar-mini">
<div class="wrapper">
<%-- <!-- 引用top --> --%>
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
<!-- 菜单栏 -->
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<!-- Main content -->
<section class="content container-fluid">
<div id="mainAlertdiv"></div>
<div id="subDiv"></div>
<div id="unit4SelectDiv"></div>
<div>
<!-- <div id="companySelectTree"></div> -->
<div class="form-group form-inline">
<div class="btn-group" style="width: 400px;padding-bottom:10px;">
<security:authorize buttonUrl="user/addUser.do">
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i
class="fa fa-plus"></i>
新增
</button>
</security:authorize>
<!-- <button type="button" class="btn btn-default" onclick="editFun();"><i class="fa fa-edit"></i> 编辑</button> -->
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i
class="fa fa-warning"></i>禁用
</button>
<%-- <button type="button" class="btn btn-default btn-sm" onclick='importFun()'><i--%>
<%-- class="fa fa-cloud-upload"></i>--%>
<%-- 导入--%>
<%-- </button>--%>
<%-- <button type="button" class="btn btn-default btn-sm" onclick="exportFun();"><i--%>
<%-- class="fa fa-cloud-download"></i>--%>
<%-- 导出--%>
<%-- </button>--%>
<!--<button type="button" class="btn btn-default" onclick="syncFun();"><i class="fa fa-upload"></i> 同步</button> -->
</div>
<div class="form-group pull-right form-inline ">
<!-- <div class="form-group has-feedback ">
<input type="text" class="form-control " id="search_group" name ="search_group" placeholder="小组" onclick="showUnit4SelectFun();" style="width: 250px;height:30px">
<a class="glyphicon glyphicon-remove form-control-feedback btn-sm" id="removea" style="padding-top:6px;pointer-events: auto"></a>
</input>
</div>
<input id="search_pid" class="form-control" name="search_pid" type="hidden" /> -->
<div class="form-group">
<label class="form-label text-center"
style="padding-left: 10px; padding-top: 7px">锁定情况<span class="text-red"
id="lockLabel"></span></label>
<select class="form-control select2 " id="lock" name="lock" onchange="activeChange()"
style="width: 100px; height: 30px; border-radius: 5px">
<option value="" selected>全部</option>
<option value="0">未锁定</option>
<option value="1">已锁定</option>
</select>
</div>
<div class="form-group">
<label class="form-label text-center"
style="padding-left: 10px; padding-top: 7px">层级部门:</label>
<select class="form-control select2 " id="listpid" name="listpid"
style="width: 160px;">
</select>
</div>
<div class="form-group">
<label class="form-label text-center">状态:</label>
<select class="form-control select2 " onchange="activeChange()" id="listactive" name="listactive"
style="width: 100px; height: 30px; border-radius: 5px">
<option value="0">禁用</option>
<option value="1" selected>启用</option>
</select>
</div>
<div class="input-group input-group-sm" style="width: 250px;">
<input type="text" id="search_name" name="search_name" class="form-control pull-right"
placeholder="姓名">
<a class="glyphicon glyphicon-remove form-control-feedback btn-sm" id="removea"
style="padding-top:6px;pointer-events: auto"></a>
</input>
<div class="input-group-btn">
<button type="button" class="btn btn-default"
onclick="dosearch();"><i
class="fa fa-search"></i></button>
</div>
</div>
</div>
</div>
<table id="table"></table>
</div>
</section>
<!-- /.content -->
</div>
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
</div>
</body>
</html>