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

164 lines
5.0 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"%>
<!DOCTYPE html>
<!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD -->
<head>
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
<!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<script type="text/javascript">
var websocket = null;
var switchWindow = null;//大屏Switch的window
var planId;
var editFun = function (id) {
planId = id;
$.post(ext.contextPath + '/plan/doPlan.do', { id: id }, function (data) {
$("#planBox").html(data);
//启用投放按钮
$("#Putin").attr('disabled', false);
//发送指令 传递方案id参数 先声明方案
$("#Putin").click(function (event) {
//聚焦大屏
// if (switchWindow != null) {
// console.log(1);
switchWindow.focus();
// }
// else {
// console.log(2);
// OpenWindows();
// }
setTimeout(sendSocket, 1000);
});
});
};
function sendSocket() {
//清除交互
var clearInterationJsonStr = "[{'type':'clearInteraction'}]";
websocket.send(clearInterationJsonStr);
var jsonstr = "[{'type':'plan','id':'" + planId + "'}]";
websocket.send(jsonstr);
}
var initTreeView = function () {
$.post(ext.contextPath + '/plan//getPlansJsonActive.do', { ng: '' }, function (data) {
//console.info(data)
$('#tree').treeview({
data: data,
});
$('#tree').on('nodeSelected', function (event, data) {
editFun(data.id);
//var node=$('#tree').treeview('getSelected');
});
}, 'json');
$("#planBox").html("");
};
function doCollapse() {
if (document.getElementById("planBox").className == "col-md-9") {
doHide();
} else {
doShow();
}
};
//隐藏折叠框
function doHide() {
document.getElementById("collapseIcon").className = "fa fa-arrow-right";//改变图标箭头
$('#treeCollapse').collapse('toggle');//1
setTimeout(function () {
document.getElementById("planBox").className = "col-md-12";//2
}, 400);
};
//显示折叠框
function doShow() {
document.getElementById("collapseIcon").className = "fa fa-arrow-left";//改变图标箭头
document.getElementById("planBox").className = "col-md-9";//1
setTimeout(function () {
$('#treeCollapse').collapse('toggle');//2
}, 400);
};
$(function () {
$('#treeCollapse').collapse('show');//显示折叠框
initTreeView();
// 浏览器上的websocket对象,用来和服务端通信.
if ('WebSocket' in window) {
// 创建websocket对象
var userName = "控制";
websocket = new WebSocket(ext.basePath.replace("http","ws")+"/chat/"+userName);
registerEvent();
} else {
alert('当前浏览器不支持websocket')
}
function registerEvent() {
websocket.onopen = function (event) {
}
websocket.onmessage = function (event) {
};
websocket.onclose = function (event) {
websocket.close();
};
//连接发生错误的回调方法
websocket.onerror = function () {
$("#Putin").attr('disabled', 'disabled');
websocket.close();
};
}
$(window).unload(function () {
console.log("websocket关闭");
websocket.close();
});
});
</script>
</head>
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
<div class="wrapper">
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="head_title"></h1>
<ol class="breadcrumb">
<li><a id='head_firstlevel' href="#"><i class="fa fa-dashboard"></i> </a></li>
</ol>
</section>
<!-- Main content -->
<section class="content container-fluid">
<div id="mainAlertdiv"></div>
<div id="subDiv"></div>
<div class="row">
<div class="col-md-3">
<div id="treeCollapse" class="collapse">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">方案列表</h3>
</div>
<div class="box-body no-padding">
<div id="tree" style="height:550px;overflow:auto; "></div>
</div>
<!-- /.box-body -->
</div>
</div>
</div>
<div class="col-md-9" id="planBox"></div>
</div>
</section>
<!-- /.content -->
</div>
</div>
</body>
</html>