226 lines
7.5 KiB
Plaintext
226 lines
7.5 KiB
Plaintext
|
|
let form, laypage,layer, cityNameParam,seriesNameParam,table,typeParam,proTypeParam,titleName;
|
|||
|
|
let pageNum = 1, limitSize = 20; // 默认第一页,分页数量为10
|
|||
|
|
|
|||
|
|
function setParams(cityName, seriesName) { // type 1 在建 2 在施 3 停工
|
|||
|
|
console.log(cityName)
|
|||
|
|
cityNameParam = cityName;
|
|||
|
|
seriesNameParam = seriesName;
|
|||
|
|
|
|||
|
|
if(seriesNameParam=="人员数"){
|
|||
|
|
$("#typeNum").removeAttr('style')
|
|||
|
|
$('.title p').html('班组人员')
|
|||
|
|
}else{
|
|||
|
|
$("#typeNums").removeAttr('style')
|
|||
|
|
$('.title p').html('班组')
|
|||
|
|
}
|
|||
|
|
layui.use(['form', 'layer', 'table', 'laypage'], function () {
|
|||
|
|
form = layui.form;
|
|||
|
|
table = layui.table;
|
|||
|
|
layer = layui.layer;
|
|||
|
|
laypage = layui.laypage; //分页
|
|||
|
|
$('#proType').val(proTypeParam)
|
|||
|
|
|
|||
|
|
layui.form.render();
|
|||
|
|
pages(1, 20, 1);
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
function pages(pageNum, pageSize, typeNum) {
|
|||
|
|
let params = getReqParams(pageNum, pageSize, typeNum);
|
|||
|
|
if(seriesNameParam=="人员数"){
|
|||
|
|
$.ajax({
|
|||
|
|
headers: {
|
|||
|
|
"encrypt": sm3(JSON.stringify(params))
|
|||
|
|
},
|
|||
|
|
url: dataUrl + "proteam/pot/teamNew/getPersonData?token=" + token,
|
|||
|
|
data: params,
|
|||
|
|
type: 'POST',
|
|||
|
|
async: false,
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.code === 200) {
|
|||
|
|
if (result.data) {
|
|||
|
|
initTable(result.data, result.limit, result.curr)
|
|||
|
|
laypages(result.count, result.curr, result.limit)
|
|||
|
|
}
|
|||
|
|
} else if (result.code === 500) {
|
|||
|
|
layer.alert(result.msg, {icon: 2})
|
|||
|
|
} else if (result.code === 401) {
|
|||
|
|
logout(1);
|
|||
|
|
}
|
|||
|
|
}, error: function () {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}else{
|
|||
|
|
$.ajax({
|
|||
|
|
headers: {
|
|||
|
|
"encrypt": sm3(JSON.stringify(params))
|
|||
|
|
},
|
|||
|
|
url: dataUrl + "proteam/pot/teamNew/getTeamByOrg?token=" + token,
|
|||
|
|
data: params,
|
|||
|
|
type: 'POST',
|
|||
|
|
async: false,
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.code === 200) {
|
|||
|
|
if (result.data) {
|
|||
|
|
initTable2(result.data, result.limit, result.curr)
|
|||
|
|
laypages(result.count, result.curr, result.limit)
|
|||
|
|
}
|
|||
|
|
} 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) {
|
|||
|
|
laypage.render({
|
|||
|
|
elem: 'voi-page',
|
|||
|
|
count: total,
|
|||
|
|
curr: page,
|
|||
|
|
limit: limit,
|
|||
|
|
limits: [10,20,50,100,200,500],
|
|||
|
|
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) {
|
|||
|
|
table.render({
|
|||
|
|
elem: "#proTable",
|
|||
|
|
id: "proTable",
|
|||
|
|
height: "full-200",
|
|||
|
|
data: dataList,
|
|||
|
|
limit: limit,
|
|||
|
|
cols: [
|
|||
|
|
[
|
|||
|
|
//表头
|
|||
|
|
{
|
|||
|
|
title: "序号", width: 100, unresize: true, align: "center", templet: function (d) {
|
|||
|
|
return (page - 1) * limit + d.LAY_INDEX;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{field: "idNumber", title: "身份证", unresize: true, align: "center"},
|
|||
|
|
{field: "personName", title: "姓名", unresize: true, align: "center"},
|
|||
|
|
{field: "personType", title: "类型", unresize: true, align: "center"},
|
|||
|
|
{field: "age", title: "年龄",unresize: true, align: "center"},
|
|||
|
|
],
|
|||
|
|
],
|
|||
|
|
done: function (res, curr, count) {
|
|||
|
|
$(".layui-laypage-skip").css("display", "none");
|
|||
|
|
table.resize("proTable");
|
|||
|
|
count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block");
|
|||
|
|
count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto");
|
|||
|
|
},
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 班组信息
|
|||
|
|
function initTable2(dataList, limit, page) {
|
|||
|
|
|
|||
|
|
table.render({
|
|||
|
|
elem: "#proTable",
|
|||
|
|
id: "proTable",
|
|||
|
|
height: "full-200",
|
|||
|
|
data: dataList,
|
|||
|
|
limit: limit,
|
|||
|
|
cols: [
|
|||
|
|
[
|
|||
|
|
//表头
|
|||
|
|
{
|
|||
|
|
title: "序号", width: 100, unresize: true, align: "center", templet: function (d) {
|
|||
|
|
return (page - 1) * limit + d.LAY_INDEX;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{field: "proName", title: "工程名称", width: 350, unresize: true, align: "center"},
|
|||
|
|
{field: "teamName", title: "班组名称", width: 200, unresize: true, align: "center"},
|
|||
|
|
{field: "fzrName", title: "负责人", width: 120, unresize: true, align: "center"},
|
|||
|
|
{field: "phone", title: "手机号",width: 120, unresize: true, align: "center"},
|
|||
|
|
{field: "content", title: "作业内容", unresize: true, align: "center",
|
|||
|
|
templet: function (d) {
|
|||
|
|
if (d.content) {
|
|||
|
|
if (d.content.length > 60) {
|
|||
|
|
return '<span title="' + d.content + '">' + d.content.substring(0, 60) + '...</span>'
|
|||
|
|
} else {
|
|||
|
|
return '<span title="' + d.content + '">' + d.content + '</span>'
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
return '';
|
|||
|
|
}
|
|||
|
|
}},
|
|||
|
|
],
|
|||
|
|
],
|
|||
|
|
done: function (res, curr, count) {
|
|||
|
|
table.resize("proTable");
|
|||
|
|
count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block");
|
|||
|
|
count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto");
|
|||
|
|
},
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 获取参数
|
|||
|
|
function getReqParams(page, limit, type) {
|
|||
|
|
let obj = {};
|
|||
|
|
if (!type) {
|
|||
|
|
if(seriesNameParam=="人员数"){
|
|||
|
|
obj = {
|
|||
|
|
page: page + "",
|
|||
|
|
limit: limit + "",
|
|||
|
|
cityName:cityNameParam,
|
|||
|
|
idNumber: $('#idNumber').val(),
|
|||
|
|
personName: $('#personName').val()
|
|||
|
|
};
|
|||
|
|
}else{
|
|||
|
|
obj = {
|
|||
|
|
page: page + "",
|
|||
|
|
limit: limit + "",
|
|||
|
|
cityName:cityNameParam,
|
|||
|
|
fzrName: $('#fzrName').val(),
|
|||
|
|
teamName: $('#teamName').val()
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
obj = {
|
|||
|
|
page: '1',
|
|||
|
|
limit: '20',
|
|||
|
|
cityName:cityNameParam
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return obj;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 查询/重置
|
|||
|
|
function query(type) {
|
|||
|
|
let pattern = new RegExp("[%_<>]");
|
|||
|
|
if (pattern.test($("#proName").val())) {
|
|||
|
|
$("#proName").val('');
|
|||
|
|
return layer.msg('工程名称查询包含特殊字符,请重新输入', {
|
|||
|
|
icon: 2,
|
|||
|
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
pages(1, limitSize, false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// 关闭页面
|
|||
|
|
function closePage(type) {
|
|||
|
|
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
|||
|
|
parent.layer.close(index); //再执行关闭
|
|||
|
|
}
|