IntelligentRecognition/ah-jjsp-web/.svn/pristine/8a/8a61a5706a03bd4e624ac9ccd2f...

284 lines
9.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

let buildNameParam, nameParam, dayTypeParam ,proTypeParam;
let form, layer, table, laypage, orgList,limitSize;
let orgIds;
function setParams(buildName, name, dayType,proType) { // 建管单位、已执行/计划书、当日/昨日/前日
buildNameParam = buildName;
nameParam = name;
dayTypeParam = dayType;
proTypeParam=proType;
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, 10, 1,proTypeParam);
})
}
function pages(pageNum, pageSize, typeNum) {
let params = getReqParams(pageNum, pageSize, typeNum,proTypeParam);
$.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: [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,});
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: "proName", title: "工程名称", width: 300, unresize: true, align: "center", sort: true},
{
field: "riskLevel",
title: "风险等级",
width: 120,
unresize: true,
align: "center",
sort: true,
templet: function (d) {
return setRiskLevelColor(d.riskLevel);
}
},
{field: "teamName", title: "工作班组", width: 200, unresize: true, align: "center", sort: true},
{field: "workManage", title: "班组负责人", width: 300, unresize: true, align: "center", sort: true},
{field: "workType", title: "作业类型", width: 300, unresize: true, align: "center", sort: true},
{field: "workGx", title: "作业工序", width: 300, unresize: true, align: "center", sort: true},
{field: "controll", title: "控制措施", width: 300, unresize: true, align: "center", sort: true},
{
field: "workContent",
title: "作业内容",
width: 400,
unresize: true,
align: "center",
sort: true,
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 '';
}
}
},
],
],
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,proType) {
planType='01'
let obj = {};
if (!type) {
obj = {
page: page + "",
limit: limit + "",
keyWord: $('#keyWord').val(),
dayTypeParam:dayTypeParam,
planType:planType,
proType:proType,
orgId:formSelects.value('buildCode', 'val').toString(),
keyWord:$("#keyWord").val(),
};
} else {
obj = {
page: '1',
limit: '10',
keyWord: '',
dayTypeParam:dayTypeParam,
planType:planType,
proType:proType,
orgId:formSelects.value('buildCode', 'val').toString(),
keyWord:$("#keyWord").val(),
};
}
return obj;
}
// 地市工程数量和占比
function getOrgNumAndRateByTicket(type) {
let dataList = [];
let params = getReqParams(1, 10, 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, 10,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 "";
}