2024-12-06 18:32:24 +08:00
|
|
|
|
let table, form, layer, util
|
|
|
|
|
|
let pageNum = 1, limitSize = 30; // 默认第一页,分页数量为10
|
|
|
|
|
|
$(function () {
|
|
|
|
|
|
layui.config({
|
|
|
|
|
|
base: "../../js/layui/", //此处路径请自行处理, 可以使用绝对路径
|
|
|
|
|
|
}).use(['layer', 'form', 'table', 'util'], function () {
|
|
|
|
|
|
layer = layui.layer;
|
|
|
|
|
|
form = layui.form;
|
|
|
|
|
|
// laydate = layui.laydate;
|
|
|
|
|
|
table = layui.table;
|
|
|
|
|
|
util = layui.util;
|
|
|
|
|
|
form.render();
|
|
|
|
|
|
util.event('lay-active', {
|
|
|
|
|
|
query: function () {
|
|
|
|
|
|
pages(1, limitSize);
|
|
|
|
|
|
},
|
|
|
|
|
|
reset: function () {
|
|
|
|
|
|
$('#keyWord').val('');
|
|
|
|
|
|
form.render();
|
|
|
|
|
|
pages(1, limitSize);
|
|
|
|
|
|
},
|
|
|
|
|
|
export: function () {
|
|
|
|
|
|
exportData();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
pages(1, 30, 1);
|
|
|
|
|
|
table.on("rowDouble(classTable)", function (res) {
|
|
|
|
|
|
let obj = res.data;
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function pages(pageNum, pageSize) {
|
|
|
|
|
|
let params = getReqParams(pageNum, pageSize);
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
headers: {
|
|
|
|
|
|
"encrypt": sm3(JSON.stringify(params))
|
|
|
|
|
|
},
|
|
|
|
|
|
url: dataUrl + "proteam/query/queryManage/getTeamPeopleList" + '?token=' + token,
|
|
|
|
|
|
data: params,
|
|
|
|
|
|
type: 'POST',
|
|
|
|
|
|
async: false,
|
|
|
|
|
|
success: function (result) {
|
|
|
|
|
|
console.log(result);
|
|
|
|
|
|
if (result.code === 200) {
|
|
|
|
|
|
if (result.data) {
|
|
|
|
|
|
initTable(result.data, limitSize, pageNum)
|
|
|
|
|
|
laypages(result.count, pageNum, limitSize)
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (result.code === 500) {
|
|
|
|
|
|
layer.alert(result.msg, {icon: 2})
|
|
|
|
|
|
} else if (result.code === 401) {
|
|
|
|
|
|
logout(1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}, error: function () {
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function laypages(total, page, limit) {
|
|
|
|
|
|
layui.use(['laypage'], function () {
|
|
|
|
|
|
let laypage = layui.laypage;
|
|
|
|
|
|
laypage.render({
|
|
|
|
|
|
elem: 'voi-page',
|
|
|
|
|
|
count: total,
|
|
|
|
|
|
curr: page,
|
|
|
|
|
|
limit: limit,
|
|
|
|
|
|
limits: [30,50,100],
|
|
|
|
|
|
layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
|
|
|
|
|
|
groups: 5,
|
|
|
|
|
|
jump: function (obj, first) {
|
|
|
|
|
|
if (!first) {
|
|
|
|
|
|
pageNum = obj.curr, limitSize = obj.limit;
|
|
|
|
|
|
pages(obj.curr, obj.limit, null);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function initTable(dataList, limit, page) {
|
|
|
|
|
|
console.log(dataList);
|
|
|
|
|
|
table.render({
|
|
|
|
|
|
elem: "#classTable",
|
|
|
|
|
|
id: "classTable",
|
|
|
|
|
|
height: "full-250",
|
|
|
|
|
|
data: dataList,
|
|
|
|
|
|
cols: [
|
|
|
|
|
|
[//表头
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "序号",
|
|
|
|
|
|
width: 100,
|
|
|
|
|
|
unresize: true,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
templet: function (d) {
|
|
|
|
|
|
return (page - 1) * limit + d.LAY_INDEX;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
{field: "id",title: "id",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "provinceCode",title: "省公司编码",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field:"createrId",title:"创建人id",unresize:false,minWidth:120,sort:true,align:"center"},
|
|
|
|
|
|
{field:"createTime",title:"创建时间",unresize:false,minWidth:120,sort:true,align:"center"},
|
|
|
|
|
|
{field:"updaterId",title:"修改人id",unresize:false,minWidth:120,sort:true,align:"center"},
|
|
|
|
|
|
{field:"updateTime",title:"修改时间",unresize:false,minWidth:120,sort:true,align:"center"},
|
|
|
|
|
|
{field: "teamId",title: "班组id",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "personnelId",title: "人员id",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "unitCode",title: "单位id",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "personType",title: "人员类型",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "realName",title: "姓名",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "workCode",title: "工种编码",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "positionCode",title: "岗位编码",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "idCard",title: "身份证号",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field:"deleteFlag",title:"删除状态",unresize:false,minWidth:120,sort:true,align:"center"},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
],
|
|
|
|
|
|
limit: limit,
|
|
|
|
|
|
done: function (res, curr, count) {
|
|
|
|
|
|
$(".layui-laypage-skip").css("display", "none");
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取参数
|
|
|
|
|
|
function getReqParams(page, limit) {
|
|
|
|
|
|
let obj = {};
|
|
|
|
|
|
obj = {
|
|
|
|
|
|
page: page + "",
|
|
|
|
|
|
limit: limit + "",
|
|
|
|
|
|
keyWord:$("#keyWord").val(),
|
|
|
|
|
|
};
|
|
|
|
|
|
return obj;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//导出
|
|
|
|
|
|
function exportData() {
|
|
|
|
|
|
let loadingMsg = layer.msg("数据导出中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
|
|
|
|
|
let url = dataUrl + "proteam/query/queryManage/exportTeamPeople?" + setData(getReqParams(1, 1000000)) + '&token='+token;
|
|
|
|
|
|
let xhr = new XMLHttpRequest();
|
|
|
|
|
|
let a = document.createElement("a");
|
|
|
|
|
|
xhr.open("get", url, true);
|
|
|
|
|
|
xhr.responseType = "blob"; // 转换流
|
|
|
|
|
|
xhr.setRequestHeader("encrypt",
|
|
|
|
|
|
sm3(JSON.stringify(
|
|
|
|
|
|
getReqParams(pageNum, limitSize)
|
|
|
|
|
|
)));
|
2024-12-13 18:24:28 +08:00
|
|
|
|
xhr.setRequestHeader('encryption','encryption');
|
|
|
|
|
|
xhr.setRequestHeader('token',token);
|
2024-12-06 18:32:24 +08:00
|
|
|
|
xhr.onload = function () {
|
|
|
|
|
|
layer.close(loadingMsg);
|
|
|
|
|
|
if (this.status === 200) {
|
|
|
|
|
|
let url = window.URL.createObjectURL(new Blob([this.response]))
|
|
|
|
|
|
let link = document.createElement('a')
|
|
|
|
|
|
link.style.display = 'none'
|
|
|
|
|
|
link.href = url
|
|
|
|
|
|
link.setAttribute('download', "班组人员统计信息.xlsx")
|
|
|
|
|
|
document.body.appendChild(link)
|
|
|
|
|
|
link.click()
|
|
|
|
|
|
// 释放URL对象所占资源
|
|
|
|
|
|
window.URL.revokeObjectURL(url)
|
|
|
|
|
|
// 用完即删
|
|
|
|
|
|
document.body.removeChild(link)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
layer.msg("数据发生异常,请稍后重试", {icon: 16, scrollbar: false, time: 2000});
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
xhr.send();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|