2025-11-27 16:55:35 +08:00
|
|
|
|
var example = null;
|
|
|
|
|
|
var pers = null;
|
|
|
|
|
|
var proId = localStorage.getItem("proId");
|
|
|
|
|
|
var einStatus = localStorage.getItem("einStatus");
|
|
|
|
|
|
var isEinPush = localStorage.getItem("isEinPush");
|
|
|
|
|
|
layui.use(['layer', 'laydate', 'form'], function () {
|
|
|
|
|
|
var layer = layui.layer;
|
|
|
|
|
|
var laydate = layui.laydate;
|
|
|
|
|
|
var form = layui.form;
|
|
|
|
|
|
pers = checkPermission();
|
|
|
|
|
|
|
|
|
|
|
|
$("#searchBt").click(function () {
|
|
|
|
|
|
example.ajax.reload();
|
|
|
|
|
|
});
|
|
|
|
|
|
if (isEinPush === '1') {
|
|
|
|
|
|
$("#isEinPush").style = "display:none"
|
|
|
|
|
|
}
|
|
|
|
|
|
// $("#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);
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
getSubPro(form, proId);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 推送引入标段工程概念,需要重新查工程
|
|
|
|
|
|
* @param form
|
|
|
|
|
|
* @param orgId
|
|
|
|
|
|
*/
|
|
|
|
|
|
function getSubPro(form,proId) {
|
|
|
|
|
|
$("#proId").html("");
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'post',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/infoPushs/getSubPro',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data: {
|
|
|
|
|
|
proId: proId
|
|
|
|
|
|
},
|
|
|
|
|
|
async: false,
|
|
|
|
|
|
dataType:"json",
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
|
|
|
html += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
|
|
|
|
|
|
}
|
|
|
|
|
|
$("#proId").html(html);
|
|
|
|
|
|
form.render('select');
|
|
|
|
|
|
init();
|
|
|
|
|
|
},
|
|
|
|
|
|
error: function (err) {
|
|
|
|
|
|
console.log("获取工程下拉列表出错:", err);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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 + "/infoPushs/selectWorkerOnJob",
|
2025-11-27 16:55:35 +08:00
|
|
|
|
"type": "post",
|
|
|
|
|
|
"data": function (d) {
|
|
|
|
|
|
// d.orgId = $("#orgId").val();
|
|
|
|
|
|
d.proId = $("#proId").val();
|
|
|
|
|
|
d.einStatus = einStatus;
|
|
|
|
|
|
if (isEinPush === '1') {
|
|
|
|
|
|
d.isEinPush = isEinPush;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
d.isEinPush = $("#isEinPush").val();
|
|
|
|
|
|
}
|
|
|
|
|
|
d.isExitPush = $("#isExitPush").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 isEinPush = row['isEinPush'];
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
if (isEinPush == '0') {
|
|
|
|
|
|
html += '<span style="color:#f7a00a;">未推送</span>';
|
|
|
|
|
|
} else if (isEinPush == '1') {
|
|
|
|
|
|
html += '<span style="color:green">已推送</span>';
|
|
|
|
|
|
} else if (isEinPush == '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 isExitPush = row['isExitPush'];
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
if (isExitPush == '0') {
|
|
|
|
|
|
html += '<span style="color:#f7a00a;">未推送</span>';
|
|
|
|
|
|
} else if (isExitPush == '1') {
|
|
|
|
|
|
html += '<span style="color:green">已推送</span>';
|
|
|
|
|
|
} else if (isExitPush == '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 isIntact = row['isIntact'];
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
if (isIntact == '0') {
|
|
|
|
|
|
html += '<span style="color:#f7a00a;">不完整</span>';
|
|
|
|
|
|
} else if (isIntact == '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 isEinPush = row['isEinPush'];
|
|
|
|
|
|
var isExitPush = row['isExitPush'];
|
|
|
|
|
|
var idNumber = row['idNumber'];
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
let proId = $("#proId").val();;
|
|
|
|
|
|
if (isEinPush == '1') {
|
|
|
|
|
|
html += buttonExitPush(idNumber, proId, isExitPush, "sys:infoPush:out", pers); // 出场推送
|
|
|
|
|
|
} else {
|
|
|
|
|
|
html += buttonEinPush(idNumber, proId, isEinPush, "sys:infoPush:in", pers);//入场推送
|
|
|
|
|
|
}
|
|
|
|
|
|
// html += buttonConPush(idNumber,proId,"", pers); // 合同推送
|
|
|
|
|
|
return html;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
|
|
|
|
|
"order": [[0, "desc"], [1, "asc"]] //在栏目列上显示排序功能
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 单个信息推送
|
|
|
|
|
|
* */
|
|
|
|
|
|
function oneEinPush(idNumber, proId, isEinPush) {
|
|
|
|
|
|
if (isEinPush !== '1') {
|
|
|
|
|
|
$.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();
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
layer.msg("已经推送成功,不能重复推送");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function oneExitPush(idNumber, proId, isExitPush) {
|
|
|
|
|
|
if (isExitPush !== '1') {
|
|
|
|
|
|
$.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();
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
layer.msg("已经推送成功,不能重复推送");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 入场推送
|
|
|
|
|
|
function buttonEinPush(idNumber, proId, isEinPush, permission, pers) {
|
|
|
|
|
|
if (permission != "") {
|
|
|
|
|
|
if ($.inArray(permission, pers) < 0) {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var btn = $("<button class='layui-btn layui-btn-xs' title='入场推送' onclick='oneEinPush(\"" + idNumber + "\",\"" + proId + "\",\"" + isEinPush + "\")'>入场推送</button>");
|
|
|
|
|
|
return btn.prop("outerHTML");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 出场推送
|
|
|
|
|
|
function buttonExitPush(idNumber, proId, isExitPush, permission, pers) {
|
|
|
|
|
|
if (permission != "") {
|
|
|
|
|
|
if ($.inArray(permission, pers) < 0) {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var btn = $("<button class='layui-btn layui-btn-xs' title='出场推送' onclick='oneExitPush(\"" + idNumber + "\",\"" + proId + "\",\"" + isExitPush + "\")'>出场推送</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'); //这里就是我们要渲染的地方了
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|