| var year = '2020'; | 
| var month = '05'; | 
| var day = '01'; | 
| var hour = '08'; | 
| var minute = '00'; | 
| var second = '00'; | 
| var week = '星期一'; | 
|   | 
| setInterval(function () { | 
|     setDate(); | 
|     initlineChart(); | 
|     initPieChart(); | 
| }, 1000); | 
|   | 
| setInterval(function () { | 
|     getOther(); | 
| }, 500); | 
|   | 
| function setDate() { | 
|     getDate(); | 
|     $('#bar-year').text(year); | 
|     $('#bar-month').text(month); | 
|     $('#bar-day').text(day); | 
|     $('#bar-hour').text(hour); | 
|     $('#bar-minute').text(minute); | 
|     $('#bar-second').text(second); | 
|     $('#bar-week').text(week); | 
| } | 
|   | 
| /** | 
|  * 获取时间 | 
|  */ | 
| function getDate() { | 
|     http.get(baseUrl+"/monitor/date", null, function (res) { | 
|         if (res.code === 200){ | 
|             year = res.data.year; | 
|             month = res.data.month; | 
|             day = res.data.day; | 
|             hour = res.data.hour; | 
|             minute = res.data.minute; | 
|             second = res.data.second; | 
|             week = res.data.week; | 
|         } else if (res.code === 403){ | 
|             parent.location.href = baseUrl+"/login"; | 
|         }  else { | 
|             layer.msg("连接服务器失败", {icon: 2}); | 
|         } | 
|     }) | 
|   | 
| } | 
|   | 
| /** | 
|  * 获取其他数据 | 
|  */ | 
| function getOther() { | 
|     http.get(baseUrl+"/monitor/other", {crnId: getUrlVal("crnId"), ledId: getUrlVal("ledId")}, function (res) { | 
|         if (res.code === 200){ | 
|   | 
|             // 左 | 
|             $('#xDistance').text(res.data.xDistance); | 
|             $('#yDistance').text(res.data.yDistance); | 
|             $('#xDuration').text(res.data.xDuration); | 
|             $('#yDuration').text(res.data.yDuration); | 
|   | 
|             // 中上 | 
|             crnChartOption.series[0].data[0].value = res.data.xSpeed - 0; // 走行 | 
|             crnChartOption.series[1].data[0].value = res.data.ySpeed - 0; // 升降 | 
|             crnChartOption.series[2].data[0].value = res.data.zSpeed - 0; // 叉牙 | 
|             crnChartOption.series[3].data[0].value = res.data.forkPos - 0; // 货叉位置 | 
|             // crnChartOption.series[0].data[0].value = (Math.random()*100).toFixed(2) - 0; | 
|             // crnChartOption.series[1].data[0].value = (Math.random()*7).toFixed(2) - 0; | 
|             // crnChartOption.series[2].data[0].value = (Math.random()*2).toFixed(2) - 0; | 
|             // crnChartOption.series[3].data[0].value = (Math.random()*2).toFixed(2) - 0; | 
|             crnChart.setOption(crnChartOption); | 
|   | 
|             // 中下 | 
|             if (res.data.isShow) { | 
|                 $('#banner').hide(); | 
|                 $('#led-content').show(); | 
|                 $('#led-p-content').text(res.data.content); | 
|             } else { | 
|                 $('#led-content').hide(); | 
|                 $('#banner').show(); | 
|                 $('#led-p-content').text(""); | 
|             } | 
|   | 
|         } else if (res.code === 403){ | 
|             parent.location.href = baseUrl+"/login"; | 
|         }  else { | 
|             layer.msg("连接服务器失败", {icon: 2}); | 
|         } | 
|     }) | 
|   | 
| } | 
|   | 
| // 全屏 ----------------------------------------------------------------------- | 
|   | 
| //开始全屏 | 
| function full() { | 
|     var docElm = document.documentElement; | 
|     //W3C | 
|     if (docElm.requestFullscreen) { | 
|         docElm.requestFullscreen(); | 
|     } | 
|     //FireFox | 
|     else if (docElm.mozRequestFullScreen) { | 
|         docElm.mozRequestFullScreen(); | 
|     } | 
|     //Chrome等 | 
|     else if (docElm.webkitRequestFullScreen) { | 
|         docElm.webkitRequestFullScreen(); | 
|     } | 
|     //IE11 | 
|     else if (elem.msRequestFullscreen) { | 
|         elem.msRequestFullscreen(); | 
|     } | 
| } | 
|   | 
| //退出全屏 | 
| function exitFull() { | 
|     if (document.exitFullscreen) { | 
|         document.exitFullscreen(); | 
|     } | 
|     else if (document.mozCancelFullScreen) { | 
|         document.mozCancelFullScreen(); | 
|     } | 
|     else if (document.webkitCancelFullScreen) { | 
|         document.webkitCancelFullScreen(); | 
|     } | 
|     else if (document.msExitFullscreen) { | 
|         document.msExitFullscreen(); | 
|     } | 
| } | 
|   | 
| //事件监听 | 
| document.addEventListener("fullscreenchange", function () { | 
|     try { | 
|         fullscreenState.innerHTML = (document.fullscreen) ? "" : "not "; | 
|     } catch (e) {} | 
| }, false); | 
| document.addEventListener("mozfullscreenchange", function () { | 
|     fullscreenState.innerHTML = (document.mozFullScreen) ? "" : "not "; | 
| }, false); | 
| document.addEventListener("webkitfullscreenchange", function () { | 
|     fullscreenState.innerHTML = (document.webkitIsFullScreen) ? "" : "not "; | 
| }, false); | 
| document.addEventListener("msfullscreenchange", function () { | 
|     fullscreenState.innerHTML = (document.msFullscreenElement) ? "" : "not "; | 
| }, false); | 
| document.onkeyup = function (e) { | 
|     if (window.event)//如果window.event对象存在,就以此事件对象为准 | 
|         e = window.event; | 
|     var key = e.charCode || e.keyCode; | 
|     if (key === 13 || key === 49 || key === 97) { | 
|         full(); | 
|     } else if (key === 50 || key === 98) { | 
|         exitFull(); | 
|     } | 
| } |