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

510 lines
22 KiB
Plaintext

<%@page import="com.sipai.tools.DateSpan" %>
<%@page import="com.sipai.tools.CommString" %>
<%@page import="com.sipai.entity.activiti.ProcessType" %>
<%@page import="com.sipai.entity.sparepart.SparePartCommString" %>
<%@page import="com.sipai.entity.maintenance.Maintenance" %>
<%@page import="com.sipai.entity.business.BusinessUnit" %>
<%@page import="com.sipai.entity.maintenance.MaintenanceCommString" %>
<%@ 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.tools.CommString" %>
<% request.setAttribute("UNIT_TYPE_BIZ", CommString.UNIT_TYPE_BIZ); %>
<% request.setAttribute("UNIT_TYPE_COMPANY", CommString.UNIT_TYPE_COMPANY); %>
<%--报表--%>
<%@ page import="com.sipai.entity.report.RptSpSet" %>
<%@ page import="com.sipai.entity.report.RptCreate" %>
<%@ page import="com.sipai.entity.report.RptInfoSet" %>
<% request.setAttribute("RptSpSet_Type_Cal", RptSpSet.RptSpSet_Type_Cal); %>
<% request.setAttribute("RptSpSet_Type_Insuser", RptSpSet.RptSpSet_Type_Insuser); %>
<% request.setAttribute("RptSpSet_Type_Confirm", RptSpSet.RptSpSet_Type_Confirm); %>
<% request.setAttribute("RptSpSet_Type_Checkuser", RptSpSet.RptSpSet_Type_Checkuser); %>
<% request.setAttribute("RptSpSet_Type_Rptdt", RptSpSet.RptSpSet_Type_Rptdt); %>
<%@ page import="com.sipai.tools.Mqtt" %>
<%@ page import="org.springframework.context.ApplicationContext" %>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<% ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(request.getServletContext());
Mqtt mqtt = (Mqtt) ctx.getBean("mqtt");
request.setAttribute("mqttStatus", mqtt.getStatus()); %>
<!DOCTYPE html>
<!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD -->
<head>
<title><%= ServerObject.atttable.get("TOPTITLE")%>
</title>
<!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<!-- Ionicons -->
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/nth-tabs-master/iconfont/iconfont.css"/>
<!-- nth-tabs -->
<link rel="stylesheet"
href="<%=request.getContextPath()%>/node_modules/nth-tabs-master/jquery.scrollbar.css"></link>
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/nth-tabs-master/nth-tabs.css"></link>
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/nth-tabs-master/nth-icons.css"></link>
<!-- report -->
<link rel="stylesheet" href="<%=request.getContextPath()%>/CSS/report/report.css"></link>
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/nth-tabs-master/jquery.scrollbar.js"
charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/nth-tabs-master/nth-tabs.js"
charset="utf-8"></script>
<!-- 滚动条 -->
<script type="text/javascript"
src="<%=request.getContextPath()%>/node_modules/jquery-slimScroll/jquery.slimscroll.min.js"
charset="utf-8"></script>
<%--报表--%>
<script type="text/javascript" src="<%=request.getContextPath()%>/JS/report.js" charset="utf-8"></script>
<%-- mqtt依赖--%>
<script src="<%=request.getContextPath()%>/JS/mqtt/mqtt.min.js" type="text/javascript"></script>
<%-- mqtt事件--%>
<jsp:include page="/jsp/mqtt/alarm_mqtt.jsp"></jsp:include>
<jsp:include page="/jsp/mqtt/alarm_emergency.jsp"></jsp:include>
<style>
<!--
-->
.content-wrapper, .main-footer {
margin-left: 230px;
}
/*避免菜单下拉功能偏移sj*/
.dropdown-menu {
left: -170px !important;
}
@media (max-width: 600px) {
.content-wrapper, .main-footer {
margin-left: 0px;
}
}
/*报表预览样式*/
#viewFile_bottom table td {
/*white-space:nowrap;overflow:hidden;word-break:break-all;*/
/*padding: 1px 4px;*/
/*width: auto;*/
}
</style>
<script type="text/javascript">
let top_user_companyType = "${top_user_companyType}";
let top_user_companyId = "${top_user_companyId}";
let top_userId = "${top_userId}";
var nthTabs;
var personalAlarmNum_time = null;//报警灯闪烁效果定时器
/**
* 新建标签
* @param id
* @param title
* @param url
*/
function addTab(id, title, url, menuOne, menuTwo, menuThree) {
if (url == '' || url == null) {
url = 'Login/building.do';
}
if (url.indexOf("http") >= 0) {
url = url;
} else {
url = ext.contextPath + '/' + url;
}
var name = 'iframe_' + id;
var tabId = 'tabId_' + id;
//顶部菜单是否已有
if (nthTabs.isExistsTab(tabId)) {
//有则直接切换
nthTabs.toggleTabAndRef(tabId, url);
} else {
//无则 新建选项卡
nthTabs.addTab({
id: tabId,
title: title,
url: url,
active: true,
allowClose: true,
location: true,
fadeIn: true
});
nthTabs.toggleTab(tabId);
}
/* $.post(ext.contextPath+"/user/getMenuInfo.do" , {id:id}, function(result) {
var target = result[0].target;
var location = result[0].location;
if(target!='' && target=='external'){
//20210810临时演示使用
if(location.indexOf("hd_test") != -1 ){
var app = $("#"+tabId).find("iframe").css('left','-50px');
}
}
}, 'json'); */
}
/**
* 关闭标签
* @param id
*/
function delTab(id) {
var tabId = 'tabId_' + id;
//顶部菜单是否已有
if (nthTabs.isExistsTab(tabId)) {
//有则直接切换
nthTabs.delTab(tabId);
}
}
$(function () {
//基于bootstrap tab的自定义多标签的jquery实用插件
nthTabs = $("#main-tabs").nthTabs();
//2021.11.25 JY 增加了自定义首页配置,如查不到记录则执行原来读取
$.ajax({
type: 'post',
url: ext.contextPath + '/base/basicHomePage/getJsonByUserId.do',
data: {
unitId: unitId,
},
dataType: 'json',
async: true,
globle: false,
success: function (pageData) {
// console.log(pageData)
if (pageData.data != '' && pageData.data.length > 0) {
let nowUser = pageData.userId;
let unrolePeople = pageData.data[0].unrolepeople;
let mainUrl = pageData.data[0].url;
if (unrolePeople != '' && unrolePeople.indexOf(nowUser) != -1) {//无权限查看
mainUrl = "base/basicHomePage/showNoRole.do"
} else {
if (mainUrl.substring(0, 1) == '/') {
mainUrl = mainUrl.substring(1, mainUrl.length);
}
}
// 新建选项卡示例
nthTabs.addTab({
id: 'tabId_home',
title: '首页',
url: mainUrl,
active: true,
allowClose: false,
location: true,
fadeIn: true
});
} else {
$.ajax({
type: 'post',
url: ext.contextPath + '/base/basicComponents/getBasicComponentsForCode.do',
data: {
code: 'main-url',//配置位置
},
async: true,
globle: false,
error: function () {
// 新建选项卡示例
nthTabs.addTab({
id: 'tabId_home',
title: '首页',
// url: ext.contextPath + "/work/mpoint/overviewEquipment2020.do",
url: ext.contextPath + "/Login/mainCQBYT.do?uuid=" + Math.ceil(Math.random() * 1000),//重庆
// url: ext.contextPath + "/plan/doSwitchForView.do?planId=a8b16ecadef14f49ad1d0b94636d2dbf",
active: true,
allowClose: false,
location: true,
fadeIn: true,
});
},
success: function (data) {
var array = JSON.parse(data);
var mainUrl = "";
if (array != null && array != undefined && array.length > 0) {
if (array[0].type == 'url') {
mainUrl = ext.contextPath + array[0].url;
} else {
mainUrl = "未配置首页地址!!";
}
} else {
mainUrl = ext.contextPath + "/work/mpoint/overviewProduce2020.do";
}
// 新建选项卡示例
nthTabs.addTab({
id: 'tabId_home',
title: '首页',
url: mainUrl,
active: true,
allowClose: false,
location: true,
fadeIn: true
});
}
});
}
}
});
//渲染后的table 单击事件 -- (报表模块)
$("#viewFile_bottom").unbind("mousedown").bind("mousedown", function (event) {
if (event.which == 1) {//左键事件
tabClickLeft('${RptSpSet_Type_Cal}', event.target.id);
} else if (event.which == 2) {//中键事件
} else if (event.which == 3) {//右键事件
document.oncontextmenu = function (ev) {
return false;
}
tabClickRight();
}
});
$('#global_height').val($(window).height() - 80);
if ($("body").hasClass("sidebar-collapse")) {
$('#global_width').val($(window).width() - 50);
} else {
$('#global_width').val($(window).width() - 230);
}
try {
//初始化mqtt
if ('${mqttStatus}' == '0') {
initialMqtt('${mqttId}');
} else {
console.log('mq已关闭')
}
} catch (err) {
//处理错误
}
//刷新或关闭页面自动退出账户
/*window.addEventListener('beforeunload', function(event) {
if(event.currentTarget.performance.navigation.type==2){
$.post(ext.contextPath + "/Login/logout.do", function () {
delCookie("j_password");
delCookie('savePassword');
});
}
});*/
});
//删除cookies
function delCookie(name) {
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval = getCookie(name);
if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}
function initialMqtt(mqttId) {
const options = {
clean: true,
connectTimeout: 10000,
clientId: mqttId,
username: "admin",
password: 'public'
}
const connectUrl = '${hostWeb}';
const client = mqtt.connect(connectUrl, options);
//当重新连接启动触发回调
client.on('reconnect', function () {
// console.log('正在重连.....');
});
//连接断开后触发的回调
client.on("close", function () {
console.log('客户端已断开连接.....');
});
//从broker接收到断开连接的数据包后发出。MQTT 5.0特性
client.on("disconnect", function (packet) {
console.log('从broker接收到断开连接的数据包.....' + packet);
});
//客户端脱机下线触发回调
client.on("offline", function () {
console.log('客户端脱机下线.....');
});
//当客户端无法连接或出现错误时触发回调
client.on("error", (error) => {
console.log('客户端出现错误.....' + error);
});
//当客户端发送任何数据包时发出。这包括published()包以及MQTT用于管理订阅和连接的包
client.on("packetsend", (packet) => {
// console.log('客户端已发出数据包:' + packet);
});
//当客户端接收到任何数据包时发出。这包括来自订阅主题的信息包以及MQTT用于管理订阅和连接的信息包
client.on("packetreceive", (packet) => {
// console.log('收到:' + packet);
});
//成功连接后触发的回调
client.on("connect", function (connack) {
// layer.msg('成功连接上mq服务器');
console.log('成功连接上mqtt服务器');
//订阅某主题
/**
* client.subscribe(topic/topic array/topic object, [options], [callback])
* topic:一个string类型的topic或者一个topic数组,也可以是一个对象
* options
*/
client.subscribe(['pingtai_zhiling', 'web_topic', 'alarm_num_topic_' + "${top_userId}", 'alarm_popup_topic_' + "${top_userId}", 'alarm_emergency_topic_' + "${top_userId}"], {qos: 2});
//每隔2秒发布一次数据
// setInterval(publish, 2000)
});
function publish() {
//发布数据
/**
* client.publish(topic,message,[options], [callback])
*
* message: Buffer or String
* options:{
* qos:0, //默认0
* retain:false, //默认false
* dup:false, //默认false
* properties:{}
* }
* callback:function (err){}
*/
const message = "h5 message " + Math.random() + new Date();
client.publish("testtopic/123", message, {qos: 2});
}
//当客户端接收到发布消息时触发回调
/**
* topic:收到的数据包的topic
* message:收到的数据包的负载playload
* packet:收到的数据包
*/
client.on('message', (topic, message, packet) => {
console.log(topic);
if (topic == 'pingtai_zhiling' || topic == 'web_topic') {
var json = JSON.parse(message.toString());
mqtt_open(json);
// $("#div3").text("客户端收到订阅消息,topic=" + topic + ";消息数据:" + message + ";数据包:" + packet);
} else if (topic == 'alarm_popup_topic_' + "${top_userId}") {
var json = JSON.parse(message.toString());
mqtt_open(json);
} else if (topic == 'alarm_emergency_topic_' + "${top_userId}") {
var json = JSON.parse(message.toString());
// console.log(json)
mqtt_emergency_open(json);
} else if (topic == 'alarm_num_topic_' + "${top_userId}") {
var alarm_num_topic_json = JSON.parse(message.toString());
let top_alarm_num = 0;
if ($('#top_alarm_Num').text() != '') {
top_alarm_num = Number($('#top_alarm_Num').text());
}
let type = alarm_num_topic_json.type;
if (type == 'add') {
top_alarm_num = top_alarm_num + 1;
} else {
top_alarm_num = top_alarm_num - 1;
}
if (top_alarm_num > 0) {
$('#top_alarm_path').css("fill", "#d81e06");
$('#top_alarm_div').animate({opacity: '0'}, 1000);
$('#top_alarm_div').animate({opacity: '1'}, 1000);
if (top_alarm_num > 99) {
$('#top_alarm_Num').text("99+");
$('#top_alarm_Num').css("right", "-12px");
} else {
if (top_alarm_num < 10) {
$('#top_alarm_Num').css("right", "2px");
} else {
$('#top_alarm_Num').css("right", "-5px");
}
$('#top_alarm_Num').text(top_alarm_num);
}//消息声音
if (msgplayer) {
msgplayer = false;
var player = document.getElementById("msgMedia");
player.src = "<%=request.getContextPath()%>/node_modules/media/messaging.wav";
player.loop = false;
player.addEventListener('ended', function () {
msgplayer = true;
}, false);
}
} else {
clearInterval(personalAlarmNum_time);
$('#top_alarm_path').css("fill", "#00FF66");
$('#top_alarm_Num').css("right", "2px");
$('#top_alarm_Num').text("");
}
// console.log(alarm_num_topic_json);
}
});
//页面离开自动断开连接
$(window).bind("beforeunload", () => {
// console.log("客户端窗口关闭,断开连接");
client.disconnect();
})
}
</script>
</head>
<body onload="initMenu();" class="hold-transition ${cu.themeclass} fixed sidebar-mini">
<div class="wrapper">
<!-- 引用top -->
<jsp:include page="/jsp/top.jsp"></jsp:include>
<!-- 菜单栏 -->
<jsp:include page="/jsp/left.jsp"></jsp:include>
<div class="content-wrapper">
<!-- Main content -->
<section class="content container-fluid " style="padding:0;">
<!-- 20200617 Tab Menu @niu -->
<div class="hor-menu hor-menu-light">
<div class="nth-tabs" id="main-tabs"></div>
</div>
<div class="tab-content"></div>
</section>
<!-- /.content -->
</div>
<%--<jsp:include page="/jsp/bottom.jsp"></jsp:include>--%>
<jsp:include page="/jsp/side.jsp"></jsp:include>
</div>
<input id="global_height" type="hidden" value=""/>
<input id="global_width" type="hidden" value=""/>
<input type="hidden" id="mqttStatus" name="mqttStatus" value="${mqttStatus}">
<input type="hidden" id="mqttHostWeb" name="mqttHostWeb" value="${hostWeb}">
<input type="hidden" id="topUserId" name="topUserId" value="${top_userId}">
<input type="hidden" id="modelKeyParamTop" name="modelKeyParamTop" value="${modelKeyParamTop}">
<input type="hidden" id="businessKeyTop" name="businessKeyTop" value="${businessKeyTop}">
<input type="hidden" id="modelKeyParamNum" name="modelKeyParamNum" value="${modelKeyParamNum}">
<%--用于报表弹窗 开始--%>
<input type="hidden" id="sheet" name="sheet" value="${param.sheet}">
<input type="hidden" id="creatId" name="creatId" value="${param.creatId}">
<div id="viewFile" style="display:none;height:900px;padding:10px;">
<!-- sheet列表 -->
<div id="viewFile_top" style="width:100%;height:5%;float:left;">
</div>
<!-- 报表内容 -->
<div id="viewFile_bottom" style="width:20000px;height:95%;float:left;" @contextmenu.prevent></div>
</div>
<!-- 修订记录 -->
<div id="viewHis" style="display:none;height:300px;">
<table id="tableLog" style="table-layout:fixed;">
</table>
</div>
<%--用于报表弹窗 结束--%>
<div id="subDiv" style="z-index: 100;"></div>
<div id="user4SelectDiv"></div>
</body>
</html>