// 首页风险点定时刷新 function timedRefresh() { if (scheduledTask) { getRiskMapAjax(1) getTicketNumAjax(); getProNumByType(proType, '', 1); } else { scheduledTask = true; } setTimeout(timedRefresh, 1000 * 60 * 2); } // 首页地图天气定时刷新 function timedRefresh2() { if (scheduledTask2) { getWeatherMapAjax(1); } else { scheduledTask2 = true; } setTimeout(timedRefresh2, 1000 * 60 * 2); } /*周计划echarts数据--请求*/ function getWeekRiskNumAjax() { Ajax().post({ url: dataUrl + 'proteam/pot/home/getWeekRiskNum', headers: { "encrypt": sm3(JSON.stringify({ curryDay: $('#weekRiskDate').val() })) }, data: { curryDay: $('#weekRiskDate').val() }, async: true, success: function (result) { if (result.code === 200) { if (result.data) { initEchartsTwo(result.data.data, result.data.data1, result.data.data2); } } else { initEchartsTwo([], [], [], []); } }, error: function () { initEchartsTwo([], [], [], []); } }); } /*作业票echarts数据--请求1*/ function getTicketNumAjax() { Ajax().post({ url: dataUrl + 'proteam/pot/home/getTicketNumByType', headers: { "encrypt": sm3(JSON.stringify({ 'proType': proType })) }, data: { proType: proType }, async: true, success: function (result) { if (result.code === 200) { if (result.data) { let two = result.data.two, three = result.data.three, four = result.data.four, five = result.data.five, ticketNumB = result.data.ticketNumB, ticketNumA = result.data.ticketNumA; $('#two').html('二级:' + two) $('#three').html('三级:' + three) $('#four').html('四级:' + four) $('#five').html('五级:' + five) } } else { } }, error: function () { } }); } /*站班会--请求*/ function mergeData() { let objParam = { type: classType, curryDay: $('#classDate').val() } $.ajax({ url: dataUrl + 'proteam/pot/home/getClassMettingData?token=' + token, type: 'post', headers: { "encrypt": sm3(JSON.stringify(objParam)) }, data: objParam, async: true, success: function (result) { if (result.code === 200) { if (result.data) { initEchartsFive(result.data.data, result.data.value); } } else if (result.code === 500) { return layer.alert(result.msg, { icon: 2 }) } else if (result.code === 401) { logout(1); } }, }); } /** * 查询杆塔数据集合 * 标段工程编码 */ function getGtList(){ $.ajax({ url: dataUrl + 'proteam/pot/home/getGtList?token=' + token, data: { proNo:"2222" }, type: 'post', success: function (result) { gtList=result.data; }, }); } /*人员统计echarts--请求*/ function getDayAttendanceNumAjax(type, clickCityCode) { let objParam = {}; if (type === 2) { objParam.orgId = clickCityCode; } $.ajax({ url: dataUrl + 'proteam/pot/home/getClassPeopleNum?token=' + token, data: objParam, headers: { "encrypt": sm3(JSON.stringify(objParam)) }, type: 'post', async: true, success: function (result) { if (result.code === 200) { if (result.data) { if (type === 1) { initEchartsSix(result.data.all, result.data.data) } else if (type === 2) { $('#attendanceNum').html(result.data.data[0].bzgg); $('#attendanceNum2').html(result.data.data[1].ttzy); $('#attendanceNum3').html(result.data.data[2].ptzy); } } } else if (result.code === 500) { return layer.alert(result.msg, { icon: 2 }) } else if (result.code === 401) { logout(1); } }, }); } /*地图作业点-请求*/ function getRiskMapAjax(type) { $.ajax({ url: dataUrl + 'proteam/pot/home/getRiskMap?token=' + token, data: {}, headers: { "encrypt": sm3(JSON.stringify({})) }, type: 'post', async: true, success: function (result) { mapPointList.splice(0, mapPointList.length) mainMapPointList.splice(0, mainMapPointList.length) if (result.code === 200) { if (result.data) { let allNum = 0, twoNum = 0, threeNum = 0, fourNum = 0; $.each(result.data, function (index, item) { if (item.riskType === '2') { twoNum++; } else if (item.riskType === '3') { threeNum++; } else if (item.riskType === '4' || item.riskType === '5') { fourNum++; } 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); if (type === 1) { // 定时刷新时使用 searchRiskData(); } else { map(mapPointList); } } else { if (type === 1) { // 定时刷新时使用 searchRiskData(); } else { map(mapPointList); } } } }, }); function setRiskNumByMap(allNum, twoNum, threeNum, fourNum) { $('#allNum').html(allNum); $('#twoNum').html(twoNum); $('#threeNum').html(threeNum); $('#fourNum').html(fourNum); } } /*地图天气-请求*/ function getWeatherMapAjax(type) { $.ajax({ url: dataUrl + 'proteam/pot/home/getWeatherMap?token=' + token, data: {}, headers: { "encrypt": sm3(JSON.stringify({})) }, type: 'post', async: true, success: function (result) { weatherList.splice(0, weatherList.length) if (result.code === 200) { if (result.data) { $.each(result.data, function (index, item) { item.value = [parseFloat(item.lon), parseFloat(item.lat)]; item.weatherDes = item.dayTemp + ' ' + item.weather; weatherList.push(JSON.parse(JSON.stringify(item))) }) } if (type === 1) { searchRiskData(); } } }, }); } /*根据日期获取各地市风险等级数量*/ function getRiskByDateAjax(clickCityCode, dateType) { $.ajax({ url: dataUrl + 'proteam/pot/home/getRiskByDate?token=' + token, headers: { "encrypt": sm3(JSON.stringify({ orgId: clickCityCode, dateType: dateType })) }, data: { orgId: clickCityCode, dateType: dateType }, type: 'post', async: true, success: function (result) { console.log(result) if (result.code === 200) { if (result.data) { if (dateType === '0') { $('#lastTwoRiskNum').html(result.data.twoNum); $('#lastThreeRiskNum').html(result.data.threeNum); $('#lastFourRiskNum').html(result.data.fourNum); $('#lastFiveRiskNum').html(result.data.fiveNum); } else if (dateType === '1') { $('#dayTwoRiskNum').html(result.data.twoNum); $('#dayThreeRiskNum').html(result.data.threeNum); $('#dayFourRiskNum').html(result.data.fourNum); $('#dayFiveRiskNum').html(result.data.fiveNum); } } } }, }); } /*电子地图-天气预警-根据用户信息获取当天的天气预警情况*/ function getWeatherAlertAjax() { var orgId = ""; var user = JSON.parse(decrypt(us)); if (user.isSup != '1') { orgId = user.orgId; } $.ajax({ url: dataUrl + 'proteam/pot/home/getWeatherAlert?token=' + token, headers: { "encrypt": sm3(JSON.stringify({ orgId: orgId })) }, data: { orgId: orgId, }, type: 'post', async: true, success: function (result) { if (result.code === 200) { if (result.data && result.data.length > 0) { setTimes(result.data); } else { $("#outText").text('今日暂无预警信息'); $("#outText2").text('今日暂无预警信息'); } } else if (result.code === 500) { layer.alert(result.msg, { icon: 2 }) } else if (result.code === 401) { logout(1); } }, }); } //定时器添加数据 function setTimes(data) { var intnum = 0; this.timer = window.setInterval(() => { console.log(intnum); if (intnum == data.length) { intnum = 0; } var text = data[intnum]; $("#outText").empty(); $("#outText").text(text); $("#outText2").empty(); $("#outText2").text(text); intnum++; }, 30000) } /*日计划-请求*/ function getDayPlanNumAjax() { Ajax().post({ url: dataUrl + 'proteam/pot/home/getDayPlanNum', headers: { "encrypt": sm3(JSON.stringify({ proType: proType, dayType: dayType })) }, data: { proType: proType, dayType: dayType }, async: true, success: function (result) { if (result.msg === 'success') { if (result.data) { $('#totalNum').html(result.data.totalDayNum) $('#executedDayNum').html(result.data.executedDayNum) initEchartsOne(result.data.listMap) } } else { $('.count').html('0') $('.count2').html('0') initEchartsOne(null) } }, error: function () { $('.count').html('0') $('.count2').html('0') initEchartsOne(null) } }); } /*根据工程类型和地市编码获取在建工程、在施工程、停工工程数量--请求*/ function getProNumByType(proType, orgId, type) { let objParam = { proType: proType, orgId: orgId } $.ajax({ url: dataUrl + 'proteam/pot/home/getProNumByType?token=' + token, type: 'post', headers: { "encrypt": sm3(JSON.stringify(objParam)) }, data: objParam, async: true, success: function (result) { if (result.code === 200) { if (result.data) { if (type === 1) { $('#buildNum').html(result.data.zjNum); $('#buildNum2').html(result.data.allZjNum);//总数量 $('#consNum').html(result.data.sgNum); $('#stopNum').html(result.data.tgNum); $('#dkgNum').html(result.data.dkgNum); } else if (type === 2) { $('#cityProNum').html(result.data.zjNum); $('#cityProNum2').html(result.data.sgNum); $('#cityProNum3').html(result.data.tgNum); $('#cityProNum4').html(result.data.dkgNum); } } } else if (result.code === 500) { return layer.alert(result.msg, { icon: 2 }) } else if (result.code === 401) { logout(1); } }, }); } // 获取预警信息 function getTodayWarnInfo() { let user = getUser(); let params = { currentUserId: user.userId + '', isSup: user.isSup, currentUserOrgId: user.orgId } $.ajax({ headers: { "encrypt": sm3(JSON.stringify(params)) }, url: dataUrl + 'proteam/pot/early/getTodayWarnInfo?token=' + token, data: params, type: 'POST', async: true, success: function (result) { // scrollEarlyData(null); scrollEarlyData(result.data); } }); } let scrollMove = null; // 设置预警信息 function scrollEarlyData(data) { let html = '', cent = ''; let scrollTopValue = 0, earlyTotalNum = 0, earlyDealNum = 0, earlyNoDealNum = 0; if (data && data.length > 0) { $.each(data, function (index, item) { earlyTotalNum = earlyTotalNum + 1; if (item.handleId) { cent += '
' + getTypeValue(item.type) + '
'; cent += '' + setHandleStatus(item.handleId) + '
'; cent += '' + (item.handleTime ? item.handleTime : '--') + '
'; cent += '' + getTypeValue(item.type) + '
'; html += '' + setHandleStatus(item.handleId) + '
'; html += '' + (item.handleTime ? item.handleTime : '--') + '
'; html += '