first commit
This commit is contained in:
217
bin/WebRoot/jsp/material/watchInkAndBoard.jsp
Normal file
217
bin/WebRoot/jsp/material/watchInkAndBoard.jsp
Normal file
@ -0,0 +1,217 @@
|
||||
<%@page import="com.sipai.tools.CommString"%>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.sipai.tools.SessionManager"%>
|
||||
<%
|
||||
SessionManager sessionManager = new SessionManager();
|
||||
%>
|
||||
<%request.setAttribute("Alarm_InkBoard",CommString.Alarm_InkBoard);%>
|
||||
<%String contextPath = request.getContextPath();%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script src="<%=contextPath%>/JS/reconnecting-websocket.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var grid;
|
||||
var websocket = null;
|
||||
//判断当前浏览器是否支持WebSocket
|
||||
if ('WebSocket' in window) {
|
||||
websocket = new ReconnectingWebSocket(ext.basePath.replace("http","ws")+"/websocket/${Alarm_InkBoard}");
|
||||
}
|
||||
else {
|
||||
alert('当前浏览器 Not support websocket')
|
||||
}
|
||||
|
||||
//连接发生错误的回调方法
|
||||
websocket.onerror = function () {
|
||||
};
|
||||
|
||||
//连接成功建立的回调方法
|
||||
websocket.onopen = function () {
|
||||
}
|
||||
|
||||
//接收到消息的回调方法
|
||||
websocket.onmessage = function (event) {
|
||||
var result= JSON.parse(event.data);
|
||||
//alert(result.inkbatch)
|
||||
if(result.type=="ink"){
|
||||
var equipmentcardid=result.equipmentcardid;
|
||||
var lastinkbatchno=result.lastinkbatchno;
|
||||
var starttime=result.starttime;
|
||||
var dialog = top.ext.modalDialog({
|
||||
title : '油墨报警',
|
||||
width : 600,
|
||||
height : 400,
|
||||
resizable:true,
|
||||
url : ext.contextPath + '/material/inkalert/changeink.do?equipmentcardid='+equipmentcardid+'&lastinkbatchno='+lastinkbatchno+'&starttime='+starttime,
|
||||
buttons : [{
|
||||
text : '更换',
|
||||
handler : function() {
|
||||
dialog.find('iframe').get(0).contentWindow.dosave(dialog, grid);
|
||||
}
|
||||
}]
|
||||
});
|
||||
}else if(result.type=="board"){
|
||||
var equipmentcardid=result.equipmentcardid;
|
||||
var lastboardbatchno=result.lastboardbatchno;
|
||||
var starttime=result.starttime;
|
||||
var dialog = top.ext.modalDialog({
|
||||
title : '网板报警',
|
||||
width : 600,
|
||||
height : 400,
|
||||
resizable:true,
|
||||
url : ext.contextPath + '/material/inkalert/changeboard.do?equipmentcardid='+equipmentcardid+'&lastboardbatchno='+lastboardbatchno+'&starttime='+starttime,
|
||||
buttons : [{
|
||||
text : '更换',
|
||||
handler : function() {
|
||||
dialog.find('iframe').get(0).contentWindow.dosave(dialog, grid);
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//连接关闭的回调方法
|
||||
websocket.onclose = function () {
|
||||
closeWebSocket();
|
||||
}
|
||||
|
||||
//监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
|
||||
window.onbeforeunload = function () {
|
||||
closeWebSocket();
|
||||
}
|
||||
|
||||
//关闭WebSocket连接
|
||||
function closeWebSocket() {
|
||||
websocket.close();
|
||||
}
|
||||
|
||||
//发送消息
|
||||
function send() {
|
||||
var message = document.getElementById('text').value;
|
||||
websocket.send(message);
|
||||
}
|
||||
|
||||
var editFun = function(id) {
|
||||
var dialog = parent.ext.modalDialog({
|
||||
title : '编辑油墨更换信息',
|
||||
url : ext.contextPath + '/material/inkalert/changeinkhandle.do?id=' + id, /* 油墨手动更换 */
|
||||
buttons : [ {
|
||||
text : '保存',
|
||||
handler : function() {
|
||||
dialog.find('iframe').get(0).contentWindow.dosave(dialog, grid);
|
||||
}
|
||||
} ]
|
||||
});
|
||||
};
|
||||
var editFun1 = function(id) {
|
||||
var dialog = parent.ext.modalDialog({
|
||||
title : '编辑网板更换信息',
|
||||
url : ext.contextPath + '/material/inkalert/changeboardhandle.do?id=' + id, /* 网板手动更换 */
|
||||
buttons : [ {
|
||||
text : '保存',
|
||||
handler : function() {
|
||||
dialog.find('iframe').get(0).contentWindow.dosave(dialog, grid);
|
||||
}
|
||||
} ]
|
||||
});
|
||||
};
|
||||
$(function() {
|
||||
grid = $('#grid').datagrid({
|
||||
title : '',
|
||||
url : ext.contextPath + '/material/inkinfo/getlist.do',
|
||||
striped : true,
|
||||
rownumbers : true,
|
||||
pagination : true,
|
||||
singleSelect: false,
|
||||
ctrlSelect: true,
|
||||
selectOnCheck: false,
|
||||
checkOnSelect: false,
|
||||
idField : 'id',
|
||||
pageSize : 50,
|
||||
pageList : [ 20, 50, 100],
|
||||
columns : [ [
|
||||
{checkbox:true , field : 'ck'},
|
||||
{width : '110', title : '设备编号', field : 'equipmentcode', sortable : true, halign:'center'},
|
||||
{width : '110', title : '设备名称', field : 'equipmentname', sortable : true, halign:'center'},
|
||||
{width : '150', title : '参数上次修改时间', field : 'time', sortable : true, halign:'center',formatter : function(value, row){
|
||||
return value.substring(0,19);
|
||||
} },
|
||||
{width : '100', title : '修改者', field : 'operator', sortable : true, halign:'center',formatter : function(value, row) {
|
||||
value ='admin';
|
||||
return value;
|
||||
} },
|
||||
{width : '170', title : '油墨更换间隔提醒时间(分钟)', field : 'parameter1', sortable : true, halign:'center'},
|
||||
{width : '177', title : '稀释剂添加提醒间隔时间(分钟)', field : 'parameter2', sortable : true, halign:'center'},
|
||||
{width : '170', title : '网板更换提醒间隔时间(分钟)', field : 'parameter3', sortable : true, halign:'center'},
|
||||
{title : '操作', field : 'action', width : '110', halign:'center', align:'center', formatter : function(value, row) {
|
||||
var str = '';
|
||||
<%if (sessionManager.havePermission(session,"material/inkalert/edit.do")) {%>
|
||||
str += '<img class="iconImg ext-icon-table_edit" title="油墨手动更换" onclick="editFun(\''+row.id+'\');"/>';
|
||||
<%}%>
|
||||
<%if (sessionManager.havePermission(session,"material/inkalert/edit.do")) {%>
|
||||
str += '<img class="iconImg ext-icon-table_edit" title="网板手动更换" onclick="editFun1(\''+row.id+'\');"/>';
|
||||
<%}%>
|
||||
return str;
|
||||
}
|
||||
}
|
||||
] ],
|
||||
toolbar : '#toolbar',
|
||||
onLoadSuccess : function(data) {
|
||||
$('.iconImg').attr('src', ext.pixel_0);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body class="easyui-layout" data-options="fit:true,border:false">
|
||||
<div id="toolbar" style="display: none;">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<%-- <tr>
|
||||
<%if (sessionManager.havePermission(session,"material/inkinfo/add.do")) {%>
|
||||
<td>
|
||||
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true"
|
||||
onclick="addFun();">添加</a>
|
||||
</td>
|
||||
<%}%>
|
||||
<%if (sessionManager.havePermission(session,"material/inkinfo/delete.do")) {%>
|
||||
<td>
|
||||
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true"
|
||||
onclick="deletesFun();">删除</a>
|
||||
</td>
|
||||
<%}%>
|
||||
</tr> --%>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<form id="searchForm">
|
||||
<input name="idStr" type="hidden" />
|
||||
<table class="tooltable">
|
||||
<tr>
|
||||
<td>设备名称</td>
|
||||
<td><input name="search_equipmentname" class="easyui-textbox" /></td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-search',plain:true"
|
||||
onclick="grid.datagrid('load',ext.serializeObject($('#searchForm')));">搜索</a>
|
||||
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true"
|
||||
onclick="$('#searchForm').form('clear');grid.datagrid('load',{});">重置</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div data-options="region:'center',fit:true,border:false">
|
||||
<table id="grid" data-options="fit:true,border:false"></table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user