zhanmingkan
2022-05-17 e8d9f2bb15b9e2a0aedafa2e7d56e741b2296f8a
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
//根据人员ID查询人员详细信息,并弹出气泡
function getPoliceById_3D(id,pos) {
    var policerArgs = JSON.stringify({
        "deviceNum" : id
    });
    $.ajax({
        type : "post",
        url : "../../easyAPI/police/getPoliceAndEquipmentsByPuid.action",
        dataType: "json",
        data : policerArgs,
        contentType : "application/json;charset=utf-8",
        success : function(data) {
            if(data !== undefined){
                showManVideo(data,pos);
            }else{
                console.log("人员查询结果为undefined")
            }
            
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("根据人员ID获取信息请求失败!");
        }
    });
}
//根据人员ID查询人员详细信息
function getPoliceInfoById_3D(id) {
    var policerArgs = JSON.stringify({
        "deviceNum" : id
    });
    $.ajax({
        type : "post",
        url : "../../easyAPI/police/getPoliceByPuid.action",
        data : policerArgs,
        contentType : "application/json;charset=utf-8",
        success : function(data) {
            if (data[0] !== undefined) {
                showInfoPolice_3D(data[0]);
            };
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("根据人员ID获取信息请求失败!");
        }
    });
}
//更新人员目录树列表
function freshPolicelayer(){
    var manData;
    var count;
    $.ajax({
        type : "post",
        url : "../../easyAPI/police/getPolice.action",
        contentType : "application/json;charset=utf-8",
        success : function(data) {
            manData = data;
            $.ajax({
                type : "post",
                url : "../../easyAPI/police/countPolice.action",
                contentType : "application/json;charset=utf-8",
                success : function(data1) {
                    if(data !== undefined){
                        count = data1;
                        createManZTree(manData,count);
                    }
                },
                error : function(XMLHttpRequest, textStatus, errorThrown) {
                    console.log("获取人员总数请求失败!");
                }
            });
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            // 请求失败时执行该函数
            console.log("获取人员信息失败!");
        }
    });
}
function getManPosByDn(deviceNum){
    var args = JSON.stringify({
        "deviceNum" : deviceNum
    });
    $.ajax({
        type : "post",
        url : "../../easyAPI/police/getManPosByDn.action",
        data : args,
        contentType : "application/json;charset=utf-8",
        success : function(data) {
            if (data[0] !== undefined) {
                var posArr = data[0].realPos.split(',');
                var poi = [Number(posArr[0]), Number(posArr[1]), Number(posArr[2])+500];
                flyToLocation(poi);
            };
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("根据人员ID获取信息请求失败!");
        }
    });
}
//获取设备GPS
function getGpsRealdata(deviceList){
    if(deviceList.length==0){
        deletePolice3DMarks();
        return;
    }
    var args = JSON.stringify({
        'deviceNums': deviceList
    });
    $.ajax({
        type : "post",
        url : "../../easyAPI/police/getManPosWithNameAndOrigin.action",
        data : args,
        contentType : "application/json;charset=utf-8",
        success : function(realdata) {
            showPolice_3D(realdata);
            return;
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("获取人员实时信息失败!");
        }
    });
}
 
var smartEyesession;
function smartEyelogin(){
    if (!smartEyesession) {
        var urlArrtemp = serverUrl.split(':');
        var urlArr = urlArrtemp[1].split('\//');
        smartEyesession = new jSW.SWSession({
            server: urlArr[1], // 如果是jSW.CallProtoType.OCX方式,这里需要填写具体的IP
            port: 9701,
            onopen: function (sess) {
                sess.swLogin({
                    user: 'admin',
                    password: '123456'
                });
            }
        });
    }
}
function smartEyelogout(){
    if (smartEyesession) {
        smartEyesession.swLogout();
    }
}
var dlghandleArr = [];
function openSmartEyeVideo(deviceNum,divobj,type) {
    var chanel = smartEyesession.swGetPuChanel(deviceNum, 0);
    if (chanel) {
        var result = chanel.swOpenEx({
            ismuti: true,
            div: divobj,
            prototype: 'auto', //rtmp > hls
            callback: function (options, response, dlghandle) {
                var obj = {'dn':deviceNum,'dlghandle':dlghandle,'type':type};
                dlghandleArr.push(obj);
            }
        });
 
        if (result != jSW.RcCode.RC_CODE_S_OK) {
            console.log('打开视频失败: ' + result);
        }
    } else {
        console.log('没有该设备通道');
    }
}
function closeSmartEyeVideo(deviceNum,type) {
    var chanel = smartEyesession.swGetPuChanel(deviceNum, 0);
    if (chanel) {
        for(var j = 0; j < dlghandleArr.length; j++){
            if(dlghandleArr[j].type==type){
                if(deviceNum==dlghandleArr[j].dn){
                    var result = chanel.swClose(dlghandleArr[j].dlghandle.hdlg);
                    dlghandleArr.splice(j, 1);
                    break;
                }
            }
        }
    } else {
        console.log('没有该设备通道');
    }
}