17a3407ec14a0a56af207f839c8ab6c5001ee2ed.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. var grid = null ;
  2. /**
  3. * @param QUIlayoutpage类为Qui布局相关的所有的方法
  4. * @author jiangyongfei zhumingyue
  5. * @constructor null
  6. * @exception null
  7. * @version 1.0
  8. * @Date 2015-09-24
  9. */
  10. (function(){
  11. QUIlayoutpage();
  12. Gislayerpage();
  13. });
  14. QUIlayoutpage=function()
  15. {
  16. /**
  17. * 实例化
  18. */
  19. gislayerpages = new Gislayerpage();
  20. /**
  21. * 响应事件类型自动提交参数
  22. */
  23. var settingMoreOpt = {
  24. view: {
  25. dblClickExpand: false
  26. },
  27. check: {
  28. enable: true,
  29. autoCheckTrigger: true
  30. },
  31. callback: {
  32. //响应右键
  33. onRightClick: OnRightClick,
  34. onCheck: onCheckID
  35. }
  36. };
  37. /**
  38. * 树形复选框内容
  39. */
  40. var zNodes = [
  41. //{ id:1, parentId:0, name:"气象灾害", open: true, icon:"/nwyj/images/cockpit/morelayer.ico", nocheck: false,menuType:"fathermenu"},
  42. { id:11,parentId:1, name:"日常气象图层",icon:"/nwyj/images/cockpit/onelayer.ico", chkDisabled: false,menuType:"sonmenu",checked:false},
  43. { id:12,parentId:1, name:"台风图层",icon:"/nwyj/images/cockpit/onelayer.ico", chkDisabled: false,menuType:"sonmenu",checked:false},
  44. { id:13,parentId:1, name:"暴雨图层",icon:"/nwyj/images/cockpit/onelayer.ico", chkDisabled: false,menuType:"sonmenu",checked:false},
  45. { id:14,parentId:1, name:"冰灾图层",icon:"/nwyj/images/cockpit/onelayer.ico", chkDisabled: false,menuType:"sonmenu",checked:false},
  46. //{ id:15,parentId:1, name:"地震图层",icon:"/nwyj/images/cockpit/onelayer.ico", chkDisabled: false,menuType:"sonmenu",checked:false},
  47. { id:16,parentId:1, name:"山火图层",icon:"/nwyj/images/cockpit/onelayer.ico", chkDisabled: false,menuType:"sonmenu",checked:false},
  48. //{ id:2, parentId:0, name:"应急预警与响应", open: false, icon:"/nwyj/images/cockpit/morelayer.ico", nocheck: false,menuType:"fathermenu"},
  49. { id:21,parentId:2, name:"应急预警与响应图层",icon:"/nwyj/images/cockpit/morelayer.ico", chkDisabled: false,menuType:"sonmenu",checked:false},
  50. // { id:3, parentId:0, name:"线路跳闸与变电站停运", open: false, icon:"/nwyj/images/cockpit/morelayer.ico", nocheck: false,menuType:"fathermenu"},
  51. // { id:31,parentId:3, name:"线路跳闸与变电站停运图层",icon:"/nwyj/images/cockpit/morelayer.ico", chkDisabled: false,menuType:"sonmenu",checked:false},
  52. //{ id:4, parentId:0, name:"应急资源", open: false, icon:"/nwyj/images/cockpit/morelayer.ico", nocheck: false,menuType:"fathermenu"},
  53. { id:41,parentId:4, name:"应急资源图层",icon:"/nwyj/images/cockpit/morelayer.ico", chkDisabled: false,menuType:"sonmenu",checked:false},
  54. //{ id:5, parentId:0, name:"线路覆冰", open: false, icon:"/nwyj/images/cockpit/morelayer.ico", nocheck: false,menuType:"fathermenu"},
  55. //{ id:51,parentId:5, name:"线路覆冰图层",icon:"/nwyj/images/cockpit/onelayer.ico", chkDisabled: false,menuType:"sonmenu",checked:false},
  56. //{ id:6, parentId:0, name:"设备损失", open: false, icon:"/nwyj/images/cockpit/morelayer.ico",chkDisabled: false, nocheck: false,menuType:"fathermenu"},
  57. { id:61,parentId:6, name:"设备损失图层",icon:"/nwyj/images/cockpit/onelayer.ico", chkDisabled: false,menuType:"sonmenu",checked:false},
  58. //{ id:7, parentId:0, name:"用户停电", open: false, icon:"/nwyj/images/cockpit/morelayer.ico",chkDisabled: false, nocheck: false,menuType:"fathermenu"},
  59. { id:71,parentId:7, name:"用户停电图层",icon:"/nwyj/images/cockpit/onelayer.ico", chkDisabled: false,menuType:"sonmenu",checked:false},
  60. ];
  61. /**
  62. * @param QUI布局,分为左中右的三部分弹窗效果,传入参数分别为控件名称,true/false,true/false
  63. * @version 1.0
  64. * @Date 2015-09-26
  65. */
  66. //this.QUIlayout=function(Uicontrolname,leftflag,rightflag)
  67. //{
  68. //var layout=$(Uicontrolname).layout({ leftWidth: 250,rightWidth:300});
  69. //layout.setLeftCollapse(leftflag);
  70. //layout.setRightCollapse(rightflag);
  71. //};
  72. /**
  73. * @param QUI树形复选框,传入参数为控件名称
  74. * @version 1.0
  75. * @Date 2015-09-26
  76. */
  77. this.QUItreecheckbox=function(Uicontrolname)
  78. {
  79. $.fn.zTree.init($(Uicontrolname),settingMoreOpt, zNodes);
  80. };
  81. /**
  82. * @param QUI中的右键菜单,传入参数为控件名称
  83. * @version 1.0
  84. * @Date 2015-09-26
  85. */
  86. this.QUItreerightmeun=function(Uicontrolname)
  87. {
  88. zTree = $.fn.zTree.getZTreeObj(Uicontrolname);
  89. //鼠标移入右键菜单效果
  90. $("#rMenu >div").hover(function(){
  91. $(this).addClass("b-m-ifocus");
  92. },function(){
  93. $(this).removeClass("b-m-ifocus");
  94. });
  95. };
  96. /**
  97. * @param QUI中的右键菜单按钮内容
  98. * @version 1.0
  99. * @Date 2015-09-26
  100. */
  101. this.ShowRightMeun=function(type, x, y)
  102. {
  103. $("#rMenu ul").show();
  104. // if(type == "fathermenu") {//父节点全选和全不选
  105. // $("#fullopt").show();
  106. // $("#nofullopt").show();
  107. // $("#openfind").show();
  108. // $("#openlegend").show();
  109. // $("#opendatatable").show();
  110. // $("#openspecial").show();
  111. // $("#zoomtolayer").show();
  112. //
  113. // $("#zoomtolayer").hide();
  114. // $("#openspecial").hide();
  115. // $("#opendatatable").hide();
  116. // $("#openlegend").hide();
  117. // $("#openfind").hide();
  118. // }else
  119. if(type == "sonmenu") {//子节点不保留选择和删除
  120. // $("#fullopt").show();
  121. // $("#nofullopt").show();
  122. $("#openfind").show();
  123. $("#openlegend").show();
  124. $("#opendatatable").show();
  125. // $("#openspecial").show();
  126. $("#zoomtolayer").show();
  127. // $("#fullopt").show();
  128. // $("#nofullopt").show();
  129. }
  130. $("#rMenu").css({"top":y+"px", "left":x+"px", "visibility":"visible"});
  131. //点击菜单外时隐藏菜单
  132. $("body").bind("mousedown", onBodyMouseDown);
  133. };
  134. /**
  135. * @param 鼠标点击右键面板中的菜单之后隐藏右键面板
  136. * @version 1.0
  137. * @Date 2015-09-26
  138. */
  139. this.hideRMenu = function()
  140. {
  141. if ($("#rMenu")) $("#rMenu").css({"visibility": "hidden"});
  142. $("body").unbind("mousedown", onBodyMouseDown);
  143. };
  144. /**
  145. * @param 鼠标点击空白处后隐藏右键面板
  146. * @version 1.0
  147. * @Date 2015-09-26
  148. */
  149. function onBodyMouseDown(event)
  150. {
  151. if (!(event.target.id == "rMenu" || $(event.target).parents("#rMenu").length > 0))
  152. {
  153. $("#rMenu").css({"visibility" : "hidden"});
  154. }
  155. };
  156. /**
  157. * @param 右键菜单中的全选功能
  158. * @version 1.0
  159. * @Date 2015-09-26
  160. */
  161. this.Rfullopt = function(checked)
  162. {
  163. //获取选中的行
  164. var nodes = zTree.getSelectedNodes();
  165. if (nodes && nodes.length>0)
  166. {
  167. zTree.checkNode(nodes[0], checked, true);
  168. }
  169. };
  170. /**
  171. * 定义图层ID与选项卡之间的映射
  172. */
  173. var pageTitles = { 11:'日常气象图层', 12:'台风图层', 13:'暴雨图层', 14:'冰灾图层',
  174. 15:'地震图层', 16:'山火图层', 21:'应急预警,应急响应',
  175. 41:'应急资源', 61:'设备损失图层', 71:'用户停电图层'} ;
  176. // var pageTitles = { 11:'日常气象图层', 12:'台风图层', 13:'暴雨图层', 14:'冰灾图层',
  177. // 15:'地震图层', 16:'山火图层', 21:'应急预警,应急响应',31:'线路跳闸,变电站停运,负荷损失',
  178. // 41:'应急资源', 51:'数量统计,详细信息', 61:'设备损失图层', 71:'用户停电图层'} ;
  179. // var gridUrl = { "21a":"ew.jsp","21b":"er.jsp","31a":'lt.jsp',"31b":"so.jsp","31c":"lost.jsp"} ;
  180. var gridUrl = { "21a":"ew.jsp"+window.location.search,"21b":"er.jsp"+window.location.search} ;
  181. var tab = null ;
  182. /**
  183. * 定义图层ID与数据表图层名称之间的映射
  184. *
  185. */
  186. var layerNames = {11:'日常气象',12:'台风',13:'暴雨',14:'冰灾',15:'地震',
  187. 16:'山火',21:'应急预警与响应',41:'应急资源',61:'设备损失',71:'用户停电'} ;
  188. // var layerNames = {11:'日常气象',12:'台风',13:'暴雨',14:'冰灾',15:'地震',
  189. // 16:'山火',21:'应急预警与响应',31:'线路跳闸与变电站停运',
  190. // 41:'应急资源',51:'线路覆冰',61:'设备损失',71:'用户停电'} ;
  191. /**
  192. * @param 通过ID改变数据表中的选项卡
  193. * @version 1.0
  194. * @Date 2015-09-26
  195. */
  196. this.tableInit=function()
  197. {
  198. tab = new TabView( {
  199. containerId :'tab_menu',
  200. pageid :'page',
  201. cid :'tab1',
  202. position :"top"
  203. });
  204. tab.add( {
  205. id :'0',
  206. title :'应急预警',
  207. url :'ew.jsp'+window.location.search,
  208. isClosed :false
  209. });
  210. tab.add( {
  211. id :'1',
  212. title :'应急响应',
  213. url :'er.jsp'+window.location.search,
  214. isClosed :false
  215. });
  216. tab.activate('0') ;
  217. };
  218. /**
  219. * @param 通过ID改变数据表
  220. * @version 1.0
  221. * @Date 2015-09-26
  222. */
  223. this.getPageTitle=function(id)
  224. {
  225. for(var key in pageTitles)
  226. {
  227. if(id==key){
  228. if (pageTitles[key].indexOf(',') > -1) {
  229. var pageTitle0 = pageTitles[key].split(',')[0];
  230. var pageTitle1 = pageTitles[key].split(',')[1];
  231. tab.update({id:'0',title:pageTitle0,url:gridUrl[id+"a"] }) ;
  232. tab.close('1') ;
  233. tab.add({
  234. id :'1',
  235. title :pageTitle1,
  236. url :gridUrl[id+"b"],
  237. isClosed :false
  238. });
  239. }
  240. else
  241. {
  242. var pageTitle = pageTitles[key] ;
  243. tab.update({id:'0',title:pageTitle,url:gridUrl[id]}) ;
  244. tab.close('1') ;
  245. }
  246. }
  247. }
  248. tab.activate('0');
  249. };
  250. /**
  251. * 根据ID改变框架右侧数据表格的图层标题
  252. */
  253. this.getRightTitles=function(id)
  254. {
  255. for(var key in layerNames)
  256. {
  257. if(id==key)
  258. {
  259. //选中centerUI中样式表中的低第二个元素进行修改
  260. $("#centerUI").find(".l-layout-header-inner").eq(1).text(layerNames[key]);
  261. $(".tabContainer").css("left","0px");
  262. $(".tabButtonLeft").remove();
  263. $(".tabButtonRight").remove();
  264. };
  265. };
  266. };
  267. /**
  268. * @param 关闭应急资源的绘图面板
  269. * @version 1.0
  270. * @Date 2015-10-12
  271. */
  272. this.closeERdrowTool = function()
  273. {
  274. $("#floatPanel-6").floatPanelClose();
  275. };
  276. /**
  277. * 单击打开应急资源投入查询面板
  278. */
  279. this.resourceInvestment = function()
  280. {
  281. $("#toolWin").floatPanelClose();
  282. $("#ewerWin").floatPanelClose();
  283. $("#ltsoWin").floatPanelClose();
  284. $("#erWin").floatPanelOpen();
  285. $("#teamWin").floatPanelClose();
  286. };
  287. /**
  288. * 单击打开设备列表图标事件
  289. */
  290. this.listFun = function()
  291. {
  292. $("#toolWin").floatPanelClose();
  293. $("#ewerWin").floatPanelClose();
  294. $("#ltsoWin").floatPanelClose();
  295. $("#erWin").floatPanelClose();
  296. $("#teamWin").floatPanelOpen();
  297. };
  298. /**
  299. * 单击打开绘图工具栏图标事件
  300. */
  301. this.toolFun = function()
  302. {
  303. $("#teamWin").floatPanelClose();
  304. $("#ewerWin").floatPanelClose();
  305. $("#ltsoWin").floatPanelClose();
  306. $("#erWin").floatPanelClose();
  307. $("#toolWin").floatPanelOpen();
  308. };
  309. /**
  310. * @param 弹出右键面板的同时获取右键菜单的ID
  311. * @version 1.0
  312. * @Date 2015-09-26
  313. */
  314. function OnRightClick(event, treeId, treeNode)
  315. {
  316. if(treeNode && !treeNode.noR)
  317. {
  318. zTree.selectNode(treeNode);
  319. showRMenu(treeNode.menuType, event.clientX, event.clientY);
  320. //右键得到点击的ID
  321. RightMenuId = treeNode.id;
  322. Rightflag=treeNode.checked;
  323. }
  324. };
  325. /**
  326. * @param 鼠标点击复选框传点击参数
  327. * @version 1.0
  328. * @Date 2015-09-26
  329. */
  330. function onCheckID(event, treeId, treeNode)
  331. {
  332. appendMenuid("onCheck", treeNode.id, treeNode.checked);
  333. };
  334. //类结束
  335. };
  336. /**
  337. * @author jiangyongfei
  338. * @param Gislayerpage类为针对GIS图层操作的方法
  339. * @constructor null
  340. * @exception null
  341. * @version 1.0
  342. * @Date 2015-09-26
  343. */
  344. Gislayerpage=function()
  345. {
  346. //类结束
  347. };