all_menu.jsp 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007
  1. <%@page language="java" pageEncoding="UTF-8"%>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title></title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <!--框架必需start 扁平风格-->
  8. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/jquery.js"></script>
  9. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/language/cn.js"></script>
  10. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/framework.js"></script>
  11. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/main.js"></script>
  12. <!--框架必需end-->
  13. <script type="text/javascript" src="/nwyj/scripts/jquery/plugins/jquery.extension.util.js"></script>
  14. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/form/selectTree.js"></script>
  15. <link rel="stylesheet" type="text/css" href="/nwyj/scripts/qui/libs/css/import_basic.css" />
  16. <link href="/nwyj/scripts/qui/libs/skins/flatBlue/style.css"
  17. rel="stylesheet" type="text/css" id="theme" themeColor="flatBlue"
  18. positionTarget="positionContent" selInputHeight="32"
  19. selButtonWidth="35" defaultSelWidth="200" fileBtnWidth="60"
  20. defaultFileInputWidth="200" defaultGridHeaderHeight="34"
  21. defaultGridRowHeight="38" defaultFontSize="12" defaultPageSelWidth="55"
  22. defaultFilterItemHeight="32" dialogWidthFix="0"
  23. defaultSelItemHeight="32" defaultFontFamily="宋体" />
  24. <!--用户使用菜单计数 start -->
  25. <script type="text/javascript" src="/nwyj/scripts/freamwork/com/sinosoft/system/right/userClickNum.js"></script>
  26. <!--用户使用菜单计数 end -->
  27. <!--菜单图标-->
  28. <link href="/nwyj/scripts/qui/libs/css/framework/icon_position.css" rel="stylesheet" type="text/css"/>
  29. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/popup/floatPanel.js"></script>
  30. <style>
  31. body {
  32. }
  33. .body_div{
  34. margin: 5px 10px 0px 10px;
  35. }
  36. .fixItem {
  37. position: fixed;
  38. top: 400px;
  39. right: 0;
  40. z-index: 999;
  41. display: none;
  42. }
  43. .fixItem div{
  44. margin-bottom: 3px;
  45. }
  46. .fixItem img{
  47. width:36px;
  48. height:36px;
  49. }
  50. .work_cont{
  51. border:1px solid #b1b0b0;
  52. background-color:#fff;
  53. padding:5px 5px 0 5px;
  54. }
  55. .menu_cont{
  56. border:1px solid #b1b0b0;
  57. background-color:#fff;
  58. }
  59. .selection_div{
  60. margin-top:15px;
  61. padding: 0px 10px;
  62. height: 40px;
  63. line-height: 40px;
  64. }
  65. .all_menu_content{
  66. min-height: 300px;
  67. }
  68. /*搜索区域开始*/
  69. .search_cont{
  70. position:relative;
  71. margin:5px 5px 5px 15px;
  72. float: left;
  73. }
  74. .search_img{
  75. position: absolute;
  76. top: 8px;
  77. left: 8px;
  78. }
  79. .search_input{
  80. height: 28px;
  81. width:330px;
  82. padding-left:30px;
  83. }
  84. /*搜索区域结束*/
  85. /*下拉框开始*/
  86. .select_cont{
  87. margin-top:5px;
  88. float:left;
  89. position: relative;
  90. }
  91. .select_text{
  92. position: absolute;
  93. line-height: 200%;
  94. left: 50px;
  95. }
  96. .select_opt{
  97. padding-left: 100px;
  98. width:330px;
  99. }
  100. /*下拉框结束*/
  101. .qiehuan_cont{
  102. margin-top: 0px;
  103. margin-right: 18px;
  104. float:right;
  105. position: relative;
  106. }
  107. .qiehuan_img{
  108. width: 20px;
  109. height: 20px;
  110. display:inline-block;
  111. margin-left:10px;
  112. line-height:20px;
  113. text-align:center;
  114. cursor: pointer;
  115. }
  116. .flag_class_1{
  117. background-image:url('/nwyj/images/index/idx_main/grid_img_2.png') !important;
  118. }
  119. .flag_class_2{
  120. background-image:url('/nwyj/images/index/idx_main/list_img_2.png') !important;
  121. }
  122. .menu_div{
  123. margin: 5px;
  124. }
  125. .div_contenter{
  126. min-height: 110px;
  127. }
  128. .cont_ul{
  129. margin:10px auto;
  130. width: 98% ;
  131. text-align: center;
  132. position: relative;
  133. }
  134. .li_cont_1{
  135. text-align:center;
  136. float: left;
  137. width: 10%;
  138. }
  139. .li_cont_2{
  140. text-align:center;
  141. float: left;
  142. width: 14.28%;
  143. }
  144. .work_menu_content{
  145. position: relative;
  146. }
  147. .menu_div_contents_1{
  148. position:relative;
  149. width:80%;
  150. height:100px;
  151. margin:0px auto;
  152. border: 1px solid #b1b0b0;
  153. }
  154. .menu_div_contents_2{
  155. width:90%;
  156. height:40px;
  157. margin:0px auto;
  158. border: 1px solid #b1b0b0;
  159. }
  160. .div_contenter li:hover{
  161. box-shadow: -1px -1px 4px rgba(0, 0, 0, 0.2), 1px 1px 4px
  162. rgba(0, 0, 0, 0.2);
  163. -webkit-box-shadow: -1px -1px 4px rgba(0, 0, 0, 0.2), 1px 1px 4px
  164. rgba(0, 0, 0, 0.2);
  165. -moz-box-shadow: -1px -1px 4px rgba(0, 0, 0, 0.2), 1px 1px 4px
  166. rgba(0, 0, 0, 0.2);
  167. -ms-box-shadow: -1px -1px 4px rgba(0, 0, 0, 0.2), 1px 1px 4px
  168. rgba(0, 0, 0, 0.2);
  169. -o-box-shadow: -1px -1px 4px rgba(0, 0, 0, 0.2), 1px 1px 4px
  170. rgba(0, 0, 0, 0.2);
  171. border: 1px solid #ccc;
  172. cursor:pointer;
  173. }
  174. .div_contenter li{
  175. list-style-type: none;
  176. }
  177. .text_img {
  178. position: relative;
  179. }
  180. .text_img_1 {
  181. height: 60px;
  182. width: 100%;
  183. }
  184. .text_img_2 {
  185. margin:5px;
  186. /*background-color:#000000;*/
  187. float:left;
  188. height: 30px;
  189. width: 30px;
  190. }
  191. .text_div{
  192. height:30px;
  193. line-height:30px;
  194. font-size: 14px;
  195. }
  196. .text_div_1{
  197. white-space: nowrap;
  198. background-color: #fff;
  199. /* border-bottom:1px solid #b1b0b0; */
  200. width: 99%;
  201. overflow: hidden;
  202. text-overflow: ellipsis;
  203. margin: 0.5px 0.5px 5px 0.5px;
  204. }
  205. .text_div_2{
  206. background-color: #efefef;
  207. margin:4.5px 0;
  208. float:left;
  209. white-space: nowrap;
  210. width: 65%;
  211. overflow: hidden;
  212. text-overflow: ellipsis;
  213. }
  214. .div_title {
  215. position:relative;
  216. height: 30px;
  217. }
  218. .ev_title {
  219. font-weight:bold;
  220. float:left;
  221. padding-left: 10px;
  222. margin-left: 5px;
  223. border-left: 2px solid #6aa725;
  224. }
  225. .line_point{
  226. float:left;
  227. height:1px;
  228. margin-top: 14px;
  229. margin-left: 10px;
  230. }
  231. .line_img{
  232. background-image:url("../images/index/line_point.png");
  233. width:100%;
  234. height:1px;
  235. }
  236. .sel-btn{
  237. position: absolute;
  238. border:1px solid #0091E7;
  239. cursor:pointer;
  240. right: 25px;
  241. top:-5px;
  242. color: #000000;
  243. width: 36px;
  244. height:18px;
  245. line-height: 18px;
  246. text-align: center;
  247. font-size: 14px;
  248. }
  249. .uhide{
  250. display:block;
  251. }
  252. .delete_menu_img{
  253. position: absolute;
  254. display: block;
  255. bottom: 3px;
  256. right:3px;
  257. }
  258. .delect_img_show{
  259. display: none;
  260. }
  261. .select_menu_img{
  262. position: absolute;
  263. display: block;
  264. bottom: 3px;
  265. right:3px;
  266. }
  267. .select_img_show{
  268. display: none;
  269. }
  270. .select_menu_img_flag{
  271. display: block !important;;
  272. }
  273. .selet_menu{
  274. border: 2px solid #016bc3 !important;
  275. color: #016bc3 !important;
  276. }
  277. .check_select {
  278. border: 0px none;
  279. background-image: url("/nwyj/images/index/module_img/select.png");
  280. background-repeat: no-repeat;
  281. background-position: 95% 95%;
  282. padding: 0px 0px 0px 0px;
  283. display: inline-block;
  284. white-space: nowrap;
  285. word-break: keep-all;
  286. word-wrap: normal;
  287. background-size: 18px 14px;
  288. }
  289. </style>
  290. <script type="text/javascript">
  291. var user_menu_data = "";
  292. var menutext = "添加";
  293. var menuId_arr = "";
  294. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  295. var roleids = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
  296. $(function(){
  297. /* 置顶图标固定位置 */
  298. top.onscroll = function () {
  299. var scroH = $(this).scrollTop();
  300. if(scroH>200){
  301. $(".fixItem").css({"top":scroH+350+"px"});
  302. $(".fixItem").show();
  303. }else{
  304. $(".fixItem").css({"top":scroH+350+"px"});
  305. $(".fixItem").hide();
  306. }
  307. };
  308. /* 创建工作台中的菜单 */
  309. getWorkMenuData();
  310. /* 创建所有的菜单列表 */
  311. getAllMenuData();
  312. $(parent.document.body).find("#frmright").css("height",$(window.document.body).height()+30);
  313. $("#search_menu_btn").bind("click",searchMenu);
  314. /* $("#search_menu_btn").bind("input propertychange",function(){
  315. var length = document.getElementById("searchdata").value.length;
  316. if(length>10){
  317. top.Dialog.alert("");
  318. }
  319. }); */
  320. $("#search_menu_input").keyup(function(event){
  321. var value = document.getElementById("search_menu_input").value;
  322. if(value.length>10){
  323. document.getElementById("search_menu_input").value=value.substr(0,9);
  324. top.Dialog.alert("搜索内容不能超过10汉字!");
  325. }
  326. if(event.which == "13") {
  327. $("#search_menu_btn").click();
  328. }
  329. });
  330. $(".qiehuan_img").bind("click",function(){
  331. if($(this).attr("id")=="flag_class_1"){
  332. $(this).addClass("flag_class_1");
  333. $("#flag_class_2").removeClass("flag_class_2");
  334. createMenu1($("#all_menu_contents"),user_menu_data);
  335. }else{
  336. $(this).addClass("flag_class_2");
  337. $("#flag_class_1").removeClass("flag_class_1");
  338. createMenu2($("#all_menu_contents"),user_menu_data);
  339. };
  340. });
  341. })
  342. /**标记用户已经用过的menu*/
  343. function changeMenuStyle($menu){
  344. //var $menu = $cont.find(".div_contenter li");
  345. //console.log($menu);
  346. if($menu.data("select_data")=="2"){
  347. if($menu.hasClass("selet_menu")){
  348. $menu.removeClass("selet_menu");
  349. }else{
  350. $menu.addClass("selet_menu");
  351. }
  352. }else{
  353. var $lisdd = $menu.find(".select_menu_img");
  354. if($lisdd.hasClass("select_menu_img_flag")){
  355. $lisdd.removeClass("select_menu_img_flag");
  356. $lisdd.find("img").attr("src","/nwyj/images/index/idx_main/select_flag1.png");
  357. }else{
  358. $lisdd.addClass("select_menu_img_flag");
  359. $lisdd.find("img").attr("src","/nwyj/images/index/idx_main/select_flag.png");
  360. }
  361. }
  362. }
  363. /* 访问后台,创建工作台上的菜单 */
  364. function getWorkMenuData(){
  365. $.ajax({
  366. url : $.pathname() + '/ws/sys/SysCustomMenuService/queryIndexMenuByroleId/',
  367. type : 'post',
  368. async:false,
  369. data : {
  370. user_id:user_id
  371. },
  372. dataType : 'json',
  373. success : function(data) {
  374. if(data==null){
  375. top.Dialog.alert("查询失败!");
  376. }else{
  377. createWorkMenu($("#all_work_menu"),data.resultData);
  378. }
  379. },
  380. error : function(e) {
  381. top.Dialog.alert("查询失败!");
  382. }
  383. });
  384. }
  385. /* 访问后台查询该用户权限下所有菜单 */
  386. function getAllMenuData(){
  387. $.ajax({
  388. url : $.pathname() + '/ws/sys/SysCustomMenuService/getIndexMenuByRoleIds/',
  389. type : 'post',
  390. data : {
  391. roleids:roleids
  392. //roleids:'11111'
  393. },
  394. dataType : 'json',
  395. //async:false,
  396. success : function(data) {
  397. //console.log(data);
  398. if(data==null){
  399. top.Dialog.alert("查询失败!");
  400. }else{
  401. //储存菜单信息
  402. user_menu_data = data;
  403. setSelection($(".select_opt"),data);
  404. createMenu1($("#all_menu_contents"),data)
  405. }
  406. },
  407. error : function(e) {
  408. top.Dialog.alert("查询失败!");
  409. }
  410. });
  411. }
  412. /* 创建工作台中的菜单 */
  413. function createWorkMenu($dom,data){
  414. //console.log($dom.parent());
  415. //设置横线宽度
  416. var contWidth = $(window.document.body).width()-$("#work_1_title .ev_title").width()-100;
  417. //console.log($("#work_1_title .ev_title").width());
  418. $("#work_1_title .line_point").css("width",contWidth);
  419. menuId_arr="|";
  420. $dom.empty();
  421. var $contul = $('<ul class="cont_ul" style="height: 110px;"></ul>');
  422. $dom.append($contul);
  423. for (var i = 0; i < data.length; i++) {
  424. var menudata = data[i];
  425. var menu_fd_id = menudata.MENU_ID;//系统菜单表的主键id
  426. //把添加的菜单放入一个集合
  427. menuId_arr = menuId_arr + menu_fd_id +"|";
  428. var fd_id = menudata.FD_OBJECTID;//本表主键id
  429. var menu_img = menudata.IMAGE_URL;
  430. var img_class = menu_img.substring(menu_img.lastIndexOf("/")+1,menu_img.indexOf(".png"));
  431. img_class = img_class==""?"idx_sys_moren":img_class;
  432. //console.log(menu_img);
  433. //console.log(img_class);
  434. var title_name = menudata.TITLE_NAME =="统计表"?"保供电统计表":menudata.TITLE_NAME;
  435. var $liCont = $('<div class="li_cont_1"></div>');
  436. $contul.append($liCont);
  437. var $li = $('<li class="menu_div_contents_1 work_menu_content" title="'+title_name+'" id="workMenu'+menu_fd_id+'"></li>');
  438. $liCont.append($li);
  439. $li.bind("mouseenter",delectImgShow);
  440. $li.bind("mouseleave",delectImgShow);
  441. $li.append($('<div class="text_div text_div_1">'+title_name+'</div><div class="text_img text_img_1 '+img_class+'1" value="'+menu_img+'" ></div><a href="javascript:;" class="delete_menu_img delect_img_show" ><img src="/nwyj/images/index/idx_main/delect.png" style="width:18px;height:18px"/></a>'));
  442. $li.data("menu_fd_id",menu_fd_id);
  443. $li.data("fd_id",fd_id);
  444. $li.data("menu_url",menudata.BUSINESS_URL);
  445. $li.data("menu_name",menudata.TITLE_NAME);
  446. //$li.data("menu_fd_id",menu_fd_id);
  447. //绑定点击事件——跳转页面
  448. $li.find(".text_img").bind("click",toPage);
  449. menudata = null;
  450. menu_fd_id = null;
  451. fd_id = null;
  452. menu_img = null;
  453. img_class = null;
  454. $li = null;
  455. }
  456. $(".delete_menu_img").bind("click",deleteMenuForWorkById);
  457. $dom = null;
  458. $(parent.document.body).find("#frmright").css("height",$(window.document.body).height()+30);
  459. }
  460. function delectImgShow(){
  461. var $self = $(this).find(".delete_menu_img");
  462. if($self.hasClass("delect_img_show")){
  463. $self.removeClass("delect_img_show");
  464. }else{
  465. $self.addClass("delect_img_show");
  466. }
  467. }
  468. function setSelectFlag(menu_id){
  469. if($("#allMenu"+menu_id).data("select_data")=="2"){
  470. if(isContainer(menu_id)){
  471. $("#allMenu"+menu_id).addClass("selet_menu");
  472. }
  473. }else{
  474. var $lisdd = $("#allMenu"+menu_id).find(".select_menu_img").last();
  475. if(isContainer(menu_id)){
  476. //console.log($lisdd.hasClass("select_menu_img"));
  477. $lisdd.addClass("select_menu_img_flag");
  478. $lisdd.find("img").attr("src","/nwyj/images/index/idx_main/select_flag.png");
  479. //$("#allMenu"+menu_id).removeClass("select_menu_img_flag");
  480. //$lisdd.removeClass("select_img_show");
  481. //$lisdd.addClass("select_img_show");
  482. }else{
  483. //$("#allMenu"+menu_id).addClass("select_menu_img_flag");
  484. //$lisdd.addClass("select_img_show");
  485. }
  486. $lisdd = null;
  487. }
  488. }
  489. /* 创建所有的菜单列表2 */
  490. function createMenu2($dom,data){
  491. $dom.empty();
  492. for(var k=0;k<data.length;k++){
  493. //setSelection($(".select_opt"),data);
  494. var $content = $('<div class="menu_div" id="menu'+k+'"></div>');
  495. $dom.append($content);
  496. var $titltCont = $('<div class="div_title"></div>');
  497. var value = data[k].value;
  498. $content.append($titltCont);
  499. $titltCont.append($('<div class="ev_title">'+data[k].display+'</div><div class="line_point"><div class="line_img" alt="" src="../images/index/line_point.png"></div></div>'));
  500. var $cont_menu = $('<div class="div_contenter" ></div>');
  501. $content.append($cont_menu);
  502. var dataLength = Math.ceil((value.length)/7);
  503. for (var j = 0; j < dataLength; j++) {
  504. var $contul = $('<ul class="cont_ul" style="height: 50px;"></ul>');
  505. $cont_menu.append($contul);
  506. for (var i = j*7; i < (j+1)*7; i++) {
  507. if(i<value.length){
  508. var menu = value[i];
  509. createMenuLi(menu,$contul,"2");
  510. menu = null;
  511. }
  512. }
  513. $titltCont = null;
  514. }
  515. var contWidth = $(window.document.body).width()-$content.find(".ev_title").width()-100;
  516. $content.find(".line_point").css("width",contWidth);
  517. dataLength = null;
  518. $content = null;
  519. value = null;
  520. $cont_menu = null;
  521. }
  522. $dom = null;
  523. $(parent.document.body).find("#frmright").css("height",$(window.document.body).height()+30);
  524. }
  525. function createMenuLi(menudata,$dom,idx){
  526. var menu_url = menudata.menu_url;
  527. var menu_fd_id= menudata.menu_id;
  528. var menu_img = menudata.menu_img;
  529. var img_class = menu_img.substring(menu_img.lastIndexOf("/")+1,menu_img.indexOf(".png"));
  530. img_class = img_class==""?"idx_sys_moren":img_class;
  531. //console.log(img_class);
  532. //alert(menu_img);
  533. var $liCont = $('<div class="li_cont_'+idx+'"></div>');
  534. $dom.append($liCont);
  535. var menu_name = menudata.menu_name =="统计表"?"保供电统计表":menudata.menu_name;
  536. var $li = $('<li class="menu_div_contents_'+idx+'" id="allMenu'+menu_fd_id+'" title="'+menu_name+'"></li>');
  537. $liCont.append($li);
  538. //$li.append($('<div class="text_div">'+menudata.menu_name+'</div><img class="text_img" alt="" src="'+menudata.menu_img+'">'));
  539. var $title = $('<div class="text_div text_div_'+idx+'" >'+menu_name+'</div>');
  540. var $img = $('<div class="text_img text_img_'+idx+' '+img_class+idx+'" value="'+menu_img+'"></div>');
  541. //绑定点击事件——跳转页面
  542. $img.bind("click",toPage);
  543. if(idx=="2"){
  544. /* 绑定鼠标移入、移出事件,
  545. 先将其中文字保存在变量中,
  546. 移入时显示保存字样,
  547. 移出时恢复原来的文字 */
  548. $title.bind("mouseenter",toggleMenuState1);
  549. $title.bind("mouseleave",toggleMenuState2);
  550. $title.bind("click",addmenu);
  551. $li.append($img).append($title);
  552. }else{
  553. $li.append($title).append($img);
  554. var $selectBtn = $('<a href="javascript:;" class="select_menu_img " ><img src="/nwyj/images/index/idx_main/select_flag1.png" style="width:18px;height:18px"/></a>');
  555. $selectBtn.bind("click",addmenu);
  556. $li.append($selectBtn);
  557. //$li.bind("mouseenter",function(){$(this).find(".select_menu_img").removeClass("select_img_show");});
  558. //$li.bind("mouseleave",function(){$(this).find(".select_menu_img").addClass("select_img_show");});
  559. }
  560. $li.data("select_data",idx);
  561. $li.data("menu_url",menu_url);
  562. $li.data("menu_name",menudata.menu_name);
  563. $li.data("menu_fd_id",menu_fd_id);
  564. setSelectFlag(menu_fd_id);
  565. $img = null;
  566. $title = null;
  567. $li = null;
  568. menudata = null;
  569. menu_url = null;
  570. menu_fd_id= null;
  571. menu_img = null;
  572. img_class = null;
  573. $dom = null;
  574. idx = null;
  575. }
  576. /* 创建所有的菜单列表1 */
  577. function createMenu1($dom,data){
  578. $dom.empty();
  579. for(var k=0;k<data.length;k++){
  580. //setSelection($(".select_opt"),data);
  581. var $content = $('<div class="menu_div" id="menu'+k+'"></div>');
  582. $dom.append($content);
  583. var $titltCont = $('<div class="div_title"></div>');
  584. var value = data[k].value;
  585. $content.append($titltCont);
  586. $titltCont.append($('<div class="ev_title">'+data[k].display+'</div><div class="line_point"><div class="line_img" alt="" src="../images/index/line_point.png"></div></div><div class="sel-btn flag-class" id = "sel-btn'+k+'">展开</div>'));
  587. if(value.length<=9){
  588. $("#sel-btn"+k).remove();
  589. }else{
  590. $("#sel-btn"+k).bind("click",gotoshouqi);
  591. }
  592. var $cont_menu = $('<div class="div_contenter" ></div>');
  593. $content.append($cont_menu);
  594. var dataLength = Math.ceil((value.length)/10);
  595. for (var j = 0; j < dataLength; j++) {
  596. var $contul = $('<ul class="cont_ul" style="height: 110px;"></ul>');
  597. $cont_menu.append($contul);
  598. for (var i = j*10; i < (j+1)*10; i++) {
  599. if(i<value.length){
  600. var menu = value[i];
  601. createMenuLi(menu,$contul,"1");
  602. menu = null;
  603. }
  604. }
  605. if(j>0){
  606. $contul.hide();
  607. }
  608. }
  609. $titltCont = null;
  610. var contWidth = $(window.document.body).width()-$content.find(".ev_title").width()-100;
  611. $content.find(".line_point").css("width",contWidth);
  612. dataLength = null;
  613. $content = null;
  614. value = null;
  615. $cont_menu = null;
  616. }
  617. $dom = null;
  618. $(parent.document.body).find("#frmright").css("height",$(window.document.body).height()+30);
  619. }
  620. function gotoshouqi (){
  621. var _this = $(this);
  622. var $self = _this.parent();
  623. var $liArr = $self.parent().find("ul");
  624. if(_this.hasClass('flag-class')){
  625. _this.html("收缩");
  626. $.each($liArr, function(i, e) {
  627. if(i>0){
  628. $(e).show();
  629. }
  630. });
  631. _this.removeClass('flag-class');
  632. }else{
  633. _this.html("展开");
  634. $.each($liArr, function(i, e) {
  635. if(i>0){
  636. $(e).hide();
  637. }
  638. });
  639. _this.addClass('flag-class');
  640. }
  641. $(parent.document.body).find("#frmright").css("height",$(window.document.body).height()+30);
  642. }
  643. /* 通过menu_fd_id删除工作台中的菜单 */
  644. function deleteMenuForWorkById(){
  645. var $self = $(this);
  646. var fd_id = $self.parent().data("fd_id");
  647. //console.log($self.parent());
  648. deleteMenu($self.parent());
  649. $self = null;
  650. }
  651. function deleteMenu($self){
  652. var fd_id = $self.data("fd_id");
  653. var menu_id = $self.data("menu_fd_id");
  654. //刷新工作台中的menuId_arr字符串
  655. var _arr = menuId_arr.split("|");
  656. menuId_arr = "";
  657. for(var i=0;i<_arr.length-1;i++){
  658. if(menu_id!=_arr[i]){
  659. menuId_arr = menuId_arr + _arr[i] +"|";
  660. }
  661. }
  662. $.ajax({
  663. url : $.pathname() + '/ws/sys/SysCustomMenuService/deleteIndexMenu/',
  664. type : 'post',
  665. async:false,
  666. data : {
  667. fd_id:fd_id
  668. },
  669. dataType : 'text',
  670. success : function(data) {
  671. /* 移除该菜单div */
  672. //alert(data);
  673. if(data=="success"){
  674. changeMenuStyle($("#allMenu"+menu_id));
  675. removeDom($self);
  676. }else{
  677. top.Dialog.alert("删除失败!");
  678. }
  679. },
  680. error : function(e) {
  681. top.Dialog.alert("删除失败!");
  682. }
  683. });
  684. }
  685. /* 移除节点 */
  686. function removeDom($dom){
  687. $dom.remove();
  688. }
  689. /* 绑定鼠标移入、移出事件,
  690. 先将其中文字保存在变量中,
  691. 移入时显示保存字样,
  692. 移出时恢复原来的文字 */
  693. function toggleMenuState1(){
  694. var $self = $(this).parent();
  695. var text = $self.find(".text_div").text();
  696. //var state = $self.find(".text_div").attr("value");
  697. var is_state = $self.data("menu_fd_id");
  698. //console.log(state);
  699. //console.log(menutext);
  700. //console.log(menuId_arr);
  701. //console.log(is_state);
  702. if(!isContainer(is_state)){
  703. menutext="添加";
  704. }else {
  705. menutext="取消";
  706. }
  707. $self.find(".text_div").text(menutext);
  708. menutext = text;
  709. $self = null;
  710. }
  711. /*判断menuId_arr中是否有menuid*/
  712. function isContainer (menuid){
  713. if(menuId_arr.indexOf("|"+menuid+"|")>-1){
  714. return true;
  715. }
  716. return false;
  717. }
  718. /* 绑定鼠标移入、移出事件,
  719. 先将其中文字保存在变量中,
  720. 移入时显示保存字样,
  721. 移出时恢复原来的文字 */
  722. function toggleMenuState2(){
  723. var $self = $(this).parent();
  724. var text = $self.find(".text_div").text();
  725. //var state = $self.find(".text_div").attr("value");
  726. //console.log(state);
  727. //console.log(menutext);
  728. $self.find(".text_div").text(menutext);
  729. menutext = text;
  730. $self = null;
  731. }
  732. function addmenu(){
  733. var $self = $(this).parent();
  734. /* 通过匹配menu_id判断是否添加过 */
  735. var thisfdid = $self.data("menu_fd_id");
  736. if(isContainer(thisfdid)){
  737. //console.log(menuId_arr);
  738. deleteMenu($("#workMenu"+thisfdid));
  739. return;
  740. }
  741. var $workMenu = $("#all_work_menu").find(".work_menu_content");
  742. if($workMenu.length==10){
  743. top.Dialog.alert("最多只能添加10个菜单!");
  744. return;
  745. }
  746. $workMenu = null;
  747. var menu_url = $self.data("menu_url");
  748. var menu_name = $self.data("menu_name");
  749. var menu_img_url = $self.find(".text_img").attr("value");
  750. //console.log(menu_img_url);
  751. /* 访问后台,将该菜单保存到工作菜单表 */
  752. $.ajax({
  753. url : $.pathname() + '/ws/sys/SysCustomMenuService/addIndexMenu/',
  754. type : 'post',
  755. async:false,
  756. data : {
  757. menu_id:thisfdid,
  758. menu_url:menu_url,
  759. menu_name:menu_name,
  760. menu_img_url:menu_img_url,
  761. user_id:user_id
  762. },
  763. dataType : 'json',
  764. success : function(data) {
  765. changeMenuStyle($("#allMenu"+thisfdid));
  766. /* 保存成功后重新刷新工作菜单栏 */
  767. createWorkMenu($("#all_work_menu"),data);
  768. },
  769. error : function(e) {
  770. top.Dialog.alert("添加失败!");
  771. }
  772. });
  773. menu_url = null;
  774. menu_name = null;
  775. menu_img_url = null;
  776. $self = null;
  777. }
  778. function toPage(){
  779. var $self = $(this).parent();
  780. var thisfdid = $self.data("menu_fd_id");
  781. var menu_url = $self.data("menu_url");
  782. var menuId = $self.data("menuId");
  783. var imgclass = $self.find(".text_img").attr("value");
  784. imgclass = imgclass.substring(imgclass.lastIndexOf("/")+1,imgclass.indexOf(".png"));
  785. //alert(imgclass);
  786. var menu_name = $self.data("menu_name");
  787. /*根据用户运用情况,记录此菜单的使用次数
  788. */
  789. $.indexUserClickNum (user_id,thisfdid);
  790. $(top.document.body).find("#positionMsg").html("<div id='positionTitle1' class='"+imgclass+"'>"+menu_name+"</div>");
  791. $(top.document.body).find("#positionMsg #positionTitle1").data("menuid",menuId).data("imgclass",imgclass);
  792. $(top.document.body).find("#currPosition .changeYQ").remove();
  793. var curSrc = top.getTabMsg();
  794. menuUri = curSrc!="" && curSrc!=undefined?curSrc:menu_url;
  795. $.indexOpenSelfWindow(menuUri);
  796. // 隐藏二三极菜单框
  797. hideMenu();
  798. $(top.document.body).find("#currPosition").show();
  799. thisfdid = null;
  800. menu_url = null;
  801. //menuId = null;
  802. imgclass = null;
  803. menu_name = null;
  804. $self = null;
  805. }
  806. function searchMenu(){
  807. var searchCond = $("#search_menu_input").val();
  808. if(searchCond==null||searchCond==""){
  809. getAllMenuData();
  810. }else{
  811. $.ajax({
  812. url : $.pathname() + '/ws/sys/SysCustomMenuService/queryIndexMenu/',
  813. type : 'post',
  814. data : {
  815. roleids:roleids,
  816. menuName:searchCond
  817. },
  818. dataType : 'json',
  819. //async:false,
  820. success : function(data) {
  821. user_menu_data = data;
  822. setSelection($(".select_opt"),data);
  823. createMenu1($("#all_menu_contents"),data)
  824. },
  825. error : function(e) {
  826. top.Dialog.alert("查询失败!");
  827. }
  828. });
  829. }
  830. }
  831. function onchangeHandler(obj){
  832. var opt_value = $(obj).val();
  833. if(opt_value!="menu-1"){
  834. $("#menu0").css("display","none");
  835. $("#menu1").css("display","none");
  836. $("#menu2").css("display","none");
  837. $("#menu3").css("display","none");
  838. $("#"+opt_value).css("display","block");
  839. }else{
  840. $("#menu0").css("display","block");
  841. $("#menu1").css("display","block");
  842. $("#menu2").css("display","block");
  843. $("#menu3").css("display","block");
  844. }
  845. $(parent.document.body).find("#frmright").css("height",$(window.document.body).height()+30);
  846. }
  847. function setSelection($dom,data){
  848. $dom.empty();
  849. var $selbox = $('<select onchange="onchangeHandler(this)" ></select>');
  850. $dom.append($selbox);
  851. $selbox.append($('<option value="menu-1">全部</option>'));
  852. for(var i=0;i<data.length;i++){
  853. var $opt = $('<option value="menu'+i+'">'+data[i].display+'</option>')
  854. $selbox.append($opt);
  855. }
  856. $selbox.render(); //渲染下拉框
  857. }
  858. </script>
  859. </head>
  860. <body>
  861. <!-- 顶层图标:到顶部、添加 -->
  862. <div class="fixItem">
  863. <div id="toTop"><a href="#menutop"><img src="/nwyj/images/index/to_top.png" /></a></div>
  864. </div>
  865. <div class="work_cont body_div" id="menutop">
  866. <div class="div_title" id = "work_1_title">
  867. <div class="ev_title" >常用菜单管理</div>
  868. <div class="line_point">
  869. <div class="line_img" alt="" src="../images/index/line_point.png"></div>
  870. </div>
  871. </div>
  872. <div class="div_contenter" id="all_work_menu">
  873. <!-- 工作台菜单 -->
  874. </div>
  875. </div>
  876. <div class="menu_cont body_div">
  877. <div class="selection_div">
  878. <div class="search_cont" id="searchinput" >
  879. <a href="javascript:;" class="search_img" id="search_menu_btn"><img src="/nwyj/images/index/search_img.png"/></a>
  880. <input watermark="应用搜索" type="text" class="search_input" id="search_menu_input">
  881. </div>
  882. <div class="select_cont">
  883. <span class="select_text">类别:</span>
  884. <div class="select_opt">
  885. </div>
  886. </div>
  887. <div class="qiehuan_cont">
  888. <div id="flag_class_1" class="qiehuan_img flag_class_1" style = "background-image:url('/nwyj/images/index/idx_main/grid_img_1.png');" ></div>
  889. <div id="flag_class_2" class="qiehuan_img " style = "background-image:url('/nwyj/images/index/idx_main/list_img_1.png');"></div>
  890. </div>
  891. </div>
  892. <!-- 所有菜单容器 -->
  893. <div class="all_menu_content" id="all_menu_contents">
  894. </div>
  895. </div>
  896. </body>
  897. </html>