zhitong.yu
2024-03-21 6beef2ce75f15a8b3d4394b83da62071c686eb3d
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
 
layui.use('table', function(){
    var table = layui.table;
    var layer = layui.layer;
    //告警汇总
    table.render({
        elem: '#wangguan'
 
        ,url: '/hxzkuwb/findLoraGateWay'
        ,page: true //开启分页
        ,size:'sm'
        ,toolbar:'#toolbarDemo' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
        ,cols: [[ //表头
            {type:'checkbox',fixed: "left"}
            ,{field: 'id', title: '序号'}
            ,{ field: 'loragwid', title: '设备ID'}
            ,{field: 'status', title: '在线状态'}
            ,{field: 'lon', title: '经度' }
            ,{field: 'lat', title: '纬度'}
            ,{field: 'gwip', title: '网关Ip'}
            ,{field: 'gwport', title: '网关端口'}
            ,{field: 'pindian1', title: '一通道频点'}
            ,{field: 'pindian2', title: '二通道频点'}
            ,{field: 'pindian3', title: '三通道频点'}
            ,{field: 'pindian4', title: '四通道频点'}
            ,{field: 'pindian5', title: '五通道频点'}
            ,{field: 'gonglv', title: '功率'}
            ,{field: 'version', title: '版本'}
            ,{field: 'addtime', title: '更新时间'}
 
        ]]
        ,limits: [10, 20, 30, 40, 50,60,70,80,90,100,100000]
        ,limit: 20,
    });
 
    table.on('toolbar(wangguan)', function(obj) {
        var checkStatus = table.checkStatus(obj.config.id);
        switch(obj.event) {
            case 'getUpdate':
                var data = checkStatus.data;
                if(data.length>1){
                    layer.alert("一次只能选中一个进行修改")
                }else if(data.length == 0){
                    layer.alert("请选中一条数据")
                }else{
                    $("#up1").val(data[0].tagId)
                    var types = data[0].type
                    $(".update").show();
                    $(".heimu").show();
 
                }
                break;
            case 'getdelete':
                var data = checkStatus.data;
                if(data<1){
                    layer.alert("请选中一条数据")
                }else{
                    for (var i = 0; i<data.length;i++){
                        var ds = "id="+data[i].id
                        $.get("/hxzkuwb/deLoraGateWay",ds,function (data){
 
                        })
                    }
                    location.reload()
                }
                break;
            case 'getshuaxin':
                layer.msg('刷新成功')
                setTimeout(function (){
                    location.reload();
                },500)
                break;
        }
 
    })
});
 
function quxiao(){
    layer.msg('操作成功')
    setTimeout(function() {
        $(".add").hide();
        $(".update").hide()
        $(".heimu").hide();
    }, 500);
}