screenmanage.js
17.3 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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
var syncFun={
init: function () {
//初始化设备状态
$('#screenJB').selectpicker('render');
$('#devStatus').selectpicker('render');
$('#screenStatus').selectpicker('render');
//基本信息
syncFun.createTableData();
//查看弹窗
documentBindFunc.on('click', '[lookGuide]', function() {
syncFun.lookscreenManage(this);
});
//回显弹窗
documentBindFunc.on('click', '[openGuideImg]', function() {
syncFun.openImgManage(this);
});
},
getQueryParam:function () {
var guidesNo = $.trim($("#guidesNo").val());//诱导屏名称
var screenJB = $("#screenJB").val();//级别
var devStatus = $("#devStatus").val();//设备状态
var screenStatus = $("#screenStatus").val();//屏幕状态
var levels = [];
if(screenJB==undefined || screenJB == "全部"){
levels = null;
}else{
levels = [screenJB];
}
if(devStatus==undefined || devStatus == "全部"){
devStatus=null;
}
if(screenStatus==undefined || screenStatus == "全部"){
screenStatus=null;
}
//条件查询
var req= {
sysCode:sysComm.sysCode,
nameOrNo:guidesNo,
ledDeviceStatus:devStatus,
ledScreenStatus:screenStatus,
levels:levels,
dataState:1,
};
return req;
},
createTableData:function () {
$('#screenmanageTable').bootstrapTable('destroy').bootstrapTable({
striped: true,//表格显示条纹
rownumbers:true,
pagination: true, //启动分页
pageNumber: 1, //当前第几页
pageSize: 10, //每页显示的记录数
pageList: [10, 15, 20], //记录数可选列表
sidePagination: 'server',//表示服务端分页
queryParamsType: 'limit',
method: 'POST',//请求方法
paginationPreText: '<',
paginationNextText: '>',
ajax: tableLoadRequest,//自定义ajax加载数据
uniqueId:'id',
columns: [
{field: 'id', title: '主键', width: '15%', align: 'left',visible: false},
{
field: 'guideName',
title: '<span class="office-icon"></span>诱导屏名称',
width: '15%',
align: "left",
formatter:commonObj.replacenull
},
{
field: 'level',
title: '<span class="device-icon"></span>诱导屏级别',
width: '10%',
align: "left",
formatter:syncFun.levelFormatter
},
{
field: 'guideNo',
title: '<span class="information-icon"></span>诱导屏编码',
width: '20%',
align: "left",
formatter:commonObj.replacenull
},
{
field: 'eqpImei',
title: '<span class="information-icon"></span>诱导屏IMEI',
width: '20%',
align: "left",
formatter:function(value,row,index){
var operStr = '<div class="ITD-cursor-pointer ITD-hidden-nowrap" style="max-width: 200px;" title="'+commonObj.replacenull(value)+'">'+commonObj.replacenull(value)+'</div>';
return operStr;
},
},
{
field: 'ledDeviceStatus',
title: '<span class="status-icon"></span>设备状态',
width: '10%',
align: 'left',
formatter:syncFun.ledDeviceStatusFormatter
},
{
field: 'ledScreenStatus',
title: '<span class="status-icon"></span>屏幕状态',
width: '10%',
align: 'left',
formatter:syncFun.ledScreenStatusFormatter
},
{
field: 'oper',
title: '<span class="opration-icon"></span>操作',
width: '15%',
align: 'left',
formatter:syncFun.operFormatter
}
]
});
},
//操作显示
operFormatter:function(value,row,index){
var operStr = '<span class="ITD-oper-green" lookGuide style="margin-right: 3px" dataid="' + row.id + '" >查看</span>'
+'<span openGuideImg class="ITD-oper-show" dataid="' + row.id + '" datapdano = "'+row.pdaNo+'" >回显</span>';
return operStr;
},
levelFormatter:function(value,row,index){
if(value == null){
return "-";
}if(value == 1){
return "一级";
}if(value == 2){
return "二级";
}if(value == 3){
return "三级";
}
},
ledDeviceStatusFormatter:function(value,row,index){
if(value == null){
return "-";
}if(value == 1){
return "启用";
}if(value == 2){
return "停用";
}else{
return "未知";
}
},
ledScreenStatusFormatter:function(value,row,index){
if(value == null){
return "-";
}if(value == 1){
return "在线";
}if(value == 2){
return "离线";
}else{
return "未知";
}
},
guideTypeFormatter:function(value,row,index){
if(value == null){
return "-";
}if(value == 1){
return "点阵屏";
}if(value == 2){
return "光带屏";
}if(value == 3){
return "复合屏";
}else{
return "未知";
}
},
echoTypeFormatter:function(value,row,index){
if(value == null){
return "-";
}if(value == 1){
return "诱导屏IP";
}if(value == 2){
return "诱导屏IMEI";
}if(value == 2){
return "诱导屏编码";
}else{
return "未知";
}
},
lookscreenManage:function(element) {
var id = $(element).attr('dataid');
// $("#pdamanage_modify_id").val(id);
//根据唯一值获取行数据
var row = $('#screenmanageTable').bootstrapTable('getRowByUniqueId', id);
console.log(row);
$("[id^='_']").text("");
$("#screenparkShow").html("");
$("#_guideNo").text(commonObj.replacenull(row.guideNo));
$("#_guideName").text(commonObj.replacenull(row.guideName));
$("#_guideType").text(syncFun.guideTypeFormatter(row.guideType));
$("#_eqpImei").text(commonObj.replacenull(row.eqpImei));
$("#_eqpImei").attr('title',commonObj.replacenull(row.eqpImei));
$("#_eqpPort").text(commonObj.replacenull(row.eqpPort));
$("#_lonId").text(commonObj.replacenull(row.lonId));
$("#_address").text(commonObj.replacenull(row.address));
$("#_latId").text(commonObj.replacenull(row.latId));
$("#_level").text(syncFun.levelFormatter(row.level));
$("#_echoType").text(syncFun.echoTypeFormatter(row.echoType));
$("#_eqpIp").text(commonObj.replacenull(row.eqpIp));
$("#_installDate").text(commonObj.timeFormatter(row.installDate));
$("#_lightBandIp").text(commonObj.replacenull(row.lightBandIp));
var req = {
guideNo:row.guideNo,
sysCode:sysComm.sysCode,
dataState:1,
}
var ajax= {
method: 'post',
url: dataUrl.util.getGuideScreenConfigInfo(),
data: JSON.stringify(req),
contentType: 'application/json; charset=utf-8',
dataType:'json',
success: function(res){
if(res.code = "8888"){
if(res.data != null && (res.data).length > 0){
var data = res.data;
var html = '';
$.each(data, function(index,item) {
html += commonObj.replacenull(item.plName)+' ';
});
$("#screenparkShow").html(html);
$("#screenparkShow").attr('title',html);
}
}else{
console.log(res);
}
}
};
sysAjax(ajax);
$('#screen_detailmodel').modal('show');
},
openImgManage:function(element) {
var id = $(element).attr('dataid');
var row = $('#screenmanageTable').bootstrapTable('getRowByUniqueId', id);
var guideNo = row.guideNo;
$(".pop-common").empty();
var guideHtml = '';
var req = {
guideNo:row.guideNo,
sysCode:sysComm.sysCode,
dataState:1,
}
var ajax= {
method: 'post',
url: dataUrl.util.getGuideScreenInfo(),
data: JSON.stringify(req),
contentType: 'application/json; charset=utf-8',
dataType:'json',
success: function(res){
if(res.code = "8888"){
console.log(res);
if(res.data != null){
var data = res.data;
if(!(data.showPic)){
//不显示图片
guideHtml+='<img src="../../assets/pages/img/screenPopnoImg.png" alt="" title="点击查看原图">';
$(".pop-common").append(guideHtml);
}else{
//大于一个图时 轮播
if(data.filePaths.length>1){
guideHtml+='<div class="pos-abs guiico_left ITD-cursor-pointer" id="guiico_left"></div><img id="guilevel_img" src="" dataIMG="" alt="" title="点击查看原图"><div class="pos-abs guiico_right ITD-cursor-pointer" id="guiico_right"></div>';
$(".pop-common").append(guideHtml);
//轮播 函数部分
var obt1 = document.getElementById("guiico_left");
var obt2 = document.getElementById("guiico_right");
var oImg = document.getElementById("guilevel_img");
var index = 0;
function funTab() {
oImg.src = data.filePaths[index];
// oImg.dataIMG = data.filePaths[index];
}
funTab();
obt1.onclick = prevImg;
obt2.onclick = nextImg;
function nextImg() {
// $('.pop-common').css('display','block');
index++;
if(index > data.filePaths.length - 1) {
index = 0;
}
funTab();
};
function prevImg() {
index--;
if(index < 0) {
index = data.filePaths.length - 1;//那么下标修改为最大下标 这样就可以循环显示图片
}
funTab();//显示图片和文字信息
};
var timers;
timers=setInterval(function() {
index++;
if(index > data.filePaths.length - 1) {
index = 0;
}
funTab();
},3000);
//给文档绑定一个按键事件, 来响应键盘的按键
document.onkeydown = function(event) {
//兼容主流浏览器的写法 获取按键事件
var e = event || window.event || arguments.callee.caller.arguments[0];
if(e && e.keyCode == 37) { // 按 左方向键 (37 是←方向键码值)
prevImg();//这里是方法调用 ,方法名后要加括号, 立刻调用方法
}
if(e && e.keyCode == 39) { // 按 右方向键(39 是→方向键码值)
nextImg();//这里是方法调用 ,方法名后要加括号, 立刻调用方法
}
};
}else{
//返回一个图
guideHtml+='<img dataIMG=" '+data.filePaths[0]+'" src=" '+data.filePaths[0]+'" alt="" title="点击查看原图">';
$(".pop-common").append(guideHtml);
}
}
}else{
guideHtml+='<img src="../../assets/pages/img/screenPopnoImg.png" alt="" title="点击查看原图">';
$(".pop-common").append(guideHtml);
}
}else{
guideHtml+='<img src="../../assets/pages/img/screenPopnoImg.png" alt="" title="点击查看原图">';
$(".pop-common").append(guideHtml);
}
}
};
sysAjax(ajax);
$('#screen_showmodel').modal('show');
},
};
//查看 原图
documentBindFunc.on('click', ".pop-common", function () {
var imgs = $(this).find('img').attr('src');
window.open(imgs, "_blank");
});
//查询按钮
documentBindFunc.on('click', "#queryBtn", function () {
syncFun.createTableData();
});
//导出
var InterValObj; //timer变量,控制时间
var count = 8; //间隔函数,1秒执行
var curCount;//当前剩余秒数
function sendMessage() {
curCount = count;
//设置button效果,开始计时
$("#screenmanage_syncBtn").attr("disabled", "true");
$(".ITD-panelbtnsync-icon").css("width", "156px");
$("#screenmanage_syncBtn").val(curCount + "秒后可再次同步");
InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器,1秒执行一次
}
//timer处理函数
function SetRemainTime() {
if (curCount == 0) {
window.clearInterval(InterValObj);//停止计时器
$("#screenmanage_syncBtn").removeAttr("disabled");//启用按钮
$(".ITD-panelbtnsync-icon").css("width", "90px");
$("#screenmanage_syncBtn").val("一键同步");
}
else {
curCount--;
$("#screenmanage_syncBtn").val(curCount + "秒后可再次同步");
}
}
//一键同步
documentBindFunc.on('click', "#screenmanage_syncBtn", function () {
$('.ITD-alertmodel-contentmsg').text('');
//执行倒计时函数
sendMessage();
var req = {
sysCode:sysComm.sysCode
};
var ajax= {
method: 'post',
url: dataUrl.util.synAllGuideInfo(),
data: JSON.stringify(req),
contentType: 'application/json; charset=utf-8',
dataType:'json',
success: function(res){
if(res.code = "8888"){
syncFun.createTableData();
$('.ITD-alertmodel-contentmsg').text('同步成功!');
$('#records_alertmodel').modal('show')
setTimeout(function () {
$('.ITD-alertmodel-contentmsg').text('');
$('#records_alertmodel').modal('hide')
},2000);
}else{
// console.log(res.msg);
$('.ITD-alertmodel-contentmsg').text(res.msg);
$('#records_alertmodel').modal('show')
setTimeout(function () {
$('.ITD-alertmodel-contentmsg').text('');
$('#records_alertmodel').modal('hide')
},2000);
}
}
};
sysAjax(ajax);
});
syncFun.init();
//停车场默认加载
function tableLoadRequest(params){
var req = syncFun.getQueryParam();
//设置请求参数
//条件查询
var pageNum = (params.data.offset/params.data.limit)+1;
req.baseRequest={
pageNum:pageNum,
pageSize:params.data.limit
}
req.sysCode=sysComm.sysCode;
var cehicleFlowTableAjax= {
method: params.type,
url: dataUrl.util.queryGuideScreenForPage(),
data: JSON.stringify(req),
contentType: 'application/json; charset=utf-8',
dataType:'json',
success: function(res){
console.log(res)
if(res.code = "8888"){
params.success(res.data);
$("[data-toggle='tooltip']").tooltip({
delay: {show: 500, hide: 100},
});
}else{
}
}
};
sysAjax(cehicleFlowTableAjax);
};