299 lines
12 KiB
JavaScript
299 lines
12 KiB
JavaScript
|
|
var example = null;
|
|||
|
|
var pers = null;
|
|||
|
|
var form =null;
|
|||
|
|
layui.use(['layer','form'], function () {
|
|||
|
|
var layer = layui.layer;
|
|||
|
|
form = layui.form;
|
|||
|
|
getProject(form);
|
|||
|
|
pers = checkPermission();
|
|||
|
|
init();
|
|||
|
|
$("#searchBt").click(function () {
|
|||
|
|
example.ajax.reload();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
form.on('select(proId)', function (data) {
|
|||
|
|
getProSubInfo(data.value,form);
|
|||
|
|
getSubTeamInfo('',form);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
form.on('select(subId)', function (data) {
|
|||
|
|
getSubTeamInfo(data.value,form);
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
function init() {
|
|||
|
|
example =
|
|||
|
|
$('#dt-table').DataTable({
|
|||
|
|
"searching": false,
|
|||
|
|
"processing": true, //加载数据时显示进度状态
|
|||
|
|
"serverSide": true,
|
|||
|
|
"pagingType": "full_numbers", //首页|尾页
|
|||
|
|
"language": {
|
|||
|
|
"url": ctxPath + "/js/plugin/datatables/Chinese.lang"
|
|||
|
|
},
|
|||
|
|
"ajax": {
|
|||
|
|
"url": ctxPath + "/certificate/getWorkerCertificateRecheck",
|
|||
|
|
"type": "post",
|
|||
|
|
"data": function (d) {
|
|||
|
|
d.companyId = $("#orgId").val();
|
|||
|
|
d.proId = $("#proId").val();
|
|||
|
|
d.subId = $("#subId").val();
|
|||
|
|
d.teamId = $("#teamId").val();
|
|||
|
|
d.idNumber = $("#idNumber").val().trim();
|
|||
|
|
d.postName = $("#postName").val().trim();
|
|||
|
|
d.certificateName = $("#certificateName").val().trim();
|
|||
|
|
d.remind = $("#remind").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) {
|
|||
|
|
localStorage.removeItem("token");
|
|||
|
|
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function () {
|
|||
|
|
location.href = ctxPath + '/login.html';
|
|||
|
|
});
|
|||
|
|
} 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() {
|
|||
|
|
// alert( '表格重绘了' );
|
|||
|
|
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>><'dt-table-length'l>",
|
|||
|
|
"columns": [
|
|||
|
|
{
|
|||
|
|
"width": "5%",
|
|||
|
|
"orderable": false,
|
|||
|
|
data: function (row, type, set, meta) {
|
|||
|
|
var c = meta.settings._iDisplayStart + meta.row + 1;
|
|||
|
|
return c;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{"data": "proName", "defaultContent": ""},
|
|||
|
|
{"data": "subName", "defaultContent": ""},
|
|||
|
|
{"data": "teamName", "defaultContent": ""},
|
|||
|
|
{"data": "name", "defaultContent": ""},
|
|||
|
|
{"data": "idNumber", "defaultContent": ""},
|
|||
|
|
{"data": "postName", "defaultContent": ""},
|
|||
|
|
{"data": "phone", "defaultContent": ""},
|
|||
|
|
{"data": "certificateName", "defaultContent": ""},
|
|||
|
|
{"data": "oneReviewTime", "defaultContent": ""},
|
|||
|
|
{
|
|||
|
|
"data": "",
|
|||
|
|
"defaultContent": "",
|
|||
|
|
"orderable": false,
|
|||
|
|
"render": function (data, type, row) {
|
|||
|
|
var id = row['id'];
|
|||
|
|
var recheckFile = row['recheckFile'];
|
|||
|
|
var html = '';
|
|||
|
|
if (recheckFile != '无') {
|
|||
|
|
html += "<a style = 'color:#09A8F1;cursor: pointer' onclick = 'certificateFileView(\"" + id + "\")'>" + recheckFile + "</a>";
|
|||
|
|
} else {
|
|||
|
|
html += "<span style='color: red'>无</span>"
|
|||
|
|
}
|
|||
|
|
return html;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
"data": " ",
|
|||
|
|
"defaultContent": "",
|
|||
|
|
"orderable": false,
|
|||
|
|
"render": function (data, type, row) {
|
|||
|
|
var remind = row['remind'];
|
|||
|
|
var oneReviewTime = row['oneReviewTime'];
|
|||
|
|
var stopDate = row['stopDate'];
|
|||
|
|
var html = "";
|
|||
|
|
if (remind == "已复审" || remind == "未到复审时间" || remind == "无需复审"){
|
|||
|
|
html = "<span style='color: green'>"+remind+"</span>";
|
|||
|
|
}else if(remind == "待复审"){
|
|||
|
|
html = "<span style='color: orange'>"+remind+"</span>";
|
|||
|
|
}else{
|
|||
|
|
html = "<span style='color: red'>"+remind+"</span>";
|
|||
|
|
}
|
|||
|
|
return html;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
"data": "",
|
|||
|
|
"defaultContent": "",
|
|||
|
|
"orderable": false,
|
|||
|
|
"render": function (data, type, row) {
|
|||
|
|
var id = row['id'];
|
|||
|
|
var remind = row['remind'];
|
|||
|
|
var oneReviewTime = row['oneReviewTime'];
|
|||
|
|
var reviewNum = row['reviewNum'];
|
|||
|
|
var html = '';
|
|||
|
|
if(remind == "无需复审"){
|
|||
|
|
|
|||
|
|
}else if(remind == "待复审" || remind == "过期"){
|
|||
|
|
html += buttonUploadView(id,oneReviewTime,reviewNum, "", pers);
|
|||
|
|
html += buttonCheckView(id, "", pers);
|
|||
|
|
}else{
|
|||
|
|
html += buttonCheckView(id, "", pers);
|
|||
|
|
}
|
|||
|
|
return html;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
"order": [[1, "desc"],[2, "desc"],[3, "desc"],[4, "desc"],[5, "desc"],[6, "desc"], [7, "desc"],[8, "desc"], [9, "desc"]] //在栏目列上显示排序功能
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取分公司
|
|||
|
|
* */
|
|||
|
|
function getCompanys(form) {
|
|||
|
|
$("#orgId").empty();
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'POST',
|
|||
|
|
url: ctxPath + '/users/getOrgInfo',
|
|||
|
|
data: {},
|
|||
|
|
dataType: 'json',
|
|||
|
|
success: function (data) {
|
|||
|
|
var str = '<option value="">请选择分公司</option>';
|
|||
|
|
for (var i = 0; i < data.length; i++) {
|
|||
|
|
str += '<option value=\'' + data[i].id + '\'>' + data[i].companyName + '</option>';
|
|||
|
|
}
|
|||
|
|
$("#orgId").html(str);
|
|||
|
|
form.render();
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//查看附件详情
|
|||
|
|
function certificateFileView(id) {
|
|||
|
|
//去后台查数据
|
|||
|
|
var formUrl = ctxPath + "/certificate/getWorkerCertificateRecheckPhoto";
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'POST',
|
|||
|
|
async: false, // 默认异步true,false表示同步
|
|||
|
|
url: formUrl, // 请求地址
|
|||
|
|
contentType: "application/json; charset=utf-8",
|
|||
|
|
dataType: 'json', // 服务器返回数据类型
|
|||
|
|
data: JSON.stringify({id:id}), //获取提交的表单字段
|
|||
|
|
success: function (data) {
|
|||
|
|
if (data.resMsg == "数据获取成功") {
|
|||
|
|
localStorage.setItem("filePaths", data.obj.files);
|
|||
|
|
localStorage.setItem("fileTimes",data.obj.times);
|
|||
|
|
localStorage.removeItem("fileNames");
|
|||
|
|
var height = '525px';
|
|||
|
|
var width = '800px';
|
|||
|
|
var index = layer.open({
|
|||
|
|
title: ["查看", 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
|||
|
|
type: 2,
|
|||
|
|
content: '../../publicFileView.html',
|
|||
|
|
area: [width, height],
|
|||
|
|
maxmin: false,
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
parent.layer.msg('照片查询失败', {icon: 2, time: 2000});
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error: function (XMLHttpRequest, textStatus, e) {
|
|||
|
|
layer.msg('数据请求发生异常,请稍后重试', {icon: 16, scrollbar: false});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function buttonUploadView(id, oneReviewTime, reviewNum, permission, pers) {
|
|||
|
|
if (permission != "") {
|
|||
|
|
if ($.inArray(permission, pers) < 0) {
|
|||
|
|
return "";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var btn = $("<button class='layui-btn layui-btn-xs' title='修改' onclick='uploadView(\"" + id + "\",\""+oneReviewTime+"\",\""+reviewNum+"\")'>上传复审结果</button>");
|
|||
|
|
return btn.prop("outerHTML");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 修改
|
|||
|
|
* */
|
|||
|
|
function uploadView(id,oneReviewTime, reviewNum) {
|
|||
|
|
localStorage.setItem("id", id);
|
|||
|
|
localStorage.setItem("oneReviewTime", oneReviewTime);
|
|||
|
|
localStorage.setItem("reviewNum", reviewNum);
|
|||
|
|
layer.open({
|
|||
|
|
title: ['上传复审结果', 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
|||
|
|
type: 2,
|
|||
|
|
content: 'certificateRecheckForm.html',
|
|||
|
|
area: ['40%', '65%'],
|
|||
|
|
maxmin: false,
|
|||
|
|
btn: ['确定', '关闭'],
|
|||
|
|
success: function (layero, index) {
|
|||
|
|
},
|
|||
|
|
yes: function (index, layero) {
|
|||
|
|
// 获取弹出层中的form表单元素
|
|||
|
|
var formSubmit = layer.getChildFrame('form', index);
|
|||
|
|
var submited = formSubmit.find('button')[1];
|
|||
|
|
submited.click();
|
|||
|
|
},
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function buttonCheckView(id, permission, pers) {
|
|||
|
|
if (permission != "") {
|
|||
|
|
if ($.inArray(permission, pers) < 0) {
|
|||
|
|
return "";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var btn = $("<button class='layui-btn layui-btn-xs' title='查看' onclick='checkView(\"" + id + "\")'>查看</button>");
|
|||
|
|
return btn.prop("outerHTML");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 查看
|
|||
|
|
* */
|
|||
|
|
function checkView(id) {
|
|||
|
|
localStorage.setItem("id", id);
|
|||
|
|
layer.open({
|
|||
|
|
title: ['查看', 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
|||
|
|
type: 2,
|
|||
|
|
content: 'workerCertificateRecheck.html',
|
|||
|
|
area: ['85%', '95%'],
|
|||
|
|
maxmin: false,
|
|||
|
|
success: function (layero, index) {
|
|||
|
|
var myIframe = window[layero.find('iframe')[0]['name']];
|
|||
|
|
myIframe.setData(); //aaa()为子页面的方法
|
|||
|
|
},
|
|||
|
|
yes: function (index, layero) {
|
|||
|
|
},
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|