-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomized.html
More file actions
383 lines (379 loc) · 12.7 KB
/
customized.html
File metadata and controls
383 lines (379 loc) · 12.7 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="js/libs/jquery-1.11.2.js"></script>
<link rel="stylesheet" href="css/reasyui.css">
<style>
.container{
width: 980px;
height: 508px;
background: #ccc;
}
.container-left-right {
width: 96%;
border: 2px solid #ccc;
float: left;
background: #ccc;
}
.container-left-right td{
width: 6px;
height: 18px;
border-top:4px solid white;
border-bottom:4px solid white;
/*border-right:1px solid #dcdcdc;*/
}
.container-left-right th{
border-right:1px solid #2d2d30;
text-align: right;
background: #D5D5D5;
}
.container-left-right span{
float: left;
}
.container-left-left {
width: 3.5%;
float: left;
}
.container-left-left td{
font-size: 13px;
}
.container-left-left th{
height: 23px;
}
.container-right li{
float: left;
padding: 5px;
margin-right: 12px;
margin-bottom: 10px;
font-size: 20px;
list-style: none;
}
</style>
</head>
<body>
<div class="container">
<div class="container-right">
<ul class="channel-top">
<li id="s00000">运行正常</li>
<li id="s00001">GPS</li>
<li id="s00002">中心对时</li>
<li id="s00003">大灯开</li>
<li id="s00004">2018-01-20 00:00:00</li>
</ul>
</div>
<div >
<table class="table">
<thead>
<tr>
<th class="col-sm-1">路口号</th>
<th class="col-sm-1">控制模式</th>
<th class="col-sm-1">时间表号</th>
<th class="col-sm-1">方案号</th>
<th class="col-sm-1">周期</th>
<th class="col-sm-1">运行时长</th>
<th class="col-sm-1">当前阶段</th>
<th class="col-sm-1">协调状态</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td id="s01000"></td>
<td id="s01001">1</td>
<td id="s01002">1</td>
<td id="s01003">60</td>
<td id="s01004">30</td>
<td id="s01005">2</td>
<td id="s01006">1</td>
</tr>
<tr>
<td>2</td>
<td id="s02000"></td>
<td id="s02001">1</td>
<td id="s02002">1</td>
<td id="s02003">60</td>
<td id="s02004">30</td>
<td id="s02005">2</td>
<td id="s02006">1</td>
</tr>
<tr>
<td>3</td>
<td id="s03000"></td>
<td id="s03001">1</td>
<td id="s03002">1</td>
<td id="s03003">60</td>
<td id="s03004">30</td>
<td id="s03005">2</td>
<td id="s03006">1</td>
</tr>
<tr>
<td>4</td>
<td id="s04000"></td>
<td id="s04001">1</td>
<td id="s04002">1</td>
<td id="s04003">60</td>
<td id="s04004">30</td>
<td id="s04005">2</td>
<td id="s04006">1</td>
</tr>
</tbody>
</table>
</div>
<div>
<div class="container-left-left">
<table>
<thead>
<tr>
<th>灯组</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td>3</td>
</tr>
<tr>
<td>4</td>
</tr>
<tr>
<td>5</td>
</tr>
<tr>
<td>6</td>
</tr>
<tr>
<td>7</td>
</tr>
<tr>
<td>8</td>
</tr>
<tr>
<td>9</td>
</tr>
<tr>
<td>10</td>
</tr>
<tr>
<td>11</td>
</tr>
<tr>
<td>12</td>
</tr>
<tr>
<td>13</td>
</tr>
<tr>
<td>14</td>
</tr>
<tr>
<td>15</td>
</tr>
<tr>
<td>16</td>
</tr>
</tbody>
</table>
</div>
<div class="container-left-right">
<table>
<tr>
<th colspan="30">30</th>
<th colspan="30"><span>S</span>60</th>
<th colspan="30"><span>S</span>90</th>
<th colspan="30"><span>S</span>120</th>
<th colspan="30"><span>S</span>150</th>
<th colspan="30"><span>S</span>180</th>
</tr>
<tbody id="phase1"></tbody>
</table>
</div>
</div>
</div>
<script>
/*
* 信号机状态
*/
function single(single_data) {
var status = [];
var a = single_data;
console.log(single_data);
status.push(
{"s00000":a.s00000,"s00001":a.s00001,"s00002":a.s00002,"s00003":a.s00003},
{"s00004":a.s00004,"s01001":a.s01001,"s01002":a.s01002,"s01003":a.s01003,"s01004":a.s01004,
"s01005":a.s01005,"s02001":a.s02001,"s02002":a.s02002,"s02003":a.s02003,"s02004":a.s02004,
"s02005":a.s02005,"s03001":a.s03001,"s03002":a.s03002,"s03003":a.s03003,"s03004":a.s03004,
"s03005":a.s03005,"s04001":a.s04001,"s04002":a.s04002,"s04003":a.s04003,"s04004":a.s04004,
"s04005":a.s04005},
{"s01000":a.s01000,"s02000":a.s02000,"s03000":a.s03000,"s04000":a.s04000},
{"s01006":a.s01006,"s02006":a.s02006,"s03006":a.s03006,"s04006":a.s04006}
);
$.each(status[0],function(key,item){
switch (item)
{
case 0:
document.getElementById(key).style.background = "#0f0";
break;
case 1:
document.getElementById(key).style.background = "#ccc";
break;
}
});
$.each(status[1],function(key,item){
document.getElementById(key).innerText =item;
});
$.each(status[2],function(key,item){
switch (item)
{
case 16:
document.getElementById(key).innerText ="中心控制";
break;
case 17:
document.getElementById(key).innerText ="中心时间表控制";
break;
case 18:
document.getElementById(key).innerText ="中心优化控制";
break;
case 19:
document.getElementById(key).innerText =" 中心协调控制";
break;
case 20:
document.getElementById(key).innerText ="中心自适应控制";
break;
case 21:
document.getElementById(key).innerText =" 中心手动控制";
break;
case 32:
document.getElementById(key).innerText ="本地控制";
break;
case 33:
document.getElementById(key).innerText ="本地固定周期控制";
break;
case 34:
document.getElementById(key).innerText ="本地感应控制";
break;
case 35:
document.getElementById(key).innerText ="本地协调控制";
break;
case 36:
document.getElementById(key).innerText ="本地自适应控制";
break;
case 37:
document.getElementById(key).innerText ="本地手动控制";
break;
case 38:
document.getElementById(key).innerText ="本地优先控制";
break;
case 39:
document.getElementById(key).innerText ="本地紧急控制";
break;
case 48:
document.getElementById(key).innerText ="特殊控制";
break;
case 49:
document.getElementById(key).innerText ="黄闪控制";
break;
case 50:
document.getElementById(key).innerText =" 全红控制";
break;
case 51:
document.getElementById(key).innerText ="关灯控制";
break;
default:
document.getElementById(key).innerText ="中心控制";
break;
}
});
$.each(status[3],function(key,item){
switch (item)
{
case 0:
document.getElementById(key).innerText ="未协调";
break;
case 1:
document.getElementById(key).innerText ="协调";
break;
}
});
}
/*
* 相位状态
*/
//设置行,列
var cols=180; //11列
var rows=16; //16行
var htmlstr="<tr>";
for(var i=0;i<rows;i++){
if (i<10) {
i = "0" +i;
}
for(var j=0;j<cols;j++){
if (j<10) {
j = "00" +j;
} else if (j>=10 && j<100) {
j = "0" + j;
} else {
j = j;
}
htmlstr+="<td id="+"p"+i+j+"></td>";
}
htmlstr+="</tr>";
}
document.getElementById('phase1').innerHTML = htmlstr;
function fillDatas(rect_data) {
$.each(rect_data,function(key,item){
switch (item)
{
case 1:
document.getElementById(key).style.background = "red";
break;
case 16:
document.getElementById(key).style.background = "red";
// document.getElementById(key).style.background = "-moz-linear-gradient(left,#ccc,#0f0)";
break;
case 32:
document.getElementById(key).style.background = "#0f0";
break;
case 48:
document.getElementById(key).style.background = "#ff0";
break;
}
})
}
var fun = function() {
$.ajax({
type: "POST",
url: "/get_status",
contentType: 'application/json',
dataType: "json",
success:function(data){
single(data);
console.log(data);
},
error:function(){
// alert("加载资源失败");
}
});
$.ajax({
type: "POST",
url: "/get_lamp",
contentType: 'application/json',
dataType: "json",
success:function(data){
fillDatas(data);
},
error:function(){
// alert("加载资源失败");
}
});
};
setInterval(fun,1000);
</script>
</body>
</html>