2025-11-27 16:55:35 +08:00
|
|
|
|
var example = null;
|
|
|
|
|
|
var pers = null;
|
2025-12-05 15:39:43 +08:00
|
|
|
|
var token = localStorage.getItem("smz-token");
|
2025-11-27 16:55:35 +08:00
|
|
|
|
var usernameLogin = localStorage.getItem("usernameLogin");
|
|
|
|
|
|
|
|
|
|
|
|
var ids=null;
|
|
|
|
|
|
|
|
|
|
|
|
$(function () {
|
|
|
|
|
|
initTrees();
|
|
|
|
|
|
layui.use(['layer', 'laydate', 'form'], function () {
|
|
|
|
|
|
var layer = layui.layer;
|
|
|
|
|
|
var form = layui.form;
|
|
|
|
|
|
var laydate = layui.laydate
|
|
|
|
|
|
// 获取当前日期并格式化为 YYYY-MM
|
|
|
|
|
|
var now = new Date();
|
|
|
|
|
|
var year = now.getFullYear();
|
|
|
|
|
|
var month = ('0' + (now.getMonth() + 1)).slice(-2); // 确保月份是两位数
|
|
|
|
|
|
var currentDate = year + '-' + month;
|
|
|
|
|
|
laydate.render({
|
|
|
|
|
|
elem: '#month',
|
|
|
|
|
|
type: 'month',
|
|
|
|
|
|
range: true, // 启用范围选择
|
|
|
|
|
|
value: currentDate + ' - ' + currentDate, // 默认选中的日期范围为当前年月到当前年月
|
|
|
|
|
|
done: function(value, date, endDate){
|
|
|
|
|
|
// 当选择完成时触发
|
|
|
|
|
|
if (value) {
|
|
|
|
|
|
var times = value.split(' - ');
|
|
|
|
|
|
console.log('开始时间:', times[0]);
|
|
|
|
|
|
console.log('结束时间:', times[1]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
// getPro(form);
|
|
|
|
|
|
pers = checkPermission();
|
|
|
|
|
|
getusertype(form,"typeName","rylx","--请选择人员类型--");
|
|
|
|
|
|
|
|
|
|
|
|
init();
|
|
|
|
|
|
|
|
|
|
|
|
$("#saveZipButton").click(function(){
|
|
|
|
|
|
importExcel();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$("#searchBt").click(function () {
|
|
|
|
|
|
example.ajax.reload();
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
function getusertype(form,name,type,text) {
|
|
|
|
|
|
$("#"+ name).empty();
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'post',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/users/getOWNType',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data: {
|
|
|
|
|
|
type:type
|
|
|
|
|
|
},
|
|
|
|
|
|
async: false,
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
console.log(data)
|
|
|
|
|
|
var html = '<option value="">'+text+'</option>';
|
|
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
|
|
|
html += '<option value="' + data[i].userName + '">' + data[i].userName + '</option>';
|
|
|
|
|
|
}
|
|
|
|
|
|
$("#"+ name).html(html);
|
|
|
|
|
|
form.render();
|
|
|
|
|
|
},
|
|
|
|
|
|
error: function (err) {
|
|
|
|
|
|
console.log("获取工程下拉列表出错:", err);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
function initTrees() {
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'POST',
|
|
|
|
|
|
headers : {
|
|
|
|
|
|
"token" : token
|
|
|
|
|
|
},
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/org/getCompanyTreeListOWN',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data: {},
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
$.fn.zTree.init($("#orgTree"),{
|
|
|
|
|
|
view:{
|
|
|
|
|
|
dblClickExpand:false,
|
|
|
|
|
|
selectedMulti:false,
|
|
|
|
|
|
nameIsHTML:true
|
|
|
|
|
|
},
|
|
|
|
|
|
data:{
|
|
|
|
|
|
simpleData:{
|
|
|
|
|
|
enable: true
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
callback:{
|
|
|
|
|
|
onClick:clickRoles
|
|
|
|
|
|
}
|
|
|
|
|
|
}, data.obj);
|
|
|
|
|
|
},
|
|
|
|
|
|
error: function (e) {
|
|
|
|
|
|
console.log(e.resMsg);
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function clickRoles(e, treeId, treeNode) {
|
|
|
|
|
|
//设置父节点不能被选择
|
|
|
|
|
|
if(treeNode.id =="x"){
|
|
|
|
|
|
var check = (treeNode);
|
|
|
|
|
|
if(check){
|
|
|
|
|
|
var zTree = $.fn.zTree.getZTreeObj("orgTree"),
|
|
|
|
|
|
nodes = zTree.getSelectedNodes(),v ="",n ="",o="",p="",c="";
|
|
|
|
|
|
for (var i=0, l=nodes.length; i<l; i++) {
|
|
|
|
|
|
v += nodes[i].name + ",";//获取name值
|
|
|
|
|
|
n += nodes[i].id + ",";//获取id值
|
|
|
|
|
|
o += nodes[i].other + ",";//获取自定义值
|
|
|
|
|
|
c += nodes[i].companyId + ",";
|
|
|
|
|
|
var pathNodes=nodes[i].getPath();
|
|
|
|
|
|
for(var y=0;y<pathNodes.length;y++){
|
|
|
|
|
|
p+=pathNodes[y].name+"/";//获取path/name值
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (v.length > 0 ) v = v.substring(0, v.length-1);
|
|
|
|
|
|
if (n.length > 0 ) n = n.substring(0, n.length-1);
|
|
|
|
|
|
if (o.length > 0 ) o = o.substring(0, o.length-1);
|
|
|
|
|
|
if (p.length > 0 ) p = p.substring(0, p.length-1);
|
|
|
|
|
|
if (c.length > 0 ) c = c.substring(0, c.length-1);
|
|
|
|
|
|
|
|
|
|
|
|
$("#orgName").val(p);
|
|
|
|
|
|
$("#companyId").val(c);
|
|
|
|
|
|
$("#auForm input[name$='orgId']").prop("value",n);
|
|
|
|
|
|
hideRole(n,c);
|
|
|
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
|
|
|
if (treeNode.level !="1") {
|
|
|
|
|
|
layer.msg('请选择组织管理中的最后一级');
|
|
|
|
|
|
}else{
|
|
|
|
|
|
var check = (treeNode);
|
|
|
|
|
|
if(check){
|
|
|
|
|
|
var zTree = $.fn.zTree.getZTreeObj("orgTree"),
|
|
|
|
|
|
nodes = zTree.getSelectedNodes(),v ="",n ="",o="",p="",c="";
|
|
|
|
|
|
for (var i=0, l=nodes.length; i<l; i++) {
|
|
|
|
|
|
v += nodes[i].name + ",";//获取name值
|
|
|
|
|
|
n += nodes[i].id + ",";//获取id值
|
|
|
|
|
|
o += nodes[i].other + ",";//获取自定义值
|
|
|
|
|
|
c += nodes[i].companyId + ",";
|
|
|
|
|
|
var pathNodes=nodes[i].getPath();
|
|
|
|
|
|
for(var y=0;y<pathNodes.length;y++){
|
|
|
|
|
|
p+=pathNodes[y].name+"/";//获取path/name值
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (v.length > 0 ) v = v.substring(0, v.length-1);
|
|
|
|
|
|
if (n.length > 0 ) n = n.substring(0, n.length-1);
|
|
|
|
|
|
if (o.length > 0 ) o = o.substring(0, o.length-1);
|
|
|
|
|
|
if (p.length > 0 ) p = p.substring(0, p.length-1);
|
|
|
|
|
|
if (c.length > 0 ) c = c.substring(0, c.length-1);
|
|
|
|
|
|
|
|
|
|
|
|
$("#orgName").val(p);
|
|
|
|
|
|
$("#companyId").val(c);
|
|
|
|
|
|
$("#auForm input[name$='orgId']").prop("value",n);
|
|
|
|
|
|
hideRole(n,c);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function loadCompanyInfo(n, c) { //分公司工程联动
|
|
|
|
|
|
var orgId = n;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function init() {
|
|
|
|
|
|
example =
|
|
|
|
|
|
$('#dt-table').DataTable({
|
|
|
|
|
|
"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 + "/paySlip",
|
2025-12-02 17:19:35 +08:00
|
|
|
|
"type": "POST",
|
2025-11-27 16:55:35 +08:00
|
|
|
|
"data": function (d) {
|
|
|
|
|
|
d.orgName = $("#orgName").val();
|
|
|
|
|
|
d.idNumber = $("#idNumber").val();
|
|
|
|
|
|
d.typeName = $("#typeName").val();
|
|
|
|
|
|
d.month = $("#month").val();
|
|
|
|
|
|
d.name = $("#name").val();
|
|
|
|
|
|
var months = $("#month").val();
|
|
|
|
|
|
if(months == ""){
|
|
|
|
|
|
d.startMonth = "";
|
|
|
|
|
|
d.endMonth = "";
|
|
|
|
|
|
}else{
|
|
|
|
|
|
d.startMonth = months.split(" - ")[0].trim();
|
|
|
|
|
|
d.endMonth = months.split(" - ")[1].trim();
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"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>",
|
|
|
|
|
|
"scrollX": true,
|
|
|
|
|
|
"fixedColumns": {
|
|
|
|
|
|
"leftColumns": 7,
|
|
|
|
|
|
"rightColumns": 1
|
|
|
|
|
|
},
|
|
|
|
|
|
"columns": [
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
"orderable": false,
|
|
|
|
|
|
data: function (row, type, set, meta) {
|
|
|
|
|
|
var c = meta.settings._iDisplayStart + meta.row + 1;
|
|
|
|
|
|
return c;
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{"data": "name",},
|
|
|
|
|
|
{"data": "idNumber",},
|
|
|
|
|
|
{"data": "orgName",},
|
|
|
|
|
|
{"data": "typeName",},
|
|
|
|
|
|
{"data": "phone",},
|
|
|
|
|
|
|
|
|
|
|
|
{"data": "month","orderable": false,},
|
|
|
|
|
|
{"data": "basePay","orderable": false,},
|
|
|
|
|
|
{"data": "monthPerPay","orderable": false,},
|
|
|
|
|
|
{"data": "quarterPerPay","orderable": false,},
|
|
|
|
|
|
{"data": "yearPerPay","orderable": false,},
|
|
|
|
|
|
{"data": "quotaPay","orderable": false,},
|
|
|
|
|
|
{"data": "overtimePay","orderable": false,},
|
|
|
|
|
|
{"data": "countPay","orderable": false,},
|
|
|
|
|
|
{"data": "festivalPay","orderable": false,},
|
|
|
|
|
|
{"data": "foodPay","orderable": false,},
|
|
|
|
|
|
{"data": "certificatePay","orderable": false,},
|
|
|
|
|
|
{"data": "hyperthermyPay","orderable": false,},
|
|
|
|
|
|
{"data": "nightPay","orderable": false,},
|
|
|
|
|
|
{"data": "healthPay","orderable": false,},
|
|
|
|
|
|
{"data": "securePay","orderable": false,},
|
|
|
|
|
|
{"data": "qualityPay","orderable": false,},
|
|
|
|
|
|
{"data": "projectPay","orderable": false,},
|
|
|
|
|
|
{"data": "feedPay","orderable": false,},
|
|
|
|
|
|
{"data": "advancedPay","orderable": false,},
|
|
|
|
|
|
{"data": "praisePay","orderable": false,},
|
|
|
|
|
|
{"data": "otherPay","orderable": false,},
|
|
|
|
|
|
{"data": "secureFine","orderable": false,},
|
|
|
|
|
|
{"data": "qualityFine","orderable": false,},
|
|
|
|
|
|
{"data": "otherFine","orderable": false,},
|
|
|
|
|
|
{"data": "payablePay","orderable": false,},
|
|
|
|
|
|
{"data": "fundMonth","orderable": false,},
|
|
|
|
|
|
{"data": "socialPay","orderable": false,},
|
|
|
|
|
|
{"data": "fundPay","orderable": false,},
|
|
|
|
|
|
{"data": "retirement","orderable": false,},
|
|
|
|
|
|
{"data": "treatment","orderable": false,},
|
|
|
|
|
|
{"data": "unemployment","orderable": false,},
|
|
|
|
|
|
{"data": "illness","orderable": false,},
|
|
|
|
|
|
{"data": "socialDiffer","orderable": false,},
|
|
|
|
|
|
{"data": "fundFine","orderable": false,},
|
|
|
|
|
|
{"data": "fundDiffer","orderable": false,},
|
|
|
|
|
|
{"data": "personTotal","orderable": false,},
|
|
|
|
|
|
{"data": "preTax","orderable": false,},
|
|
|
|
|
|
{"data": "personTax","orderable": false,},
|
|
|
|
|
|
{"data": "foodFine","orderable": false,},
|
|
|
|
|
|
{"data": "realPay","orderable": false,},
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
"data": "",
|
|
|
|
|
|
"defaultContent": "",
|
|
|
|
|
|
"orderable": false,
|
|
|
|
|
|
"render": function (data, type, row) {
|
|
|
|
|
|
var id = row['id'];
|
|
|
|
|
|
ids = id;
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
html += buttonEdits(id, "", pers);//sys:project:add
|
|
|
|
|
|
html += buttonDel(id,"", "", pers);//
|
|
|
|
|
|
return html;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
"order": [[1, "desc"], [2, "desc"], [3, "desc"], [4, "desc"],] //在栏目列上显示排序功能
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 编辑按钮
|
|
|
|
|
|
function buttonEdits(id, permission, pers) {
|
|
|
|
|
|
if (permission != "") {
|
|
|
|
|
|
if ($.inArray(permission, pers) < 0) {
|
|
|
|
|
|
//return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var btn = $("<button class='layui-btn layui-btn-xs' title='编辑' onclick='edit(\""+id+"\")'><i class='layui-icon'></i></button>");
|
|
|
|
|
|
return btn.prop("outerHTML");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 删除按钮
|
|
|
|
|
|
function buttonDel(data,lxdh, permission, pers){
|
|
|
|
|
|
if(permission != ""){
|
|
|
|
|
|
if ($.inArray(permission, pers) < 0) {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var btn = $("<button class='layui-btn layui-btn-xs' title='删除' onclick='del(\"" + data +"\",\"" + lxdh +"\")'><i class='layui-icon'></i></button>");
|
|
|
|
|
|
return btn.prop("outerHTML");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 导出数据
|
|
|
|
|
|
*/
|
|
|
|
|
|
function exportBtn() {
|
2025-12-05 15:39:43 +08:00
|
|
|
|
var token = localStorage.getItem("smz-token");
|
2025-11-27 16:55:35 +08:00
|
|
|
|
var orgName = $("#orgName").val();
|
|
|
|
|
|
var idNumber = $("#idNumber").val();
|
|
|
|
|
|
var typeName = $("#typeName").val();
|
|
|
|
|
|
var month = $("#month").val();
|
|
|
|
|
|
var name = $("#name").val();
|
|
|
|
|
|
var startMonth = "";
|
|
|
|
|
|
var endMonth = "";
|
|
|
|
|
|
if(month == ""){
|
|
|
|
|
|
startMonth = "";
|
|
|
|
|
|
endMonth = "";
|
|
|
|
|
|
}else{
|
|
|
|
|
|
startMonth = month.split(" - ")[0].trim();
|
|
|
|
|
|
endMonth = month.split(" - ")[1].trim();
|
|
|
|
|
|
}
|
|
|
|
|
|
let loadingMsg = layer.msg('数据导出中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
2025-12-09 18:44:29 +08:00
|
|
|
|
let url = smz_ht_url + "/paySlip/exportData?orgName=" + orgName + "&idNumber=" + idNumber +"&typeName=" + typeName +
|
2025-11-27 16:55:35 +08:00
|
|
|
|
"&month=" + month + "&name=" + name + "&startMonth=" + startMonth + "&endMonth=" + endMonth+"&token=" + token;
|
|
|
|
|
|
let xhr = new XMLHttpRequest();
|
|
|
|
|
|
xhr.open("get", url, true);
|
|
|
|
|
|
xhr.responseType = "blob"; // 转换流
|
|
|
|
|
|
xhr.onload = function () {
|
|
|
|
|
|
layer.close(loadingMsg);
|
|
|
|
|
|
if (this.status === 200) {
|
|
|
|
|
|
let 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 edit(id) {
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'POST',
|
|
|
|
|
|
contentType: "application/x-www-form-urlencoded",
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/paySlip/getPaySlipId',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data:{"id":id},
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
var height = '80%';
|
|
|
|
|
|
var width = '60%';
|
|
|
|
|
|
var index = layer.open({
|
|
|
|
|
|
title: ['修改','color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
|
|
|
|
|
type: 2,
|
|
|
|
|
|
content: 'paySlipForm.html',
|
|
|
|
|
|
area: [width, height],
|
|
|
|
|
|
maxmin: false,
|
|
|
|
|
|
btn: ['确定', '关闭'],
|
|
|
|
|
|
success:function(layero,index){
|
|
|
|
|
|
var myIframe = window[layero.find('iframe')[0]['name']];
|
|
|
|
|
|
var fnc = myIframe.setData(data); //aaa()为子页面的方法
|
|
|
|
|
|
myIframe.cancelReadOnly();
|
|
|
|
|
|
},
|
|
|
|
|
|
yes: function (index, layero) {
|
|
|
|
|
|
// 获取弹出层中的form表单元素
|
|
|
|
|
|
var formSubmit = layer.getChildFrame('form', index);
|
|
|
|
|
|
var submited = formSubmit.find('button')[0];
|
|
|
|
|
|
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
|
|
|
|
|
submited.click();
|
|
|
|
|
|
// example.ajax.reload(); // 刷新页面
|
|
|
|
|
|
},
|
|
|
|
|
|
btn2: function (index, layero) {
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查看
|
|
|
|
|
|
* */
|
|
|
|
|
|
function view(id) {
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'POST',
|
|
|
|
|
|
contentType: "application/x-www-form-urlencoded",
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/workerOn/getWorkerOnId',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data:{"id":id},
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
var height = '80%';
|
|
|
|
|
|
var width = '60%';
|
|
|
|
|
|
var index = layer.open({
|
|
|
|
|
|
title: ['查看','color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
|
|
|
|
|
type: 2,
|
|
|
|
|
|
content: 'workerOnForm.html',
|
|
|
|
|
|
area: [width, height],
|
|
|
|
|
|
maxmin: false,
|
|
|
|
|
|
btn: ['关闭'],
|
|
|
|
|
|
success:function(layero,index){
|
|
|
|
|
|
var myIframe = window[layero.find('iframe')[0]['name']];
|
|
|
|
|
|
var fnc = myIframe.setData(data); //aaa()为子页面的方法
|
|
|
|
|
|
myIframe.setReadOnly();
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 删除
|
|
|
|
|
|
* */
|
|
|
|
|
|
function del(id,lxdh) {
|
|
|
|
|
|
layer.confirm("确定删除吗?",function () {
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'delete',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/paySlip/'+id,
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data: {"lxdh":lxdh},
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
if (data.obj == '删除成功') {
|
|
|
|
|
|
layer.alert('删除成功', {icon: 1});
|
|
|
|
|
|
example.ajax.reload(null, false); // 刷新页面
|
|
|
|
|
|
} else {
|
|
|
|
|
|
layer.msg(data.obj, {icon: 2});
|
|
|
|
|
|
example.ajax.reload(null, false); // 刷新页面
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function depart(id,lxdh) {
|
|
|
|
|
|
var height = '40%';
|
|
|
|
|
|
var width = '30%';
|
|
|
|
|
|
localStorage.setItem("id",id);
|
|
|
|
|
|
localStorage.setItem("lxdh",lxdh);
|
|
|
|
|
|
var index = layer.open({
|
|
|
|
|
|
title: ['离职','color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
|
|
|
|
|
type: 2,
|
|
|
|
|
|
content: 'workerDeparts.html',
|
|
|
|
|
|
area: [width, height],
|
|
|
|
|
|
maxmin: false,
|
|
|
|
|
|
btn: ['确定', '关闭'],
|
|
|
|
|
|
yes: function (index, layero) {
|
|
|
|
|
|
// 获取弹出层中的form表单元素
|
|
|
|
|
|
var formSubmit = layer.getChildFrame('form', index);
|
|
|
|
|
|
var submited = formSubmit.find('button')[0];
|
|
|
|
|
|
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
|
|
|
|
|
submited.click();
|
|
|
|
|
|
// example.ajax.reload(); // 刷新页面
|
|
|
|
|
|
},
|
|
|
|
|
|
btn2: function (index, layero) {
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 入职证明路径
|
|
|
|
|
|
*/
|
|
|
|
|
|
function entry(id) {
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'POST',
|
|
|
|
|
|
contentType: "application/x-www-form-urlencoded",
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/workerOn/getWorkerOnId',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data:{"id":id},
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
var height = '80%';
|
|
|
|
|
|
var width = '60%';
|
|
|
|
|
|
var index = layer.open({
|
|
|
|
|
|
title: ['入职证明生成','color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
|
|
|
|
|
type: 2,
|
|
|
|
|
|
content: 'workerOnEntry.html',
|
|
|
|
|
|
area: [width, height],
|
|
|
|
|
|
maxmin: false,
|
|
|
|
|
|
btn: ['下发', '关闭'],
|
|
|
|
|
|
success:function(layero,index){
|
|
|
|
|
|
var myIframe = window[layero.find('iframe')[0]['name']];
|
|
|
|
|
|
var fnc = myIframe.setData(data); //aaa()为子页面的方法
|
|
|
|
|
|
},
|
|
|
|
|
|
yes: function (index, layero) {
|
|
|
|
|
|
// 获取弹出层中的form表单元素
|
|
|
|
|
|
var formSubmit = layer.getChildFrame('form', index);
|
|
|
|
|
|
var submited = formSubmit.find('button')[0];
|
|
|
|
|
|
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
|
|
|
|
|
submited.click();
|
|
|
|
|
|
// example.ajax.reload(); // 刷新页面
|
|
|
|
|
|
},
|
|
|
|
|
|
btn2: function (index, layero) {
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 收入证明路径
|
|
|
|
|
|
*/
|
|
|
|
|
|
function income(id) {
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'POST',
|
|
|
|
|
|
contentType: "application/x-www-form-urlencoded",
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/workerOn/getWorkerOnId',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data:{"id":id},
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
var height = '80%';
|
|
|
|
|
|
var width = '60%';
|
|
|
|
|
|
var index = layer.open({
|
|
|
|
|
|
title: ['收入证明生成','color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
|
|
|
|
|
type: 2,
|
|
|
|
|
|
content: 'workerOnIncome.html',
|
|
|
|
|
|
area: [width, height],
|
|
|
|
|
|
maxmin: false,
|
|
|
|
|
|
btn: ['确定', '关闭'],
|
|
|
|
|
|
success:function(layero,index){
|
|
|
|
|
|
var myIframe = window[layero.find('iframe')[0]['name']];
|
|
|
|
|
|
var fnc = myIframe.setData(data); //aaa()为子页面的方法
|
|
|
|
|
|
},
|
|
|
|
|
|
yes: function (index, layero) {
|
|
|
|
|
|
// 获取弹出层中的form表单元素
|
|
|
|
|
|
var formSubmit = layer.getChildFrame('form', index);
|
|
|
|
|
|
var submited = formSubmit.find('button')[0];
|
|
|
|
|
|
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
|
|
|
|
|
submited.click();
|
|
|
|
|
|
// example.ajax.reload(); // 刷新页面
|
|
|
|
|
|
},
|
|
|
|
|
|
btn2: function (index, layero) {
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 导出
|
|
|
|
|
|
*/
|
|
|
|
|
|
function exportPaySlipBtn() {
|
|
|
|
|
|
var ssdw = $("#ssdw").val();
|
|
|
|
|
|
var orgId = $("#orgId").val();
|
|
|
|
|
|
var rylx = $("#rylx").val();
|
|
|
|
|
|
var proName = $("#proName").val();
|
|
|
|
|
|
var name = $("#name").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 + "/workerOn/exportWorkerOnOut?ssdw=" + ssdw + "&orgId=" + orgId + "&rylx=" + rylx + "&proName=" + proName + "&name=" + name + "&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 downPaySlip(){
|
2025-12-09 18:44:29 +08:00
|
|
|
|
window.location.href = smz_ht_url + "/download/download?filename=工资条信息导入模板.xlsx";
|
2025-11-27 16:55:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
//导入excel文件
|
|
|
|
|
|
function importExcel(){
|
|
|
|
|
|
var formData = new FormData($('form')[0]);
|
|
|
|
|
|
var name = $("#articleImageFile").val();
|
|
|
|
|
|
if(name==null|| name == "") {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(!(name.endsWith(".xls") || name.endsWith(".xlsx") || name.endsWith(".xlsm"))) {
|
|
|
|
|
|
layer.msg("请上传正确的Excel表格!");
|
|
|
|
|
|
$("#articleImageFile").val("");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
formData.append("file", $("#articleImageFile")[0].files[0]);
|
|
|
|
|
|
var idx = layer.msg('正在提交数据,请稍等...', {
|
|
|
|
|
|
icon: 16
|
|
|
|
|
|
,shade: 0.01
|
|
|
|
|
|
,time:'-1'
|
|
|
|
|
|
});
|
|
|
|
|
|
$.ajax({
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url : smz_ht_url + "/paySlip/importExcel",
|
2025-11-27 16:55:35 +08:00
|
|
|
|
type : 'POST',
|
|
|
|
|
|
async : false,
|
|
|
|
|
|
data : formData,
|
|
|
|
|
|
timeout:20000,
|
|
|
|
|
|
// 告诉jQuery不要去处理发送的数据
|
|
|
|
|
|
processData : false,
|
|
|
|
|
|
// 告诉jQuery不要去设置Content-Type请求头
|
|
|
|
|
|
contentType : false,
|
|
|
|
|
|
success : function(data) {
|
|
|
|
|
|
layer.close(idx);
|
|
|
|
|
|
if(data.indexOf("导入成功") !=-1){
|
|
|
|
|
|
layer.alert(data, {icon: 1});
|
|
|
|
|
|
}else if(data.indexOf("导入失败") !=-1){
|
|
|
|
|
|
console.log(data)
|
|
|
|
|
|
layer.alert(data, {icon: 2});
|
|
|
|
|
|
}
|
|
|
|
|
|
example.ajax.reload(null, false); // 刷新页面
|
|
|
|
|
|
},
|
|
|
|
|
|
error:function(XMLHttpRequest, textStatus, errorThrown) {
|
|
|
|
|
|
console.log(JSON.stringify(errorThrown));
|
|
|
|
|
|
layer.close(idx);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
$("#articleImageFile").val("");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 批量删除
|
|
|
|
|
|
function delPaySlipBtn() {
|
|
|
|
|
|
var month = $("#month").val();
|
|
|
|
|
|
layer.confirm("您确定要删除"+ month +"的数据吗?", function () {
|
|
|
|
|
|
var form = {"month" : month};
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'post',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url: smz_ht_url + '/paySlip/delPaySlipBtn',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
contentType: "application/json; charset=utf-8",
|
|
|
|
|
|
data: JSON.stringify(form),
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
if (data.resMsg == "删除成功") {
|
|
|
|
|
|
layer.msg('删除成功', {icon: 1, time: 3000});
|
|
|
|
|
|
example.ajax.reload(null, false); // 刷新页面
|
|
|
|
|
|
} else {
|
|
|
|
|
|
layer.msg(data.resMsg, {icon: 2, time: 3000});
|
|
|
|
|
|
example.ajax.reload(null, false); // 刷新页面
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|