IGD3000系列(一体屏)网关的app和文件系统的打包目录
朱浩东
2025-06-14 58d2e329d04aaf39b0ed00308de62bff47fa8ce8
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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
var laypage;
var layer;
var laydate;
var form;
var page = 1;  //页面,默认第1页
var request = {};  //请求数据
var LIST_DEVICE;
var warnData;
var checkbox_warn;
var warnMap = [];
var excel;
$(function () {
    layui.use(['laypage', 'layer','form', 'laydate'], function () {
        laypage = layui.laypage;
        layer = layui.layer;
        form = layui.form;
        laydate = layui.laydate;
        //开始时间
        laydate.render({
            elem: '#start'
            , type: 'date'
            , trigger: 'click'
            , theme: 'custom'
        });
        //截止时间
        laydate.render({
            elem: '#end'
            , type: 'date'
            , trigger: 'click'
            , theme: 'custom'
        });
 
        //渲染按钮位置
        renderParamBtn();
 
        //请求设备列表
        queryDevice();
 
        //获取警告并渲染
        // queryWarn(page);
        query(page);
 
    });
});
 
//请求获取设备列表
function queryDevice() {
    $.get("./cgi-bin/device/query-all", function (data, status) {
        if ("success" == status) {
            LIST_DEVICE = data;
            renderDeviceInfo();
        }
    }, "json");
}
 
//渲染设备下拉框
function renderDeviceInfo() {
    var html = '';
    html += '<option value="" selected>所有设备</option>';
    if (LIST_DEVICE != null && LIST_DEVICE.length > 0) {
        $.each(LIST_DEVICE, function (index, item) {
            html += '<option value="' + item.id + '">' + item.name + '</option>';
        });
    }
    $("#deviceId").html(html);
}
 
//获取请求参数
function query(page) {
    //获取参数
    request.id = $("#deviceId").val();
    if(!request.id){
        request.id = '0';
    }
 
    request.beginTime = $("#start").val().replace('-', '').replace('-', '');
    if (request.beginTime) {
        request.beginTime += '000000';
    }
 
    request.endTime = $("#end").val().replace('-', '').replace('-', '');
    if (request.endTime) {
        request.endTime += '235959';
    }
    request.page = page;
    queryWarn();
}
 
//请求获取报警数据
function queryWarn() {
    $.post("./cgi-bin/warn-list/query", JSON.stringify(request), function (data, status) {
        if ("success" == status) {
 
            warnData = data;
 
            //渲染警告列表
            renderWarnInfo(warnData.data);
            //渲染页码
            renderPageInfo(request.page, warnData.total);
        } else {
            window.parent.notify("数据查询出错,请重新操作!");
        }
    }, "json");
}
 
//渲染警告列表
function renderWarnInfo(data) {
 
    var html = '';
    var total = 0;
    if (data != null && data.length > 0) {
        listSetMap(data);
 
        // $.each(data, function (index, item) {
        //     if(item.flag == 0){
        //         total++;
        //     }
        // });
 
        $.each(data, function (index, item) {
            // if(item.flag == 0){
                html += '<tr><td><input class="ckeck" name="ckeck" type="checkbox" id="'+item.sn+'"/></td>';
                // html += '<td>' + (index + 1) + '</td>';
                html += '<td>' + item.sn + '</td>';
                html += '<td>' + item.name + '</td>';
                html += '<td>' + item.id + '</td>';
                html += '<td>' + timeStr(item.time) + '</td>';
                html += '<td>' + (item.flag == 0 ? '<em>未处理</em>' : '已处理') + '</td>';
                var str = item.msg;
                str = str.replace("供电方式 : 0","供电方式 : 市电供电");
                str = str.replace("供电方式 : 1","供电方式 : 电池供电");
                str = str.replace("工作模式 : 0","工作模式 : 正常模式");
                str = str.replace("工作模式 : 1","工作模式 : 旁路模式");
                str = str.replace("工作模式 : 2","工作模式 : 电池供电");
                // str = str.replaceAll(": 0",": 正常");
                // str = str.replaceAll(": 2",": 告警");
 
                html += '<td>' + str + '</td>';
                if(item.flag==0){
                    html +='<td><button style="height: 29px;line-height: 29px;" class="layui-btn layui-btn-normal" ' +
                        'onclick="warnTodo(\''+index+'\')">处理</button>';
                }else {
                    html +='<td><button style="height: 29px;line-height: 29px;" class="layui-btn layui-btn-primary" ' +
                        'onclick="warnTodo(\''+index+'\')" disabled>处理</button>';
                }
                html +='<button style="height: 29px;line-height: 29px;"' +
                    'class="layui-btn layui-btn-normal" onclick="warnDetail(\''+index+'\')">查看</button></td></tr>';
            // }
 
        });
    }else {
        html += '<tr><td colspan="8">暂未查到数据</td></tr>';
    }
 
    $("#warnList").html(html);
 
    // //渲染页码
    // renderPageInfo(request.page, total);
}
 
//修改警报状态
function warnUpdate() {
 
    //获取表单内容
    var data = form.val('edit_warn_example');
    if(data.note){
        console.log(data);
        var comData={
            "sn": data.sn,
            "flag": 1,
            "note": data.note,
            "processTime": timeStr1(data.processTime),
            "id": data.id
        };
        console.log(comData);
 
        $.post("./cgi-bin/warn-list/update", JSON.stringify(comData), function (data, status) {
            if ("success" == status) {
                //关闭弹窗
                closepopBtn();
                //重新刷新此页面数据
                queryWarn();
            } else {
                window.parent.notify("处理失败,请重新操作!");
            }
        }, "json");
    }
}
 
//警报处理弹窗
function warnTodo(index) {
 
    var winInfo = warnData.data[index];
 
    $("#note").removeAttr("readOnly");
    $(".pop-complete-btn").show();
    form.val('edit_warn_example', {
        "sn": winInfo.sn,
        "name": winInfo.name,
        "id": winInfo.id,
        "flag": winInfo.flag == 0?'未处理':'已处理',
        "time": timeStr(winInfo.time),
        "msg": winInfo.msg,
        "note": winInfo.note,
        "processTime": new Date().Format("yyyy-MM-dd hh:mm:ss")
    });
 
    if(screen.width==1920 && screen.height==1080){
        layer.open({
            skin: 'mypop',
            type: 1,
            title: false,
            area: ['50%', '62%'],
            closeBtn: 0,
            shade: 0,
            scrollbar: false,
            content: $('#editWarnDom')
        });
    }else if(screen.width==1280 && screen.height==1024){
        layer.open({
            skin: 'mypop',
            type: 1,
            title: false,
            area: ['80%', '64%'],
            closeBtn: 0,
            shade: 0,
            scrollbar: false,
            content: $('#editWarnDom')
        });
    }else{
        layer.open({
            skin: 'mypop',
            type: 1,
            title: false,
            area: ['50%', '62%'],
            closeBtn: 0,
            shade: 0,
            scrollbar: false,
            content: $('#editWarnDom')
        });
    }
 
};
 
//警报查看弹窗
function warnDetail(index) {
    var winInfo = warnData.data[index];
 
    $("#note").attr("readOnly","readOnly");
    $(".pop-complete-btn").hide();
 
    form.val('edit_warn_example', {
        "sn": winInfo.sn,
        "name": winInfo.name,
        "id": winInfo.id,
        "flag": winInfo.flag == 0?'未处理':'已处理',
        "time": timeStr(winInfo.time),
        "msg": winInfo.msg,
        "note": winInfo.note,
        "processTime": new Date().Format("yyyy-MM-dd hh:mm:ss")
    });
 
    layer.open({
        skin: 'mypop',
        type: 1,
        title: false,
        area: ['50%', '62%'],
        closeBtn: 0,
        shade: 0,
        scrollbar: false,
        content: $('#editWarnDom')
    });
}
 
//页码渲染
function renderPageInfo(page, total) {
    laypage.render({
        elem: 'pdgxq-page',
        count: total,
        theme: '#e45163',
        layout: ['prev', 'page', 'next', 'skip'],
        curr: page,
        limit: 10,
        jump: function (obj, first) {
            if (!first) {
                page = obj.curr;
                query(page);
            }
        }
    });
}
 
//标准时间格式化
Date.prototype.Format = function (fmt) {
    var o = {
        "M+": this.getMonth() + 1, // 月份
        "d+": this.getDate(), // 日
        "h+": this.getHours(), // 小时
        "m+": this.getMinutes(), // 分
        "s+": this.getSeconds(), // 秒
        "q+": Math.floor((this.getMonth() + 3) / 3), // 季度
        "S": this.getMilliseconds() // 毫秒
    };
    if (/(y+)/.test(fmt))
        fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
};
 
//时间格式处理,20210226101010-----2021-02-26 10:10:10
function timeStr(time) {
    return time.substring(0, 4) + "-" + time.substring(4, 6) + "-" + time.substring(6, 8) + " " + time.substring(8, 10) + ":" + time.substring(10, 12) + ":" + time.substring(12, 14)
}
 
//时间格式处理,2021-02-26 10:10:10-----20210226101010
function timeStr1(time) {
    return time.replace('-','').replace('-','').replace(' ','').replace(':','').replace(':','');
}
 
function closepopBtn(){
 
    layer.closeAll();
}
 
 
 
/*------------------ tableToExcel导出模块-start ----------------- */
//初始化Excel导出,id=table表格的id
 
//导出Excel点击事件
function generateClick(){
    queryAllWarn();
}
 
function queryAllWarn(){
    $.post("./cgi-bin/warn-list/excel-warn", JSON.stringify(request), function (data, status) {
        if ("success" == status) {
            //渲染警告列表
            var html = renderTable(data.data);
            tableToExcel(html);
        } else {
            window.parent.notify("数据查询出错,请重新操作!");
        }
    }, "json");
}
 
function renderTable(data){
 
    //表头
    var thead = "";
    thead += "<thead><tr>";
    thead += "<th>序号</th>";
    thead += "<th>设备ID</th>";
    thead += "<th>设备名称</th>";
    thead += "<th>警告时间</th>";
    thead += "<th>警告内容</th>";
    thead += "<th>警告状态</th>";
    thead += "<th>处理时间</th>";
    thead += "<th>处理备注</th>";
    thead += "</tr></thead>";
 
    var tbody = "";
    if (data != null && data.length > 0) {
        $.each(data, function (index, item) {
            tbody += "<tr><td>" + item.sn + "</td>";
            tbody += "<td>" + item.id + "</td>";
            tbody += "<td>" + item.name + "</td>";
            tbody += "<td>" + timeStr(item.time) + "</td>";
            tbody += "<td>" + item.msg + "</td>";
            tbody += "<td>" + (item.flag == 0 ? "<em>未处理</em>": "已处理") + "</td>";
            tbody += "<td>" + timeStr(item.processTime) + "</td>";
            tbody += "<td>" + item.note + "</td></tr>";
        });
    }else {
        tbody += '<tr><td colspan="8">暂未查到数据</td></tr>';
    }
    var html = thead + tbody;
    return html;
}
 
function tableToExcel(html) {
    var name = "告警记录";
    var uri = 'data:application/vnd.ms-excel;base64,';
    var template = '<html><head><meta charset="UTF-8"></head><body><table border="1">{table}</table></body></html>';
 
    if(!html){
        layer.msg("没有获取到要导出的内容!");
    }
 
    var ctx = {worksheet: name || 'Worksheet', table: html};
    window.location.href = uri + base64(format(template, ctx))
}
 
function format(s, c) {
    return s.replace(/{(\w+)}/g,function(m, p) { return c[p]; });
}
 
function base64(s) {
    return window.btoa(unescape(encodeURIComponent(s)))
};
/*------------------ tableToExcel导出模块-end ----------------- */
function listSetMap(list) {
    $.each(list,function (index,data) {
        warnMap[data.sn] = data;
    })
}
 
 
//批处理
function batchHandle() {
    console.log("=============批处理============");
    checkbox_warn = [];
    var b;
    var id= "";
    $('[name=ckeck]:checked').each(function() {
        id= "";
        b = false;
        b = $(this).prop('checked');
        if(b){
            id = $(this).attr('id');
            checkbox_warn.push(warnMap[id]);
        }
    });
    if(checkbox_warn.length <= 0){
        layer.msg("选择不能为空!");
        return;
    }
    console.log(checkbox_warn);
    for(var i=0;i<checkbox_warn.length;i++){
        if(checkbox_warn[i].flag !=0 ){
            console.log(checkbox_warn[i]);
            console.log("选中的数据中存在已经处理过的数据!");
            layer.msg("选中的数据中存在已经处理过的数据!");
            return;
        }
    }
 
    $("#batch_processTime").attr("readOnly","readOnly");
    $("#batch_processTime").val(new Date().Format("yyyy-MM-dd hh:mm:ss"));
    layer.open({
        skin: 'mypop',
        type: 1,
        // title: '警报信息',
        title: false,
        area: ['50%', '35%'],
        closeBtn: 0,
        shade: 0,
        scrollbar: false,
        content: $('#batchWarnDom')
    });
}
 
function allCheckbox() {
    var b = $("#all").is(":checked");
    $(".ckeck").prop('checked', b);
}
 
//批量修改警报状态
function warnUpdateBatch() {
    // //同步进行
    // $.ajaxSettings.async = false;
    // var param = {};
    // var note = $("#batch_note").val();
    // var processTime = $("#batch_processTime").val();
    // if(note){
    //     if(checkbox_warn && checkbox_warn.length > 0){
    //         for(var i=0;i<checkbox_warn.length;i++){
    //             param = {};
    //             param = {
    //                 "sn": checkbox_warn[i].sn,
    //                 "flag": 1,
    //                 "note": note,
    //                 "processTime": timeStr1(processTime),
    //                 "id": checkbox_warn[i].id
    //             };
    //             $.post("./cgi-bin/warn-list/update-batch", JSON.stringify(param), function (data, status) {
    //                 if ("success" == status) {
    //                     //关闭弹窗
    //                     // closepopBtn();
    //                     //重新刷新此页面数据
    //                     // queryWarn();
    //                 } else {
    //                     window.parent.notify("处理失败,请重新操作!");
    //                 }
    //             }, "json");
    //         }
    //         //关闭弹窗
    //         closepopBtn();
    //         //重新刷新此页面数据
    //         queryWarn();
    //     }else{
    //         layer.msg("没有选中数据,请先选中数据!");
    //         console.log("没有选中数据,请先选中数据!");
    //     }
    // }else{
    //     layer.msg("处理说明不能为空!");
    //     console.log("处理说明不能为空!");
    // }
 
 
    //同步进行
    $.ajaxSettings.async = false;
    var param = {};
    var note = $("#batch_note").val();
    var processTime = $("#batch_processTime").val();
    var sns = "";
    var ids = "";
    if(note){
 
        param = {
            "sn": sns,
            "note": note,
            "processTime": timeStr1(processTime)
        };
        $.post("./cgi-bin/warn-list/update-all", JSON.stringify(param), function (data, status) {
            if ("success" == status) {
                //关闭弹窗
                closepopBtn();
                //重新刷新此页面数据
                queryWarn();
            } else {
                window.parent.notify("处理失败,请重新操作!");
            }
        }, "json");
 
        // if(checkbox_warn && checkbox_warn.length > 0){
        //     for(var i=0;i<checkbox_warn.length;i++){
        //         sns += checkbox_warn[i].sn;
        //         ids += checkbox_warn[i].id;
        //         if(i < checkbox_warn.length -1){
        //             sns += ",";
        //             ids += ",";
        //         }
        //     }
        //     param = {
        //         "sn": sns,
        //         "note": note,
        //         "processTime": timeStr1(processTime)
        //     };
        //     $.post("./cgi-bin/warn-list/update-batch", JSON.stringify(param), function (data, status) {
        //         if ("success" == status) {
        //             //关闭弹窗
        //             closepopBtn();
        //             //重新刷新此页面数据
        //             queryWarn();
        //         } else {
        //             window.parent.notify("处理失败,请重新操作!");
        //         }
        //     }, "json");
        //     // //关闭弹窗
        //     // closepopBtn();
        //     // //重新刷新此页面数据
        //     // queryWarn();
        // }else{
        //     layer.msg("没有选中数据,请先选中数据!");
        //     console.log("没有选中数据,请先选中数据!");
        // }
    }else{
        layer.msg("处理说明不能为空!");
        console.log("处理说明不能为空!");
    }
}
 
 
function renderParamBtn() {
    if(screen.width==1920 && screen.height==1080){
        // $("#param-btn").addClass("layui-col-md6");
        $("#param-btn").removeClass("layui-col-md6");
    }else if(screen.width==1280 && screen.height==1024){
        // $("#param-btn").addClass("layui-col-md4");
        $("#param-btn").removeClass("layui-col-md4");
    }else{
        // $("#param-btn").addClass("layui-col-md6");
        $("#param-btn").removeClass("layui-col-md6");
    }
    $("#param-btn").show();
 
}