231 lines
7.8 KiB
Plaintext
231 lines
7.8 KiB
Plaintext
|
|
let form, laypage, layer, table,laydate, buildNameParam, riskLevelParam, orgList = getOrgSelect(),riskLevelList = getRiskLevelSelect('risk_level');;
|
|||
|
|
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
|||
|
|
function setParams(buildName, riskLevel) {
|
|||
|
|
buildNameParam = buildName;
|
|||
|
|
riskLevelParam = riskLevel;
|
|||
|
|
layui.use(['form', 'layer', 'table', 'laypage','laydate'], function () {
|
|||
|
|
form = layui.form;
|
|||
|
|
table = layui.table;
|
|||
|
|
layer = layui.layer;
|
|||
|
|
laypage = layui.laypage; //分页
|
|||
|
|
laydate = layui.laydate;
|
|||
|
|
laydate.render({
|
|||
|
|
elem: '#classDate', //指定元素 元素选择器
|
|||
|
|
type: 'date', //选择时间类型 可选值:year(年) month(年月) date(年月日) time(时分秒) datetime(年月日时分秒)
|
|||
|
|
trigger: 'click',
|
|||
|
|
format: 'yyyy-MM-dd', //时间格式 常用时间格式:yyyy-MM-dd HH:mm:ss
|
|||
|
|
btns: ['clear', 'now', 'confirm'], //选择框右下角显示的按钮 清除-现在-确定
|
|||
|
|
done: function (value, date) { //时间回调
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
$('#classDate').val(getNowTime())
|
|||
|
|
setOrg();
|
|||
|
|
setRiskLevel();
|
|||
|
|
layui.form.render();
|
|||
|
|
pages(1, 10, 1);
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function pages(pageNum, pageSize, typeNum) {
|
|||
|
|
let params = getReqParams(pageNum, pageSize, typeNum);
|
|||
|
|
$.ajax({
|
|||
|
|
headers: {
|
|||
|
|
"encrypt": sm3(JSON.stringify(params))
|
|||
|
|
},
|
|||
|
|
url: dataUrl + "proteam/pot/dailyRisk/getDayRiskByChild?token=" + token,
|
|||
|
|
data: params,
|
|||
|
|
type: 'POST',
|
|||
|
|
async: false,
|
|||
|
|
success: function (result) {
|
|||
|
|
console.log(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 () {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
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-260",
|
|||
|
|
data: dataList,
|
|||
|
|
limit: limit,
|
|||
|
|
cols: [
|
|||
|
|
[
|
|||
|
|
//表头
|
|||
|
|
{
|
|||
|
|
title: "序号", width: 100, unresize: true, align: "center", templet: function (d) {
|
|||
|
|
return (page - 1) * limit + d.LAY_INDEX;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
field: "orgName",
|
|||
|
|
title: "建管单位",
|
|||
|
|
unresize: true,
|
|||
|
|
width: 120,
|
|||
|
|
align: "center",
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
field: "proName",
|
|||
|
|
title: "标段工程名称",
|
|||
|
|
unresize: true,
|
|||
|
|
align: "center",
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: "风险等级",
|
|||
|
|
width: 120,
|
|||
|
|
unresize: true,
|
|||
|
|
align: "center",
|
|||
|
|
templet: function (d) {
|
|||
|
|
return setRiskLevelColor(d.riskLevel);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: "班组长",
|
|||
|
|
width: 180,
|
|||
|
|
unresize: true,
|
|||
|
|
align: "center",
|
|||
|
|
templet: function (d) {
|
|||
|
|
return '<span>' + setValue2(d.workManage) + '</span> <span>' + setValue2(d.workManagePhone) + '</span>'
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: "工作内容",
|
|||
|
|
align: "center",
|
|||
|
|
templet: function (d) {
|
|||
|
|
if (d.workContent) {
|
|||
|
|
if (d.workContent.length > 60) {
|
|||
|
|
return '<span title="' + d.workContent + '">' + d.workContent.substring(0, 60) + '...</span>'
|
|||
|
|
} else {
|
|||
|
|
return '<span title="' + d.workContent + '">' + d.workContent + '</span>'
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
return '';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
field: "state",
|
|||
|
|
title: "施工状态",
|
|||
|
|
width: 120,
|
|||
|
|
unresize: true,
|
|||
|
|
align: "center",
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
field: "curryDay",
|
|||
|
|
title: "开工日期",
|
|||
|
|
width: 120,
|
|||
|
|
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 getReqParams(page, limit, type) {
|
|||
|
|
let obj = {};
|
|||
|
|
if (!type) {
|
|||
|
|
obj = {
|
|||
|
|
page: page + "",
|
|||
|
|
limit: limit + "",
|
|||
|
|
curryDay: $('#classDate').val(),
|
|||
|
|
BuildCode:$('#buildCode').val(),
|
|||
|
|
riskLevel:$('#riskLevel').val(),
|
|||
|
|
keyWord: $('#keyWord').val(),
|
|||
|
|
state : $('#status').val()
|
|||
|
|
};
|
|||
|
|
} else {
|
|||
|
|
obj = {
|
|||
|
|
page: '1',
|
|||
|
|
limit: '10',
|
|||
|
|
curryDay: $('#classDate').val(),
|
|||
|
|
BuildCode:$('#buildCode').val(),
|
|||
|
|
riskLevel:$('#riskLevel').val(),
|
|||
|
|
keyWord: '',
|
|||
|
|
state : ''
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return obj;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 查询/重置
|
|||
|
|
function query(type) {
|
|||
|
|
let pattern = new RegExp("[%_<>]");
|
|||
|
|
if (pattern.test($("#bidName").val())) {
|
|||
|
|
$("#bidName").val('');
|
|||
|
|
return layer.msg('工程名称查询包含特殊字符,请重新输入', {
|
|||
|
|
icon: 2,
|
|||
|
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
pages(1, limitSize, false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/*建管单位赋值*/
|
|||
|
|
function setOrg() {
|
|||
|
|
let html = '<option value="">全部</option>';
|
|||
|
|
$.each(orgList, function (index, item) {
|
|||
|
|
if(buildNameParam === item.name){
|
|||
|
|
html += '<option selected value="' + item.code + '">' + item.name + '</option>';
|
|||
|
|
}else{
|
|||
|
|
html += '<option value="' + item.code + '">' + item.name + '</option>';
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
$('#buildCode').empty().append(html);
|
|||
|
|
layui.form.render();
|
|||
|
|
}
|
|||
|
|
/* 风险等级赋值 */
|
|||
|
|
function setRiskLevel() {
|
|||
|
|
let html = '<option value="">全部</option>';
|
|||
|
|
$.each(riskLevelList, function (index, item) {
|
|||
|
|
if(riskLevelParam === item.name){
|
|||
|
|
html += '<option selected value="' + item.code + '">' + item.name + '</option>';
|
|||
|
|
}else{
|
|||
|
|
html += '<option value="' + item.code + '">' + item.name + '</option>';
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
$('#riskLevel').empty().append(html);
|
|||
|
|
layui.form.render();
|
|||
|
|
}
|
|||
|
|
// 关闭页面
|
|||
|
|
function closePage(type) {
|
|||
|
|
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
|||
|
|
parent.layer.close(index); //再执行关闭
|
|||
|
|
}
|