IntelligentRecognition/ah-jjsp-web/.svn/pristine/5e/5e8fa0b50cb1f396b3c44822090...

344 lines
11 KiB
Plaintext
Raw Normal View History

2024-05-24 16:09:40 +08:00
// 首页数据定时刷新-5min 刷新一次
function timedRefresh() {
if (scheduledTask) {
loadDayPlanAjax('1');
loadDutyTaskAjax();
loadDutyProgressAjax();
} else {
scheduledTask = true;
}
setTimeout(timedRefresh, 1000 * 60 * 5);
}
// 工程统计
function loadProNumAjax() {
let url = dataUrl + 'proteam/pot/sup/getProMaps';
let params = {
'isSup': user.isSup,
'orgId': user.orgId
};
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
if (parseInt(result.code) == 200) {
setProNum(result);
} else if (parseInt(result.code) === 500) {
layer.alert('服务异常', { icon: 2 })
} else if (parseInt(result.code) === 401) {
logout(1);
}
}, function (xhr) {
});
// 工程统计数量赋值
function setProNum(obj) {
$('#proTotalNum').html(obj.allNum);
$('#workNum').html(obj.sgNum);
$('#noWorkNum').html(obj.wsgNum);
$('#stopNum').html(obj.TgNum);
initEchartsOne(obj.allNum, obj.sgNum, obj.wsgNum, obj.TgNum);
}
}
// 1.周计划/2.计划趋势/3.全省周计划
function loadWeekPlanAjax(type) {
let url = dataUrl + 'proteam/pot/sup/getWeekMaps';
let params = {
'isSup': user.isSup,
'orgId': user.orgId,
'type': type
};
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
console.log(result);
if (parseInt(result.code) == 200) {
setWeekPlan(result);
} else if (parseInt(result.code) === 500) {
layer.alert('服务异常', { icon: 2 })
} else if (parseInt(result.code) === 401) {
logout(1);
}
}, function (xhr) {
});
// 工程统计数量赋值
function setWeekPlan(obj) {
if (type === '1') {
let data = obj.data;
initEchartsFive(data[0], data[1], data[2], data[3]);
$('#weekPlanNum').html(parseInt(data[0]) + parseInt(data[1]) + parseInt(data[2]) + parseInt(data[3]));
} else if (type === '2') {
initEchartsThree(obj.times, obj.twoList, obj.threeList);
}
}
}
// 日计划
function loadDayPlanAjax(type) {
let url = dataUrl + 'proteam/pot/sup/getDayPlanMaps';
let params = {
'isSup': user.isSup,
'orgId': user.orgId,
'type': type
};
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
if (parseInt(result.code) == 200) {
setDayPlanNum(result);
} else if (parseInt(result.code) === 500) {
layer.alert('服务异常', { icon: 2 })
} else if (parseInt(result.code) === 401) {
logout(1);
}
}, function (xhr) {
});
// 日计划数量赋值
function setDayPlanNum(obj) {
if (type === '1') {
$('#dayTotalNum').html(obj.allNum);
$('#dayDoNum').html(obj.yzxNum);
$('#dayNoDoNum').html(obj.wzxNum);
$('#wzxNum').html(obj.wzxNum);
$('#yhsNum').html(obj.HsNum);
$('#whsNum').html(obj.WhsNum);
initEchartsEight((obj.HsNum / obj.wzxNum));
}
}
}
// 值班任务
function loadDutyTaskAjax() {
let url = dataUrl + 'proteam/pot/sup/getDutyTaskMaps';
let params = {
'isSup': user.isSup,
'orgId': user.orgId
};
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
if (parseInt(result.code) == 200) {
setDutyTaskNum(result);
} else if (parseInt(result.code) === 500) {
layer.alert('服务异常', { icon: 2 })
} else if (parseInt(result.code) === 401) {
logout(1);
}
}, function (xhr) {
});
// 值班任务数量赋值
function setDutyTaskNum(obj) {
$('#todayTaskTotalNum').html(obj.allNum);
$('#todayTaskXSNum').html(obj.xs);
$('#todayTaskWXSNum').html(obj.noXs);
$('#yzwzNum').html(obj.YZWZ);
$('#ybwzNum').html(obj.YBWZ);
$('#xfNum').html(obj.XFWZ);
$('#zgNum').html(obj.YZG);
}
}
// 值班进度
function loadDutyProgressAjax() {
let url = dataUrl + 'proteam/pot/sup/getDutySchedule';
let params = {
'isSup': user.isSup,
'orgId': user.orgId
};
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
if (parseInt(result.code) == 200) {
setDutyTaskNum(result);
} else if (parseInt(result.code) === 500) {
layer.alert('服务异常', { icon: 2 })
} else if (parseInt(result.code) === 401) {
logout(1);
}
}, function (xhr) {
});
// 值班进度赋值
function setDutyTaskNum(obj) {
let num = 0, totalNum = 0;
if (obj.taskList && obj.taskList.length > 0) {
$.each(obj.taskList, function (index, item) {
totalNum += parseInt(item)
})
}
if (obj.xsList && obj.xsList.length > 0) {
$.each(obj.xsList, function (index, item) {
num += parseInt(item)
})
}
initEchartsFour(num, totalNum);
initEchartsSix(obj.userList, obj.taskList, obj.xsList, obj.wzList);
}
}
// 人员统计
function loadPersonNumAjax() {
let url = dataUrl + 'proteam/pot/sup/getPeopleMaps';
let params = {
'isSup': user.isSup,
'orgId': user.orgId,
'dateTimes': getNowTime()
};
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
setPersonNum(result);
}, function (xhr) {
});
// 人员统计赋值
function setPersonNum(obj) {
$('#totalPersonNum').html(obj.allNUM)
// $('#rkPersonNum').html()
// $('#wrkPersonNum').html()
initEchartsSeven(obj.ptzy, obj.ttzy, obj.bzgg);
}
}
// 告警信息
function loadEarlyInfoAjax() {
let url = dataUrl + 'proteam/pot/early/getTodayWarnInfo';
let params = {
'isSup': user.isSup,
'orgId': user.orgId,
'userId': user.userId
};
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
setEarlyWarnInfo(result.data);
}, function (xhr) {
});
// 预警信息
function setEarlyWarnInfo(result) {
function getTypeValue(type) {
if (type === '4') {
return '人数变化大';
} else if (type === '5') {
return '工序变化';
} else if (type === '6') {
return '作业类型变化';
} else if (type === '7') {
return '球机异常';
} else if (type === '8') {
return '球机信号差';
} else if (type === '9') {
return '今日未施工';
}
}
let html = '<div id="early-box" class="list_lh"><ul>';
if (result && result.length > 0) {
$.each(result, function (index, item) {
if (item.handleId) { // 已处理
let names = '';
if (item.userName) {
names = item.userName
} else {
names = item.handleUser
}
html += '<li class="layout deal">' +
'<div class="early-info layout">' +
'<div class="title-circle layout"><span class="layui-badge-dot layui-bg-green"></span></div>' +
'<div class="proInfo">' +
'<p data-mtpis="' + item.proName + '">' + item.proName + '</p>' +
'<p>' + getTypeValue(item.type) + '</p>' +
'</div>' +
'</div>' +
'<div class="early-deal-detail layout">' +
'<p>已处理 ' + (names) + '</p>' +
'<p>' + item.handleTime + '</p>' +
'</div>' +
'</li>'
} else { // 未处理
html += '<li class="layout no-deal">' +
'<div class="early-info layout">' +
'<div class="title-circle layout"><span class="layui-badge-dot"></span></div>' +
'<div class="proInfo">' +
'<p data-mtpis="' + item.proName + '">' + item.proName + '</p>' +
'<p>' + getTypeValue(item.type) + '</p>' +
'</div>' +
'</div>' +
'<div class="early-deal-detail layout">' +
'<p>未处理</p>' +
'</div>' +
'</li>'
}
})
} else {
html += '<li class="layout" style="font-size:16px;justify-content: center;">无数据</li>';
}
html += '</ul></div>'
$('#right-center').children('#early-box').remove()
$('#early-title').after(html);
$("#early-box").myScroll({
speed: 40, //数值越大,速度越慢
rowHeight: 58 //li的高度
});
}
}
// 违章下发审核
function loadVoiCheckAjax() {
let url = dataUrl + 'proteam/pot/sup/getViolationAudit';
let params = {
'isSup': user.isSup,
'orgId': user.orgId
};
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
if (parseInt(result.code) == 200) {
setVoiData(result.data);
} else if (parseInt(result.code) === 500) {
layer.alert('服务异常', { icon: 2 })
} else if (parseInt(result.code) === 401) {
logout(1);
}
}, function (xhr) {
});
// 违章下发审核赋值
function setVoiData(dataList) {
let html = '<div id="voi-box" class="list_lh"><ul>';
if (dataList && dataList.length > 0) {
$.each(dataList, function (index, item) {
if(item.state==7){
html += '<li class="layout">' +
'<p data-mtpis="' + item.proName + '">' + item.proName + '</p>' +
'<p>' + item.noticeLevel + '</p>' +
'<p>' + item.createDay + '</p>' +
'<p>' + (item.bindName ? item.bindName : item.userName) + '</p>' +
'<p onclick=openVoiCheckPage(' + item.id + ',\'' + item.classId + '\',"1")>' + item.status + '</p>' +
'</li>';
}else{
html += '<li class="layout" style="background-color:grey" >' +
'<p data-mtpis="' + item.proName + '">' + item.proName + '</p>' +
'<p>' + item.noticeLevel + '</p>' +
'<p>' + item.createDay + '</p>' +
'<p>' + (item.bindName ? item.bindName : item.userName) + '</p>' +
'<p >' + item.status + '</p>' +
'</li>';
}
})
} else {
html += '<li class="layout" style="font-size:16px;justify-content: center;">无数据</li>';
}
html += '</ul></div>';
$('#right-bottom').children('#voi-box').remove()
$('#voi-ul-title').after(html);
$("#voi-box").myScroll({
speed: 40, //数值越大,速度越慢
rowHeight: 58 //li的高度
});
}
}