//归结主要方法有: 居中显示,关闭、打开层,自适应高度,冻结表头、冻结头和列, //首先: special命名为sp var sp = window.NameSpace || {}; if (typeof (SM4Util) != "undefined") { var s4 = new SM4Util(); } /*禁用右键*/ if (window.parent.location.href.indexOf("tpl/index/index2.html") > -1 || window.location.href.indexOf("attachlist.html") > -1) { console.log(window.location.href) $("body").attr("onselectstart", "return false") } //在页面dom加载完之后执行 $(document).ready(function () { sp.addMask(); //为body添加上遮罩层 sp.setClass(); //为自定义class类添加功能操作 sp.table(); //操作table,为table加上隔行变色、 sp.setPanel(); //面板 sp.disablesaving(); //禁止ctrl+s sp.setdisabled(); sp.setreadonly(); sp.addDLTX(); //为body添加上点击不会隐藏的遮罩层 //文字不可被选中 //document.body.onselectstart = function () { // return false; //} }); // $(document).click(function (e) { // var className = ["sp-menu-item", "sp-menu-tab", "icon-menu", "sp-menu-switch"], n = 0; // className.forEach(function (item) { // if (e.target.className.indexOf(item) != -1 || ($(e.target).parents("." + item).length > 0 && e.target.className.indexOf('fa-close') == -1)) { // n = 1; // return; // } // }) // if (n == 0) { // $(".sp-menu-tab", window.parent.document).removeClass("fadeInLeft").addClass("fadeOutLeft"); // setTimeout(function () { // $(".sp-menu-tab", window.parent.document).hide() // }, 500) // } // if (n == 1) { // $(".sp-menu-tab", window.parent.document).removeClass("fadeOutLeft").addClass("fadeInLeft") // $(".sp-menu-tab", window.parent.document).show() // } // }) sp.addMask = function () { //1.为每个页面的body加上遮罩层,样式为不可见 if ($('body').find(".sp-bgMask").length < 1) { $('body').prepend("
"); } //2.如果body中含有对话框 sp-dialog类名,就为其加上温馨提示和关闭按钮 if ($('body').find(".sp-dialog").length < 1) { $('body').prepend(""); } //3.点击遮罩层,对话框、弹出层、遮罩层均淡出 $(".sp-bgMask").bind("click", function () { $(this).fadeOut(200); if ($(".sp-dialog").is(":visible")) { //若对话框显示则淡出 $(".sp-dialog").fadeOut(200); } if ($(".sp-layer").is(":visible")) { //若中间层显示则淡出 $(".sp-layer").fadeOut(200); } if ($(".sp-layer2").is(":visible")) { //若中间层显示则淡出 $(".sp-layer2").fadeOut(200); } }); } //sp.dialog("身份证号不能为空!"); sp.dialog = function (tip, state) { ///