3939c6135e8499b152958216b853647f8ad9f706.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /**
  2. * 全局变量
  3. * @param maticLayout 全局明明空间
  4. */
  5. var maticLayout={};
  6. var count=null;
  7. $(function(){
  8. init();
  9. });
  10. /**
  11. * 初始化方法
  12. */
  13. function init(){
  14. /**
  15. * 布局列表配置参数
  16. */
  17. maticLayout={
  18. items:[
  19. {text:"布局一",icon:"_icon_url_1 _background_position _display _background_size _top" ,layoutData:[{column:"100%",row:[{id:"content1" ,value:"100%"}]}]},
  20. {text:"布局二",icon:"_icon_url_2 _background_position _display _background_size _top",layoutData:[{column:"50%",row:[{id:"content1",value:"100%"}]},{column:"50%",row:[{id:"content2",value:"100%"}]}]},
  21. {text:"布局四",icon:"_icon_url_2_2 _background_position _display _background_size _top",layoutData:[{column:"50%",row:[{id:"content1",value:"50%"},{id:"content2",value:"50%"}]},
  22. {column:"50%",row:[{id:"content3",value:"50%"},{id:"content4",value:"50%"}]}]},
  23. {text:"布局五",icon:"_icon_url_2_2_1 _background_position _display _background_size _top",layoutData:[{column:"25%",row:[{id:"content1",value:"50%"},{id:"content2",value:"50%"}]},
  24. {column:"50%",row:[{id:"content3",value:"100%"}]},
  25. {column:"25%",row:[{id:"content4",value:"50%"},{id:"content5",value:"50%"}]}]},
  26. {text:"布局六",icon:"_icon_url_2_3 _background_position _display _background_size _top",layoutData:[{column:"33.33%",row:[{id:"content1",value:"50%"},{id:"content2",value:"50%"}]},{column:"33.33%",row:[{id:"content3",value:"50%"},{id:"content4",value:"50%"}]},{column:"33.33%",row:[{id:"content5",value:"50%"},{id:"content6",value:"50%"}]}]},
  27. {text:"布局七",icon:"_icon_url_3_2_1 _background_position _display _background_size _top",layoutData:[{column:"25%",row:[{id:"content1",value:"33.33%"},{id:"content2",value:"33.33%"},{id:"content3",value:"33.33%"}]},
  28. {column:"75%",row:[{id:"content4",value:"66.66%"},{id:"a2",value:"33.33%",
  29. layoutData:[{row:"100%",column:[{id:"content5",value:"33.33%"},{id:"content6",value:"33.33%"},{id:"content7",value:"33.33%"}]}]}]}
  30. ]},
  31. {text:"布局八",icon:"_icon_url_2_4 _background_position _display _background_size _top",layoutData:[{column:"25%",row:[{id:"content1",value:"50%"},{id:"content2",value:"50%"}]},{column:"25%",row:[{id:"content3",value:"50%"},{id:"content4",value:"50%"}]},
  32. {column:"25%",row:[{id:"content5",value:"50%"},{id:"content6",value:"50%"}]},{column:"25%",row:[{id:"content7",value:"50%"},{id:"content8",value:"50%"}]}
  33. ]}]
  34. };
  35. /* maticLayout.items=[
  36. {text:"1",icon:"_icon_url_1 _background_position _display _background_size _top" ,layoutData:[{column:"100%",row:[{id:"content1" ,value:"100%"}]}]},
  37. {text:"2",icon:"_icon_url_2 _background_position _display _background_size _top",layoutData:[{column:"50%",row:[{id:"content1",value:"100%"}]},{column:"50%",row:[{id:"content2",value:"100%"}]}]},
  38. {text:"4",icon:"_icon_url_2_2 _background_position _display _background_size _top",layoutData:[{column:"50%",row:[{id:"content1",value:"50%"},{id:"content2",value:"50%"}]},
  39. {column:"50%",row:[{id:"content3",value:"50%"},{id:"content4",value:"50%"}]}]},
  40. {text:"2X2+1",icon:"_icon_url_2_2_1 _background_position _display _background_size _top",layoutData:[{column:"25%",row:[{id:"content1",value:"50%"},{id:"content2",value:"50%"}]},
  41. {column:"50%",row:[{id:"content3",value:"100%"}]},
  42. {column:"25%",row:[{id:"content4",value:"50%"},{id:"content5",value:"50%"}]}]},
  43. {text:"2X3",icon:"_icon_url_2_3 _background_position _display _background_size _top",layoutData:[{column:"33.33%",row:[{id:"content1",value:"50%"},{id:"content2",value:"50%"}]},{column:"33.33%",row:[{id:"content3",value:"50%"},{id:"content4",value:"50%"}]},{column:"33.33%",row:[{id:"content5",value:"50%"},{id:"content6",value:"50%"}]}]},
  44. {text:"2X3+1",icon:"_icon_url_2_4 _background_position _display _background_size _top",layoutData:[{column:"25%",row:[{id:"content1",value:"33.33%"},{id:"content2",value:"33.33%"},{id:"content3",value:"33.33%"}]},
  45. {column:"75%",row:[{id:"content4",value:"66.66%"},{id:"a2",value:"33.33%",
  46. layoutData:[{row:"100%",column:[{id:"content5",value:"33.33%"},{id:"content6",value:"33.33%"},{id:"content7",value:"33.33%"}]}]}]}
  47. ]},
  48. {text:"2X4",icon:"_icon_url_3_2_1 _background_position _display _background_size _top",layoutData:[{column:"25%",row:[{id:"content1",value:"50%"},{id:"content2",value:"50%"}]},{column:"25%",row:[{id:"content3",value:"50%"},{id:"content4",value:"50%"}]},
  49. {column:"25%",row:[{id:"content5",value:"50%"},{id:"content6",value:"50%"}]},{column:"25%",row:[{id:"content7",value:"50%"},{id:"content8",value:"50%"}]}
  50. ]}]; */
  51. //生成菜单
  52. createSetMenu($("#i_content"), maticLayout.items);
  53. $("#i_submit").on("click",function(){
  54. top.createLayout("",maticLayout.items[count].layoutData,"");
  55. top.iframeTYLoadPage();
  56. top.destoryIframeContent("#layout_list_iframe");
  57. });
  58. $("#i_cancle").on("click",function(){
  59. top.destoryIframeContent("#layout_list_iframe");
  60. });
  61. }
  62. /**
  63. *
  64. * @param $dom 操作的容器
  65. * @param arrParam 操作的数组数据
  66. * @returns {Boolean}
  67. */
  68. function createSetMenu($dom,arrParam){
  69. /*
  70. * 1.清楚主容器
  71. * 2.追加容器节点和选项节点
  72. * 3.绑定节点事件
  73. * 4.销毁对象
  74. */
  75. //1
  76. $dom.empty();
  77. //2
  78. $dom.append("<div class='_layout_ul'></div>");
  79. /*$("#menu_switch").show();布局菜单按钮开关控制*/
  80. createLi($dom.find("._layout_ul"),arrParam/*,function(a){
  81. //$("#"+options.layoutParams.dom).createLayout(a,$(window).width()*0.003);
  82. // $("._column_move").each(function(){$(this).on("mousedown",moveDomY).addClass("_drag");});
  83. // $("._row_move").each(function(){$(this).on("mousedown",moveDomX).addClass("_drag");});
  84. //loadPage($("#"+options.layoutParams.dom),options);
  85. return false;
  86. }*/);
  87. /*
  88. * 3
  89. * 鼠标移入div事件
  90. * 鼠标点击li事件
  91. * 鼠标移出div事件
  92. */
  93. $("#i_content").find("ul").find("li").each(function(){
  94. $(this).on("mouseenter",move_in_icon);
  95. });
  96. click_in_icon();
  97. //4
  98. $dom=null;
  99. /*
  100. * IE9一下版本垃圾回收
  101. */
  102. /* if(true){
  103. }*/
  104. /* $(this).find("._set_menu").find("input[type='button']").on("click",{$dom: $(this)},function(e){
  105. var diag = new top.Dialog();
  106. diag.Title = "视图名称";
  107. diag.Height=100;
  108. diag.Width=300;
  109. diag.URL = path+"page/cockpit/webgis/layoutName.jsp";
  110. diag.OKEvent = function(){
  111. var inputValue = diag.innerFrame.contentWindow.document.getElementById('layoutName').value;
  112. diag.close();
  113. saveLayout(inputValue);
  114. $("#menu_content").empty();
  115. $("#menu_content").hide();
  116. $("#content").css({height:"100%"});
  117. };
  118. diag.CancelEvent=function(){
  119. diag.close();
  120. };
  121. diag.show();
  122. });*/
  123. return false;
  124. };
  125. /**
  126. * 鼠标移入图标事件
  127. */
  128. function move_in_icon(){
  129. var time=300;
  130. var _this=$(this).find(".i_icon_content").find("div");
  131. _this.animate({"margin-top":"-100px",opacity:0},time,"",function(){
  132. _this.css({"margin-top":"40px"});
  133. _this.animate({"margin-top":"0px",opacity:1},time);
  134. _this=null;
  135. });
  136. return false;
  137. };
  138. /**
  139. * 鼠标点击事件
  140. * 从新对主页面的主容器进行布局
  141. */
  142. function click_in_icon(){
  143. $("#i_content").find("ul").find("li").each(function(i,item){
  144. $(this).find("div").on("click",function(){
  145. count=i;
  146. });
  147. });
  148. return false;
  149. };
  150. /**
  151. * 鼠标移出div事件
  152. */
  153. function move_leave_icon(){
  154. }
  155. /**
  156. * 绑定鼠标移入,移出和点击事件
  157. * @param $dom 操作的节点
  158. * @param label 如果采用委托机制,委托dom标签节点
  159. * @param fn_move_in 鼠标移入事件
  160. * @param fn_move_leave 鼠标移出事件
  161. * @param fn_click 鼠标点击事件
  162. */
  163. function bindEvent($dom,label,fn_move_in,fn_move_leave,fn_click){
  164. /*
  165. * 判断是否为委托绑定事件
  166. */
  167. if(label===""){
  168. //点击事件
  169. if(typeof fn_click=="function"){
  170. $dom.on("click",fn_click);
  171. };
  172. //移入事件
  173. if(typeof fn_move_in=="function"){
  174. $dom.on("mouseenter",fn_move_in);
  175. }
  176. //移出事件
  177. if(typeof fn_move_leave=="function"){
  178. $dom.on("mouseleave",fn_move_leave);
  179. }
  180. }else{
  181. //点击事件
  182. if(typeof fn_click=="function"){
  183. $dom.on("click",label,fn_click);
  184. };
  185. //移入事件
  186. if(typeof fn_move_in=="function"){
  187. $dom.on("mouseenter",label,fn_move_in);
  188. }
  189. //移出事件
  190. if( typeof fn_move_leave=="function"){
  191. $dom.on("mouseleave",label,fn_move_leave);
  192. }
  193. }
  194. return false;
  195. }
  196. /**
  197. * 创建布局选项
  198. * @param dataParams
  199. * @param fn_option
  200. * @returns {Boolean}
  201. */
  202. function createLi($dom,dataParams){
  203. var htmlStr="<ul>";
  204. for(var index=0,len=dataParams.length;index<len;index++){
  205. htmlStr+="<li class='_ul_li _display'><div class='i_icon_content'><div class='"+dataParams[index].icon+"' title='"+dataParams[index].text+"'/></div><div class='c_icontext'>"+dataParams[index].text+"</div></li>";
  206. };
  207. htmlStr+="</ul>";
  208. $dom.append(htmlStr);
  209. //销毁地图
  210. htmlStr=null;
  211. /* var selfDom=this;
  212. $(selfDom).append("<ul></ul>");
  213. for(var index=0,len=dataParams.items.length;index<len;index++){
  214. $(selfDom).find("ul").append("<li class='_img_content'><img src='"+dataParams.items[index].url+"' title='"+dataParams.items[index].text+"'/></li>");
  215. $(selfDom).find("ul").find("li").last().data("layouParams",dataParams.items[index].layoutData)
  216. .on("click",function(){fn_option($(this).data("layouParams"));});
  217. $(selfDom).find("li").last().on(
  218. "mouseenter",
  219. function(){
  220. $(this).addClass("_fn_mouse");}).on(
  221. "mouseleave",
  222. function(){
  223. $(this).removeClass("_fn_mouse");}).on(
  224. "click",
  225. function(){
  226. $(this).siblings().each(function() {
  227. $(this).removeClass("_fn_click_layout");
  228. });
  229. $(this).addClass("_fn_click_layout");
  230. });;
  231. }
  232. return false;*/
  233. };