IntelligentRecognition/ah-jjsp-web/.svn/pristine/ae/ae0d56b0b27897856c1bb96aefa...

401 lines
15 KiB
Plaintext
Raw Permalink 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 urlLis = ['getNoWorkByDay', 'getNewTeam', 'getNoWorkBySeven', 'getTeamByPer', 'getTeamByWork', 'getFocusWork', 'getBallByUnusual', 'getBallSignal', 'getTeamByJob'];
function setTable(table) {
table.set({
elem: "#table",
id: "table",
height: "full-140",
});
}
//今日无施工,七日无施工,新进班组
function setTableCols(page, limit, type) {
let tableCols = [
{
title: "序号",
width: 100,
unresize: true,
align: "center",
templet: function (d) {
return (page - 1) * limit + d.LAY_INDEX;
}
}, {
field: "org",
title: "建管单位",
unresize: false,
sort: true,
width: 150,
align: "center",
}, {
field: "proName",
title: "工程名称",
unresize: false,
sort: true,
width: 300,
align: "center",
},
{
field: 'fzrName',
title: "班组长",
unresize: false,
sort: true,
width: 150,
align: "center",
templet: function (d) {
return "<span>" + d.fzrName + "</span><br/><span>" + d.phone + "</span>";
},
}
];
$('.riskLevel').addClass('layui-hide');
switch (type) {
case 0:
tableCols.push({
field: "content",
title: "工作内容",
unresize: false,
sort: true,
minWidth: 200,
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 '';
}
}
}
)
//addCols(tableCols,0);
break;
case 1:
tableCols.push(
{ field: "teamName",title: "班组名称", unresize: false,sort: true,minWidth: 200,align: "center"},
{field: "createDay",title: "入场时间",unresize: false,sort: true,minWidth: 200,align: "center", },
)
break;
case 2:
tableCols.push(
{ field: "teamName",title: "班组名称", unresize: false,sort: true,minWidth: 200,align: "center"},
{field: "createDay",title: "入场时间",unresize: false,sort: true,minWidth: 200,align: "center", },
)
break;
case 3:
$('.riskLevel').removeClass('layui-hide');
tableCols = [
{ title: "序号", width: 100, unresize: true,sort: true,align: "center",
templet: function (d) {
return (page - 1) * limit + d.LAY_INDEX;
} },
{ field: "org",title: "建管单位",unresize: false,sort: true,width: 150,align: "center",},
{field: "proName", title: "工程名称",unresize: false, sort: true,minWidth: 200,align: "center",},
{field: "riskLevel", title: "风险等级", unresize: false, width: 150,sort: true,align: "center",
templet: function (d) {
return setRiskLevelColor(d.riskLevel);
}},
{ field: 'fzrName', title: "班组长", unresize: false, sort: true, width: 150, align: "center",
templet: function (d) {
return "<span>" + d.fzrName + "</span><br/><span>" + d.phone + "</span>"; }, },
{ field: "dnum", title: "今日人数", unresize: false,sort: true, width: 150,align: "center"}, {
field: "ynum", title: "昨日人数", unresize: false,sort: true,width: 150,align: "center"},
{ field: "content", title: "工作内容", unresize: false,sort: true,minWidth: 200,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 '';
}
}
},
];
addCols(tableCols,3);
break;
case 4:
tableCols.push(
{field: "teamName", title: "班组名称", unresize: false,sort: true, minWidth: 200, align: "center" },
{ field: "tgx", title: "今日工序",unresize: false, sort: true, minWidth: 180,align: "center",
templet: function (d) {
if (d.tgx) {
if (d.tgx.length > 60) {
return '<span title="' + d.tgx + '">' + d.tgx.substring(0, 60) + '...</span>'
} else {
return '<span title="' + d.tgx + '">' + d.tgx + '</span>'
}
} else {
return '';
}
}
},
{field: "ygx",title: "昨日工序", unresize: false,sort: true,minWidth: 180,align: "center",
templet: function (d) {
if (d.ygx) {
if (d.ygx.length > 60) {
return '<span title="' + d.ygx + '">' + d.ygx.substring(0, 60) + '...</span>'
} else {
return '<span title="' + d.ygx + '">' + d.ygx + '</span>'
}
} else {
return '';
}
}
}
)
addCols(tableCols,4);
break;
case 8:
tableCols.push(
{ field: "teamName", title: "班组名称", unresize: false,sort: true,minWidth: 200, align: "center"},
{ field: "tzylx", title: "今日作业类型", unresize: false,sort: true, minWidth: 180,align: "center",
templet: function (d) {
if (d.tzylx) {
if (d.tzylx.length > 60) {
return '<span title="' + d.tzylx + '">' + d.tzylx.substring(0, 60) + '...</span>'
} else {
return '<span title="' + d.tzylx + '">' + d.tzylx + '</span>'
}
} else {
return '';
}
}
},
{ field: "yzylx", title: "昨日作业类型",unresize: false, sort: true, minWidth: 180, align: "center",
templet: function (d) {
if (d.yzylx) {
if (d.yzylx.length > 60) {
return '<span title="' + d.yzylx + '">' + d.yzylx.substring(0, 60) + '...</span>'
} else {
return '<span title="' + d.yzylx + '">' + d.yzylx + '</span>'
}
} else {
return '';
}
}
}
)
addCols(tableCols,5);
break;
case 6:
$('.riskLevel').removeClass('layui-hide');
tableCols = [
{ title: "序号", width: 100,unresize: true, sort: true,align: "center",
templet: function (d) {
return (page - 1) * limit + d.LAY_INDEX;
}
},
{ field: "org", title: "建管单位",unresize: false,sort: true, width: 150, align: "center",
},
{ field: "riskLevel", title: "风险等级",unresize: false, width: 150, sort: true, align: "center",
templet: function (d) {
return setRiskLevelColor(d.riskLevel);
}
},
{title: "监控",width: 100,unresize: false,align: "center", sort: true,
templet: function (d) {
let html = '';
if (d.isOnline === '不在线') {
html += '<img src="../../img/common-icon/ball-offline.png">'
} else {
html += ''
}
return html;
}
},
{ field: "proName", title: "工程名称", unresize: false, sort: true, minWidth: 200, align: "center", },
{field: 'fzrName', title: "班组长", unresize: false, sort: true, width: 200, align: "center",
templet: function (d) {
return "<span>" + d.fzrName + "</span><br/><span>" + d.phone + "</span>";
},
}
];
addCols(tableCols,7);
break;
case 7:
tableCols = [
{ title: "序号",width: 80,unresize: true, align: "center",
templet: function (d) {
return (page - 1) * limit + d.LAY_INDEX;
}
},
{ field: "org", title: "建管单位", unresize: false, sort: true, width: 180, align: "center",},
{field: "proName",title: "工程名称", unresize: false, sort: true,width: 180, align: "center", },
{field: 'fzrName',title: "班组长",unresize: false, sort: true, width: 150,align: "center",
templet: function (d) {
return "<span>" + d.fzrName + "</span><br/><span>" + d.phone + "</span>";
},
},
{ field: "macId", title: "设备编码", unresize: false, sort: true,width: 215, align: "center", },
{ field: "puid", title: "球机PUID", unresize: false, sort: true, width: 215,align: "center",},
{ field: "qjXh", title: "球机信号值", unresize: false, sort: true, width: 200, align: "center", }
];
addCols(tableCols,8);
break;
default:
tableCols.push({ field: "content", title: "工作内容", unresize: false, sort: true, minWidth: 200, 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 '';
}
}
}
)
break;
}
return tableCols;
}
/**
* 添加模块
*/
function addCols(tableCols,type){
if(user.isSup=='1' ){//管理员
tableCols.push(
{field: "handleState",title: "是否处理",unresize: false,sort: true,minWidth: 200,align: "center", templet:function(d){
if(d.handleState){return '已处理';}else{return '未处理';}
}},
{field: "handleUser",title: "处理人",unresize: false,sort: true,minWidth: 200,align: "center",templet:function(d){
if(d.userName){return d.userName;}else{return d.handleUser;}
} },
{field: "handleState",title: "处理结果",unresize: false,sort: true,minWidth: 200,align: "center",templet:function(d){
if(d.handleState){if(d.handleState==1){return '符合'}else{return '不符合'}}else{return ''}
} },
{field: "handleTime",title: "处理时间",unresize: false,sort: true,minWidth: 200,align: "center", },
{field: "handelRemark",title: "处理备注",unresize: false,sort: true,minWidth: 200,align: "center", }
)
}else if(user.isSup=='2'){
tableCols.push(
{field: "handleState",title: "是否处理",unresize: false,sort: true,minWidth: 200,align: "center", templet:function(d){
if(d.handleState){return '已处理';}else{return '未处理';}
}
},
{title: "操作",unresize: false,sort: true,minWidth: 200,align: "center",templet:function(d){
var handleId=d.handleId;
var handleState=d.handleState;
var handelRemark=d.handelRemark;
if(handelRemark==null){handelRemark='';}
if(handleState==null){handleState='';}
if(handleId==null){handleId='';}
return '<i class="layui-icon layui-icon-read" onclick="opendata('+d.classId+','+type+',\''+handleId+'\',\''+handleState+'\',\''+handelRemark+'\')"></i>'
}},
)
}
}
function updateFzrData(fzrNum, isHl) {
let formData = {
fzrNum: fzrNum,
type: type,
isHl: isHl
}
console.log(formData);
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify(formData))
},
type: "post",
url: dataUrl + 'proteam/pot/early/updateFzrData?token=' + token,
data: formData,
dataType: "json",
success: function (data) {
pages(1, limitSize, type);
getEarlyNum();
},
error: function (data) {
console.error("修改失败");
}
});
}
function getEarlyNum() {
let params = getReqParams();
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify(params))
},
url: dataUrl + "proteam/pot/early/getEarlyNum?token=" + token,
data: params,
type: 'POST',
async: false,
success: function (result) {
console.log(result);
$.each(result.data, function (index, item) {
$('[value=' + index + ']').find('span').text("(" + item + ")");
})
}, error: function () {
}
});
}
function opendata(classId,type,handelId,handleState,handelRemark){
console.log(classId,type,handelId,handleState,handelRemark);
layer.open({
title: '告警处置',
type: 2,
area: ['30%','40%'],
content: '../../html/earlyWarning/warnSure.html',
cancel: function(){
},
btn: ['确定', '取消'] ,//只是为了演示
success: function (layero, index) {
var body = layer.getChildFrame('body', index);
var iframeWin = window[layero.find('iframe')[0]['name']];//获得iframe页的窗口对象执行iframe页的方法
iframeWin.setForm(classId,type,handelId,handleState,handelRemark);//调用子页面的方法,页面锁定
}
,yes: function(index,leyuo){
var body = layer.getChildFrame('body', index);
body.find('#add-data').click();
}
,btn2: function(){
layer.closeAll();
}
});
}
function timestamp() {
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
let hours = date.getHours();
let minutes = date.getMinutes();
let seconds = date.getSeconds()
if (month < 10) {
month = "0" + month;
}
if (day < 10) {
day = "0" + day;
}
if (hours < 10) {
hours = "0" + hours;
}
if (minutes < 10) {
minutes = "0" + minutes;
}
if (seconds < 10) {
seconds = "0" + seconds;
}
return year + "-" + month + "-" + day + " " + hours + "-" + minutes + "-" + seconds
}