Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/visual/modules/singleStatus.jsp
2026-01-16 14:13:44 +08:00

273 lines
11 KiB
Plaintext

<%@ 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_GetHistory", JspElement.Type_GetHistory); %>
<%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/incVisual.jsp"></jsp:include>
<style>
.slopingside {
height: 0px;
border: 1px solid #5AD8FF;
width: 45px;
transform: rotate(150deg);
-o-transform: rotate(150deg);
-moz-transform: rotate(150deg);
-webkit-transform: rotate(150deg);
}
.circle {
width: 8px;
height: 8px;
background-color: #5AD8FF;
margin-left: 6px;
border-radius: 50%;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
}
.title {
border-radius: 30px;
border: 3px solid #fff;
background-color: #1BB3DC;
}
.tag {
border-radius: 10px;
border: 3px solid #5AD8FF;
background-color: #000;
}
.titleDiv {
border-radius: 30px;
border: 3px solid #fff;
background-color: #1BB3DC;
}
</style>
<script type="text/javascript">
/* 请求数据 */
var timeflash = 0;
function clock() {
var time = new Date();
var week;
switch (time.getDay()) {
case 1: week = "星期一"; break;
case 2: week = "星期二"; break;
case 3: week = "星期三"; break;
case 4: week = "星期四"; break;
case 5: week = "星期五"; break;
case 6: week = "星期六"; break;
default: week = "星期日";
}
var year = time.getFullYear();
var month = time.getMonth()+1;
var date = time.getDate();
var hour = time.getHours();
var minute = time.getMinutes();
if (minute < 10) {
minute = "0" + minute;
}
if (month < 10) {
month = "0" + month;
}
var apm = "上午";
if (hour < 6 && hour >= 0) {
apm = "凌晨";
} else if (hour == 12) {
apm = "中午";
} else if (hour > 12 && hour < 18) {
apm = "下午";
} else if (hour >= 18 && hour < 24) {
apm = "晚上";
}
var maohao = "";
if (timeflash == 0) {
maohao = "<font color='#4972B4'>:</font>";
timeflash = 1;
} else {
maohao = "<font color='#1A2D58'>:</font>";
timeflash = 0;
}
if(document.getElementById("clock")){
document.getElementById("clock").innerHTML = hour + maohao + minute;
}
if(document.getElementById("apm")){
document.getElementById("apm").innerHTML = apm;
}
if(document.getElementById("date")){
document.getElementById("date").innerHTML = year + "." + month + "." + date;
}
if(document.getElementById("week")){
document.getElementById("week").innerHTML = week;
}
if(document.getElementById("lunar")){
document.getElementById("lunar").innerHTML = showCal();
}
}
function getValue() {
$.post(ext.contextPath + '/plan/getJspWholeInfoByPlanLayoutId.do', { planLayoutId: "${param.planLayoutId}" }, function (data) {
//每一条循环判断
//console.log("data", data);
for (var i = 0; i < data.length; i++) {
if (data[i].elementCode == 'background') {
if (data[i].style != null && data[i].style != "") {
document.getElementById("backImage").src = "../../.." + data[i].style;
}
} else if (data[i].elementCode.indexOf("title") != -1) {//获取车间名
var code = data[i].elementCode;
if (document.getElementById(code)) {//判断存不存在
//赋值
document.getElementById(code).innerHTML = data[i].name;
document.getElementById(code).style.display = "block";
}
} else {
//获取值 和 获取Modbus
if (data[i].getValueType == '${Type_GetValue}' || data[i].getValueType == '${Type_GetModbus}') {
var code = data[i].elementCode;
if (data[i].mPoint != null) {
if (data[i].elementCode.indexOf("pressure") != -1) {//压差
addPressure(data[i].style,parseFloat(data[i].mPoint.parmvalue).toFixed(1),data[i].mPoint.unit);
}else if (data[i].elementCode.indexOf("temp") != -1) {//温度
addTemperature(data[i].style,parseFloat(data[i].mPoint.parmvalue).toFixed(1),data[i].mPoint.unit);
}else if (data[i].elementCode.indexOf("rh") != -1) {//湿度
addRH(data[i].style,parseFloat(data[i].mPoint.parmvalue).toFixed(1),data[i].mPoint.unit);
}
}
} else if (data[i].getValueType == '${Type_GetHistory}') {
} else if (data[i].getValueType == '${Type_GetHttp}') {
var code = data[i].elementCode;
document.getElementById(code).innerHTML = data[i].value;
} else {
}
}
}
}, 'json');
}
function addPressure(style,value,unit){
var divStr = '<div style="'+style+'">'
+ '<div style="border-radius:4px;border:0;background-color: #7298D6;'
+ ' width:'+document.documentElement.clientWidth * 0.05+'px;text-align:center;">'
+ '<span style="font-weight:bold;font-size:'+document.documentElement.clientWidth*0.01+'px">'+value+unit+'</span></div></div>';
$("#floatDiv").append(divStr);
}
function addTemperature(style,value,unit){
var divStr = '<div style="'+style+'">'
+ '<div style="float:left"><span style="color: #B9A551;font-weight:bold;font-size: '+document.documentElement.clientWidth*0.01+'px;">T</span>&nbsp;</div>'
+ '<div style="border-radius:4px;border:0;background-color: #B9A551;'
+ ' width:'+document.documentElement.clientWidth * 0.05+'px;text-align:center;float:right">'
+ '<span style="font-weight:bold;font-size:'+document.documentElement.clientWidth*0.01+'px">'+value+unit+'</span></div></div>';
$("#floatDiv").append(divStr);
}
function addRH(style,value,unit){
var divStr = '<div style="'+style+'">'
+ '<div style="float:left"><span style="color: #A759C7;font-weight:bold;font-size: '+document.documentElement.clientWidth*0.01+'px;">RH</span>&nbsp;</div>'
+ '<div style="border-radius:4px;border:0;background-color: #A759C7;'
+ ' width:'+document.documentElement.clientWidth * 0.05+'px;text-align:center;float:right">'
+ '<span style="font-weight:bold;font-size:'+document.documentElement.clientWidth*0.01+'px">'+value+unit+'</span></div></div>';
$("#floatDiv").append(divStr);
}
/* 定时器 */
setInterval(getValue, 300000); //<!--每隔5分钟刷新一次-->
setInterval(clock, 1000); //每隔1秒显示一次
$(function () {
getValue();
// console.log(document.documentElement.offsetHeight);
// console.log(document.documentElement.clientHeight);
document.body.style.backgroundColor = "#" + '${param.backgroundColor}';
document.getElementById("backImage").style.width = document.documentElement.clientWidth + "px";
document.getElementById("backImage").style.height = document.documentElement.clientHeight + "px";
$("#clock").css("font-size", (document.documentElement.clientWidth * 0.03 + "px"));
// $("#lunar").css("font-size", (document.documentElement.clientWidth * 0.03 + "px"));
$("#date").css("font-size", (document.documentElement.clientWidth * 0.03 + "px"));
$("#week").css("font-size", (document.documentElement.clientWidth * 0.03 + "px"));
$("#title1").css("font-size", (document.documentElement.clientWidth * 0.02 + "px"));
document.getElementById("titleDiv").style.width = document.documentElement.clientWidth * 0.18 + "px";
document.getElementById("titleDiv").style.height = document.documentElement.clientHeight * 0.058 + "px";
document.getElementById("titleDiv").style.borderWidth = document.documentElement.clientHeight * 0.003 + "px";
document.getElementById("floatDiv").style.width = document.documentElement.clientWidth + "px";
document.getElementById("floatDiv").style.height = document.documentElement.clientHeight + "px";
});
</script>
</head>
<body style="width:100%;height:100%;margin:0;padding:0;">
<div id="floatDiv" style="position: absolute;z-index:1;">
<!-- <div style="position: absolute;z-index:1;bottom:49%;left:12%">
<div style="float:left">
<span style="color: #A759C7;font-size: 20px;">RH</span>&nbsp;
</div>
<div style="border-radius:4px;border:0;text-align:center;float:right;background-color: #A759C7;width:80px">
<span style="font-size:20px">49.5%</span>
</div>
</div>
<div style="position: absolute;z-index:1;bottom:59%;left:12%">
<div style="float:left">
<span style="color: #B9A551;font-size: 20px;">T</span>&nbsp;
</div>
<div style="border-radius:4px;border:0;text-align:center;float:right;background-color: #B9A551;width:80px;">
<span style="font-size:20px">21.8℃</span>
</div>
</div>
<div style="position: absolute;z-index:1;bottom:69%;left:12%">
<div style="border-radius:4px;border:0;background-color: #7298D6;width:80px;text-align:center;">
<span style="font-size:16px">0.12pa</span>
</div>
</div> -->
</div>
<!-- 时间 -->
<div style="width:96%;height:10%;padding-top:2%;padding-left:4%;position: absolute;z-index:2;text-align: center;">
<table style="width:100%;height:100%;padding:5%;padding-top:2%" align="right">
<tr>
<td width="55%" align="left">
<div id="titleDiv" class="titleDiv" style="text-align: center;display:none">
<span id="title1" style="font-size:30px;color:#fff;"></span>
</div>
</td>
<td><span id="date" style="font-size:25px;color:#4972B4;font-family:Microsoft YaHei;font-weight:bold"></span>
</td>
<td><span id="week" style="font-size:25px;color:#4972B4;font-family:Microsoft YaHei;font-weight:bold"></span>
</td>
<!-- <td><span id="lunar" style="font-size:25px;color:#4972B4;font-family:Microsoft YaHei;font-weight: bold;"></span></td> -->
<td><span id="clock"
style="font-size:70px;color:#4972B4;font-family:Microsoft YaHei;font-weight: bold;"></span>
</td>
</tr>
</table>
</div>
<img id="backImage" src="" style="z-index:-1;positon:relative;" alt="" />
</body>
</html>