function reloadSelf(){ if(typeof(DZ) != "undefined" && DZ && DZ.length>0){ s_r_c[0]=-1; var iCurrentRow = getRow(0); TableFactory.search(0,undefined,v_g_DWIsSerializJbo,undefined,"fromarea"); if(iCurrentRow== -1) iCurrentRow=0; lightRow(0,iCurrentRow);//高亮 } else { self.location.reload(); } } function MRCheckDate(obj){ //alert("MRCheckDate"); var sDate = obj.value.replace(/\//g,''); if(checkDate(sDate)){ obj.value = sDate.substring(0,4) + "/" + sDate.substring(4,6) + "/" + sDate.substring(6,8); } } function formatNumber(number,pattern){ //格式化数字 if(isNaN(number)) return 0.00; var str = number.toString(); var strInt; var strFloat; var formatInt; var formatFloat; if(/\./g.test(pattern)){ formatInt = pattern.split('.')[0]; formatFloat = pattern.split('.')[1]; }else{ formatInt = pattern; formatFloat = null; } if(/\./g.test(str)){ if(formatFloat!=null){ var tempFloat = Math.round(parseFloat('0.'+str.split('.')[1])*Math.pow(10,formatFloat.length))/Math.pow(10,formatFloat.length); strInt = (Math.floor(number)+Math.floor(tempFloat)).toString(); strFloat = /\./g.test(tempFloat.toString())?tempFloat.toString().split('.')[1]:'0'; }else{ strInt = Math.round(number).toString(); strFloat = '0'; } }else{ strInt = str; strFloat = '0'; } if(formatInt!=null){ var outputInt = ''; var zero = formatInt.match(/0*$/)[0].length; var comma = null; if(/,/g.test(formatInt)){ comma = formatInt.match(/,[^,]*/)[0].length-1; } var newReg = new RegExp('(\\d{'+comma+'})','g'); if(strInt.length-1){ var dotFormat = ""; for(var i=0;i -1) return true; } // END HOME LEFT RIGHT var codes = [35, 36, 37, 39]; if(codes.indexOf(keycode) > -1) return true; if(keycode == 8) return true; // backspace if(keycode == 45){ var fot = value.indexOf("-"); if(fot > -1) return false; else return true; } var dot = value.indexOf("."); if(keycode == 46){ if(dot > -1) return false; else return true; } if(keycode < 48 || keycode > 57) return false; if(dot > -1) value = value.substring(0, dot); value = value.replace(",", "").replace("-", ""); if(value.length >= 15) return false; return true; } //只允许数字 function NumberFilter(value,size,evt){ var keycode = evt.keyCode; if(keycode==13) evt.keyCode = 9; var dot = value.indexOf("."); if(keycode==45){ if(value.indexOf("-")>-1){ evt.keyCode=0; } }else{ if(dot==-1){ if(keycode!=46 &&(keycode<48 || keycode>57)) evt.keyCode=0; if(value.replace(/,/g,"").length>=15) evt.keyCode=0; }else{ if(keycode<48 || keycode>57) evt.keyCode=0; if(value.substring(0,dot).replace(/,/g,"").length>=15) evt.keyCode=0; } } } //只允许输入数字 function IntegerFilter(value,evt){ var keycode = evt.keyCode; if(keycode==13){ evt.keyCode = 9; } if(keycode<48 || keycode>57) evt.keyCode=0; } //禁止黏贴非数字 function ReplaceNaN(obj,evt){ //alert(clipboardData.getData('text')); clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9\.]+/g,'')); } function wordlimit(obj,evt){ var arrExclude = [8,37,38,39,40,46,13,35,36,16,17,20,18]; if(obj.getAttribute("maxlength")){ var maxLength = parseInt(obj.getAttribute("maxlength")); for(var i=0;i=maxLength) evt.returnValue = false; } } //控制显示模板分组信息 function showHideFields(obj,tableid){ if(tableid=="@SysSubNOGROUPSYS@") tableid = "@SysSub@"; if(obj.expand!="0"){ obj.expand = "0"; obj.className = "info_group_collapse"; if(document.getElementById(tableid)) document.getElementById(tableid).style.display = "none"; } else{ obj.expand = "1"; obj.className = "info_group_expand"; if(document.getElementById(tableid)) document.getElementById(tableid).style.display = ""; } } //格式化显示日期 function fomartDate(date){ var sResult = ""; var sYear = date.getYear(); var sMonth = date.getMonth()+1; if(sMonth<10)sMonth = "0" + sMonth; var sDate = date.getDate(); if(sDate<10)sDate = "0" + sDate; sResult = sYear + "/" + sMonth + "/" + sDate; return sResult; } //还原日期对象 function parseDate(datestr){ var oDate; if(datestr=="") oDate = new Date(); else oDate = new Date(datestr); return oDate; } function getCurrentItemValue(fieldName){ return getItemValue(0,getRow(),fieldName); } function setCurrentItemValue(fieldName,value){ setItemValue(0,getRow(),fieldName,value); } var DWDialogEventHandler; function openDWDialog(initTitle){ if(initTitle==undefined) initTitle = "正在处理中..."; var topDiv = $("#DWOverLayoutDiv"); topDiv.show(); var obj = $("#DWOverLayoutSubDiv"); //topDiv.children(".datawindow_overdiv_subdiv"); obj.children(".datawindow_overdiv_info").html(initTitle); obj.show(); var iLeft = document.body.clientWidth/2-obj.width()/2+document.body.scrollLeft;//100 + document.body.scrollLeft;//var iLeft = (topDiv[0].offsetWidth-obj[0].offsetWidth)/2; var iTop = document.body.clientHeight/2-obj.height()/2+document.body.scrollTop;//100 + document.body.scrollTop;//var iTop = (topDiv[0].offsetHeight-obj[0].offsetHeight)/2; obj.css({left:iLeft,top:iTop}); document.getElementById('sp_datawindow_overdiv_top').style.display= 'inline'; //alert(obj.children(".datawindow_overdiv_info").html()); } function resetDWDialog(msg,status){ var obj = $("#DWOverLayoutSubDiv"); obj.children(".datawindow_overdiv_info").html(msg); DWDialogEventHandler = undefined; if(status){ DWDialogEventHandler = window.setInterval(autoCloseDWDialog, 500); } } function autoCloseDWDialog(){ $("#DWOverLayoutDiv").hide(); $("#DWOverLayoutSubDiv").hide(); if(DWDialogEventHandler) window.clearInterval(DWDialogEventHandler); } var DWDialogEventHandlerForAjax_URL=undefined; var DWDialogEventHandlerForAjax=undefined; function resetDWDialogForAjax(title,url){ if(title){ var obj = $("#DWOverLayoutSubDiv"); obj.children(".datawindow_overdiv_info").html(title); } DWDialogEventHandlerForAjax_URL = url; //alert(DWDialogEventHandlerForAjax_URL); DWDialogEventHandlerForAjax = window.setInterval(autoCloseDWDialogForAjax, 500); } function autoCloseDWDialogForAjax(){ $.ajax({ type:"GET", url:DWDialogEventHandlerForAjax_URL, processData:false, success:function(status){ //alert("status="+status); if(status=="true"){ $("#DWOverLayoutDiv").hide(); $("#DWOverLayoutSubDiv").hide(); if(DWDialogEventHandlerForAjax) window.clearInterval(DWDialogEventHandlerForAjax); DWDialogEventHandlerForAjax_URL=undefined; DWDialogEventHandlerForAjax=undefined; } } }); } function toNumber(value){ if(typeof(value)=="number") return value; else return parseFloat(value.replace(/,/g,'')); } function isNumber(value){ if(value==undefined) return false; if(value.indexOf("/")>-1) return false; if(isNaN(value)==false) return true; else{ if(isNaN(toNumber(value))==false) return true; else return false; } } function beforeCheck(dwname){ return true; } function afterCheck(dwname){ return true; } function calendarPancelScroll(scrollTop){ var calendarPancel = document.getElementById("calendarPanel"); if(calendarPancel){ var origtop = calendarPancel.getAttribute("origtop"); origtop = origtop.substring(0,origtop.length-2); origtop= parseInt(origtop); calendarPancel.style.top = (origtop-scrollTop)+"px"; } }