$(function () { $(".taskBtn:eq(0)").css({ "display": "block" }); $("ul.tab li:eq(0)").find("a").addClass("selected"); $("ul.tab").width(__sysRightPanel-55); $(".taskMain").width(__sysRightPanel-1); $(".taskBtn:eq(0)").css({ "display": "block" }); $("ul.tab li:eq(0)").find("a").addClass("selected"); //用户信息展开 $(".pagesList li").hover( function(){ $(this).addClass("hover"); },function(){ $(this).removeClass("hover"); } ); $(".userInfor").hover( function (event) { $(this).find("ul").show(); event.stopPropagation(); //阻止事件冒泡 },function (event) { $(this).find("ul").hide(); event.stopPropagation(); //阻止事件冒泡 }); //点击页面,隐藏内容。 $("body").click( function () { $(".userInfor ul").hide(); $(".btn-group ul").hide(); }); //鼠标点击后,清除搜索框默认值 $(".searchBox").focus( function () { var myval = $(this).val(); if (myval == this.defaultValue) { $(this).val(""); } }); $(".searchBox").blur( function () { var myval = $(this).val(); if (myval == "") { $(this).val(this.defaultValue); } }); //下拉按钮选择 $("button.dropdown-toggle").click( function (event) { $(".btn-group ul").hide(); $(this).next().slideToggle("fast"); event.stopPropagation(); }); $(".grid-group button.dropdown-toggle").click( function (event) { var myparent=$(this).parent(); var objParentwidth = myparent.offset().left; var objParentheight = myparent.offset().top+28; $(".btn-group ul").hide(); $(this).next().css({"top":objParentheight,"left":objParentwidth}) $(this).next().slideToggle("fast"); event.stopPropagation(); }); //表格控制,必须放在页面加载完成后执行。 $(".content .tableGrid tr").find("td:last").addClass("borderRightNone"); //双行换色 $(".tableGrid tr:even").addClass("even"); //查找class为disable的添加禁止输入,同时也可以反之。 $("input.disable").attr("disabled", "true"); //单击选中checked,不选中行 $("td input[type=checkbox]").click( function (event) { event.stopPropagation(); //阻止事件冒泡 if ($(this).attr("checked", flase)) { $(this).attr("checked", "checked"); } else { $(this).attr("checked", flase); } }); //给有下拉菜单的栏目加三角 $(".navMain li").each( function () { var mylength = $(this).children("ul").length; var downIocn = ""; if (mylength > 0) { $(this).children("a").append(downIocn); } }); //菜单 $(".navMain li").hover( function (event) { $(this).children("ul").show(); $(this).children("a").addClass("hover"); }, function () { $(this).children("a").removeClass("hover"); $(this).find("ul").hide(); }); $(".navMain > li").click( function (event) { // $(this).children("a").addClass("selected"); event.stopPropagation(); //阻止事件冒泡 //$(this).siblings("a").removeClass("selected"); }); $(".taskInformation").height($(window).height()-105-38); }); function demoResize() { var contentWidth = $(window).width() - 50; //边距48,加上边框2 var treecontentWidth = $(window).width() - 50 - 252; $(".treeList").height($(window).height()-105); var contentHeight = $(window).height() - 105; //顶部加上菜单合计105 $(".content").height(contentHeight); $(".grid").height(contentHeight); $(".taskMain").height(contentHeight - 38); if ($(".taskMain").is(":hidden")) { if($(".content").hasClass("hastree")){ $(".content").width(treecontentWidth); $(".content").css({ "border-right": "1px solid #e5e5e5" }); } else{ $(".content").width(contentWidth); $(".content").css({ "border-right": "1px solid #e5e5e5" }); } } else { if($(".content").hasClass("hastree")){ $(".content").width(treecontentWidth); $(".content").css({ "border-right": "1px solid #e5e5e5" }); } else{ $(".content").width(contentWidth - __sysRightPanel); $(".content").css({ "border-right": "none" }); } } } $(window).ready(demoResize); //$(window).resize(demoResize); function hideTask(obj) { $(obj).hide(); $(".content").width(contentWidth); $(".content").css("border-right", "1px solid #e5e5e5"); } function sileDom(obj) { $(obj).slideUp(); } //行选中变色 var TimeFn = null; function clickTr(obj) { //执行延时 clearTimeout(TimeFn); TimeFn = setTimeout(function () { if ($(".taskMain").is(":hidden")) { } else { $(obj).addClass("selected").siblings().removeClass("selected"); } }, 300); } function clickAddNewTr() { if ($(".taskMain").is(":hidden")) { //$(obj).addClass("selected").siblings().removeClass("selected"); var contentWidth = $(window).width() - 50; $(".content").width(contentWidth - __sysRightPanel); $(".content").css({ "border-right": "none" }); $(".taskMain").fadeIn(); $gridMainList.jqGrid('setGridWidth', $('#gbox_' + 'list').parent().width()); $gridMainList.jqGrid('setGridHeight', $(".content").height() - $('.ui-jqgrid-hdiv', "#gbox_list").height() - $('#pager', "#gbox_list").height()); } } function ondblclickTr(obj) { //判断是否显示 var treelength = $("div.treeList").length; if ($(".taskMain").is(":hidden")) { if(ondblclickTr!=null) $(obj).addClass("selected").siblings().removeClass("selected"); var contentWidth = $(window).width() - 50; if(treelength=="0"){ $(".content").width(contentWidth - __sysRightPanel); $(".content").css({ "border-right": "none" }); $(".taskMain").fadeIn(); } else{ $(".content").width(contentWidth - __sysRightPanel-252); $(".content").css({ "border-right": "none" }); $(".taskMain").fadeIn(); } } else { if(treelength=="0"){ $(".content").width($(window).width() - 50); $(".content").css({ "border-right": "1px solid #e5e5e5" }); $(".taskMain").fadeOut(); } else{ $(".content").width($(window).width() - 50-252); $(".content").css({ "border-right": "1px solid #e5e5e5"}); $(".taskMain").fadeOut(); } } } //增加任务单 function addTask() { var contentWidth = $(window).width() - 39; $(".content").width(contentWidth - 1060); $(".content").css({ "border-right": "none" }); $(".taskInformationMain input").val(""); $(".taskMain").show(); } //点击按钮关闭详细区域 function closeTaskInfor() { var mainWidth = $(".main").width(); var treelength = $("div.treeList").length; if(treelength=="0"){ $(".taskMain").fadeOut("fast"); $(".content").width(mainWidth); } else{ $(".taskMain").fadeOut("fast"); $(".content").width(mainWidth-252); } $(".content").css({ "border-right": "1px solid #e5e5e5" }); if( (typeof $grid != 'undefined') && blNull($grid)==false){ $grid.jqGrid('setGridWidth', $('#gbox_' + 'list').parent().width()); $grid.jqGrid('setGridHeight', $(".content").height() - $('.ui-userdata', "#gbox_list").height()- $('.ui-jqgrid-hdiv', "#gbox_list").height() - $('#pager', "#gbox_list").height() -(__sysGridCalBottomPanelHas?__sysGridCalBottomPanelHeight:0)); } if( (typeof $gridMainList != 'undefined') && blNull( $gridMainList)==false){ $gridMainList.jqGrid('setGridWidth', $('#gbox_' + 'list').parent().width()); $gridMainList.jqGrid('setGridHeight', $(".content").height()- $('.ui-userdata', "#gbox_list").height() - $('.ui-jqgrid-hdiv', "#gbox_list").height() - $('#pager', "#gbox_list").height()-(__sysGridCalBottomPanelHas?__sysGridCalBottomPanelHeight:0)); } } //选项卡切换 function tabSelect(obj){ $(obj).addClass("selected"); $(obj).siblings().removeClass("selected"); var myIndex = $(".tab > li").index(obj); $(".taskInformation .taskInformationMain:eq("+myIndex+")").show().siblings().hide(); $(".taskBtn .taskBtnMain:eq("+myIndex+")").show().siblings().hide();} //菜单功能按钮切换 function homeNav() { $(".menu").slideToggle(); $(".nav").slideToggle(); } //弹出层 function layoutLoad(obj, width, height) { var uplayout = "
"; var uplayoutMain = "
"; $("body").append(uplayout, uplayoutMain); var uplayoutMarginTop = -(height + 48) / 2; var uplayoutMarginLeft = -(width + 24) / 2; $(".uplayoutMain").css({ "height": height, "width": width, "margin-left": uplayoutMarginLeft, "margin-top": uplayoutMarginTop }); var loading = "

正在加载请稍等

"; $(".uplayoutMain").append(loading); } //关闭层 function slideUplayout() { $(".uplayout").fadeOut("fast"); $(".uplayoutMain").fadeOut("fast"); //销毁创建的元素 setTimeout(function () { $(".uplayout").remove(); $(".uplayoutMain").remove(); }, 1500); } //表格移动上去后变色 function trhover(obj) { $(obj).addClass("hover"); } function trnohover(obj) { $(obj).removeClass("hover"); } //消息提示 function systips(time, content, tipsType) { if( tipsType=='error') { showerror(content); return; } //三种方式供调用success,error,warn var tips = "

" + content + "

"; $(".header").append(tips); var tipsWidth = $(".systips").width(); $(".systips").css({ "margin-left": -tipsWidth / 2 - 36 }); setTimeout(function () { $(".systips").fadeOut(1000); //销毁创建的元素 setTimeout(function () { $(".systips").remove(); }, time + 1000); }, time); } function coententOf(obj){ var thisobjindex = $(obj).parent().parent().index(); var endindex = $(obj).parent().parent().nextAll("tr.end:eq(0)").index(); if($(obj).hasClass("content-on")){ $(obj).removeClass("content-on").addClass("content-off"); for(var i=thisobjindex+1;i
"; $("body").append(errorBox); var errorBoxHeight = $(".errorBox").height(); $(".errorBox").css({ "top": y - errorBoxHeight - 17, "left": x + 6 }); $(".errorBox div").css({ "top": errorBoxHeight + 8 }); $(".errorBox").fadeIn("fast"); } function valueErrorLose() { $(".errorBox").fadeOut(); $(".errorBox").remove(); } function loadingUser(obj){ var loadingUserContent = $(""); $(obj).after( loadingUserContent ); return loadingUserContent; } function closeUser(obj){ $(obj).remove(); //这里要执行的动作 } function delUploadImg(obj){ $(obj).parent().parent().remove(); } function removepages(obj){ $(obj).parent().remove(); } function charactersover(obj){ var focusCtrl = $(':focus'); if(!blNull(focusCtrl)&&!blNull(focusCtrl.get(0))&&(focusCtrl.get(0).tagName=='INPUT'||focusCtrl.get(0).tagName =='TEXTAREA')) { __sysLastControl=focusCtrl; __sysLastControlCaret = getInputSelection(__sysLastControl.get(0)); } var dlobj = $(obj).find("dl"); var leftwidth = $(obj).offset().left; var widwidth = $(window).width(); var dlwidth = dlobj.width(); var dlallwidth = widwidth-leftwidth; var topfff= $(".topfff"); if(dlallwidth=0 && tmpStr.length> __sysLastControlCaret.start) { __sysLastControl.val(tmpStr.substring(0,__sysLastControlCaret.start)+$(obj).text()+tmpStr.substring( __sysLastControlCaret.start,tmpStr.length )); __sysLastControlCaret.start+=1; } else{ __sysLastControl.val(__sysLastControl.val()+$(obj).text()); } __sysLastControl.get(0).focus(); } } function getInputSelection(el) { var start = 0, end = 0, normalizedValue, range, textInputRange, len, endRange; if (typeof el.selectionStart == "number" && typeof el.selectionEnd == "number") { start = el.selectionStart; end = el.selectionEnd; } else { range = document.selection.createRange(); if (range && range.parentElement() == el) { len = el.value.length; normalizedValue = el.value.replace(/\r\n/g, "\n"); // Create a working TextRange that lives only in the input textInputRange = el.createTextRange(); textInputRange.moveToBookmark(range.getBookmark()); // Check if the start and end of the selection are at the very end // of the input, since moveStart/moveEnd doesn't return what we want // in those cases endRange = el.createTextRange(); endRange.collapse(false); if (textInputRange.compareEndPoints("StartToEnd", endRange) > -1) { start = end = len; } else { start = -textInputRange.moveStart("character", -len); start += normalizedValue.slice(0, start).split("\n").length - 1; if (textInputRange.compareEndPoints("EndToEnd", endRange) > -1) { end = len; } else { end = -textInputRange.moveEnd("character", -len); end += normalizedValue.slice(0, end).split("\n").length - 1; } } } } return { start: start, end: end }; } function offsetToRangeCharacterMove(el, offset) { return offset - (el.value.slice(0, offset).split("\r\n").length - 1); } function setInputSelection(el, startOffset, endOffset) { if (typeof el.selectionStart == "number" && typeof el.selectionEnd == "number") { el.selectionStart = startOffset; el.selectionEnd = endOffset; } else { var range = el.createTextRange(); var startCharMove = offsetToRangeCharacterMove(el, startOffset); range.collapse(true); if (startOffset == endOffset) { range.move("character", startCharMove); } else { range.moveEnd("character", offsetToRangeCharacterMove(el, endOffset)); range.moveStart("character", startCharMove); } range.select(); } } function showList(obj,evt){ var e=(evt)?evt:window.event; if (window.event) { e.cancelBubble=true; } else { //e.preventDefault(); e.stopPropagation(); } var myparent = $(obj).parent(); var inputwidth = myparent.find("input").width(); var dlobj = $(obj).parent().find("ul"); var widwidth = $(window).width(); var widheight = $(window).height(); var dlwidth = dlobj.width(); var dlheight = dlobj.height(); var objParentwidth = myparent.offset().left; var objParentheight = myparent.offset().top; var objParentheight = myparent.offset().top+28; var dlallwidth = widwidth-objParentwidth; var dlallheight = widheight-objParentheight; var rightwidth = dlallwidth-inputwidth; $(myparent).parent().css({"overflow": "visible"}); $(myparent).css({"float": "none"}); dlobj.css({"position": "absolute","margin-top":"0.5%"}); $(obj).parent().find("ul").css({"display":"block"}); return false; } function hideList(event,srcObj){ var obj = $(event.target); if(blNull(obj)) { obj=srcObj; } obj.parent().find("ul").hide(); } function fileval(obj,event){ var event = event || window.event; var code= (event.KeyCode ? event.KeyCode : event.which) ; if(code==27) { hideList(event); return false; } } function nextcontentstate(obj) { var myobj = $(obj); if (myobj.next().is(":hidden")) { myobj.next().show(); myobj.find("span").removeClass("off").addClass("on"); } else { myobj.next().hide(); myobj.find("span").removeClass("on").addClass("off"); } } function showMenu(obj) { $(obj).find("ul").show(); } function hideMenu(obj) { $(obj).find("ul").hide(); } function showTempletEditBtn(obj){ $(obj).children(".templetEditBtnPages").show(); $(obj).css({"border":"1px dashed #F69"}); } function hideTempletEditBtn(obj){ $(obj).children(".templetEditBtnPages").hide(); $(obj).css({"border":"1px solid #fff"}); } var newbox =null; var newBoxShow = false; var contentErrorStr=""; function showerror(content){ if(newbox!=null&&newBoxShow==true) { contentErrorStr+="
"+content; $("#errDlgContent").html(contentErrorStr); newbox.center('y'); newbox.center('x'); return; } contentErrorStr="详细信息:"+content; newBoxShow=true; if(newbox==null) { var newerrorbox="

详细信息:"+content+"

"; newbox = new Boxy(newerrorbox,{ afterHide: function () { newBoxShow=false; },title:"错误提示",modal: true}); } else{ $("#errDlgContent").html(contentErrorStr); } newbox.show(); newbox.center('y'); newbox.center('x'); } function statisLiclick(obj){ var ullength = $(obj).parent().find("ul").length; var mynext = $(obj).next(); if(ullength>0){ if(mynext.is(":hidden")){ mynext.show(); $(obj).addClass("statisLiOpen"); $(obj).removeClass("nodeparent").addClass("nodechildren"); } else{ mynext.hide(); $(obj).removeClass("nodechildren").addClass("nodeparent"); }} }