2024-12-09 15:34:11 +08:00
|
|
|
|
let form, layer, table, laydate, tableIns, user = getUser(), tableHeight;
|
|
|
|
|
|
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
|
|
|
|
|
layui.use(['form', 'layer', 'table', 'laydate'], function () {
|
|
|
|
|
|
form = layui.form;
|
|
|
|
|
|
layer = layui.layer;
|
|
|
|
|
|
table = layui.table;
|
|
|
|
|
|
laydate = layui.laydate;
|
|
|
|
|
|
pages(1, 10, 1);
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2024-12-09 16:49:17 +08:00
|
|
|
|
/* 加载表格 */
|
2024-12-09 15:34:11 +08:00
|
|
|
|
function pages(pageNum, pageSize, typeNum) {
|
|
|
|
|
|
let params = getReqParams(pageNum, pageSize, typeNum);
|
2024-12-09 18:47:43 +08:00
|
|
|
|
let url = dataUrl + "proteam/pot/proVio/getProVioList";
|
2024-12-09 16:49:17 +08:00
|
|
|
|
ajaxRequest(url, "POST", params, true, function () {
|
|
|
|
|
|
}, function (result) {
|
|
|
|
|
|
if (result.code === 200) {
|
|
|
|
|
|
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 })
|
2024-12-09 15:34:11 +08:00
|
|
|
|
}
|
2024-12-09 16:49:17 +08:00
|
|
|
|
}, function (xhr, status, error) {
|
|
|
|
|
|
errorFn(xhr, status, error)
|
|
|
|
|
|
}, null);
|
2024-12-09 15:34:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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: [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) {
|
|
|
|
|
|
let loadingMsg = layer.msg("数据加载中,请稍候...", { icon: 16, scrollbar: false, time: 0, });
|
|
|
|
|
|
tableIns = table.render({
|
|
|
|
|
|
id: 'currTable',
|
|
|
|
|
|
elem: "#currTable",
|
2024-12-09 16:24:34 +08:00
|
|
|
|
height: 'full-130',
|
2024-12-09 15:34:11 +08:00
|
|
|
|
data: dataList,
|
|
|
|
|
|
limit: limit,
|
|
|
|
|
|
cols: [
|
|
|
|
|
|
[
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "序号",
|
2024-12-09 16:24:34 +08:00
|
|
|
|
width: '5%',
|
2024-12-09 15:34:11 +08:00
|
|
|
|
unresize: true,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
templet: function (d) {
|
|
|
|
|
|
return (page - 1) * limit + d.LAY_NUM;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: "ticketNo",
|
|
|
|
|
|
title: "作业票编号",
|
2024-12-09 16:24:34 +08:00
|
|
|
|
width: '10%',
|
2024-12-09 15:34:11 +08:00
|
|
|
|
unresize: true,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
style: 'word-break: break-all'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: "proName",
|
|
|
|
|
|
title: "工程名称",
|
2024-12-09 16:24:34 +08:00
|
|
|
|
width: '15%',
|
2024-12-09 15:34:11 +08:00
|
|
|
|
unresize: true,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
style: 'word-break: break-all'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: "workManager",
|
|
|
|
|
|
title: "班组长",
|
2024-12-09 16:24:34 +08:00
|
|
|
|
width: '10%',
|
2024-12-09 15:34:11 +08:00
|
|
|
|
unresize: true,
|
|
|
|
|
|
align: "center",
|
2024-12-09 16:24:34 +08:00
|
|
|
|
templet: function (d) {
|
2024-12-09 16:49:17 +08:00
|
|
|
|
return '<p>' + transformNull(d.workManager) + '</p><p>' + transformNull(d.workManagerPhone) + '</p>';
|
2024-12-09 16:24:34 +08:00
|
|
|
|
}
|
2024-12-09 15:34:11 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: "riskLevel",
|
|
|
|
|
|
title: "风险等级",
|
2024-12-09 16:24:34 +08:00
|
|
|
|
width: '10%',
|
2024-12-09 15:34:11 +08:00
|
|
|
|
unresize: true,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
templet: function (d) {
|
|
|
|
|
|
return setRiskLevelColor(d.riskLevel);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: "org",
|
|
|
|
|
|
title: "违章单位",
|
2024-12-09 16:24:34 +08:00
|
|
|
|
width: '10%',
|
2024-12-09 15:34:11 +08:00
|
|
|
|
unresize: true,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: "type",
|
|
|
|
|
|
title: "违章类型",
|
2024-12-09 16:24:34 +08:00
|
|
|
|
width: '10%',
|
2024-12-09 15:34:11 +08:00
|
|
|
|
unresize: true,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-12-09 16:24:34 +08:00
|
|
|
|
field: "childType",
|
2024-12-09 15:34:11 +08:00
|
|
|
|
title: "违章子类型",
|
2024-12-09 16:24:34 +08:00
|
|
|
|
width: '10%',
|
2024-12-09 15:34:11 +08:00
|
|
|
|
unresize: true,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: "levelId",
|
|
|
|
|
|
title: "违章等级",
|
2024-12-09 16:24:34 +08:00
|
|
|
|
width: '10%',
|
2024-12-09 15:34:11 +08:00
|
|
|
|
unresize: true,
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
templet: function (d) {
|
|
|
|
|
|
if (d.levelId === '严重违章') {
|
|
|
|
|
|
return '<span style="color: #ff5d5d;">' + d.levelId + '</span>';
|
|
|
|
|
|
}
|
|
|
|
|
|
return '<span>' + d.levelId + '</span>';
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: "content",
|
|
|
|
|
|
title: "违章内容",
|
2024-12-09 16:24:34 +08:00
|
|
|
|
width: '10%',
|
2024-12-09 15:34:11 +08:00
|
|
|
|
unresize: true,
|
|
|
|
|
|
align: "center",
|
2024-12-09 16:24:34 +08:00
|
|
|
|
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 '';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-09 15:34:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
],
|
|
|
|
|
|
done: function (res, curr, count) {
|
|
|
|
|
|
layer.close(loadingMsg);
|
|
|
|
|
|
table.resize("currTable");
|
|
|
|
|
|
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) {
|
|
|
|
|
|
obj = {
|
|
|
|
|
|
page: page + "",
|
|
|
|
|
|
limit: limit + "",
|
|
|
|
|
|
proName: $('#proName').val(),
|
|
|
|
|
|
currentUserId: user.userId + '',
|
|
|
|
|
|
isSup: user.isSup,
|
|
|
|
|
|
currentUserOrgId: user.orgId
|
|
|
|
|
|
};
|
|
|
|
|
|
} else {
|
|
|
|
|
|
obj = {
|
|
|
|
|
|
page: '1',
|
|
|
|
|
|
limit: '10',
|
|
|
|
|
|
proName: '',
|
|
|
|
|
|
currentUserId: user.userId + '',
|
|
|
|
|
|
isSup: user.isSup,
|
|
|
|
|
|
currentUserOrgId: user.orgId
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
return obj;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 查询/重置
|
|
|
|
|
|
function queryTable(type) {
|
|
|
|
|
|
if (type === 2) {
|
2024-12-09 16:24:34 +08:00
|
|
|
|
$('#proName').val('');
|
2024-12-09 15:34:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
let pattern = new RegExp("[%_<>]");
|
2024-12-09 16:24:34 +08:00
|
|
|
|
if (pattern.test($("#proName").val())) {
|
|
|
|
|
|
$("#proName").val('');
|
2024-12-10 10:34:43 +08:00
|
|
|
|
return layer.msg('工程名称查询包含特殊字符,请重新输入', {
|
2024-12-09 15:34:11 +08:00
|
|
|
|
icon: 2,
|
|
|
|
|
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
pageNum = 1;
|
|
|
|
|
|
pages(1, limitSize)
|
|
|
|
|
|
}
|