840baefc3afadda526c645801e37989535fa15df.svn-base 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /**
  2. * Created by zhumingyue on 2016/2/27.
  3. */
  4. var pos = {afterX:0,afterY:0,nowX:0,nowY:0,divX:0,divY:0};
  5. $(function(){
  6. setWH();
  7. $(window).resize(function(){
  8. setWH();
  9. });
  10. $("body").mouseover(function(){
  11. $(".search_emer_video").show();
  12. });
  13. $("body").mouseout(function(){
  14. $(".search_emer_video").hide();
  15. });
  16. });
  17. $(function(){
  18. LoginServer();
  19. $(".show_bar").toggle(
  20. function(){ $("#sideBar").slideUp(0); },
  21. function(){ $("#sideBar").slideDown(0); }
  22. );
  23. });
  24. function resolveUrl(){
  25. var encondeCondition=window.location.search;
  26. var condition= decodeURI(decodeURI(encondeCondition.substring(1,encondeCondition.length)));
  27. var conditionArr=condition.split("&");
  28. var condJson={};
  29. for(var item in conditionArr){
  30. var temArr=conditionArr[item].split("=");
  31. condJson[temArr[0]]=temArr[1];
  32. }
  33. userInfo = condJson;
  34. return condJson;
  35. };
  36. /**
  37. * 登录
  38. */
  39. function LoginServer(){
  40. var url = $.pathname() + "/ws/cockpit/CockpitService/getSyncConfig";
  41. $.post(url,function(data){
  42. ocx.LoginServer(data.ip,data.port,data.name,data.pwd,data.mode);
  43. // ocx.LoginServer(data.ip,data.port,"tang","009cd3e062b7ae641621d234be10df3a",data.mode);
  44. },'json');
  45. }
  46. function setWH(){
  47. var winHei = $(window).height();
  48. var winWid = $(window).width();
  49. $("#main_tab").height(winHei-30);
  50. $("#main_tab").width(winWid);
  51. };
  52. function activityPanl(){
  53. $(".top_bar").css("height","100%");
  54. $(".bottom_bar").css("height","0");
  55. $("#con_panl").addClass("con_panl");
  56. };
  57. function removeActivity(){
  58. $(".top_bar").css("height","45%");
  59. $(".bottom_bar").css("height","55%");
  60. $("#con_panl").removeClass("con_panl");
  61. };
  62. /* 树形菜单和拖动框初始化 */
  63. function initComplete(){
  64. var deptId = resolveUrl()["dept_id"];
  65. var setting = {
  66. async: {
  67. enable: true,
  68. dataType: 'JSON',
  69. //返回的JSON数据的名字
  70. dataName: 'treeNodes',
  71. contentType: "application/json",
  72. url:'/nwyj/ws/cockpit/CockpitService/getSync',
  73. otherParam:{"deptId":deptId},
  74. autoParam: ["id", "name", "name=reName"]
  75. }
  76. };
  77. zTree = $.fn.zTree.init($("#dept_tree"), setting);
  78. };
  79. /* 监听鼠标是否移动 */
  80. function showcoords(e,obj){
  81. var e = window.event || e;
  82. pos.nowX = e.clientX;
  83. pos.nowY = e.clientY;
  84. }
  85. function changeXY(){
  86. if(pos.afterX==pos.nowX && pos.afterY==pos.nowY){
  87. $("#m_img").slideUp(0);
  88. $("#s_img").slideUp(0);
  89. }else{
  90. pos.afterX = pos.nowX;
  91. pos.afterY = pos.nowY;
  92. }
  93. };
  94. /* 拖动控制栏 */
  95. function cl(x,y){
  96. pos.divX = x ;
  97. pos.divY = y ;
  98. $(document).bind('mousemove',function(e){
  99. con_panl_move(event,this);
  100. });
  101. }
  102. function al(){
  103. $(document).unbind('mousemove');
  104. }
  105. function con_panl_move(e,obj){
  106. var e = window.event || e;
  107. var x = e.clientX - pos.divX;
  108. var y = e.clientY - pos.divY;
  109. $("#x").val("X:" + x);
  110. $("#y").val("Y:" + y);
  111. $("#con_panl").css({left:x+"px",top:y+"px"});
  112. }
  113. /* 分屏 */
  114. function SetWinNum(winnum){
  115. ocx.SetWndNum(winnum);
  116. }
  117. /* 打开视频 */
  118. function openVideo(CameraID){
  119. //var CameraID=$("#vid").val();
  120. //$(".titleBar").html(CameraID);
  121. con_panl.window.setVideoId(CameraID);
  122. var nSelWndNo = 0;
  123. nSelWndNo = ocx.GetSelWndIndex();
  124. ocx.OpenVideo(CameraID,nSelWndNo );
  125. }
  126. /* 关闭 */
  127. function closeVideo(){
  128. var nSelWndNo = 0;
  129. nSelWndNo = ocx.GetSelWndIndex();
  130. ocx.CloseVideo(nSelWndNo);
  131. }
  132. /* 抓图 */
  133. function capturePicture(){
  134. ocx.CapturePicture("f:\\1111111.bmp");
  135. }
  136. /* 录屏 */
  137. function startRecord(){
  138. ocx.StartRecord("f:\\22222222.dav");
  139. }
  140. /* 停止录屏 */
  141. function stopRecord(){
  142. ocx.StopRecord();
  143. }
  144. /* 操控 */
  145. function PTZControl(cmd,stop){
  146. // var step = $("#steps").val();//步长设置
  147. var step = window.frames["con_panl"].$("#steps").val();
  148. ocx.PTZControl(cmd,step,stop);
  149. }