// 首页数据定时刷新-5min 刷新一次 function timedRefresh() { if (scheduledTask) { loadRiskMapAjax(1) loadRiskNumAjax(1); loadEarlyNumAjax(); } else { scheduledTask = true; } setTimeout(timedRefresh, 1000 * 60 * 5); } // 电子地图 function loadRiskMapAjax(type) { let url = dataUrl + 'proteam/pot/city/getCityMaps'; let params = { 'isSup': user.isSup, 'orgId': user.orgId }; ajaxRequest(url, "POST", params, true, function () { }, function (result) { if (result.code === 200) { mapPointList.splice(0, mapPointList.length) mainMapPointList.splice(0, mainMapPointList.length) if (result.data && result.data.length > 0) { let allNum = 0, twoNum = 0, threeNum = 0, fourNum = 0, fiveNum = 0; $.each(result.data, function (index, item) { if (item.riskType === '2') { twoNum++; } else if (item.riskType === '3') { threeNum++; } else if (item.riskType === '4') { fourNum++; } else if (item.riskType === '5') { fiveNum++; } allNum++; item.value = parseInt(item.riskType) item.coordinate = [parseFloat(item.lon), parseFloat(item.lat)] mapPointList.push(item) mainMapPointList.push(JSON.parse(JSON.stringify(item))) }) setRiskNumByMap(allNum, twoNum, threeNum, fourNum, fiveNum); if (type === 1) { // 定时刷新时使用 mapSearch(); map2(mapPointList); } else { setCityMap(user.orgId, user.isSup, mapPointList); } } else { if (type === 1) { // 定时刷新时使用 mapSearch(); map2(mapPointList); } else { setCityMap(user.orgId, user.isSup, mapPointList); } } } else if (result.code === 500) { layer.alert(result.msg, { icon: 2 }) } else if (result.code === 401) { logout(1); } }, function (xhr) { }); // 设置电子地图风险作业点数量 function setRiskNumByMap(allNum, twoNum, threeNum, fourNum, fiveNum) { $('#allNum').html(allNum); $('#twoNum').html(twoNum); $('#threeNum').html(threeNum); $('#fourNum').html(fourNum); $('#fiveNum').html(fiveNum); } } // 工程统计 function loadProNumAjax() { let url = dataUrl + 'proteam/pot/city/getProMaps'; let params = { 'isSup': user.isSup, 'orgId': user.orgId }; ajaxRequest(url, "POST", params, true, function () { }, function (result) { if (result.code === 200) { setProNum(result); } else if (result.code === 500) { layer.alert(result.msg, { icon: 2 }) } else if (result.code === 401) { logout(1); } }, function (xhr) { }); // 工程统计数量赋值 function setProNum(obj) { $('#zjNum').html(obj.zjPro); $('#zsNum').html(obj.zsPro); $('#tgNum').html(obj.tgPro); $('#wgNum').html(obj.wgPro); } } // 作业票 function loadTicketNumAjax() { let url = dataUrl + 'proteam/pot/city/getTicketMaps'; let params = { 'isSup': user.isSup, 'orgId': user.orgId }; ajaxRequest(url, "POST", params, true, function () { }, function (result) { if (result.code === 200) { setTicketNum(result); } else if (result.code === 500) { layer.alert(result.msg, { icon: 2 }) } else if (result.code === 401) { logout(1); } }, function (xhr) { }); // 作业票数量赋值 function setTicketNum(obj) { $('#aTicketNum').html(obj.A); $('#bTicketNum').html(obj.B); } } // 风险情况 function loadRiskNumAjax(type) { let url = dataUrl + 'proteam/pot/city/getCityMaps'; let params = { 'isSup': user.isSup, 'orgId': user.orgId }; ajaxRequest(url, "POST", params, true, function () { }, function (result) { if (result.code === 200) { setRiskNum(result); } else if (result.code === 500) { layer.alert(result.msg, { icon: 2 }) } else if (result.code === 401) { logout(1); } }, function (xhr) { }); // 风险等级数量赋值 function setRiskNum(obj) { let num2 = obj.two, num3 = obj.three, num4 = obj.four, num5 = obj.five; if (type) { update2(num2), update3(num3), update4(num4), update5(num5); } else { update2 = $("#rollNumberList2").rollNumber(num2); update3 = $("#rollNumberList3").rollNumber(num3); update4 = $("#rollNumberList4").rollNumber(num4); update5 = $("#rollNumberList5").rollNumber(num5); } } } // 其他 function loadOtherAjax(type) { let url = dataUrl + 'proteam/pot/city/getWorkTeamMaps'; let params = { 'isSup': user.isSup, 'orgId': user.orgId, 'type': type }; ajaxRequest(url, "POST", params, true, function () { }, function (result) { if (result.code === 200) { setOtherData(result); } else if (result.code === 500) { layer.alert(result.msg, { icon: 2 }) } else if (result.code === 401) { logout(1); } }, function (xhr) { }); // 其他赋值 function setOtherData(obj) { if (type === '1') { $('#sgNum').html(obj.todayNum); $('#ggNum').html(obj.bzgg); $('#tsNum').html(obj.ttzy); $('#ptNum').html(obj.ptzy); initEchartsOne(obj.time, obj.nums); } else if (type === '2') { $('#teamNum').html(obj.today); initEchartsTwo(obj.time, obj.nums); } else if (type === '3') { console.log(obj); initEchartsThree(obj.time, obj.ANum, obj.BNum); } else if (type === '4') { initEchartsFour(obj.time, obj.twoRisk, obj.threeRisk, obj.fourRisk, obj.fiveRisk); } } } // 作业许可及销号 function loadXHNumAjax() { let url = dataUrl + 'proteam/pot/city/getTicketXhMaps'; let params = { 'isSup': user.isSup, 'orgId': user.orgId }; ajaxRequest(url, "POST", params, true, function () { }, function (result) { if (result.code === 200) { setXHNum(result); } else if (result.code === 500) { layer.alert(result.msg, { icon: 2 }) } else if (result.code === 401) { logout(1); } }, function (xhr) { }); // 作业许可及销号数量赋值 function setXHNum(obj) { $('#yxkNum').html(obj.permit); $('#bxkNum').html(obj.notPermit); $('#yxhNum').html(obj.cancel); $('#wxhNum').html(obj.notCancel); } } // 周计划 function loadWeekPlanAjax() { let url = dataUrl + 'proteam/pot/city/getWeekPlanMaps'; let params = { 'isSup': user.isSup, 'orgId': user.orgId }; ajaxRequest(url, "POST", params, true, function () { }, function (result) { if (result.code === 200) { let obj = result; initEchartsFive(obj.twoRisk, obj.threeRisk, obj.foureRisk, obj.fiveRisk); let planNum = result.planNum; $('#weekPlanNum').html(planNum); } else if (result.code === 500) { initEchartsFive(0, 0, 0, 0); layer.alert(result.msg, { icon: 2 }) } else if (result.code === 401) { logout(1); } }, function (xhr) { initEchartsFive(0, 0, 0, 0); }); } // 预警提醒数量 function loadEarlyNumAjax() { let url = dataUrl + 'proteam/pot/city/getEarMaps'; let params = { 'isSup': user.isSup, 'currentUserOrgId': user.orgId, 'currentUserId':user.currentUserId }; ajaxRequest(url, "POST", params, true, function () { }, function (result) { if (result.code === 200) { setEarlyNumByType(result); } else if (result.code === 500) { layer.alert(result.msg, { icon: 2 }) setEarlyNumByType(null); } else if (result.code === 401) { logout(1); } }, function (xhr) { setEarlyNumByType(null); }); // 预警提醒数量赋值 function setEarlyNumByType(data) { if (data) { document.querySelector('#early-module' + (1) + '').setAttribute('data-notification', data.one); document.querySelector('#early-module' + (2) + '').setAttribute('data-notification', data.two); document.querySelector('#early-module' + (3) + '').setAttribute('data-notification', data.three); document.querySelector('#early-module' + (4) + '').setAttribute('data-notification', data.four); document.querySelector('#early-module' + (5) + '').setAttribute('data-notification', data.five); document.querySelector('#early-module' + (6) + '').setAttribute('data-notification', data.six); document.querySelector('#early-module' + (7) + '').setAttribute('data-notification', data.seven); } else { for (let i = 1; i <= 7; i++) { let earlyModule = document.querySelector('#early-module' + (i) + ''); earlyModule.setAttribute('data-notification', 0); } } } } // 预警提醒 function loadEarlyAjax(type) { let url = dataUrl + 'proteam/pot/early/getNoWorkByDay'; if (type === '1') { // 今日无施工 url = dataUrl + 'proteam/pot/early/getNoWorkByDay'; } else if (type === '2') { // 新进班组 url = dataUrl + 'proteam/pot/early/getNewTeam'; } else if (type === '3') { // 七日无施工 url = dataUrl + 'proteam/pot/early/getNoWorkBySeven'; } else if (type === '4') { // 人数变化大 url = dataUrl + 'proteam/pot/early/getTeamByPer'; } else if (type === '5') { // 工序变化 url = dataUrl + 'proteam/pot/early/getTeamByWork'; } else if (type === '6') { // 作业类型 url = dataUrl + 'proteam/pot/early/getTeamByJob'; } else if (type === '7') { // 球机异常 url = dataUrl + 'proteam/pot/early/getBallByUnusual'; } let params = { 'isSup': user.isSup, 'currentUserOrgId': user.orgId, 'currentUserId':user.currentUserId, 'pageNum': 1, 'pageSize': 10000, }; ajaxRequest(url, "POST", params, true, function () { }, function (result) { if (result.code === 200) { setEarlyDataByType(result.rows); } else if (result.code === 500) { layer.alert(result.msg, { icon: 2 }) setEarlyDataByType(null); } else if (result.code === 401) { logout(1); } }, function (xhr) { setEarlyDataByType(null); }); // 预警提醒赋值 function setEarlyDataByType(dataList) { $('#early-ul li:not(:first)').remove(); let html = ''; if (dataList && dataList.length > 0) { $.each(dataList, function (index, item) { html += '
' + item.proName + '
' + (item.fzrName + '
' + item.phone) + '
无数据