2025-11-27 16:55:35 +08:00
|
|
|
|
var example = null;
|
|
|
|
|
|
var pers = null;
|
|
|
|
|
|
var form,layer = null;
|
|
|
|
|
|
|
|
|
|
|
|
function receiveParamsContract(params) {
|
|
|
|
|
|
console.log("通过函数接收到的参数:", params)
|
|
|
|
|
|
let id = params.id;
|
|
|
|
|
|
let proId = params.proId;
|
|
|
|
|
|
$("#id").val(id);
|
|
|
|
|
|
$("#proId").val(proId);
|
|
|
|
|
|
|
|
|
|
|
|
layui.use(['layer', 'form'], function () {
|
|
|
|
|
|
layer = layui.layer;
|
|
|
|
|
|
form = layui.form;
|
|
|
|
|
|
|
|
|
|
|
|
pers = checkPermission();
|
|
|
|
|
|
//工序桩位下拉选
|
|
|
|
|
|
getGxs(proId,form)
|
|
|
|
|
|
//小包干合同详情
|
|
|
|
|
|
getDetailByXbg(id)
|
|
|
|
|
|
|
|
|
|
|
|
//小包干合同详情-工序桩位查询
|
|
|
|
|
|
initPositionTable(id);
|
|
|
|
|
|
|
|
|
|
|
|
//小包干合同详情-人员信息
|
|
|
|
|
|
initStaffTable(id);
|
|
|
|
|
|
|
|
|
|
|
|
//小包干合同详情- 修改记录
|
|
|
|
|
|
initRecordTable(id);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function getDetailByXbg(id) {
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'get',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/dataCount/getDetailByXbg',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data: {
|
|
|
|
|
|
id: id
|
|
|
|
|
|
},
|
|
|
|
|
|
async: false,
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
if(data.res==1 || data.res=="1" ){
|
|
|
|
|
|
let l = data.succeed;
|
|
|
|
|
|
let workerCost = "技工:" + l.technicianWorkload + "普工:" + l.generalWorkerWorkload;
|
|
|
|
|
|
$("#workerCost").text(workerCost);
|
|
|
|
|
|
|
|
|
|
|
|
let num = l.technicianWorkload * l.technicianCost + l.generalWorkerWorkload * l.generalWorkerCost;
|
|
|
|
|
|
let workload = l.technicianWorkload + "*" + l.technicianCost + "+" + l.generalWorkerWorkload + "*" + l.generalWorkerCost +"=" + num;
|
|
|
|
|
|
$("#workload").text(workload);
|
|
|
|
|
|
|
|
|
|
|
|
$("#contractCode").text(l.contractCode);
|
|
|
|
|
|
$("#subName").text(l.subName);
|
|
|
|
|
|
$("#partyUser").text(l.partyUser);
|
|
|
|
|
|
$("#teamName").text(l.teamName);
|
|
|
|
|
|
$("#contractMoney").text(l.contractMoney);
|
|
|
|
|
|
|
|
|
|
|
|
$("#gxNum").text(l.gxNum);
|
|
|
|
|
|
$("#contractDate").text(l.contractDate);
|
|
|
|
|
|
if(l.contractStatus==1){
|
|
|
|
|
|
$("#contractStatus").text("终止");
|
|
|
|
|
|
}else{
|
|
|
|
|
|
$("#contractStatus").text("生效中");
|
|
|
|
|
|
}
|
|
|
|
|
|
$("#attDayNum").text(l.attDayNum);
|
|
|
|
|
|
$("#proName").text(l.proName);
|
|
|
|
|
|
$("#totalNum").text(l.totalNum);
|
|
|
|
|
|
$("#dateRange").text(l.dateRange);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
error: function (err) {
|
|
|
|
|
|
console.log("获取小包干合同详情列表出错:", err);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function downloadContract(){
|
|
|
|
|
|
var contractId = $("#id").val();
|
|
|
|
|
|
var loadingIndex = layer.load(2, {shade: [0.3, '#000']});
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'GET',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/teamSmallBagDryTreaty/downloadContract',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data: {
|
|
|
|
|
|
contractId: contractId,
|
|
|
|
|
|
downloadType: "1"
|
|
|
|
|
|
},
|
|
|
|
|
|
xhrFields: {
|
|
|
|
|
|
responseType: 'blob' // 关键:设置响应类型为blob
|
|
|
|
|
|
},
|
|
|
|
|
|
beforeSend: function(xhr) {
|
2025-12-05 15:39:43 +08:00
|
|
|
|
var token = localStorage.getItem("smz-token");
|
2025-11-27 16:55:35 +08:00
|
|
|
|
if (token) {
|
|
|
|
|
|
xhr.setRequestHeader('Authorization', 'Bearer ' + token);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
success: function(data, textStatus, xhr) {
|
|
|
|
|
|
layer.close(loadingIndex);
|
|
|
|
|
|
|
|
|
|
|
|
// 获取文件名
|
|
|
|
|
|
var contentDisposition = xhr.getResponseHeader('Content-Disposition');
|
|
|
|
|
|
var filename = 'contract.pdf';
|
|
|
|
|
|
|
|
|
|
|
|
if (contentDisposition) {
|
|
|
|
|
|
var filenameMatch = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
|
|
|
|
|
|
if (filenameMatch && filenameMatch[1]) {
|
|
|
|
|
|
filename = filenameMatch[1].replace(/['"]/g, '');
|
|
|
|
|
|
try {
|
|
|
|
|
|
filename = decodeURIComponent(filename);
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
// 解码失败使用原文件名
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 创建下载链接
|
|
|
|
|
|
var url = window.URL.createObjectURL(data);
|
|
|
|
|
|
var a = document.createElement('a');
|
|
|
|
|
|
a.href = url;
|
|
|
|
|
|
a.download = filename;
|
|
|
|
|
|
document.body.appendChild(a);
|
|
|
|
|
|
a.click();
|
|
|
|
|
|
|
|
|
|
|
|
window.URL.revokeObjectURL(url);
|
|
|
|
|
|
document.body.removeChild(a);
|
|
|
|
|
|
|
|
|
|
|
|
layer.msg('下载成功');
|
|
|
|
|
|
},
|
|
|
|
|
|
error: function(xhr, textStatus, errorThrown) {
|
|
|
|
|
|
layer.close(loadingIndex);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var recordData = [
|
|
|
|
|
|
{
|
|
|
|
|
|
"changeType": "作业范围",
|
|
|
|
|
|
"beforeContent": "xxxxxxxxxxxxxxx",
|
|
|
|
|
|
"afterContent": "xxxxxxxxxxxxxxx",
|
|
|
|
|
|
"operator": "孙亮",
|
|
|
|
|
|
"operateTime": "2025-05-06 10:20",
|
|
|
|
|
|
"id": "1"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"changeType": "作业期限",
|
|
|
|
|
|
"beforeContent": "计划开始备定作业日期:2025年06月10日\n计划结束备定作业日期:2026年06月10日",
|
|
|
|
|
|
"afterContent": "计划开始备定作业日期:2025年06月12日\n计划结束备定作业日期:2026年06月11日",
|
|
|
|
|
|
"operator": "孙亮",
|
|
|
|
|
|
"operateTime": "2025-05-05 10:20",
|
|
|
|
|
|
"id": "2"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"changeType": "作业范围",
|
|
|
|
|
|
"beforeContent": "xxxxxxxxxxxxxxx",
|
|
|
|
|
|
"afterContent": "xxxxxxxxxxxxxxx",
|
|
|
|
|
|
"operator": "孙亮",
|
|
|
|
|
|
"operateTime": "2025-05-06 10:20",
|
|
|
|
|
|
"id": "3"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"changeType": "作业期限",
|
|
|
|
|
|
"beforeContent": "计划开始备定作业日期:2025年06月10日\n计划结束备定作业日期:2026年06月10日",
|
|
|
|
|
|
"afterContent": "计划开始备定作业日期:2025年06月12日\n计划结束备定作业日期:2026年06月11日",
|
|
|
|
|
|
"operator": "孙亮",
|
|
|
|
|
|
"operateTime": "2025-05-05 10:20",
|
|
|
|
|
|
"id": "4"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"changeType": "作业范围",
|
|
|
|
|
|
"beforeContent": "xxxxxxxxxxxxxxx",
|
|
|
|
|
|
"afterContent": "xxxxxxxxxxxxxxx",
|
|
|
|
|
|
"operator": "孙亮",
|
|
|
|
|
|
"operateTime": "2025-05-06 10:20",
|
|
|
|
|
|
"id": "5"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"changeType": "作业期限",
|
|
|
|
|
|
"beforeContent": "计划开始备定作业日期:2025年06月10日\n计划结束备定作业日期:2026年06月10日",
|
|
|
|
|
|
"afterContent": "计划开始备定作业日期:2025年06月12日\n计划结束备定作业日期:2026年06月11日",
|
|
|
|
|
|
"operator": "孙亮",
|
|
|
|
|
|
"operateTime": "2025-05-05 10:20",
|
|
|
|
|
|
"id": "6"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"changeType": "作业范围",
|
|
|
|
|
|
"beforeContent": "xxxxxxxxxxxxxxx",
|
|
|
|
|
|
"afterContent": "xxxxxxxxxxxxxxx",
|
|
|
|
|
|
"operator": "孙亮",
|
|
|
|
|
|
"operateTime": "2025-05-06 10:20",
|
|
|
|
|
|
"id": "7"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"changeType": "作业期限",
|
|
|
|
|
|
"beforeContent": "计划开始备定作业日期:2025年06月10日\n计划结束备定作业日期:2026年06月10日",
|
|
|
|
|
|
"afterContent": "计划开始备定作业日期:2025年06月12日\n计划结束备定作业日期:2026年06月11日",
|
|
|
|
|
|
"operator": "孙亮",
|
|
|
|
|
|
"operateTime": "2025-05-05 10:20",
|
|
|
|
|
|
"id": "8"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"changeType": "作业范围",
|
|
|
|
|
|
"beforeContent": "xxxxxxxxxxxxxxx",
|
|
|
|
|
|
"afterContent": "xxxxxxxxxxxxxxx",
|
|
|
|
|
|
"operator": "孙亮",
|
|
|
|
|
|
"operateTime": "2025-05-06 10:20",
|
|
|
|
|
|
"id": "9"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"changeType": "作业期限",
|
|
|
|
|
|
"beforeContent": "计划开始备定作业日期:2025年06月10日\n计划结束备定作业日期:2026年06月10日",
|
|
|
|
|
|
"afterContent": "计划开始备定作业日期:2025年06月12日\n计划结束备定作业日期:2026年06月11日",
|
|
|
|
|
|
"operator": "孙亮",
|
|
|
|
|
|
"operateTime": "2025-05-05 10:20",
|
|
|
|
|
|
"id": "10"
|
|
|
|
|
|
}
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
var positionTable, staffTable, recordTable;
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化岗位信息表格
|
|
|
|
|
|
function initPositionTable(id) {
|
|
|
|
|
|
positionTable = $('#position-table').DataTable({
|
|
|
|
|
|
"searching": false,
|
|
|
|
|
|
"processing": true,
|
|
|
|
|
|
"serverSide": true,
|
|
|
|
|
|
"pagingType": "full_numbers",
|
|
|
|
|
|
"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 + "/dataCount/getDetailGxListByXbg",
|
2025-11-27 16:55:35 +08:00
|
|
|
|
"type": "POST",
|
|
|
|
|
|
"data": function (d) {
|
|
|
|
|
|
d.id = id;
|
|
|
|
|
|
d.gxId = $("#gxId").val();
|
|
|
|
|
|
},
|
|
|
|
|
|
"error": function (xhr, textStatus, errorThrown) {
|
|
|
|
|
|
var msg = xhr.responseText;
|
|
|
|
|
|
console.log(msg);
|
|
|
|
|
|
var response = JSON.parse(msg);
|
|
|
|
|
|
var code = response.code;
|
|
|
|
|
|
var message = response.message;
|
|
|
|
|
|
if (code == 400) {
|
|
|
|
|
|
layer.msg(message);
|
|
|
|
|
|
} else if (code == 401) {
|
2025-12-15 18:16:05 +08:00
|
|
|
|
localStorage.removeItem("public_token");
|
|
|
|
|
|
localStorage.removeItem("smz_token");
|
2025-11-27 16:55:35 +08:00
|
|
|
|
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function () {
|
2025-12-15 18:16:05 +08:00
|
|
|
|
top.location.href= contentPath + '/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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"lengthMenu": [[10, 20, 50], [10, 20, 50]],
|
|
|
|
|
|
"drawCallback": function() {
|
|
|
|
|
|
var thisDataTable = $('#position-table').DataTable();
|
|
|
|
|
|
$("#position-table_wrapper .pagination").append("<li>" +
|
|
|
|
|
|
"<a class='paginate_button' style='padding:4px;' href='#' tabindex='0'>到 <input style='margin:0px;width:40px;' id='changePagePosition'> 页</a>" +
|
|
|
|
|
|
"<a class='paginate_button' style='margin-bottom:1px' href='#' tabindex='0' id='dataTable-btn-position'>确认</a></li>");
|
|
|
|
|
|
$('#dataTable-btn-position').click(function (e) {
|
|
|
|
|
|
if ($("#changePagePosition").val() && $("#changePagePosition").val() > 0) {
|
|
|
|
|
|
var redirectpage = $("#changePagePosition").val() - 1;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
var redirectpage = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
thisDataTable.page(redirectpage).draw('page');
|
|
|
|
|
|
});
|
|
|
|
|
|
$("#changePagePosition").keypress(function (e) {
|
|
|
|
|
|
if(event.keyCode==13){
|
|
|
|
|
|
if ($("#changePagePosition").val() && $("#changePagePosition").val() > 0) {
|
|
|
|
|
|
var redirectpage = $("#changePagePosition").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>><'dt-table-length'>",
|
|
|
|
|
|
"columns": [
|
|
|
|
|
|
{
|
|
|
|
|
|
width: '40px',
|
|
|
|
|
|
"orderable": false,
|
|
|
|
|
|
data: function (row, type, set, meta) {
|
|
|
|
|
|
var c = meta.settings._iDisplayStart + meta.row + 1;
|
|
|
|
|
|
return c;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{"data": "gxName", "orderable": false, 'width': '120px'},
|
|
|
|
|
|
{"data": "gxZw", "orderable": false, 'width': '80px'},
|
|
|
|
|
|
{"data": "attPersonNum", "orderable": false, 'width': '80px'},
|
|
|
|
|
|
{"data": "attDayNum", "orderable": false, 'width': '80px'},
|
|
|
|
|
|
{"data": "attUserName", "orderable": false, 'width': '150px'},
|
|
|
|
|
|
{
|
|
|
|
|
|
"data": "",
|
|
|
|
|
|
'width': '80px',
|
|
|
|
|
|
"defaultContent": "",
|
|
|
|
|
|
"orderable": false,
|
|
|
|
|
|
"render": function (data, type, row) {
|
|
|
|
|
|
var id = row['gxId'];
|
|
|
|
|
|
var html = '<button class="layui-btn layui-btn-xs" style="background-color: transparent; color: #002CFF;" onclick="gxView(' + id + ')">详情</button>';
|
|
|
|
|
|
return html
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
"order": []
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 小包干工序桩位详情
|
|
|
|
|
|
* */
|
|
|
|
|
|
function gxView(id) {
|
|
|
|
|
|
var height = '85%';
|
|
|
|
|
|
var width = '91%';
|
|
|
|
|
|
var index = parent.layer.open({
|
|
|
|
|
|
title: ['小包干工序桩位详情','color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
|
|
|
|
|
type: 2,
|
|
|
|
|
|
content: 'gxStatView.html',
|
|
|
|
|
|
area: [width, height],
|
|
|
|
|
|
maxmin: false,
|
|
|
|
|
|
btn: ['关闭'],
|
|
|
|
|
|
success: function (layero, index) {
|
|
|
|
|
|
// 延迟执行,确保 iframe 完全加载
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
var iframe = layero.find("iframe")[0]
|
|
|
|
|
|
if (iframe && iframe.contentWindow && iframe.contentWindow.receiveParamsGx) {
|
|
|
|
|
|
iframe.contentWindow.receiveParamsGx({
|
|
|
|
|
|
id: id,
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 100)
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化人员信息表格
|
|
|
|
|
|
function initStaffTable(id) {
|
|
|
|
|
|
staffTable = $('#staff-table').DataTable({
|
|
|
|
|
|
"searching": false,
|
|
|
|
|
|
"processing": true,
|
|
|
|
|
|
"serverSide": true,
|
|
|
|
|
|
"pagingType": "full_numbers",
|
|
|
|
|
|
"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 + "/dataCount/getDetailPersonListByXbg",
|
2025-11-27 16:55:35 +08:00
|
|
|
|
"type": "POST",
|
|
|
|
|
|
"data": function (d) {
|
|
|
|
|
|
d.id = id;
|
|
|
|
|
|
d.userName = $("#userName").val();
|
|
|
|
|
|
d.entryAndExitStatus = $("#entryAndExitStatus").val();
|
|
|
|
|
|
},
|
|
|
|
|
|
"error": function (xhr, textStatus, errorThrown) {
|
|
|
|
|
|
var msg = xhr.responseText;
|
|
|
|
|
|
console.log(msg);
|
|
|
|
|
|
var response = JSON.parse(msg);
|
|
|
|
|
|
var code = response.code;
|
|
|
|
|
|
var message = response.message;
|
|
|
|
|
|
if (code == 400) {
|
|
|
|
|
|
layer.msg(message);
|
|
|
|
|
|
} else if (code == 401) {
|
2025-12-15 18:16:05 +08:00
|
|
|
|
localStorage.removeItem("public_token");
|
|
|
|
|
|
localStorage.removeItem("smz_token");
|
2025-11-27 16:55:35 +08:00
|
|
|
|
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function () {
|
2025-12-15 18:16:05 +08:00
|
|
|
|
top.location.href= contentPath + '/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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"lengthMenu": [[10, 20, 50], [10, 20, 50]],
|
|
|
|
|
|
"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>><'dt-table-length'>",
|
|
|
|
|
|
"drawCallback": function() {
|
|
|
|
|
|
var thisDataTable = $('#staff-table').DataTable();
|
|
|
|
|
|
$("#staff-table_wrapper .pagination").append("<li>" +
|
|
|
|
|
|
"<a class='paginate_button' style='padding:4px;' href='#' tabindex='0'>到 <input style='margin:0px;width:40px;' id='changePageStaff'> 页</a>" +
|
|
|
|
|
|
"<a class='paginate_button' style='margin-bottom:1px' href='#' tabindex='0' id='dataTable-btn-staff'>确认</a></li>");
|
|
|
|
|
|
$('#dataTable-btn-staff').click(function (e) {
|
|
|
|
|
|
if ($("#changePageStaff").val() && $("#changePageStaff").val() > 0) {
|
|
|
|
|
|
var redirectpage = $("#changePageStaff").val() - 1;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
var redirectpage = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
thisDataTable.page(redirectpage).draw('page');
|
|
|
|
|
|
});
|
|
|
|
|
|
$("#changePageStaff").keypress(function (e) {
|
|
|
|
|
|
if(event.keyCode==13){
|
|
|
|
|
|
if ($("#changePageStaff").val() && $("#changePageStaff").val() > 0) {
|
|
|
|
|
|
var redirectpage = $("#changePageStaff").val() - 1;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
var redirectpage = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
thisDataTable.page(redirectpage).draw('page');
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
"columns": [
|
|
|
|
|
|
{
|
|
|
|
|
|
"width": '40px',
|
|
|
|
|
|
"orderable": false,
|
|
|
|
|
|
data: function (row, type, set, meta) {
|
|
|
|
|
|
var c = meta.settings._iDisplayStart + meta.row + 1;
|
|
|
|
|
|
return c;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{"data": "userName", "orderable": false, 'width': '80px'},
|
|
|
|
|
|
{"data": "phone", "orderable": false, 'width': '120px'},
|
|
|
|
|
|
{"data": "postName", "orderable": false, 'width': '120px'},
|
|
|
|
|
|
{"data": "attDayNum", "orderable": false, 'width': '80px'},
|
|
|
|
|
|
{"data": "gxNum", "orderable": false, 'width': '80px'},
|
|
|
|
|
|
{"data": "entryAndExitStatus", "orderable": false, 'width': '80px'},
|
|
|
|
|
|
{
|
|
|
|
|
|
"data": "",
|
|
|
|
|
|
'width': '80px',
|
|
|
|
|
|
"defaultContent": "",
|
|
|
|
|
|
"orderable": false,
|
|
|
|
|
|
"render": function (data, type, row) {
|
|
|
|
|
|
// var idCard = row['idCard'];
|
|
|
|
|
|
// var html = '<button class="layui-btn layui-btn-xs" style="background-color: transparent; color: #002CFF;" onclick="personnelView(' + idCard + ')">详情</button>';
|
|
|
|
|
|
var html = "<button class='layui-btn layui-btn-xs' style='background-color: transparent; color: #002CFF;' onclick='personnelView("+JSON.stringify(row)+")'>详情</button>";
|
|
|
|
|
|
return html
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
"order": []
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 小包干人员详情
|
|
|
|
|
|
* */
|
|
|
|
|
|
function personnelView(item) {
|
|
|
|
|
|
let idCard = item.idCard
|
|
|
|
|
|
var height = '85%';
|
|
|
|
|
|
var width = '91%';
|
|
|
|
|
|
var index = parent.layer.open({
|
|
|
|
|
|
title: ['小包干人员详情','color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
|
|
|
|
|
type: 2,
|
|
|
|
|
|
content: 'personnelStatView.html',
|
|
|
|
|
|
area: [width, height],
|
|
|
|
|
|
maxmin: false,
|
|
|
|
|
|
btn: ['关闭'],
|
|
|
|
|
|
success: function (layero, index) {
|
|
|
|
|
|
// 延迟执行,确保 iframe 完全加载
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
var iframe = layero.find("iframe")[0]
|
|
|
|
|
|
if (iframe && iframe.contentWindow && iframe.contentWindow.receiveParamsPersonnel) {
|
|
|
|
|
|
iframe.contentWindow.receiveParamsPersonnel({
|
|
|
|
|
|
idCard: idCard,
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 100)
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化修改记录表格
|
|
|
|
|
|
function initRecordTable(id) {
|
|
|
|
|
|
recordTable = $('#record-table').DataTable({
|
|
|
|
|
|
"searching": false,
|
|
|
|
|
|
"processing": true,
|
|
|
|
|
|
"serverSide": true,
|
|
|
|
|
|
"pagingType": "full_numbers",
|
|
|
|
|
|
"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 + "/dataCount/getDetailUpdateRecordList",
|
2025-11-27 16:55:35 +08:00
|
|
|
|
"type": "POST",
|
|
|
|
|
|
"data": function (d) {
|
|
|
|
|
|
d.id = id;
|
|
|
|
|
|
d.operType = $("#operType").val();
|
|
|
|
|
|
},
|
|
|
|
|
|
"error": function (xhr, textStatus, errorThrown) {
|
|
|
|
|
|
var msg = xhr.responseText;
|
|
|
|
|
|
console.log(msg);
|
|
|
|
|
|
var response = JSON.parse(msg);
|
|
|
|
|
|
var code = response.code;
|
|
|
|
|
|
var message = response.message;
|
|
|
|
|
|
if (code == 400) {
|
|
|
|
|
|
layer.msg(message);
|
|
|
|
|
|
} else if (code == 401) {
|
2025-12-15 18:16:05 +08:00
|
|
|
|
localStorage.removeItem("public_token");
|
|
|
|
|
|
localStorage.removeItem("smz_token");
|
2025-11-27 16:55:35 +08:00
|
|
|
|
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function () {
|
2025-12-15 18:16:05 +08:00
|
|
|
|
top.location.href= contentPath + '/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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"lengthMenu": [[10, 20, 50], [10, 20, 50]],
|
|
|
|
|
|
"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>><'dt-table-length'>",
|
|
|
|
|
|
"drawCallback": function() {
|
|
|
|
|
|
var thisDataTable = $('#record-table').DataTable();
|
|
|
|
|
|
$("#record-table_wrapper .pagination").append("<li>" +
|
|
|
|
|
|
"<a class='paginate_button' style='padding:4px;' href='#' tabindex='0'>到 <input style='margin:0px;width:40px;' id='changePageStaff'> 页</a>" +
|
|
|
|
|
|
"<a class='paginate_button' style='margin-bottom:1px' href='#' tabindex='0' id='dataTable-btn-record'>确认</a></li>");
|
|
|
|
|
|
$('#dataTable-btn-record').click(function (e) {
|
|
|
|
|
|
if ($("#changePageRecord").val() && $("#changePageRecord").val() > 0) {
|
|
|
|
|
|
var redirectpage = $("#changePageRecord").val() - 1;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
var redirectpage = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
thisDataTable.page(redirectpage).draw('page');
|
|
|
|
|
|
});
|
|
|
|
|
|
$("#changePageRecord").keypress(function (e) {
|
|
|
|
|
|
if(event.keyCode==13){
|
|
|
|
|
|
if ($("#changePageRecord").val() && $("#changePageRecord").val() > 0) {
|
|
|
|
|
|
var redirectpage = $("#changePageRecord").val() - 1;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
var redirectpage = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
thisDataTable.page(redirectpage).draw('page');
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
"columns": [
|
|
|
|
|
|
{
|
|
|
|
|
|
width: '40px',
|
|
|
|
|
|
"orderable": false,
|
|
|
|
|
|
data: function (row, type, set, meta) {
|
|
|
|
|
|
var c = meta.settings._iDisplayStart + meta.row + 1;
|
|
|
|
|
|
return c;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{"data": "", "orderable": false, 'width': '100px',
|
|
|
|
|
|
"render": function (data, type, row) {
|
|
|
|
|
|
var types = row['type'];
|
|
|
|
|
|
if (types == 1) {
|
|
|
|
|
|
return "作业范围";
|
|
|
|
|
|
} else if (types == 2) {
|
|
|
|
|
|
return "作业内容";
|
|
|
|
|
|
} else if (types == 3) {
|
|
|
|
|
|
return "作业期限";
|
|
|
|
|
|
} else if (types == 4) {
|
|
|
|
|
|
return "协议价";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{"data": "", "orderable": false, 'width': '200px',
|
|
|
|
|
|
"render": function (data, type, row) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const beforeData = JSON.parse(row.beforeData || '{}');
|
|
|
|
|
|
const t = row.type;
|
|
|
|
|
|
if (t == 2 && beforeData.gxInfo) {
|
|
|
|
|
|
// 作业内容 - 更改前
|
|
|
|
|
|
return beforeData.gxInfo.replace(/\n/g, '<br>');
|
|
|
|
|
|
} else if (t == 3 && isValidTimestamp(beforeData.plan_start_time) && isValidTimestamp(beforeData.plan_end_time)) {
|
|
|
|
|
|
// 作业期限 - 更改前
|
|
|
|
|
|
return `开始时间: ${timestampToDateString(beforeData.plan_start_time)}<br>结束时间: ${timestampToDateString(beforeData.plan_end_time)}`;
|
|
|
|
|
|
} else if (t == 4 && beforeData.contract_money) {
|
|
|
|
|
|
// 协议价 - 更改前
|
|
|
|
|
|
return `小写金额: ${beforeData.contract_money}<br>大写金额: ${beforeData.contract_money_max || ''} `;
|
|
|
|
|
|
} else if (t == 1 && Array.isArray(beforeData.gxList)) {
|
|
|
|
|
|
// // 工序桩位 - 更改前
|
|
|
|
|
|
// let html = '';
|
|
|
|
|
|
// beforeData.gxList.forEach(item => {
|
|
|
|
|
|
// html += `包干工序: ${item.gxName}<br>桩位: ${item.gxZw}<br><br>`;
|
|
|
|
|
|
// });
|
|
|
|
|
|
// return html || '无变更';
|
|
|
|
|
|
// 工序桩位 - 更改前 (按工序分组)
|
|
|
|
|
|
const groupedData = {};
|
|
|
|
|
|
beforeData.gxList.forEach(item => {
|
|
|
|
|
|
if (!groupedData[item.gxName]) {
|
|
|
|
|
|
groupedData[item.gxName] = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
groupedData[item.gxName].push(item.gxZw);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let html = '';
|
|
|
|
|
|
Object.keys(groupedData).forEach(gxName => {
|
|
|
|
|
|
html += `${gxName}:${groupedData[gxName].join(',')}<br>`;
|
|
|
|
|
|
});
|
|
|
|
|
|
return html || '无变更';
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return '暂无数据';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.error("beforeData 解析失败", e);
|
|
|
|
|
|
return '解析失败';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{"data": "", "orderable": false, 'width': '200px',
|
|
|
|
|
|
"render": function (data, type, row) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const afterData = JSON.parse(row.afterData || '{}');
|
|
|
|
|
|
const t = row.type;
|
|
|
|
|
|
if (t == 2 && afterData.gxInfo) {
|
|
|
|
|
|
// 作业内容 - 更改后
|
|
|
|
|
|
return afterData.gxInfo.replace(/\n/g, '<br>');
|
|
|
|
|
|
} else if (t == 3 && afterData.plan_start_time && afterData.plan_end_time) {
|
|
|
|
|
|
// 作业期限 - 更改后
|
|
|
|
|
|
return `开始时间: ${timestampToDateString(afterData.plan_start_time)}<br>结束时间: ${timestampToDateString(afterData.plan_end_time)}`;
|
|
|
|
|
|
} else if (t == 4 && afterData.contract_money) {
|
|
|
|
|
|
// 协议价 - 更改后
|
|
|
|
|
|
return `小写金额: ${afterData.contract_money}<br>大写金额: ${afterData.contract_money_max || ''}`;
|
|
|
|
|
|
} else if (t == 1 && Array.isArray(afterData.gxList)) {
|
|
|
|
|
|
// // 工序桩位 - 更改后
|
|
|
|
|
|
// let html = '';
|
|
|
|
|
|
// afterData.gxList.forEach(item => {html += `包干工序: ${item.gxName}<br>桩位: ${item.gxZw}<br><br>`;});
|
|
|
|
|
|
// return html || '无变更';
|
|
|
|
|
|
// 工序桩位 - 更改后 (按工序分组)
|
|
|
|
|
|
const groupedData = {};
|
|
|
|
|
|
afterData.gxList.forEach(item => {
|
|
|
|
|
|
if (!groupedData[item.gxName]) {
|
|
|
|
|
|
groupedData[item.gxName] = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
groupedData[item.gxName].push(item.gxZw);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let html = '';
|
|
|
|
|
|
Object.keys(groupedData).forEach(gxName => {
|
|
|
|
|
|
html += `${gxName}:${groupedData[gxName].join(',')}<br>`;
|
|
|
|
|
|
});
|
|
|
|
|
|
return html || '无变更';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return '暂无数据';
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.error("afterData 解析失败", e);
|
|
|
|
|
|
return '解析失败';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{"data": "operUser", "orderable": false, 'width': '80px'},
|
|
|
|
|
|
{"data": "operTime", "orderable": false, 'width': '120px'}
|
|
|
|
|
|
],
|
|
|
|
|
|
"order": []
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 判断是否为有效时间戳(数字且大于0)
|
|
|
|
|
|
function isValidTimestamp(ts) {
|
|
|
|
|
|
return typeof ts === 'number' && ts > 0 && !isNaN(ts);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 时间戳转 yyyy-MM-dd 字符串
|
|
|
|
|
|
function timestampToDateString(timestamp) {
|
|
|
|
|
|
const date = new Date(parseInt(timestamp));
|
|
|
|
|
|
const year = date.getFullYear();
|
|
|
|
|
|
const month = ('0' + (date.getMonth() + 1)).slice(-2);
|
|
|
|
|
|
const day = ('0' + date.getDate()).slice(-2);
|
|
|
|
|
|
return `${year}-${month}-${day}`;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 搜索功能
|
|
|
|
|
|
function searchPosition() {
|
|
|
|
|
|
positionTable.ajax.reload();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function resetPosition() {
|
|
|
|
|
|
$('#gxId').val('');
|
|
|
|
|
|
// 重新渲染 select 下拉框
|
|
|
|
|
|
layui.form.render("select");
|
|
|
|
|
|
positionTable.ajax.reload();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function exportPosition() {
|
|
|
|
|
|
var id = $('#id').val();
|
|
|
|
|
|
var gxId = $('#gxId').val();
|
2025-12-05 15:39:43 +08:00
|
|
|
|
var token = localStorage.getItem("smz-token");
|
2025-11-27 16:55:35 +08:00
|
|
|
|
var loadingMsg = layer.msg('下载中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
2025-12-09 18:44:29 +08:00
|
|
|
|
var url = smz_ht_url + "/dataCount/downloadDetailGxListByXbg?id=" + id +"&gxId=" + gxId + "&token=" + token;
|
2025-11-27 16:55:35 +08:00
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
|
xhr.open("get", url, true);
|
|
|
|
|
|
xhr.responseType = "blob"; // 转换流
|
|
|
|
|
|
xhr.onload = function () {
|
|
|
|
|
|
layer.close(loadingMsg);
|
|
|
|
|
|
if (this.status === 200) {
|
|
|
|
|
|
var blob = this.response;
|
|
|
|
|
|
var a = document.createElement("a");
|
|
|
|
|
|
var url = window.URL.createObjectURL(blob);
|
|
|
|
|
|
a.href = url;
|
|
|
|
|
|
a.download = "小包干合同详情-工序桩位导出列表.xlsx"; // 文件名
|
|
|
|
|
|
}else {
|
|
|
|
|
|
layer.msg('发生异常,请稍后重试', {icon: 16, scrollbar: false, time: 2000});
|
|
|
|
|
|
}
|
|
|
|
|
|
a.click()
|
|
|
|
|
|
window.URL.revokeObjectURL(url)
|
|
|
|
|
|
};
|
|
|
|
|
|
xhr.send();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function searchStaff() {
|
|
|
|
|
|
staffTable.ajax.reload();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function resetStaff() {
|
|
|
|
|
|
$('#userName').val('');
|
|
|
|
|
|
$('#entryAndExitStatus').val('');
|
|
|
|
|
|
staffTable.ajax.reload();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function exportStaff() {
|
|
|
|
|
|
var id = $('#id').val();
|
|
|
|
|
|
var entryAndExitStatus = $('#entryAndExitStatus').val();
|
|
|
|
|
|
var userName = $('#userName').val();
|
2025-12-05 15:39:43 +08:00
|
|
|
|
var token = localStorage.getItem("smz-token");
|
2025-11-27 16:55:35 +08:00
|
|
|
|
var loadingMsg = layer.msg('下载中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
2025-12-09 18:44:29 +08:00
|
|
|
|
var url = smz_ht_url + "/dataCount/downloadDetailPersonByXbgExcel?id=" + id +"&entryAndExitStatus=" + entryAndExitStatus +"&userName=" + userName + "&token=" + token;
|
2025-11-27 16:55:35 +08:00
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
|
xhr.open("get", url, true);
|
|
|
|
|
|
xhr.responseType = "blob"; // 转换流
|
|
|
|
|
|
xhr.onload = function () {
|
|
|
|
|
|
layer.close(loadingMsg);
|
|
|
|
|
|
if (this.status === 200) {
|
|
|
|
|
|
var blob = this.response;
|
|
|
|
|
|
var a = document.createElement("a");
|
|
|
|
|
|
var url = window.URL.createObjectURL(blob);
|
|
|
|
|
|
a.href = url;
|
|
|
|
|
|
a.download = "小包干合同详情-人员信息导出.xlsx"; // 文件名
|
|
|
|
|
|
}else {
|
|
|
|
|
|
layer.msg('发生异常,请稍后重试', {icon: 16, scrollbar: false, time: 2000});
|
|
|
|
|
|
}
|
|
|
|
|
|
a.click()
|
|
|
|
|
|
window.URL.revokeObjectURL(url)
|
|
|
|
|
|
};
|
|
|
|
|
|
xhr.send();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function searchRecord() {
|
|
|
|
|
|
recordTable.ajax.reload();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function resetRecord() {
|
|
|
|
|
|
$('#operType').val('');
|
|
|
|
|
|
recordTable.ajax.reload();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function exportRecord() {
|
|
|
|
|
|
var id = $('#id').val();
|
|
|
|
|
|
var operType = $('#operType').val();
|
2025-12-05 15:39:43 +08:00
|
|
|
|
var token = localStorage.getItem("smz-token");
|
2025-11-27 16:55:35 +08:00
|
|
|
|
var loadingMsg = layer.msg('下载中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
2025-12-09 18:44:29 +08:00
|
|
|
|
var url = smz_ht_url + "/dataCount/downloadDetailUpdateRecordExcel?id=" + id +"&operType=" + operType + "&token=" + token;
|
2025-11-27 16:55:35 +08:00
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
|
xhr.open("get", url, true);
|
|
|
|
|
|
xhr.responseType = "blob"; // 转换流
|
|
|
|
|
|
xhr.onload = function () {
|
|
|
|
|
|
layer.close(loadingMsg);
|
|
|
|
|
|
if (this.status === 200) {
|
|
|
|
|
|
var blob = this.response;
|
|
|
|
|
|
var a = document.createElement("a");
|
|
|
|
|
|
var url = window.URL.createObjectURL(blob);
|
|
|
|
|
|
a.href = url;
|
|
|
|
|
|
a.download = "工序桩位.xlsx"; // 文件名
|
|
|
|
|
|
}else {
|
|
|
|
|
|
layer.msg('发生异常,请稍后重试', {icon: 16, scrollbar: false, time: 2000});
|
|
|
|
|
|
}
|
|
|
|
|
|
a.click()
|
|
|
|
|
|
window.URL.revokeObjectURL(url)
|
|
|
|
|
|
};
|
|
|
|
|
|
xhr.send();
|
|
|
|
|
|
}
|