fei.wang
2024-04-16 70223b3ef4df02622869425fed4ba9b290e1aa74
src/main/webapp/HouTai/JianKongPeiZhi/JianKongPeiZhiJs/JianKongPeiZhi.js
@@ -1,46 +1,94 @@
layui.use('table', function(){
// setTimeout(function (){
// //     console.log("打印数据===========》》》》》》》》》》》》")
// //     console.log($("#username1").val())
// //     clickLogin()
// //     // clickStartRealPlay()
//     this.I_DestroyPlugin()()
// },1000)
layui.use(['layer', 'form'], function () {
    var layer = layui.layer
        , form = layui.form;
layui.use('table', function () {
    var table = layui.table;
    var layer = layui.layer;
    //告警汇总
    table.render({
        elem: '#shipin'
        ,url: '/hxzkuwb/findhk'
        ,page: true //开启分页
        ,size:'sm'
        ,height:702
        ,toolbar:'#toolbarDemo' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
        ,cols: [[ //表头
            {type:'checkbox',sort: true,fixed: "left"}
            ,{field: 'id', title: '序号', sort: true}
            ,{ field: 'ip', title: 'Ip地址'}
            ,{field: 'port', title: '端口' }
            ,{field: 'username', title: '用户名'}
            ,{field: 'password',title: "密码"}
            ,{field: 'shebeiport',title: "设备端口"}
        , url: '/hxzkuwb/findhk'
        , page: true //开启分页
        , size: 'sm'
        , height: 702
        , toolbar: '#toolbarDemo' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
        , cols: [[ //表头
            {type: 'checkbox', sort: true, fixed: "left",  width: 40}
            , {field: 'id', title: '序号', sort: true,  width: 80}
            , {field: 'ip', title: 'Ip地址',  width: 150}
            , {field: 'port', title: '端口',  width: 80}
            , {field: 'username', title: '用户名',  width: 100}
            , {field: 'password', title: "密码",  width: 120}
            , {field: 'shebeiport', title: "设备端口",  width: 100}
            , {field: 'bindregion', title: "绑定区域",  width: 100}
            , {field: 'enterdate', title: "录入时间",  width: 200}
            , {title: '操作',  width: 150, toolbar: '#barDemo'}
        ]]
        ,limits: [10, 20, 30, 40, 50,60,70,80,90,100]
        ,limit: 20,
        , limits: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
        , limit: 20,
    });
    table.on('tool(shipin)', function(obj){
        var data = obj.data;
        console.log(data.id)
    })
    table.on('toolbar(shipin)', function(obj) {
    // table.on('tool(shipin)', function(obj){
    //     var data = obj.data;
    //     console.log(data.id,1111)
    // })
    table.on('tool(shipin)', function (obj) { //注:tool 是工具条事件名,test 是 table 容器的 id
        var data = obj.data; //获得当前行数据
        console.log(data)
        var layEvent = obj.event; //获得 lay-event 对应的值(也就是处理的事件)
        if (layEvent === 'detail') {
            var button = document.getElementById('jiankong');
            if (button.style.display != "none") {//如果已经打开一个插件,则先把之前的销毁在重新初始化插件
                WebVideoCtrl.I_DestroyPlugin()
            }
            //     // 设置样式属性来隐藏按钮
            button.style.display = '';
            $("#loginip").val(data.ip)
            $("#port").val(data.port)
            $("#username1").val(data.username)
            $("#password").val(data.password)
            setTimeout(function () {
                initialize()
            }, 500)
            setTimeout(function () {
                clickLogin()
            }, 1000)
            setTimeout(function () {
                clickStartRealPlay()
            }, 1500)
            layer.msg('正在打开监控视频...');
        }
    });
    table.on('toolbar(shipin)', function (obj) {
        var checkStatus = table.checkStatus(obj.config.id);
        switch(obj.event) {
        switch (obj.event) {
            case 'getadd' :
                $(".add").show();
                $(".heimu").show();
                break;
            case 'getUpdate':
                var data = checkStatus.data;
                if(data.length>1){
                if (data.length > 1) {
                    layer.alert("一次只能选中一个进行修改")
                }else if(data.length == 0){
                } else if (data.length == 0) {
                    layer.alert("请选中一条数据")
                }else{
                    $("#up1").val(data[0].ptagid)
                } else {
                    $("#bindregionup").val(data[0].bindregion)
                    $("#ipup").val(data[0].ip)
                    $("#portup").val(data[0].port)
                    $("#usernameup").val(data[0].username)
                    $("#psswordup").val(data[0].password)
                    $("#shebeiportup").val(data[0].shebeiport)
                    // $("#psswordup").val(data[0].pssword)
                    $(".update").show();
                    $(".heimu").show();
                }
@@ -48,12 +96,12 @@
                break;
            case 'getdelete':
                var data = checkStatus.data;
                if(data<1){
                if (data < 1) {
                    layer.alert("请选中一条数据")
                }else{
                    for (var i = 0; i<data.length;i++){
                        var ds = "id="+data[i].username
                        $.get("/hxzkuwb/deleteHk",ds,function (data){
                } else {
                    for (var i = 0; i < data.length; i++) {
                        var ds = "id=" + data[i].username
                        $.get("/hxzkuwb/deleteHk", ds, function (data) {
                        })
                    }
@@ -62,10 +110,113 @@
                break;
        }
    })
    form.on('submit(demo-table-search)', function (data) {
        console.log(data)
        var field = data.field; // 获得表单字段
        table.reload('shipin', {
            url: "/hxzkuwb/HksxtSearch",
            method: 'post',
            page: {
                curr: 1 // 重新从第 1 页开始
            }
            , where: field // 搜索的字段
        });
        layer.msg('搜索成功');
        return false; // 阻止默认 form 跳转
    });
    form.on('submit(demo-table-search1)', function (data) {
        // console.log(data)
        var field = data.field; // 获得表单字段
        table.reload('shipin', {
            url: "/hxzkuwb/HksxtSearch",
            method: 'post',
            page: {
                curr: 1 // 重新从第 1 页开始
            }
            , where: field // 搜索的字段
        });
        layer.msg('搜索成功');
});
function quxiao(){
});
});
xz = function() {
    $("#ZsGs").show()
}
function xzGong(id) {
    $("#bindregionadd").val(id)
    $("#ZsGs").hide()
}
function xzGongSi() {
    console.log(1111111111111)
    var name = $("#bindregionadd").val();
    var data = "name=" + name
    $.post("/hxzkuwb/MoHuweilan", data, function (data) {
        var str = [];
        if (data.length != 0) {
            for (var i = 0; i < data.length; i++) {
                $("#ZsGs").empty();
                var name =  data[i].name
                data[i].name = "'" + data[i].name + "'"
                str += '<p onclick="xzGong(' + data[i].name + ')" style="cursor: pointer;height: 40px;line-height: 40px;padding-left: 10px;border-bottom: 1px solid #f6f6f6">' + name+ '</p>'
            }
        }
        $("#ZsGs").append(str)
    })
    $("#ZsGs").show()
}
xzup = function() {
    $("#ZsGsup").show()
}
function xzGongup(id) {
    $("#bindregionup").val(id)
    $("#ZsGsup").hide()
}
function xzGongSiup() {
    console.log(1111111111111)
    var name = $("#bindregionup").val();
    var data = "name=" + name
    $.post("/hxzkuwb/MoHuweilan", data, function (data) {
        var str = [];
        if (data.length != 0) {
            for (var i = 0; i < data.length; i++) {
                $("#ZsGsup").empty();
                var name =  data[i].name
                data[i].name = "'" + data[i].name + "'"
                str += '<p onclick="xzGongup(' + data[i].name + ')" style="cursor: pointer;height: 40px;line-height: 40px;padding-left: 10px;border-bottom: 1px solid #f6f6f6">' + name+ '</p>'
            }
        }
        $("#ZsGsup").append(str)
    })
    $("#ZsGsup").show()
}
function guanbi() {
    console.log("1111111111111111112222")
    var button = document.getElementById('jiankong');
    //     // 设置样式属性来隐藏按钮
    button.style.display = 'none';
    WebVideoCtrl.I_DestroyPlugin()
    // layer.msg('操作成功')
    // setTimeout(function() {
    //     $(".add").hide();
    //     $(".update").hide();
    //     $(".heimu").hide();
    // }, 500);
}
function quxiao() {
    layer.msg('操作成功')
    setTimeout(function() {
    setTimeout(function () {
        $(".add").hide();
        $(".update").hide();
        $(".heimu").hide();