$(function () { $('#tab_menu-tabrefresh').click(function () { /*重新设置该标签 */ var url = $(".tabs-panels .panel").eq($('.tabs-selected').index()).find("iframe").attr("src"); $(".tabs-panels .panel").eq($('.tabs-selected').index()).find("iframe").attr("src", url); }); //在新窗口打开该标签 $('#tab_menu-openFrame').click(function () { var url = $(".tabs-panels .panel").eq($('.tabs-selected').index()).find("iframe").attr("src"); window.open(url); }); //关闭当前 $('#tab_menu-tabclose').click(function () { var currtab_title = $('.tabs-selected .tabs-inner span').text(); $('#mainTab').tabs('close', currtab_title); if ($(".tabs li").length == 0) { //open menu $(".layout-button-right").trigger("click"); } }); //全部关闭 $('#tab_menu-tabcloseall').click(function () { $('.tabs-inner span').each(function (i, n) { if ($(this).parent().next().is('.tabs-close')) { var t = $(n).text(); $('#mainTab').tabs('close', t); } }); //open menu $(".layout-button-right").trigger("click"); }); //关闭除当前之外的TAB $('#tab_menu-tabcloseother').click(function () { var currtab_title = $('.tabs-selected .tabs-inner span').text(); $('.tabs-inner span').each(function (i, n) { if ($(this).parent().next().is('.tabs-close')) { var t = $(n).text(); if (t != currtab_title) $('#mainTab').tabs('close', t); } }); }); //关闭当前右侧的TAB $('#tab_menu-tabcloseright').click(function () { var nextall = $('.tabs-selected').nextAll(); if (nextall.length == 0) { $.messager.alert('提示', '前面没有了!', 'warning'); return false; } nextall.each(function (i, n) { if ($('a.tabs-close', $(n)).length > 0) { var t = $('a:eq(0) span', $(n)).text(); $('#mainTab').tabs('close', t); } }); return false; }); //关闭当前左侧的TAB $('#tab_menu-tabcloseleft').click(function () { var prevall = $('.tabs-selected').prevAll(); if (prevall.length == 0) { $.messager.alert('提示', '后面没有了!', 'warning'); return false; } prevall.each(function (i, n) { if ($('a.tabs-close', $(n)).length > 0) { var t = $('a:eq(0) span', $(n)).text(); $('#mainTab').tabs('close', t); } }); return false; }); }); $(function () { /*为选项卡绑定右键*/ $(".tabs li").live('contextmenu', function (e) { /*选中当前触发事件的选项卡 */ var subtitle = $(this).text(); $('#mainTab').tabs('select', subtitle); //显示快捷菜单 $('#tab_menu').menu('show', { left: e.pageX, top: e.pageY }); return false; }); }); var tabRecord = {}; var ifId = 0; //去除了 function addTab(subtitle, url, icon) { //alert(subtitle); ifId++; if (url.indexOf("?") > -1) url = url + "&Ieguid=" + GetGuid(); else url = url + "?Ieguid=" + GetGuid(); if ($("#mainTab").tabs('exists', subtitle)) { $("#mainTab").tabs('close', subtitle); } $("#mainTab").tabs('add', { title: subtitle, content: createFrame(url, ifId), closable: true, icon: icon }); $("#iframe" + ifId).attr("src", url); //} else { //$("#mainTab").tabs('select', subtitle); //$("#tab_menu-tabrefresh").trigger("click"); //} //$(".layout-button-left").trigger("click"); //tabClose(); } function GetGuid() { var s4 = function () { return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); }; return s4() + s4() + s4() + "-" + s4(); } function createFrame(url, ifId) { var s = ''; return s; } function currenttabclose() { var currtab_title = $('.tabs-selected .tabs-inner span').text(); $('#mainTab').tabs('close', currtab_title); } $(function () { $(".ui-skin-nav .li-skinitem span").click(function () { var theme = $(this).attr("rel"); $.messager.confirm('提示', '切换皮肤将重新加载系统!', function (r) { if (r) { $.post("../../Home/SetThemes", { value: theme }, function (data) { window.location.reload(); }, "json"); } }); }); }); function ChildAddTab(tabTitle, url, icon) { //if (tabRecord[tabTitle] == null) // tabRecord[tabTitle] = 1; //else // tabRecord[tabTitle] += 1; //addTab(tabTitle + tabRecord[tabTitle], url, icon); addTab(tabTitle, url, icon); } $(function () { var id = $("#hidChooseId").val();//默认ID //获取树形 var o = { // showcheck: false, // url: "/Home/GetTree", // iConShow: true, // isexpand:false, onnodeclick: function (item) { var tabTitle = item.text; var url = "../../" + item.value; if (url.indexOf("http://") > -1) url = item.value; var icon = item.Icon; if (!item.hasChildren) { ChildAddTab(tabTitle, url, icon); } else { $(this).parent().find("img").trigger("click"); } } } var xmn = $("[nid='" + id + "']"); if (xmn != null) $(xmn).addClass($(xmn).attr("nclass")); $.post("/Admin/Home/GetTreeByModuleId", { "id": id }, function (data) { if (data == "0") { window.location = "/Account"; } o.data = data; console.log(o); $("#RightTree" + id).treeview(o); }, "json"); $(".main-Menu a").live("click", function () { $(".onnav").removeClass("onnav"); $(this).addClass("onnav"); ShowChildTree($(this).attr("nid")); $(".panel-title").text($(this).text()) }); }); function ShowChildTree(id) { //获取树形 var o = { // showcheck: false, // url: "/Home/GetTree", // iConShow: true, // isexpand:false, onnodeclick: function (item) { var tabTitle = item.text; var url = "../../" + item.value; if (url.indexOf("http://") > -1) url = item.value; var icon = item.Icon; if (!item.hasChildren) { ChildAddTab(tabTitle, url, icon); } else { $(this).parent().find("img").trigger("click"); } } } $("[ntype='treeGroup']").css("display", "none"); var divobj = $("#RightTree" + id).html(); if (divobj == null) { $("#comtreenb").append("
加载中...
"); $.post("/Admin/Home/GetTreeByModuleId", { "id": id }, function (data) { if (data == "0") { window.location = "/Account"; } o.data = data; $("#RightTree" + id).treeview(o); }, "json"); } $("#RightTree" + id).css("display", ""); } function SetIframeScrolling(url, isScrolling) { if (isScrolling) { $("iframe").each(function () { var nscr = $(this).attr("src"); nscr = nscr.replace("../../", ""); if (url.indexOf(nscr) > -1) { $(this).attr("scrolling", "yes"); } }); } } function showModule(nid) { var xmn = $("[nid='" + nid + "']"); $(".toolBarClass").each(function () { var chidlxm = $(this); $(chidlxm).removeClass($(chidlxm).attr("nclass")); }); $(xmn).addClass($(xmn).attr("nclass")); ShowChildTree(nid); }