Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/user/showTotalTimeList.jsp

536 lines
23 KiB
Plaintext
Raw Permalink Normal View History

2026-01-16 14:13:44 +08:00
<%@ 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>
<!-- 引入daterangepicker-->
<link rel="stylesheet"
href="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.css"/>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/moment.min.js"
charset="utf-8"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.js"
charset="utf-8"></script>
<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 viewFun = function (userId) {
$.post(ext.contextPath + '/user/showTotalTimeView.do', {userId, curDateStart, curDateEnd}, 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 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 curDateStart = "";
var curDateEnd = "";
function timeControl() {
//区间时间插件
$("#timeScope").daterangepicker(
{
// timePicker: true, //显示时间
// timePicker24Hour: true, //时间制
// timePickerSeconds: true, //时间显示到秒
autoUpdateInput: false,
opens: 'right',
linkedCalendars: false,
//startDate:moment().startOf('month'),
//endDate:moment().endOf('month'),
//startDate : '',
//endDate : '',
/* ranges : {
'今天' : [ moment(), moment() ],
'昨天' : [ moment().subtract(1, 'days'),
moment().subtract(1, 'days') ],
'近7天' : [ moment().subtract(7, 'days'), moment() ],
'这个月' : [ moment().startOf('month'),
moment().endOf('month') ],
'上个月' : [
moment().subtract(1, 'month').startOf('month'),
moment().subtract(1, 'month').endOf('month') ],
}, */
locale: {
format: "YYYY-MM-DD HH:mm:ss",
separator: " - ",
applyLabel: "确认",
cancelLabel: "清空",
fromLabel: "开始时间",
toLabel: "结束时间",
customRangeLabel: "自定义",
daysOfWeek: ["日", "一", "二", "三", "四", "五", "六"],
monthNames: ["一月", "二月", "三月", "四月", "五月", "六月",
"七月", "八月", "九月", "十月", "十一月", "十二月"]
},
}).on('cancel.daterangepicker', function (ev, picker) {
$("#timeScope").val("请选择日期范围");
curDateStart = "";
curDateEnd = ""
//refreshPageData();
//$("#startTime").val("");
// $("#endTime").val("");
}).on(
'apply.daterangepicker',
function (ev, picker) {
// $("#startTime").val(picker.startDate.format('YYYY-MM-DD'));
// $("#endTime").val(picker.endDate.format('YYYY-MM-DD'));
$("#timeScope").val(
picker.startDate.format('YYYY-MM-DD HH:mm:ss')
+ "~"
+ picker.endDate
.format('YYYY-MM-DD HH:mm:ss'));
curDateStart = picker.startDate
.format('YYYY-MM-DD HH:mm:ss');
curDateEnd = picker.endDate.format('YYYY-MM-DD HH:mm:ss');
//refreshPageData();
});
}
var initFun = function () {
$("#tables").bootstrapTable('destroy'); //加载前先销毁
$table = $("#table").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/user/getUsers.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
sortable: true,
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 20, // 页面数据条数
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(),
curDateStart: curDateStart,
curDateEnd: curDateEnd,
search_pid: unitId,
timeScope: $('#timeScope').val(),
active: $('#active').val()
}
},
sortName: 'totaltime', // 要排序的字段
sortOrder: 'desc', // 排序规则
onClickRow: function (row) {//单击行事件,执行查看功能
viewFun(row.id);
},
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',
sortable: true, //所在列是否排序
formatter: function (value, row, index) {
return value.substring(0, 19);
}
}, {
field: 'totaltime', // 返回json数据中的name
title: '在线时长', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
sortable: true, //所在列是否排序
formatter: function (value, row, index) {
return value.toFixed(2);
}
}, {
field: 'lastlogintime', // 返回json数据中的name
title: '上次登录时间', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
sortable: true, //所在列是否排序
formatter: function (value, row, index) {
return value.substring(0, 19);
}
}, {
field: 'lastloginduration', // 返回json数据中的name
title: '上次登录时长', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
// sortable: true, //所在列是否排序
formatter: function (value, row, index) {
return value.toFixed(2);
}
}, {
field: 'source', // 返回json数据中的name
title: '上次登录方式', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
},
{
field: 'weekloginduration', // 返回json数据中的name
title: '最近一周登录时长', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
sortable: true, //所在列是否排序
formatter: function (value, row, index) {
return value.toFixed(2);
}
},
{
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>" + ", ";
res += value[i].name + ", ";
}
return res.replace(/, $/g, "");
}
}, {
field: 'active', // 返回json数据中的name
title: '状态', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
switch (value) {
case '0':
return '禁用';
case '1':
return '启用';
case '2':
return '退休';
case '3':
return '离职';
default:
return '';
}
}
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("table");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
};
var $table;
var companyId;
var dosearch = function () {
$("#table").bootstrapTable('refresh');
};
$(function () {
initFun();
timeControl();
$('#removea').click(function () {
$('#search_name').val("");
})
$("#active").select2({
placeholder: '请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
});
//巡检模式触发方法
$("#active").on("change", function (e) {
$("#table").bootstrapTable('refresh');
});
});
</script>
</head>
<body class="hold-transition ${cu.themeclass} sidebar-mini">
<div class="wrapper">
<div class="content-wrapper">
<!-- Main content -->
<section class="content container-fluid" style="padding-top: 0px;">
<div id="mainAlertdiv"></div>
<div id="subDiv"></div>
<div id="unit4SelectDiv"></div>
<div>
<!-- <div id="companySelectTree"></div> -->
<div class="form-group">
<div class="form-group pull-right form-inline ">
<div class="input-group input-group-sm" style="width: 120px;">
<select class="form-control select2 " id="active" name="active" style="width: 120px;">
<option value="1" selected>启用</option>
<option value="0">禁用</option>
</select>
</div>
</div>
<div class="form-group pull-right form-inline ">
<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="$table.bootstrapTable('refresh');"><i
class="fa fa-search"></i></button>
</div>
</div>
</div>
<div class="form-group pull-right form-inline ">
<div class="input-group input-group-sm" style="width: 260px;">
<input type="text" id="timeScope" name="timeScope"
class="form-control pull-left" placeholder="请选择时间">
<div class="input-group-btn">
<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>
</div>
</body>
</html>