/** * 通用方法封装处理 * Copyright (c) 2018 ruoyi */ $(function(){ // 复选框事件绑定 if ($.fn.select2 !== undefined) { $("select.form-control:not(.noselect2)").each(function () { $(this).select2().on("change", function () { $(this).valid(); }) }) } if ($(".i-checks").length > 0) { $(".i-checks").iCheck({ checkboxClass: "icheckbox_square-green", radioClass: "iradio_square-green", }) } }); /** 创建选项卡 */ function createMenuItem(dataUrl, menuName) { dataIndex = $.common.random(1,100), flag = true; if (dataUrl == undefined || $.trim(dataUrl).length == 0) return false; var topWindow = $(window.parent.document); // 选项卡菜单已存在 $('.menuTab', topWindow).each(function() { if ($(this).data('id') == dataUrl) { if (!$(this).hasClass('active')) { $(this).addClass('active').siblings('.menuTab').removeClass('active'); $('.page-tabs-content').animate({ marginLeft: ""}, "fast"); // 显示tab对应的内容区 $('.mainContent .RuoYi_iframe', topWindow).each(function() { if ($(this).data('id') == dataUrl) { $(this).show().siblings('.RuoYi_iframe').hide(); return false; } }); } flag = false; return false; } }); // 选项卡菜单不存在 if (flag) { var str = '' + menuName + ' '; $('.menuTab', topWindow).removeClass('active'); // 添加选项卡对应的iframe var str1 = ''; $('.mainContent', topWindow).find('iframe.RuoYi_iframe').hide().parents('.mainContent').append(str1); // 添加选项卡 $('.menuTabs .page-tabs-content', topWindow).append(str); } return false; } /** 设置全局ajax超时处理 */ $.ajaxSetup({ complete: function(XMLHttpRequest, textStatus) { if (textStatus == "parsererror") { $.modal.confirm("登陆超时!请重新登陆!", function() { window.location.href = ctx + "login"; }) } } });