/* * 系统全局js脚本 */ function hrefSubmit(ele,url){ getReferenceForm(ele).action=url; getReferenceForm(ele).submit(); } function postAjax(url){ jQuery.post(url,function(result){ alert(result); }); } function postAjax(url,msg,reload){ jQuery.post(url,function(result){ if(result=="操作成功"||result==""){ alert(msg); if(reload){ window.location.href=window.location.href; } }else{ alert(result); } }); } function postAjax(url,msg,reload,isAddMask){ if(isAddMask){ setMask("main-container"); } jQuery.post(url,function(result){ if(result=="操作成功"||result==""){ alert(msg); if(reload){ window.location.href=window.location.href; }else{ if(isAddMask){ $("#main-container").unmask(); } } }else{ alert(result); if(isAddMask){ $("#main-container").unmask(); } } }); } function postAjax(url,msg,reload,isAddMask,formid,pageNumber){ if(isAddMask){ setMask("main-container"); } jQuery.post(url,function(result){ if(result=="操作成功"||result==""){ alert(msg); if(reload){ if(""!=formid){ var oldUrl = $("#"+formid).attr("action"); $("#"+formid).attr("action",oldUrl+"?pageNumber="+pageNumber); $("#"+formid).submit(); }else{ window.location.href=window.location.href; } }else{ if(isAddMask){ $("#main-container").unmask(); } } }else{ alert(result); if(isAddMask){ $("#main-container").unmask(); } } }); } function items2json(items){ var itemsVal ="["; items.each(function(i,obj){ var val=obj.value; var tempitems=val.split("&"); var valStr=""; for(var i=0;i 0) { for (var i = 0; i < items.length; i++) { if (items[i].checked == true) { return true; } } } else { if (items.checked == true) { return true; } } return false; } function setAllCheckboxState(name, state){ var elms = document.getElementsByName(name); for (var i = 0; i < elms.length; i++) { elms[i].checked = state; } } function getReferenceForm(elm){ while (elm && elm.tagName != 'BODY') { if (elm.tagName == 'FORM') return elm; elm = elm.parentNode; } return null; } //1.判断select选项中 是否存在Value="paraValue"的Item function selectIsExitItem(objSelect, objItemValue) { var isExit = false; for (var i = 0; i < objSelect.options.length; i++) { if (objSelect.options[i].value == objItemValue) { isExit = true; break; } } return isExit; } //2.向select选项中 加入一个Item function addItemToSelect(objSelect, objItemText, objItemValue) { //判断是否存在 if (selectIsExitItem(objSelect, objItemValue)) { alert("该Item的Value值已经存在"); } else { var varItem = new Option(objItemText, objItemValue); objSelect.options.add(varItem); } } //3.从select选项中 删除一个Item function removeItemFromSelect(objSelect, objItemValue) { //判断是否存在 if (selectIsExitItem(objSelect, objItemValue)) { for (var i = 0; i < objSelect.options.length; i++) { if (objSelect.options[i].value == objItemValue) { objSelect.options.remove(i); break; } } alert("成功删除"); } else { alert("该select中 不存在该项"); } } // 4.删除select中选中的项 function removeSelectedItemFromSelect(objSelect) { var length = objSelect.options.length - 1; for(var i = length; i >= 0; i--){ if(objSelect[i].selected == true){ objSelect.options[i] = null; } } } // 5.修改select选项中 value="paraValue"的text为"paraText" function updateItemToSelect(objSelect, objItemText, objItemValue) { //判断是否存在 if (selectIsExitItem(objSelect, objItemValue)) { for (var i = 0; i < objSelect.options.length; i++) { if (objSelect.options[i].value == objItemValue) { objSelect.options[i].text = objItemText; break; } } alert("成功修改"); } else { alert("该select中 不存在该项"); } } // 6.设置select中text="paraText"的第一个Item为选中 function selectItemByValue(objSelect, objItemText) { //判断是否存在 var isExit = false; for (var i = 0; i < objSelect.options.length; i++) { if (objSelect.options[i].text == objItemText) { objSelect.options[i].selected = true; isExit = true; break; } } //Show出结果 if (isExit) { alert("成功选中"); } else { alert("该select中 不存在该项"); } } function showDiaLogList(url,myTitle){ var dialog =art.dialog.open(url, {width: '1024px',height: '720px',lock:true,fixed: true,drag:false,resize: false,title: myTitle}); dialog = art.dialog.through ; } function showDiaLog(url,myTitle,myWidth,myHeigh){ var dialog =art.dialog.open(url, {width: myWidth, height: myHeigh,fixed: true,drag:false,resize: false,title: myTitle,lock:true,background:"#000",opacity:"0.8"}); dialog = art.dialog.through ; return dialog; } function showDiaLogByParent(url,myTitle,myWidth,myHeigh){ var dialog =art.dialog.parent.art.dialog.open(url, {width: myWidth, height: myHeigh,fixed: true,drag:false,resize: false,title: myTitle,lock:true,background:"#000",opacity:"0.8"}); dialog = art.dialog.through ; return dialog; } function openWindow(url,name) { var url; //转向网页的地址; window.open(url,'_blank','height=screen.height, width=screen.width, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no'); } function setMask(divid){ $("#"+divid).mask("系统正在加载中,请稍后..."); } function trimkeyup(e) { lucene_objInput = $(this); if (e.keyCode != 37 && e.keyCode != 39 && e.keyCode != 13) { var im = $.trim(lucene_objInput.val()); lucene_objInput.val(im); } } function openProcessTrackPage(ctx,histProcInstId){ var height1 = window.parent.document.documentElement.clientHeight; var height = (parseInt(height1)-45)+"px"; showDiaLog(ctx+'/workflow/trace/traceProcess.do?processInstanceId='+histProcInstId,'监控','1400px',height); } function openProcessTrackMobile(ctx,histProcInstId){ var height1 = window.parent.document.documentElement.clientHeight; var height = (parseInt(height1)-45)+"px"; showDiaLog(ctx+'/workflow/trace/traceProcessMobile.do?processInstanceId='+histProcInstId,'手机监控','450px',height); } function showFullDiaLog(url,myTitle){ var dialog =art.dialog.open(url, {width: '100%', height: '100%',fixed: true,drag:false,resize: false,title: myTitle,lock:true,background:"#000",opacity:"0.8"}); dialog = art.dialog.through ; return dialog; }