maintenance.jsp
6.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<%@ page import="com.myproject.util.StorageConstants" %>
<%@ include file="/common/taglibs.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<!-- BEGIN PAGE HEADER-->
<h3 class="page-title">
<fmt:message key="menu.system.maintenance"/>
</h3>
<div id="portlet-config" class="modal fade" tabindex="-1" data-backdrop="static" data-keyboard="false">
<div class="modal-backdrop fade in"></div>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title" id="title" >Modal title</h4>
</div>
<div class="modal-body">
<input type="hidden" id="cid" value=""/>
</div>
<div class="modal-footer">
<button type="button" class="btn blue" id="saveBtn"><fmt:message key="button.maintenance.finished"/></button>
<button type="button" class="btn default" data-dismiss="modal"><fmt:message key="button.cancel"/></button>
</div>
</div>
<!-- /.modal-content -->
</div>
</div>
<div class="page-bar">
<ul class="page-breadcrumb">
</ul>
<div class="page-toolbar">
</div>
</div>
<div class="row" id="deviceInfos">
</div>
<div style="display: none;">
<span id="1_device_updownAxis"><fmt:message key="maintenance.device.1_device_updownAxis"/></span>
<span id="1_device_inoutAxis"><fmt:message key="maintenance.device.1_device_inoutAxis"/></span>
<span id="1_device_middleAxis"><fmt:message key="maintenance.device.1_device_middleAxis"/></span>
<span id="1_device_batchAxis"><fmt:message key="maintenance.device.1_device_batchAxis"/></span>
<span id="status0"><fmt:message key="maintenance.status.0"/></span>
<span id="status1"><fmt:message key="maintenance.status.1"/></span>
<fmt:message key="maintenance.nextTime" var="nextTime"/>
<fmt:message key="maintenance.deviceName" var="deviceName"/>
<fmt:message key="maintenance.runTime" var="runTime"/>
<fmt:message key="maintenance.status" var="status"/>
<fmt:message key="time.days" var="days"/>
<fmt:message key="time.hours" var="hours"/>
<fmt:message key="time.minutes" var="minutes"/>
<fmt:message key="time.seconds" var="seconds"/>
</div>
<c:set var="scripts" scope="request">
<script type="text/javascript">
$(document).ready(function(){
showConfig = function(cid){
$("#cid").val(cid);
var name = $("#"+cid).text();
$("#title").text(name);
$("#portlet-config").modal("show");
}
$("#saveBtn").click(function(){
var cid = $("#cid").val();
$.post("${ctx}/service/store/updateMaintenanceInfo", {cid:cid}, function (data) {
$("#portlet-config").modal("hide");
});
});
updateDeviceInfos = function() {
$.post("${ctx}/service/store/deviceInfos", {}, function (data) {
var infoHtml = "";
for(var item in data){
var storageName = data[item].storageName;
var nextTime = data[item].nextTimeStr;
var cid = data[item].storageCid;
var itmeHtml = "<div class='col-md-6'><div class='portlet box yellow'>"+
"<div class='portlet-title'><div class='caption' id='"+cid+"'>"+storageName+"</div><div class='tools'>${nextTime}:"+nextTime+
"<a href='#cid' data-toggle='modal' class='config' onclick='showConfig(\""+cid+"\")'></a></div></div>";
var detailHtml = "<div class='portlet-body' style='height: auto;'>" +
"<table class='table table-bordered table-hover'>" +
"<thead><tr><th>#</th><th>${deviceName}</th><th>${runTime}</th><th>${status}</th></tr></thead><tbody>";
var deviceInfos = data[item].deviceData;
var index = 0;
for(var i in deviceInfos){
var deviceName = deviceInfos[i].deviceName;
var status = deviceInfos[i].status;
var runTimes = deviceInfos[i].runTimes;
var trHtml = "<tr>" +
"<td>"+(++index)+"</td>" +
"<td>"+$("#"+deviceName).text()+"</td>" +
"<td>"+toTimeStr(runTimes)+"</td>" +
"<td>"+$("#status"+status).text()+"</td>" +
"</tr>";
detailHtml = detailHtml + trHtml;
}
detailHtml = detailHtml + "</tbody></table></div>";
itmeHtml = itmeHtml + detailHtml + "</div></div>";
infoHtml = infoHtml + itmeHtml;
}
$("#deviceInfos").html(infoHtml);
});
}
var secs = 1000;
var minutes = 60 * secs;
var hours = 60 * minutes;
var days = 24 * hours;
toTimeStr = function(time){
var timeStr = "";
var day = parseInt(time / days);
if(day != 0){
timeStr = day + "${days}";
}
var hour = parseInt(time / hours) % 24;
if(hour != 0){
timeStr = timeStr + hour + "${hours}";
}
var minute = parseInt(time / minutes) % 60;
if(minute != 0){
timeStr = timeStr + minute + "${minutes}";
}
var sec = parseInt(time / secs) % 60;
if(sec != 0){
timeStr = timeStr + sec + "${seconds}";
}
return timeStr;
}
setInterval(function(){
updateDeviceInfos();
}, 500);
});
</script>
</c:set>