|
@@ -10,6 +10,7 @@
|
|
|
<script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
|
|
<script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
|
|
|
<script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
|
|
<script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
|
|
|
<script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
|
|
<script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
|
|
|
|
|
+<script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
|
|
|
<script type="text/javascript" src="/shares/js/constant.js"></script>
|
|
<script type="text/javascript" src="/shares/js/constant.js"></script>
|
|
|
<script type="text/javascript" src="/shares/js/common.js"></script>
|
|
<script type="text/javascript" src="/shares/js/common.js"></script>
|
|
|
<script type="text/javascript" src="/shares/datePicker/WdatePicker.js"></script>
|
|
<script type="text/javascript" src="/shares/datePicker/WdatePicker.js"></script>
|
|
@@ -107,6 +108,138 @@
|
|
|
$("#task").val("exportExcel");
|
|
$("#task").val("exportExcel");
|
|
|
$("#report").submit();
|
|
$("#report").submit();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ //同步海康考勤数据
|
|
|
|
|
+ function syncHikVisionAttendance() {
|
|
|
|
|
+ // 创建弹窗HTML
|
|
|
|
|
+ var dialogHtml = '<div style="padding:20px;">' +
|
|
|
|
|
+ '<div style="margin-bottom:15px;">' +
|
|
|
|
|
+ '<label style="display:inline-block;width:80px;">开始日期:</label>' +
|
|
|
|
|
+ '<input type="text" id="syncStartDate" class="Wdate" style="width:150px;" />' +
|
|
|
|
|
+ '</div>' +
|
|
|
|
|
+ '<div style="margin-bottom:15px;">' +
|
|
|
|
|
+ '<label style="display:inline-block;width:80px;">结束日期:</label>' +
|
|
|
|
|
+ '<input type="text" id="syncEndDate" class="Wdate" style="width:150px;" />' +
|
|
|
|
|
+ '</div>' +
|
|
|
|
|
+ '<div style="color:#999;font-size:12px;margin-top:10px;">提示:请选择要同步的日期范围</div>' +
|
|
|
|
|
+ '</div>';
|
|
|
|
|
+
|
|
|
|
|
+ // 使用ligerDialog创建弹窗
|
|
|
|
|
+ if (typeof $.ligerDialog !== 'undefined') {
|
|
|
|
|
+ var dialog = $.ligerDialog.open({
|
|
|
|
|
+ target: null,
|
|
|
|
|
+ title: '同步海康考勤数据',
|
|
|
|
|
+ width: 400,
|
|
|
|
|
+ height: 220,
|
|
|
|
|
+ modal: true,
|
|
|
|
|
+ content: dialogHtml,
|
|
|
|
|
+ buttons: [
|
|
|
|
|
+ {
|
|
|
|
|
+ text: '确定同步',
|
|
|
|
|
+ onclick: function(item, dialog) {
|
|
|
|
|
+ var startDate = $('#syncStartDate').val();
|
|
|
|
|
+ var endDate = $('#syncEndDate').val();
|
|
|
|
|
+
|
|
|
|
|
+ if (!startDate || !endDate) {
|
|
|
|
|
+ $.ligerDialog.warn('请选择开始日期和结束日期!');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 关闭对话框
|
|
|
|
|
+ dialog.hide();
|
|
|
|
|
+
|
|
|
|
|
+ // 显示加载提示
|
|
|
|
|
+ var loadingDialog = $.ligerDialog.waitting('正在同步海康考勤数据,请稍候...');
|
|
|
|
|
+
|
|
|
|
|
+ // 执行同步
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ url: 'hrAttendanceRecordAction.do',
|
|
|
|
|
+ type: 'POST',
|
|
|
|
|
+ data: {
|
|
|
|
|
+ task: 'syncHikVisionAttendance',
|
|
|
|
|
+ att_date_start: startDate,
|
|
|
|
|
+ att_date_end: endDate
|
|
|
|
|
+ },
|
|
|
|
|
+ success: function(response) {
|
|
|
|
|
+ // 关闭加载提示
|
|
|
|
|
+ $.ligerDialog.closeWaitting();
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ var result = eval('(' + response + ')');
|
|
|
|
|
+ if (result.success) {
|
|
|
|
|
+ $.ligerDialog.success("同步成功!共同步 " + result.count + " 条记录。", function() {
|
|
|
|
|
+ // 刷新表格
|
|
|
|
|
+ searchByKword();
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $.ligerDialog.error("同步失败:" + result.message);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch(e) {
|
|
|
|
|
+ $.ligerDialog.error("同步失败:" + response);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function(xhr, status, error) {
|
|
|
|
|
+ // 关闭加载提示
|
|
|
|
|
+ $.ligerDialog.closeWaitting();
|
|
|
|
|
+ $.ligerDialog.error("同步请求失败:" + error);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ text: '取消',
|
|
|
|
|
+ onclick: function(item, dialog) {
|
|
|
|
|
+ dialog.hide();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 在弹窗打开后初始化日期选择器
|
|
|
|
|
+ setTimeout(function() {
|
|
|
|
|
+ $('#syncStartDate').unbind('click').click(function() {
|
|
|
|
|
+ WdatePicker({dateFmt:'yyyy-MM-dd', maxDate:'#F{$dp.$D(\'syncEndDate\',{d:0})}'});
|
|
|
|
|
+ });
|
|
|
|
|
+ $('#syncEndDate').unbind('click').click(function() {
|
|
|
|
|
+ WdatePicker({dateFmt:'yyyy-MM-dd', minDate:'#F{$dp.$D(\'syncStartDate\',{d:0})}'});
|
|
|
|
|
+ });
|
|
|
|
|
+ }, 100);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果ligerDialog不可用,使用原生prompt
|
|
|
|
|
+ var startDate = prompt('请输入开始日期(格式:yyyy-MM-dd):');
|
|
|
|
|
+ if (!startDate) return;
|
|
|
|
|
+ var endDate = prompt('请输入结束日期(格式:yyyy-MM-dd):');
|
|
|
|
|
+ if (!endDate) return;
|
|
|
|
|
+
|
|
|
|
|
+ if (confirm("确定要同步海康考勤数据吗?\n日期范围:" + startDate + " 至 " + endDate)) {
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ url: 'hrAttendanceRecordAction.do',
|
|
|
|
|
+ type: 'POST',
|
|
|
|
|
+ data: {
|
|
|
|
|
+ task: 'syncHikVisionAttendance',
|
|
|
|
|
+ att_date_start: startDate,
|
|
|
|
|
+ att_date_end: endDate
|
|
|
|
|
+ },
|
|
|
|
|
+ success: function(response) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ var result = eval('(' + response + ')');
|
|
|
|
|
+ if (result.success) {
|
|
|
|
|
+ alert("同步成功!共同步 " + result.count + " 条记录。");
|
|
|
|
|
+ searchByKword();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ alert("同步失败:" + result.message);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch(e) {
|
|
|
|
|
+ alert("同步失败:" + response);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function(xhr, status, error) {
|
|
|
|
|
+ alert("同步请求失败:" + error);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
</script>
|
|
</script>
|
|
|
</head>
|
|
</head>
|
|
|
<body>
|
|
<body>
|
|
@@ -137,6 +270,9 @@
|
|
|
<ul>
|
|
<ul>
|
|
|
<li class="search-button"><input type="button" class='l-button' name="search" onclick="exportExcel()" value="导出" /></li>
|
|
<li class="search-button"><input type="button" class='l-button' name="search" onclick="exportExcel()" value="导出" /></li>
|
|
|
</ul>
|
|
</ul>
|
|
|
|
|
+ <ul>
|
|
|
|
|
+ <li class="search-button"><input type="button" class='l-button' name="syncHik" onclick="syncHikVisionAttendance()" value="同步海康考勤" style="width:120px;" /></li>
|
|
|
|
|
+ </ul>
|
|
|
</div>
|
|
</div>
|
|
|
<div style="clear: both;"></div>
|
|
<div style="clear: both;"></div>
|
|
|
<div id="searchbar">
|
|
<div id="searchbar">
|