Copy of positionTab.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. function tabPosition(tabjson,menuId,imgclass){
  2. var __top = $(top.document.body);
  3. var positionText = __top.find("#positionTitle1").text();
  4. imgclass = imgclass==""?__top.find("#positionTitle1").attr("class"):imgclass;
  5. __top.find("#positionMsg").html("");
  6. //添加菜单和图标
  7. __top.find("#positionMsg").append("<div id='positionTitle1' data-menuid='"+menuId+"' data-imgclass='"+imgclass+"' class='positiontitab "+imgclass+"'>"+positionText+"</div>");
  8. //添加页签
  9. __top.find("#positionMsg").append("<div class=' positiontitab positionTab positionTabCurrent' id='"+tabjson[0].YQ_ID+"' data-tabId='"+tabjson[0].FD_OBJECTID+"' data-index='"+0+"' data-src='"+tabjson[0].YQ_SRC+"'>"+tabjson[0].YQ_NAME+"</div>");
  10. for(var i=1;i<tabjson.length;i++){
  11. __top.find("#positionMsg").append("<div class=' positiontitab positionTab' data-tabId='"+tabjson[i].FD_OBJECTID+"' data-index='"+i+"' id='"+tabjson[i].YQ_ID+"' data-src='"+tabjson[i].YQ_SRC+"'>"+tabjson[i].YQ_NAME+"</div>");
  12. }
  13. __top.find("#positionMsg").append("<div class='clear'></div>");
  14. //添加左移右移图标
  15. __top.find("#currPosition .changeYQ").remove();
  16. __top.find("#currPosition").append(
  17. "<div class='changeYQ' id='changeYQ'>" +
  18. "<div class='toleft nomove'>" +
  19. "<a href='javascript:;'>" +
  20. "<img src='/nwyj/scripts/qui/libs/icons/icons_position/toleft1.png'/>" +
  21. "</a>" +
  22. "</div>" +
  23. "<div class='toright canmove'>" +
  24. "<a href='javascript:;'>" +
  25. "<img src='/nwyj/scripts/qui/libs/icons/icons_position/toright.png'/>" +
  26. "</a>" +
  27. "</div>" +
  28. "</div>");
  29. __top.find("#positionMsg .positionTabCurrent").click();
  30. };
  31. $(function(){
  32. var $tab = $(top.document.body).find("#positionMsg .positionTab");
  33. if($tab.length == 0){
  34. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  35. var menuId = $(top.document.body).find("#positionTitle1").attr("data-menuid");
  36. $.ajax({
  37. type: "POST",
  38. url: "/nwyj/ws/tabyq/PositionTabService/getTabById",
  39. //async: false,
  40. data: {
  41. menuId:menuId,
  42. userId:user_id
  43. },
  44. success: function(data){
  45. if(data.length>0){
  46. tabPosition(data,menuId,"");
  47. }
  48. }
  49. });
  50. }
  51. });