2025-11-27 16:55:35 +08:00
|
|
|
|
var example = null;
|
|
|
|
|
|
var pers = null;
|
|
|
|
|
|
$(function () {
|
|
|
|
|
|
layui.use(['layer', 'laydate', 'form'], function () {
|
|
|
|
|
|
var layer = layui.layer;
|
|
|
|
|
|
var laydate = layui.laydate;
|
|
|
|
|
|
var form = layui.form;
|
|
|
|
|
|
getOrg(form);
|
|
|
|
|
|
var orgId = $("#orgId").val();
|
|
|
|
|
|
getPro(form, orgId);
|
|
|
|
|
|
form.on('select(orgId)', function (data) {
|
|
|
|
|
|
getPro(form, data.value);
|
|
|
|
|
|
});
|
|
|
|
|
|
pers = checkPermission();
|
|
|
|
|
|
init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#searchBt").click(function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
example.ajax.reload();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$("#checkall").change(function () {
|
|
|
|
|
|
if ($(this).is(':checked')) {
|
|
|
|
|
|
$('input[name="checked"]').each(function () {
|
|
|
|
|
|
$(this).prop("checked", true);
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$('input[name="checked"]').each(function () {
|
|
|
|
|
|
$(this).prop("checked", false);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
function init() {
|
|
|
|
|
|
example =
|
|
|
|
|
|
$('#dt-table').DataTable({
|
|
|
|
|
|
"sort": false,
|
|
|
|
|
|
"searching": false,
|
|
|
|
|
|
"processing": true, //加载数据时显示进度状态
|
|
|
|
|
|
"serverSide": true,
|
|
|
|
|
|
"language": {
|
2025-12-09 18:44:29 +08:00
|
|
|
|
"url": "../../../js/plugin/datatables/Chinese.lang"
|
2025-11-27 16:55:35 +08:00
|
|
|
|
},
|
|
|
|
|
|
"ajax": {
|
2025-12-09 18:44:29 +08:00
|
|
|
|
"url": smz_ht_url + "/personInfoPush",
|
2025-11-27 16:55:35 +08:00
|
|
|
|
"type": "get",
|
|
|
|
|
|
"data": function (d) {
|
|
|
|
|
|
d.orgId = $("#orgId").val();
|
|
|
|
|
|
d.proId = $("#proId").val();
|
|
|
|
|
|
d.keyWord = $("#keyWord").val();
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
"error": function (xhr, textStatus, errorThrown) {
|
|
|
|
|
|
var msg = xhr.responseText;
|
|
|
|
|
|
var response = JSON.parse(msg);
|
|
|
|
|
|
var code = response.code;
|
|
|
|
|
|
var message = response.message;
|
|
|
|
|
|
if (code == 400) {
|
|
|
|
|
|
layer.msg(message);
|
|
|
|
|
|
} else if (code == 401) {
|
|
|
|
|
|
localStorage.removeItem("token");
|
|
|
|
|
|
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function () {
|
2025-12-09 18:44:29 +08:00
|
|
|
|
location.href = smz_ht_url + '/login.html';
|
2025-11-27 16:55:35 +08:00
|
|
|
|
});
|
|
|
|
|
|
} else if (code == 403) {
|
|
|
|
|
|
console.log("未授权:" + message);
|
|
|
|
|
|
layer.msg('未授权');
|
|
|
|
|
|
} else if (code == 500) {
|
|
|
|
|
|
console.log('系统错误:' + message);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"drawCallback": function() {
|
|
|
|
|
|
var thisDataTable = $('#dt-table').DataTable();
|
|
|
|
|
|
$(".pagination").append("<li>" +
|
|
|
|
|
|
"<a class='paginate_button' style='padding:4px;' href='#' tabindex='0'>到 <input style='margin:0px;width:40px;' id='changePage'> 页</a>" +
|
|
|
|
|
|
"<a class='paginate_button' style='margin-bottom:1px' href='#' tabindex='0' id='dataTable-btn'>确认</a></li>");
|
|
|
|
|
|
//点击按钮跳转指定页数
|
|
|
|
|
|
$('#dataTable-btn').click(function (e) {
|
|
|
|
|
|
if ($("#changePage").val() && $("#changePage").val() > 0) {
|
|
|
|
|
|
var redirectpage = $("#changePage").val() - 1;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
var redirectpage = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
thisDataTable.page(redirectpage).draw( 'page' );
|
|
|
|
|
|
});
|
|
|
|
|
|
//敲击回车键跳转指定页数
|
|
|
|
|
|
$("#changePage").keypress(function (e) {
|
|
|
|
|
|
if(event.keyCode==13){
|
|
|
|
|
|
if ($("#changePage").val() && $("#changePage").val() > 0) {
|
|
|
|
|
|
var redirectpage = $("#changePage").val() - 1;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
var redirectpage = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
thisDataTable.page(redirectpage).draw( 'page' );
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
"dom": "<'dt-toolbar'r>t<'dt-toolbar-footer'<'col-sm-4 col-xs-4 hidden-xs'i><'col-xs-8 col-sm-8' p v>>",
|
|
|
|
|
|
"columns": [
|
|
|
|
|
|
{
|
|
|
|
|
|
"width":"3%",
|
|
|
|
|
|
"data": null,
|
|
|
|
|
|
"bSortable": false,
|
|
|
|
|
|
render: function (data, type, full, meta) {
|
|
|
|
|
|
var node = '';
|
|
|
|
|
|
var checkedStatus = data['checkedStatus'];
|
|
|
|
|
|
node = '<input class="checkall" name="checked" value=\"' + full.idNumber + ',' + full.proId + '\" type="checkbox"/>';
|
|
|
|
|
|
if (checkedStatus == 1) {
|
|
|
|
|
|
node = '<input class="checkall" name="checked" checked="checked" value=\"' + full.idNumber + ',' + full.proId + '\" type="checkbox"/>';
|
|
|
|
|
|
}
|
|
|
|
|
|
return node;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
width: '3%',
|
|
|
|
|
|
data: function (row, type, set, meta) {
|
|
|
|
|
|
var c = meta.settings._iDisplayStart + meta.row + 1;
|
|
|
|
|
|
return c;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{"data": "name",width: '6%'},
|
|
|
|
|
|
{"data": "idNumber",width: '8%'},
|
|
|
|
|
|
{"data": "proName",width: '10%'},
|
|
|
|
|
|
{"data": "einTime",width: '8%'},
|
|
|
|
|
|
{"data": "exitTime",width: '8%'},
|
|
|
|
|
|
{
|
|
|
|
|
|
"data": "",
|
|
|
|
|
|
"defaultContent": "",width: '5%',
|
|
|
|
|
|
"orderable": false,
|
|
|
|
|
|
"render": function (data, type, row) {
|
|
|
|
|
|
var exitPush = row['einPush'];
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
if (exitPush == '0') {
|
|
|
|
|
|
html += '<span style="color:#f7a00a;">未推送</span>';
|
|
|
|
|
|
} else if (exitPush == '1') {
|
|
|
|
|
|
html += '<span style="color:green">已推送</span>';
|
|
|
|
|
|
} else if (exitPush == '2') {
|
|
|
|
|
|
html += '<span style="color:red">推送失败</span>';
|
|
|
|
|
|
}else{
|
|
|
|
|
|
html += '<span style="color:red"></span>';
|
|
|
|
|
|
}
|
|
|
|
|
|
return html;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{"data": "einPushTime",width: '8%'},
|
|
|
|
|
|
{
|
|
|
|
|
|
"data": "",
|
|
|
|
|
|
"defaultContent": "",width: '5%',
|
|
|
|
|
|
"orderable": false,
|
|
|
|
|
|
"render": function (data, type, row) {
|
|
|
|
|
|
var exitPush = row['exitPush'];
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
if (exitPush == '0') {
|
|
|
|
|
|
html += '<span style="color:#f7a00a;">未推送</span>';
|
|
|
|
|
|
} else if (exitPush == '1') {
|
|
|
|
|
|
html += '<span style="color:green">已推送</span>';
|
|
|
|
|
|
} else if (exitPush == '2') {
|
|
|
|
|
|
html += '<span style="color:red">推送失败</span>';
|
|
|
|
|
|
}else{
|
|
|
|
|
|
html += '<span style="color:red"></span>';
|
|
|
|
|
|
}
|
|
|
|
|
|
return html;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{"data": "exitPushTime",width: '8%'},
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
"data": "",
|
|
|
|
|
|
"defaultContent": "",width: '5%',
|
|
|
|
|
|
"orderable": false,
|
|
|
|
|
|
"render": function (data, type, row) {
|
|
|
|
|
|
var conStatus = row['conStatus'];
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
if (conStatus == '0') {
|
|
|
|
|
|
html += '<span style="color:#f7a00a;">未签署</span>';
|
|
|
|
|
|
} else if (conStatus == '1') {
|
|
|
|
|
|
html += '<span style="color:green">已签署</span>';
|
|
|
|
|
|
}else{
|
|
|
|
|
|
html += '<span style="color:red"></span>';
|
|
|
|
|
|
}
|
|
|
|
|
|
return html;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"data": "",
|
|
|
|
|
|
"defaultContent": "",width: '5%',
|
|
|
|
|
|
"orderable": false,
|
|
|
|
|
|
"render": function (data, type, row) {
|
|
|
|
|
|
var exitPush = row['conPush'];
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
if (exitPush == '0') {
|
|
|
|
|
|
html += '<span style="color:#f7a00a;">未推送</span>';
|
|
|
|
|
|
} else if (exitPush == '1') {
|
|
|
|
|
|
html += '<span style="color:green">已推送</span>';
|
|
|
|
|
|
} else if (exitPush == '2') {
|
|
|
|
|
|
html += '<span style="color:red">推送失败</span>';
|
|
|
|
|
|
}else{
|
|
|
|
|
|
html += '<span style="color:red"></span>';
|
|
|
|
|
|
}
|
|
|
|
|
|
return html;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{"data": "conPushTime",width: '8%'},
|
|
|
|
|
|
{
|
|
|
|
|
|
"data": "",
|
|
|
|
|
|
"defaultContent": "",width: '5%',
|
|
|
|
|
|
"orderable": false,
|
|
|
|
|
|
"render": function (data, type, row) {
|
|
|
|
|
|
var proId = row['proId'];
|
|
|
|
|
|
var idNumber = row['idNumber'];
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
html += buttonEinPush(idNumber,proId,"sys:infoPush:in", pers);//入场推送
|
|
|
|
|
|
html += buttonExitPush(idNumber,proId,"sys:infoPush:out", pers); // 出场推送
|
|
|
|
|
|
html += buttonConPush(idNumber,proId,"sys:infoPush:contract", pers); // 合同推送
|
|
|
|
|
|
return html;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
"order": [[0, "desc"], [1, "asc"]] //在栏目列上显示排序功能
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 单个信息推送
|
|
|
|
|
|
* */
|
|
|
|
|
|
function oneEinPush(idNumber,proId) {
|
|
|
|
|
|
// alert(idNumber+",proId:"+proId)
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'post',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/personPush/selectWorkerByOnJob',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data: {
|
|
|
|
|
|
idCard:idNumber,
|
|
|
|
|
|
projectId:proId
|
|
|
|
|
|
},
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
alert(data.obj);
|
|
|
|
|
|
example.ajax.reload();
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
function oneExitPush(idNumber,proId) {
|
|
|
|
|
|
// alert(idNumber+",proId:"+proId)
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'post',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/personPush/selectWorkerByNoJob',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data: {
|
|
|
|
|
|
idCard:idNumber,
|
|
|
|
|
|
projectId:proId
|
|
|
|
|
|
},
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
alert(data.obj);
|
|
|
|
|
|
example.ajax.reload();
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
function oneConPush(idNumber,proId) {
|
|
|
|
|
|
//alert("暂未开放!!")
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'post',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/personPush/selectContractPushList',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data: {
|
|
|
|
|
|
idCard:idNumber,
|
|
|
|
|
|
projectId:proId
|
|
|
|
|
|
},
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
alert(data.obj);
|
|
|
|
|
|
example.ajax.reload();
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 入场推送
|
|
|
|
|
|
function buttonEinPush(idNumber,proId, permission, pers) {
|
|
|
|
|
|
if (permission != "") {
|
|
|
|
|
|
if ($.inArray(permission, pers) < 0) {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var btn = $("<button class='layui-btn layui-btn-xs' title='入场推送' onclick='oneEinPush(\"" + idNumber + "\",\"" + proId + "\")'>入场推送</button>");
|
|
|
|
|
|
return btn.prop("outerHTML");
|
|
|
|
|
|
}
|
|
|
|
|
|
// 出场推送
|
|
|
|
|
|
function buttonExitPush(idNumber,proId, permission, pers) {
|
|
|
|
|
|
if (permission != "") {
|
|
|
|
|
|
if ($.inArray(permission, pers) < 0) {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var btn = $("<button class='layui-btn layui-btn-xs' title='出场推送' onclick='oneExitPush(\"" + idNumber + "\",\"" + proId + "\")'>出场推送</button>");
|
|
|
|
|
|
return btn.prop("outerHTML");
|
|
|
|
|
|
}
|
|
|
|
|
|
// 合同推送
|
|
|
|
|
|
function buttonConPush(idNumber,proId, permission, pers) {
|
|
|
|
|
|
if (permission != "") {
|
|
|
|
|
|
if ($.inArray(permission, pers) < 0) {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var btn = $("<button class='layui-btn layui-btn-xs' title='合同推送' onclick='oneConPush(\"" + idNumber + "\",\"" + proId + "\")'>合同推送</button>");
|
|
|
|
|
|
return btn.prop("outerHTML");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 批量推送
|
|
|
|
|
|
function pushAll() {
|
|
|
|
|
|
var idNumber = [];
|
|
|
|
|
|
var proId = [];
|
|
|
|
|
|
var oTable = $('#dt-table').dataTable();
|
|
|
|
|
|
var rowcollection = oTable.$(".checkall:checked", {"page": "all"});
|
|
|
|
|
|
rowcollection.each(function (index, elem) {
|
|
|
|
|
|
var checkbox_value = $(elem).val();
|
|
|
|
|
|
var strArr = checkbox_value.split(",");
|
|
|
|
|
|
idNumber.push(strArr[0]);
|
|
|
|
|
|
proId.push(strArr[1]);
|
|
|
|
|
|
});
|
|
|
|
|
|
if (idNumber.length == 0) {
|
|
|
|
|
|
return layer.msg("请勾选要批量推送的数据", {icon: 2, time: 2000});
|
|
|
|
|
|
}else{
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'post',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/attendancePush/',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
traditional:true,
|
|
|
|
|
|
data: {
|
|
|
|
|
|
idNumberList:idNumber,
|
|
|
|
|
|
currentDayList:proId
|
|
|
|
|
|
},
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获得当前时间 yyyy-MM-dd
|
|
|
|
|
|
* @returns {string}
|
|
|
|
|
|
*/
|
|
|
|
|
|
function getNowTime() {
|
|
|
|
|
|
var time = new Date();
|
|
|
|
|
|
var year = time.getFullYear();
|
|
|
|
|
|
var month = time.getMonth() + 1 >= 10 ? time.getMonth() + 1 : '0' + (time.getMonth() + 1);
|
|
|
|
|
|
var day = time.getDate() >= 10 ? time.getDate() : '0' + time.getDate();
|
|
|
|
|
|
return year + "-" + month + "-" + day;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取当月第一天
|
|
|
|
|
|
* @returns {string}
|
|
|
|
|
|
*/
|
|
|
|
|
|
function getCurrentMonthFirst() {
|
|
|
|
|
|
var date = new Date();
|
|
|
|
|
|
date.setDate(1);
|
|
|
|
|
|
var year = date.getFullYear();
|
|
|
|
|
|
var month = date.getMonth() + 1 > 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1);
|
|
|
|
|
|
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
|
|
|
|
|
return year + "-" + month + "-" + day;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取分公司
|
|
|
|
|
|
* */
|
|
|
|
|
|
function getCompanys(orgId) {
|
|
|
|
|
|
$("#orgId").empty();
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'POST',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/WorkRecord/getCompanys',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data: {},
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
if(data.length>0){
|
|
|
|
|
|
var str = '<option selected value="">请选择分公司</option>';
|
|
|
|
|
|
for(var i = 0; i < data.length; i++) {
|
|
|
|
|
|
if(orgId == data[i].id) {
|
|
|
|
|
|
str += '<option selected value=\'' + data[i].id + '\'>' + data[i].name + '</option>';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
str += '<option value=\'' + data[i].id + '\'>' + data[i].name + '</option>';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$("#orgId").append(str);
|
|
|
|
|
|
layui.form.render('select'); //这里就是我们要渲染的地方了
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取工程
|
|
|
|
|
|
* */
|
|
|
|
|
|
function getProject(orgId) {
|
|
|
|
|
|
$("#proId").empty();
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'POST',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/WorkRecord/getProject',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data: {
|
|
|
|
|
|
"comId":orgId,
|
|
|
|
|
|
},
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
if(data.length>0){
|
|
|
|
|
|
var str = '<option selected value="">请选择工程</option>';
|
|
|
|
|
|
for(var i = 0; i < data.length; i++) {
|
|
|
|
|
|
str += '<option value=\'' + data[i].id + '\'>' + data[i].name + '</option>';
|
|
|
|
|
|
}
|
|
|
|
|
|
$("#proId").append(str);
|
|
|
|
|
|
layui.form.render('select'); //这里就是我们要渲染的地方了
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|