Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/visual/modules/bigScreen_weatherAndSafe.jsp

185 lines
10 KiB
Plaintext
Raw Permalink Normal View History

2026-01-16 14:13:44 +08:00
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page import="com.sipai.entity.base.ServerObject"%>
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
<%@page import="com.sipai.entity.visual.JspElement"%>
<%request.setAttribute("Type_GetValue", JspElement.Type_GetValue); %>
<%request.setAttribute("Type_GetHourHistory", JspElement.Type_GetHourHistory); %>
<%request.setAttribute("Type_Get7dayHistory", JspElement.Type_Get7dayHistory); %>
<%request.setAttribute("Type_GetModbus", JspElement.Type_GetModbus); %>
<%request.setAttribute("Type_GetHttp", JspElement.Type_GetHttp); %>
<!DOCTYPE html>
<!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD -->
<head>
<title></title>
<!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<script type="text/javascript">
//获取url地址根目录 当前taomcat下路径
function getRootPath(){
var pathName = window.location.pathname.substring(1);
// var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));
return window.location.protocol + '//' + window.location.host;
}
/* 请求数据 */
function getValue() {
$.post(ext.contextPath + '/plan/getJspWholeInfoByPlanLayoutId.do', { planLayoutId: "${param.planLayoutId}" }, function (data) {
// console.log("weather",data);
var myDate = new Date;
var year = myDate.getFullYear(); //获取当前年
var mon = myDate.getMonth() + 1; //获取当前月
var date = myDate.getDate(); //获取当前日
var h = myDate.getHours();//获取当前小时数(0-23)
var m = myDate.getMinutes();//获取当前分钟数(0-59)
if(parseInt(m)<10){
m="0"+m;
}
// var s = myDate.getSeconds();//获取当前秒
var week = myDate.getDay();
var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
// console.log(year, mon, date, weeks[week]);
$("#time").html(year + "年" + mon + "月" + date + "日" +" "+ weeks[week]+" "+h+":"+m);
if(data!=null&&data.length>0){
for(var i=0;i<data.length;i++){
if(data[i].elementCode=="weather"){
var temperature=data[i].weather.temperature;
var weatherqk=data[i].weather.weather;
var temprange=data[i].weather.temprange;
var airquality=data[i].weather.airquality;
var weatherImgUrl="/images/大屏";
if(weatherqk=="晴"){
weatherImgUrl+="/晴.png";
}else if(weatherqk=="阴"){
weatherImgUrl+="/阴.png";
}else if(weatherqk=="多云"){
weatherImgUrl+="/多云.png";
}else if(weatherqk.indexOf("雨")>0){
weatherImgUrl+="/雨.png";
}else if(weatherqk.indexOf("雪")>0){
weatherImgUrl+="/雪.png";
}
$('#weatherImg').css("background","url("+getRootPath()+""+weatherImgUrl+") 50% 50% / 70% 70% no-repeat");
$("#temperature").text(temperature);
var airqualitys=[];
airqualitys=airquality.split(" ");
$("#airquality1").text(airqualitys[0]);
$("#airquality2").text(airqualitys[1]);
$("#temprange").text(temprange);
}else if(data[i].elementCode=="safedays"){
var safedays=data[i].mPoint.parmvalue;
var safeday1=String(safedays).substring(0,1);
var safeday2=String(safedays).substring(1,2);
var safeday3=String(safedays).substring(2,3);
var safeday4=String(safedays).substring(3,4);
$("#safeday1").text(safeday1);
$("#safeday2").text(safeday2);
$("#safeday3").text(safeday3);
$("#safeday4").text(safeday4);
}
}
}
}, 'json');
}
/* 定时器 */
// setInterval(getValue, 300000); //<!--每隔5分钟刷新一次-->
setInterval(change, 30000); //每半分钟切换
setInterval(getValue, 3600000); //每一小时切换
function change(){
var myDate = new Date;
var year = myDate.getFullYear(); //获取当前年
var mon = myDate.getMonth() + 1; //获取当前月
var date = myDate.getDate(); //获取当前日
var h = myDate.getHours();//获取当前小时数(0-23)
var m = myDate.getMinutes();//获取当前分钟数(0-59)
if(parseInt(m)<10){
m="0"+m;
}
// var s = myDate.getSeconds();//获取当前秒
var week = myDate.getDay();
var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
// console.log(year, mon, date, weeks[week]);
$("#time").html(year + "年" + mon + "月" + date + "日" +" "+ weeks[week]+" "+h+":"+m);
}
/* 初始化 */
$(function () {
if('${param.backgroundColor}'=='transparent'){
document.body.style.backgroundColor = '${param.backgroundColor}';
}else{
document.body.style.backgroundColor = "#" + '${param.backgroundColor}';
}
document.getElementById("main").style.width = document.documentElement.clientWidth + "px";
document.getElementById("main").style.height = (document.documentElement.clientHeight-15) + "px";
getValue();
document.getElementById("safeImage").src = ""+getRootPath()+"/images/大屏/安全帽.png";
//console.log("height",document.body.scrollHeight);
});
</script>
</head>
<body style="width:100%;height:100%;margin:0;padding:0;overflow-x:hidden;overflow-y:hidden">
<div style="height:100%;width:100%;padding-top:15px;">
<div id="main" style="height:100%;width:100%;background:rgba(19,32,85,0.27);border-radius: 8px;">
<div id="time" style='float:left;width:100%;height:60px;line-height: 60px;color: #69F6F9;font-size: 28px;padding-left:30px;'>
</div>
<div style="float:left;width:50%;height: calc(100vh - 60px - 15px);line-height: calc(100vh - 60px - 15px);">
<div style="float:left;width:50%;height: calc(100vh - 60px - 15px);line-height: calc(100vh - 60px - 15px);">
<div id="weatherImg" style="float:left;width:100%;height: calc((100vh - 60px - 15px)*0.65);line-height: calc((100vh - 60px - 15px)*0.65);margin-left:10px;"></div>
<div id="temperature" style="float:left;width:100%;height: calc((100vh - 60px - 15px)*0.35);line-height: calc((100vh - 60px - 80px)*0.35);color: #69F6F9;font-size: 28px;text-align: center;padding-left: 18px;"></div>
</div>
<div style="float:left;width:50%;height: calc(100vh - 60px - 15px);line-height: calc(100vh - 60px - 15px);">
<div style="float:left;width:100%;height: calc((100vh - 60px - 15px)*0.65);line-height: calc((100vh - 60px - 15px)*0.65);">
<div id="airquality" style="width:100px;height:100px;border-radius:50%;border:solid #87E8E1 2px;margin-left:35px;margin-top:25px;background-color:#11002A;">
<div id="airquality1" style="float:left;width:100px;height:60px;line-height: 60px;color:#ffffff;text-align:center;font-size: 26px;padding-right: 5px;"></div>
<div id="airquality2" style="float:left;width:100px;height:40px;line-height: 20px;color:#ffffff;text-align:center;font-size: 26px;padding-right: 5px;"></div>
</div>
</div>
<div id="temprange" style="float:left;width:100%;height: calc((100vh - 60px - 15px)*0.35);line-height: calc((100vh - 60px - 80px)*0.35);color: #69F6F9;font-size: 28px;text-align: center;"></div>
</div>
</div>
<div style='float:left;width:50%;height: calc(100vh - 60px - 15px);line-height: calc(100vh - 60px - 15px);'>
<div style='float:left;width:100%;height: calc((100vh - 60px - 15px)/2);line-height: calc((100vh - 60px - 15px)/2);color:#ffffff;font-size: 30px;'>
<img id="safeImage" src="" style="z-index:-1;position:relative;width:60px;height:60px;"/> 已安全生产
</div>
<div style='float:left;width:100%;height: calc((100vh - 60px - 15px)/2);line-height: calc((100vh - 60px - 15px)/2);color:#ffffff;font-size: 26px;'>
<div style="float:left;width:20%;height:80%;padding-top:10px;padding-left: 4px;padding-right: 4px;">
<div id="safeday1" style='float:left;width:100%;height:100%;line-height: calc((100vh - 60px - 75px)/2);background: linear-gradient(180deg,#225b97, #0f2e5e);border-radius: 10px;box-shadow: 0px 1px 17px 0px rgba(255,255,255,0.5) inset, 0px -1px 6px 0px rgba(28,54,158,0.5) inset;color:#ffffff;text-align: center;'></div>
</div>
<div style="float:left;width:20%;height:80%;padding-top:10px;padding-left: 4px;padding-right: 4px;">
<div id="safeday2" style='float:left;width:100%;height:100%;line-height: calc((100vh - 60px - 75px)/2);background: linear-gradient(180deg,#225b97, #0f2e5e);border-radius: 10px;box-shadow: 0px 1px 17px 0px rgba(255,255,255,0.5) inset, 0px -1px 6px 0px rgba(28,54,158,0.5) inset;color:#ffffff;text-align: center;'></div>
</div>
<div style="float:left;width:20%;height:80%;padding-top:10px;padding-left: 4px;padding-right: 4px;">
<div id="safeday3" style='float:left;width:100%;height:100%;line-height: calc((100vh - 60px - 75px)/2);background: linear-gradient(180deg,#225b97, #0f2e5e);border-radius: 10px;box-shadow: 0px 1px 17px 0px rgba(255,255,255,0.5) inset, 0px -1px 6px 0px rgba(28,54,158,0.5) inset;color:#ffffff;text-align: center;'></div>
</div>
<div style="float:left;width:20%;height:80%;padding-top:10px;padding-left: 4px;padding-right: 4px;">
<div id="safeday4" style='float:left;width:100%;height:100%;line-height: calc((100vh - 60px - 75px)/2);background: linear-gradient(180deg,#225b97, #0f2e5e);border-radius: 10px;box-shadow: 0px 1px 17px 0px rgba(255,255,255,0.5) inset, 0px -1px 6px 0px rgba(28,54,158,0.5) inset;color:#ffffff;text-align: center;'></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>