123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- /**
- * Created by zhumingyue on 2016/2/27.
- */
- var pos = {afterX:0,afterY:0,nowX:0,nowY:0,divX:0,divY:0};
- var un = "";
- var su = null;
- $(function(){
- // setWH();
- // $(window).resize(function(){
- //// setWH();
- // });
-
-
- // $("body").mouseover(function(){
- // $(".search_emer_video").show();
- // });
- //
- // $("body").mouseout(function(){
- // $(".search_emer_video").hide();
- // });
-
- su = new SearchUtil();
- });
-
- $(function(){
- initTree();
- if(myBrowser().brow == "IE"){
- LoginServer();
- }else{
- alert("变电站视频只能使用IE浏览器");
- };
-
- $(".show_bar").toggle(
- function(){ $("#sideBar").slideUp(0); },
- function(){ $("#sideBar").slideDown(0); }
- );
-
- var h = $(".layout_content").height();
- setMainBoxTree(h);
- });
-
- $(window).unload(function(){
- exit();
- });
- function login(){
- var user_name = $("#user_input").val();
- var pwd = $("#pwd_input").val();
-
- if(user_name=="请输入用户名" || user_name=="" || user_name==undefined || user_name==null){
- alert("请输入用户名!");
- return;
- };
- if(pwd=="" || pwd==undefined || pwd==null){
- alert("请输入密码!");
- return;
- };
- var url = $.pathname() + "/ws/cockpit/CockpitService/getSyncConfigNup";
- var data = su.getJsonData(url,{user_name:un});
-
- if(data){
- ocx.LoginServer(data.ip,data.port,user_name,pwd,data.mode);
- }else{
- alert("IP端口获取错误!");
- };
-
- };
- function exit(){
- if(un!=""){
- var url = $.pathname() + "/ws/cockpit/CockpitService/exitTvUser";
- var res = su.getJsonData(url,{user_name:un});
- };
- };
- function initComplete(){
- var layout=$("#layout1").layout({ leftWidth: 400 });
- layout.setRightCollapse(true);
- layout.onHeightChanged(function(){
- });
- };
- $(window).resize(function(){
- setWH();
- });
- function resolveUrl(){
- var encondeCondition=window.location.search;
- var condition= decodeURI(decodeURI(encondeCondition.substring(1,encondeCondition.length)));
- var conditionArr=condition.split("&");
- var condJson={};
- for(var item in conditionArr){
- var temArr=conditionArr[item].split("=");
- condJson[temArr[0]]=temArr[1];
- }
- userInfo = condJson;
- return condJson;
- };
-
- /**
- * 登录
- */
- function LoginServer(){
- var url = $.pathname() + "/ws/cockpit/CockpitService/getSyncConfig";
- $.post(url,function(res){
- if(res.stat=="success"){
- var data = res.res;
- un = data.name;
- ocx.LoginServer(data.ip,data.port,data.name,data.pwd,data.mode);
- }else if(res.stat=="full"){
- alert("用户已满,请等待!");
- }else{
- alert("登录失败!");
- };
- // ocx.LoginServer(data.ip,data.port,"tang","009cd3e062b7ae641621d234be10df3a",data.mode);
- },'json');
-
- }
- function setWH(){
- var winHei = $(window).height();
- var winWid = $(window).width();
- $("#layout1").height(winHei-30);
- $("#layout1").width(winWid);
- $(".l-layout-content").height(winHei-60);
- $(".layout_content").height(winHei-60);
- $(".main_box_tree").height(winHei-200);
- };
- function activityPanl(){
- $(".top_bar").css("height","100%");
- $(".bottom_bar").css("height","0");
- $("#con_panl").addClass("con_panl");
- };
- function removeActivity(){
- $(".top_bar").css("height","45%");
- $(".bottom_bar").css("height","55%");
- $("#con_panl").removeClass("con_panl");
- };
- /* 树形菜单和拖动框初始化 */
- function initTree(){
- var deptId = resolveUrl()["dept_id"];
- var setting = {
- async: {
- enable: true,
- dataType: 'JSON',
- //返回的JSON数据的名字
- dataName: 'treeNodes',
- contentType: "application/json",
- url:'/nwyj/ws/cockpit/CockpitService/getSync',
- otherParam:{"deptId":deptId},
- autoParam: ["id", "name", "name=reName"]
- }
- };
- zTree = $.fn.zTree.init($("#dept_tree"), setting);
- };
- function customHeightSet(contentHeight){
- $(".layout_content").height(contentHeight-30);
- };
- function setMainBoxTree(h){
- $(".main_box_tree").height(h-170);
- };
- /* 监听鼠标是否移动 */
- function showcoords(e,obj){
- var e = window.event || e;
- pos.nowX = e.clientX;
- pos.nowY = e.clientY;
- }
- function changeXY(){
- if(pos.afterX==pos.nowX && pos.afterY==pos.nowY){
- $("#m_img").slideUp(0);
- $("#s_img").slideUp(0);
- }else{
- pos.afterX = pos.nowX;
- pos.afterY = pos.nowY;
- }
- };
- /* 拖动控制栏 */
- function cl(x,y){
- pos.divX = x ;
- pos.divY = y ;
- $(document).bind('mousemove',function(e){
- con_panl_move(event,this);
- });
- };
- function al(){
- $(document).unbind('mousemove');
- };
- function con_panl_move(e,obj){
- var e = window.event || e;
- var x = e.clientX - pos.divX;
- var y = e.clientY - pos.divY;
- $("#x").val("X:" + x);
- $("#y").val("Y:" + y);
- $("#con_panl").css({left:x+"px",top:y+"px"});
- }
- /* 分屏 */
- function splic_video(){
- var splitNum = $("#steps_split option:selected").val();
- SetWinNum(splitNum);
- }
- /* 分屏 */
- function SetWinNum(winnum){
- ocx.SetWndNum(winnum);
- }
- /* 打开视频 */
- function openVideo(CameraID){
- if(CameraID==""||CameraID==undefined||CameraID==null){
- CameraID = $.trim($("#vid").val());
- }
- if(CameraID=="请输入视频ID"||CameraID==""){ return; }
- //var CameraID=$("#vid").val();
- //$(".titleBar").html(CameraID);
- setVideoId(CameraID);
- var nSelWndNo = 0;
- nSelWndNo = ocx.GetSelWndIndex();
- ocx.OpenVideo(CameraID,nSelWndNo );
- }
- /**
- * 设置视频ID
- */
- function setVideoId(CameraID){
- $("#vid").removeAttr("watermark").attr("value",CameraID);
- };
- /* 关闭 */
- function closeVideo(){
- var nSelWndNo = 0;
- nSelWndNo = ocx.GetSelWndIndex();
- ocx.CloseVideo(nSelWndNo);
- }
- /* 抓图 */
- function capturePicture(){
- ocx.CapturePicture("d:\\1111111.bmp");
- }
- /* 录屏 */
- function startRecord(){
- ocx.StartRecord("d:\\22222222.dav");
- }
- /* 停止录屏 */
- function stopRecord(){
- ocx.StopRecord();
- }
- /* 操控 */
- function PTZControl(cmd,stop){
- var step = $("#steps").val();//步长设置
- // var step = window.frames["con_panl"].$("#steps").val();
- ocx.PTZControl(cmd,step,stop);
- }
|