814714962293eb36d88a7b0cda5c73618748d191.svn-base 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. function initAlertDrag(url,str){
  2. var ai = new AlertIframe();
  3. if($(".drag_win").html()==null || $(".drag_win").html()==""){
  4. ai.createDragWin(url, str);
  5. }else{
  6. removeAlertDrag();
  7. //ai.createDragWin(url, str);
  8. }
  9. };
  10. function removeAlter(params){
  11. $("#aler").remove();
  12. $(".shade_plan").remove();
  13. };
  14. function removeIconAlter(params){
  15. $("#aler").remove();
  16. $("#"+params).removeClass("tl_show");
  17. };
  18. function removeAlertDrag(){
  19. /*$(".drag_win").css("display","none");*/
  20. $(".drag_win").empty();
  21. $(".drag_win").css({width:0,height:0});
  22. /*$("#bdmap").CSS("display","none");*/
  23. /*document.getElementById("bdmap").style.display="none";*/
  24. };
  25. function removeIframeGrid(id){
  26. $("#"+id).remove();
  27. };
  28. AlertIframe = function(){
  29. var _this = this ;
  30. var width = 320;
  31. var height = 186 ;
  32. var top = 100 ;
  33. var left = 100 ;
  34. var title = "系统提示" ;
  35. var count = "提示信息" ;
  36. var icon_width = 320 ;
  37. var icon_height = 186 ;
  38. var icon_bottom = 0 ;
  39. var icon_right = 0 ;
  40. var temp_width = 320 ;
  41. var temp_height = 186 ;
  42. var temp_bottom = 0 ;
  43. var temp_right = 0 ;
  44. var temp_src = "/nwyj/page/cockpit/webgis/toolTeam.jsp" ;
  45. var pos = {ifrX:0,ifrY:0,divX:0,divY:0};
  46. /**
  47. * 创建应急资源钻取数据弹窗
  48. */
  49. this.createErInfoGrid = function(src){
  50. var iframe = document.createElement("iframe");
  51. iframe.src = src;
  52. iframe.id = "infoGrid";
  53. iframe.name = "infoGrid";
  54. iframe.style.width = "700px";
  55. iframe.style.height = "570px";
  56. iframe.frameBorder = 0;
  57. iframe.scrolling = "no";
  58. iframe.style.position = "fixed";
  59. iframe.style.zIndex=999;
  60. iframe.style.border="none";
  61. iframe.style.top = "10%";
  62. iframe.style.left = "162px";
  63. $("body").append(iframe);
  64. };
  65. /**
  66. * 添加资源信息窗
  67. */
  68. this.addSummaryIframe = function(){
  69. var offset = $("#leftceladows").offset();
  70. var temp = $("#leftceladows").width();
  71. var iframe = document.createElement("iframe");
  72. iframe.src = "/nwyj/page/cockpit/webgis/gisMes.jsp";
  73. iframe.id = "gisMes";
  74. iframe.name = "gisMes";
  75. iframe.style.width = "15px";
  76. iframe.style.height = "15px";
  77. iframe.frameBorder = 0;
  78. iframe.scrolling = "no";
  79. iframe.style.position = "fixed";
  80. iframe.style.zIndex=999;
  81. iframe.style.border="none";
  82. iframe.style.top = offset.top+"px";
  83. iframe.style.left = (offset.left+temp)+"px";
  84. $("body").append(iframe);
  85. $("#gisMes").addClass("vis_no");
  86. };
  87. this.getPosi = function(_w,_h){
  88. /*var bh = $(window).height();
  89. var bw = $(window).width();*/
  90. //var bh = document.body.clientHeight;
  91. //var bw = document.body.clientWidth;
  92. // var bh = document.body.clientHeight;
  93. // var bw = document.body.clientWidth;
  94. var bh = window.screen.height;
  95. var bw = window.screen.width;
  96. bh = (bh - _h)/2.0 ;
  97. bw = (bw - _w)/2.0 ;
  98. top = bh ;
  99. left = bw ;
  100. };
  101. this.getTempMes = function(){
  102. return {width:temp_width, height:temp_height, top:temp_bottom, left:temp_right, title:title, count:count, src:temp_src};
  103. };
  104. this.setTempMes = function(_width,_height,_src){
  105. temp_width = _width;
  106. temp_height = _height;
  107. temp_src = _src;
  108. };
  109. this.getMes = function(){
  110. return {width:width, height:height, top:top, left:left, title:title, count:count};
  111. };
  112. this.setMes = function(_width,_height,_top,_left,_title,_count){
  113. width = _width;
  114. height = _height;
  115. top = _top;
  116. left = _left;
  117. title = _title;
  118. count = _count;
  119. };
  120. this.createAlert = function(){
  121. _this.getPosi(width,height);
  122. $("#leftceladows").append("<div class='shade_plan'></div>");
  123. var iframe = document.createElement("iframe");
  124. iframe.onload = iframe.onreadystatechange = _this.initIframe;
  125. iframe.src = "/nwyj/page/cockpit/alert/alert_iframe.html";
  126. iframe.style.width = width+"px";
  127. iframe.style.height = height+"px";
  128. iframe.style.position = "fixed";
  129. iframe.style.top = top+"px";
  130. iframe.style.left = left+"px";
  131. iframe.id = "aler";
  132. iframe.scrolling = "no";
  133. iframe.style.border="none";
  134. iframe.style.zIndex=999;
  135. iframe.frameBorder = 0;
  136. $("body").append(iframe);
  137. };
  138. this.initIframe = function(){
  139. if (this.src.length > 0) {
  140. if (!this.readyState || this.readyState == "complete") {
  141. $(this).contents().find("#alt_title").html(title);
  142. $(this).contents().find("#alt_count").html(count);
  143. }
  144. }
  145. };
  146. this.getIconMes = function(){
  147. return {width:width, height:height, top:top, left:left, title:title, count:count};
  148. };
  149. this.setIconMes = function(_width,_height,_bottom,_right,_title,_count){
  150. icon_width = _width;
  151. icon_height = _height;
  152. icon_bottom = _bottom;
  153. icon_right = _right;
  154. title = _title;
  155. count = _count;
  156. };
  157. /**
  158. * 弹出信息框
  159. * w:弹框宽度px
  160. * h:弹框高度px
  161. * b:距离底部距离px
  162. * r:距离右侧距离px
  163. * src:页面地址
  164. */
  165. this.createIconAlert = function(w,h,b,r,src){
  166. var iframe = document.createElement("iframe");
  167. /*iframe.onload = iframe.onreadystatechange = _this.initIconIframe;*/
  168. iframe.src = src;
  169. iframe.style.width = w+"px";
  170. iframe.style.height = h+"px";
  171. iframe.style.position = "fixed";
  172. iframe.style.bottom = b+"px";
  173. iframe.style.right = r+"px";
  174. iframe.id = "aler";
  175. iframe.name= "iconFrame";
  176. iframe.scrolling = "no";
  177. iframe.style.border="none";
  178. iframe.frameBorder = 0;
  179. $("body").append(iframe);
  180. return true;
  181. };
  182. /**
  183. * 创建一个Iframe
  184. */
  185. this.createIframe = function(temp_width, temp_height, temp_src){
  186. _this.getPosi(width,height);
  187. $("#leftceladows").append("<div class='shade_plan'></div>");
  188. var iframe = document.createElement("iframe");
  189. iframe.onload = iframe.onreadystatechange = _this.initIframe;
  190. iframe.src = temp_src;
  191. iframe.style.width = temp_width+"px";
  192. iframe.style.height = temp_height+"px";
  193. iframe.style.position = "fixed";
  194. iframe.style.top = top+"px";
  195. iframe.style.left = left+"px";
  196. iframe.id = "aler";
  197. iframe.scrolling = "no";
  198. iframe.style.border="none";
  199. iframe.style.zIndex=999;
  200. iframe.frameBorder = 0;
  201. $("body").append(iframe);
  202. };
  203. this.initIconIframe = function(){
  204. if (this.src.length > 0) {
  205. if (!this.readyState || this.readyState == "complete") {
  206. $(this).contents().find("#alt_title").html(title);
  207. // $(this).contents().find("#alt_count").html(count);
  208. }
  209. }
  210. };
  211. /**
  212. * 得到地图过滤条件窗口
  213. */
  214. this.createGisFilterPlant = function(){
  215. var iframe = document.createElement("iframe");
  216. iframe.onload = iframe.onreadystatechange = _this.initIconIframe;
  217. iframe.src = $.pathname() + "/page/cockpit/alert/alert_filter_plant.html";
  218. iframe.style.width = icon_width+"px";
  219. iframe.style.height = icon_height+"px";
  220. iframe.style.position = "fixed";
  221. iframe.style.bottom = icon_bottom+"px";
  222. iframe.style.right = icon_right+"px";
  223. iframe.id = "aler";
  224. iframe.scrolling = "no";
  225. iframe.style.border="none";
  226. iframe.frameBorder = 0;
  227. $("body").append(iframe);
  228. };
  229. this.createDragWin = function(url, titleStr){
  230. var wid = $(".drag_win").attr("width");
  231. var hei = $(".drag_win").attr("height");
  232. $(".drag_win").css({width:wid,height:hei});
  233. var ww = $(window).width();
  234. var wh = $(window).height();
  235. wid = _this.setWHDrag(wid,ww);
  236. hei = _this.setWHDrag(hei,wh);
  237. _this.getPosi(wid.num,hei.num);
  238. $(".drag_win").css({top:100,left:left});
  239. $(".drag_win").append('<div id="tit" class="drag_title">' +
  240. '<table class="tit_tab"><tr><td class="tit_td">&nbsp;&nbsp;&nbsp;&nbsp;' + titleStr + '</td>' +
  241. '<td class="close_td" onclick="removeAlertDrag()">' + '<img src="/nwyj/images/cockpit/close.png" class="close_drag" alt="关闭"/>' + '</td></tr></table>' +
  242. '</div>' +
  243. /*'<iframe id="bdmap" width="' + wid.num + 'px" height="' + (hei.num-30) + 'px" scrolling="no" frameborder="0" src="' + url + '"></iframe>');*/
  244. '<iframe id="bdmap" width="' + wid.num + 'px" height="560px" scrolling="no" frameborder="0" src="' + url + '"></iframe>');
  245. _this.cl_div();
  246. _this.al_div();
  247. };
  248. this.setWHDrag = function(pd,winPd){
  249. var wunit = pd.substring(pd.length-2,pd.length);
  250. var num = pd.substring(0, pd.length-2) ;
  251. if(wunit=="px"||wunit=="PX"){
  252. return {unit:"px",num:num};
  253. }else{
  254. wunit = pd.substring(pd.length-1,pd.length);
  255. if(wunit=="%"){
  256. num = pd.substring(0, pd.length-1) ;
  257. num = winPd * (num/100);
  258. return {unit:"%",num:num};
  259. }else{
  260. return {unit:"",num:num};
  261. }
  262. }
  263. };
  264. /*DIV 鼠标拖动样式*/
  265. this.cl_div = function(){
  266. $("#tit").on('mousedown',function(){
  267. pos.divX = event.offsetX;
  268. pos.divY = event.offsetY;
  269. $(document).bind('mousemove',function(e){
  270. _this.div_panl_move(event,this);
  271. });
  272. });
  273. };
  274. this.al_div = function(){
  275. $("#tit").on('mouseup',function(){
  276. $(document).unbind('mousemove');
  277. });
  278. };
  279. this.div_panl_move = function(e,obj){
  280. var e = window.event || e;
  281. var x = e.clientX - pos.divX;
  282. var y = e.clientY - pos.divY;
  283. $(".drag_win").css({left:x+"px",top:y+"px"});
  284. };
  285. };