291 lines
10 KiB
Plaintext
291 lines
10 KiB
Plaintext
|
|
let buildNameParam, nameParam, dayTypeParam;
|
|||
|
|
let form, layer, table, laypage, orgList,limitSize;
|
|||
|
|
let orgIds;
|
|||
|
|
function setParams(buildName, name, dayType) { // 建管单位、已执行/计划书、当日/昨日/前日
|
|||
|
|
buildNameParam = buildName;
|
|||
|
|
nameParam = name;
|
|||
|
|
dayTypeParam = dayType;
|
|||
|
|
layui.config({
|
|||
|
|
base: "../../../js/layui/", //此处路径请自行处理, 可以使用绝对路径
|
|||
|
|
}).extend({
|
|||
|
|
formSelects: 'formSelects-v4'
|
|||
|
|
}).use(['form', 'layer', 'table', 'formSelects', 'laypage'], function () {
|
|||
|
|
form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
|
|||
|
|
table = layui.table;
|
|||
|
|
laypage = layui.laypage; //分页
|
|||
|
|
layer = layui.layer;
|
|||
|
|
formSelects = layui.formSelects;
|
|||
|
|
layui.form.render();
|
|||
|
|
orgIds=transOrg(buildNameParam);
|
|||
|
|
orgList=getOrgNumAndRateByTicket(true);
|
|||
|
|
setOrg(orgIds);
|
|||
|
|
pages(1, 50, 1);
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function pages(pageNum, pageSize, typeNum) {
|
|||
|
|
let params = getReqParams(pageNum, pageSize, typeNum);
|
|||
|
|
$.ajax({
|
|||
|
|
headers: {
|
|||
|
|
"encrypt": sm3(JSON.stringify(params))
|
|||
|
|
},
|
|||
|
|
url: dataUrl + "proteam/pot/home/getDailPlanList?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 () {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function laypages(total, page, limit) {
|
|||
|
|
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) {
|
|||
|
|
let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
|||
|
|
table.render({
|
|||
|
|
elem: "#ticketTable",
|
|||
|
|
id: "ticketTable",
|
|||
|
|
height: "full-220",
|
|||
|
|
data: dataList,
|
|||
|
|
limit: limit,
|
|||
|
|
cols: [
|
|||
|
|
[
|
|||
|
|
//表头
|
|||
|
|
{
|
|||
|
|
title: "序号", width: 80, unresize: true, align: "center", templet: function (d) {
|
|||
|
|
return (page - 1) * limit + d.LAY_INDEX;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{field: "orgName", title: "建管单位", width: 120, unresize: true, align: "center", sort: true},
|
|||
|
|
{field: "createTime", title: "创建时间", width: 150, unresize: true, align: "center", sort: true},
|
|||
|
|
{field: "bidName", title: "工程名称", width: 300, unresize: true, align: "center", sort: true},
|
|||
|
|
{field: "workTime", title: "施工时间", width: 150, unresize: true, align: "center", sort: true},
|
|||
|
|
{
|
|||
|
|
field: "fxdj",
|
|||
|
|
title: "风险等级",
|
|||
|
|
width: 120,
|
|||
|
|
unresize: true,
|
|||
|
|
align: "center",
|
|||
|
|
sort: true,
|
|||
|
|
templet: function (d) {
|
|||
|
|
return setRiskLevelColor(d.fxdj);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{field: "xmjl", title: "项目经理", width: 200, unresize: true, align: "center", sort: true},
|
|||
|
|
{field: "jobNum", title: "作业票编号", width: 300, unresize: true, align: "center", sort: true},
|
|||
|
|
{field: "zypfzr", title: "负责人", width: 100, unresize: true, align: "center", sort: true},
|
|||
|
|
{field: "aqjhr", title: "安全监护人", width: 140, unresize: true, align: "center", sort: true},
|
|||
|
|
{field: "zybw", title: "作业部位", width: 300, unresize: true, align: "center", sort: true},
|
|||
|
|
{field: "dqztsgjd", title: "施工进度", width: 120, unresize: true, align: "center", sort: true},
|
|||
|
|
{field: "bzmc", title: "班组名称", width: 120, unresize: true, align: "center", sort: true},
|
|||
|
|
{field: "bzzName", title: "班组长名称", width: 200, unresize: true, align: "center", sort: true},
|
|||
|
|
{field: "workGkContent", title: "8+2工况", width: 120, unresize: true, align: "center", sort: true},
|
|||
|
|
{
|
|||
|
|
field: "zynr",
|
|||
|
|
title: "作业内容",
|
|||
|
|
width: 400,
|
|||
|
|
unresize: true,
|
|||
|
|
align: "center",
|
|||
|
|
sort: true,
|
|||
|
|
templet: function (d) {
|
|||
|
|
if (d.zynr) {
|
|||
|
|
if (d.zynr.length > 60) {
|
|||
|
|
return '<span title="' + d.zynr + '">' + d.zynr.substring(0, 60) + '...</span>';
|
|||
|
|
} else {
|
|||
|
|
return '<span title="' + d.zynr + '">' + d.zynr + '</span>';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} else {
|
|||
|
|
return '';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
],
|
|||
|
|
],
|
|||
|
|
done: function (res, curr, count) {
|
|||
|
|
layer.close(loadingMsg);
|
|||
|
|
table.resize("ticketTable");
|
|||
|
|
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");
|
|||
|
|
let that = this.elem.next();
|
|||
|
|
if (res.data) {
|
|||
|
|
res.data.forEach(function (item, index) {
|
|||
|
|
if (index % 2 === 0) {
|
|||
|
|
let tr = that.find(".layui-table-box tbody tr[data-index='" + index + "']").css('background-color', '#06182E')
|
|||
|
|
} else {
|
|||
|
|
let tr = that.find(".layui-table-box tbody tr[data-index='" + index + "']").css('background-color', '#1F2F43')
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 获取参数
|
|||
|
|
function getReqParams(page, limit, type) {
|
|||
|
|
var planType='';
|
|||
|
|
|
|||
|
|
if(nameParam=='已执行'){
|
|||
|
|
planType='01'
|
|||
|
|
}
|
|||
|
|
let obj = {};
|
|||
|
|
if (!type) {
|
|||
|
|
obj = {
|
|||
|
|
page: page + "",
|
|||
|
|
limit: limit + "",
|
|||
|
|
keyWord: $('#keyWord').val(),
|
|||
|
|
dayTypeParam:dayTypeParam,
|
|||
|
|
planType:planType,
|
|||
|
|
orgId:formSelects.value('buildCode', 'val').toString(),
|
|||
|
|
keyWord:$("#keyWord").val(),
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
} else {
|
|||
|
|
obj = {
|
|||
|
|
page: '1',
|
|||
|
|
limit: '50',
|
|||
|
|
keyWord: '',
|
|||
|
|
dayTypeParam:dayTypeParam,
|
|||
|
|
planType:planType,
|
|||
|
|
orgId:formSelects.value('buildCode', 'val').toString(),
|
|||
|
|
keyWord:$("#keyWord").val(),
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return obj;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 地市工程数量和占比
|
|||
|
|
function getOrgNumAndRateByTicket(type) {
|
|||
|
|
let dataList = [];
|
|||
|
|
let params = getReqParams(1, 50, type);
|
|||
|
|
$.ajax({
|
|||
|
|
url: dataUrl + 'proteam/pot/home/getOrgNumAndRateByDailPlan?token=' + token,
|
|||
|
|
headers: {
|
|||
|
|
"encrypt": sm3(JSON.stringify(params))
|
|||
|
|
},
|
|||
|
|
data: params,
|
|||
|
|
type: 'POST',
|
|||
|
|
async: false,
|
|||
|
|
success: function (result) {
|
|||
|
|
if (result.code === 200) {
|
|||
|
|
let data = result.data;
|
|||
|
|
if (data && data.length > 0) {
|
|||
|
|
$.each(data, function (index, item) {
|
|||
|
|
dataList.push(item)
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
} else if (result.code === 500) {
|
|||
|
|
return layer.alert(result.msg, {icon: 2})
|
|||
|
|
} else {
|
|||
|
|
logout(1);
|
|||
|
|
}
|
|||
|
|
}, error: function () {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
return dataList;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/*建管单位赋值*/
|
|||
|
|
function setOrg(orgid) {
|
|||
|
|
let keys = [];
|
|||
|
|
$.each(orgList, function (index, item) {
|
|||
|
|
let temp = {
|
|||
|
|
"name": item.name + "(" + item.num + "," + item.rate + ")",
|
|||
|
|
"value": item.code,
|
|||
|
|
"titleName": item.name
|
|||
|
|
};
|
|||
|
|
keys.push(temp);
|
|||
|
|
})
|
|||
|
|
formSelects.data('buildCode', 'local', {
|
|||
|
|
arr: keys
|
|||
|
|
});
|
|||
|
|
console.log(orgid)
|
|||
|
|
if (orgid) {
|
|||
|
|
formSelects.value('buildCode', [orgid])
|
|||
|
|
}
|
|||
|
|
layui.form.render();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 风险等级赋值 */
|
|||
|
|
function setRiskLevel() {
|
|||
|
|
let keys = [];
|
|||
|
|
$.each(riskLevelList, function (index, item) {
|
|||
|
|
let temp = {
|
|||
|
|
"name": item.name,
|
|||
|
|
"value": item.code
|
|||
|
|
};
|
|||
|
|
keys.push(temp);
|
|||
|
|
})
|
|||
|
|
formSelects.data('riskType', 'local', {
|
|||
|
|
arr: keys
|
|||
|
|
});
|
|||
|
|
if (ticketTypeParam) {
|
|||
|
|
let riskLevelArr = ticketTypeParam.split(',');
|
|||
|
|
formSelects.value('riskType', riskLevelArr)
|
|||
|
|
}
|
|||
|
|
layui.form.render();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 查询/重置
|
|||
|
|
function query(type) {
|
|||
|
|
let pattern = new RegExp("[%_<>]");
|
|||
|
|
if (pattern.test($("#keyWord").val())) {
|
|||
|
|
$("#keyWord").val('');
|
|||
|
|
return layer.msg('关键字查询包含特殊字符,请重新输入', {
|
|||
|
|
icon: 2,
|
|||
|
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
let buildCode = formSelects.value('buildCode', 'val');
|
|||
|
|
orgList = getOrgNumAndRateByTicket();
|
|||
|
|
setOrg(orgIds);
|
|||
|
|
formSelects.value('buildCode', buildCode);
|
|||
|
|
pages(1, 50,true)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 关闭页面
|
|||
|
|
function closePage(type) {
|
|||
|
|
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
|||
|
|
parent.layer.close(index); //再执行关闭
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function transOrg(org){
|
|||
|
|
var orgs= "合肥:12A0@马鞍山:12B0@芜湖:12C0@安庆:12D0@淮南:12F0@宣城:12G0@阜阳:12H0@铜陵:12J0@蚌埠:12L0@滁州:12M0@六安:12N0@淮北:12P0@宿州:12Q0@池州:12R0@黄山:12S0@亳州:12T0@建设分公司:12Z0";
|
|||
|
|
var orgAlls= orgs.split("@");
|
|||
|
|
for (let i = 0; i <orgAlls.length ; i++) {
|
|||
|
|
var orgIds=orgAlls[i].split(":");
|
|||
|
|
if(org==orgIds[0]){
|
|||
|
|
return orgIds[1];
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return "";
|
|||
|
|
|
|||
|
|
}
|