⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 util.js

📁 OBPM是一个开源
💻 JS
📖 第 1 页 / 共 2 页
字号:
var ie = document.all ? 1 : 0;

var wx = screen.availWidth + 'px';
var wy = screen.availHeight + 'px';

function doBack() {
	window.history.back();
}

function exit() {
  parent.close();
}

function doExit() {
  window.close();
}

function doEmpty() {
  window.returnValue = "";
  window.close();
}

function doEnter() {
	var rtn = document.uploadForm.fileFileName.value;
	window.returnValue = rtn;
	window.close();
}
// Trim whitespace from left and right sides of s.
function trim(s) {
	return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
}

function showViewDialog(str,viewid,fieldname,className) {
  wx = '600px';
  wy = '500px';


  var url = contextPath + '/core/dynaform/view/dialogfram.jsp?_viewid='+viewid;
	  url += '&className=' + className;
  
  var rtn = window.showModalDialog(url,str,'font-size:9pt;dialogWidth:' + wx + ';dialogHeight:' + wy + ';status:no;scroll=no;');
  
  var field = document.all(fieldname);
  if (field)
  {
  	if(rtn) {
	  field.value = rtn.id;
  	}
  	else {
	  field.value = '';
  	}
	dy_refresh();
  }
}

function showViewDialog2(str,viewid,mappStr,params) {
	wx = '600px';
	wy = '500px';
	
	var url = contextPath + '/core/dynaform/view/dialogfram.jsp';
		url += '?_viewid='+viewid;
		url += '&' + $H(params).toQueryString();
	var rtn = window.showModalDialog(url,str,'font-size:9pt;dialogWidth:' + wx + ';dialogHeight:' + wy + ';status:no;scroll=no;');
	var mappStr = HTMLDencode(mappStr);
	var mapps = mappStr.split(";");
	
	if (rtn) {
		for(var i=0; i < mapps.length; i++) {
			var rel = mapps[i].split(":");
			var colName = rel[0];
			var fldName = rel[1];			
			var valStr = '';
			if ($H(rtn).values().length > 0) {
				var values = $H(rtn).values();
				values.each(function(val) {
					valStr += val[colName] + ";";
				});
			}
			
			if (document.all(fldName)) {
			    valStr = valStr.substring(0, valStr.lastIndexOf(";"));
			    
			    var fields = document.getElementsByName(fldName);
	            if (fields.length>0&&fields[0].tagName.toUpperCase()=='SELECT') {
	            	for(n=0;fields[0].options.length>n;n++) {                         
			        	if(valStr==fields[0].options[n].value) {
					    	fields[0].options[n].selected=true; 
				        } 
	            	}   
	            } else if(fields.length>0&&(fields[0].type.toUpperCase()=='RADIO'
				 		||fields[0].type.toUpperCase()=='CHECKBOX')) {
					for(n=0;fields.length>n;n++){                         
						if(valStr==fields[n].value){
							fields[n].checked=true;
				    	}	
				    }  		
				}  else {
					fields[0].value = valStr;
				}																						
			}
		}
		return true;
	} else {
		if (rtn == '') {
			for(var i=0; i < mapps.length; i++) {
				var rel = mapps[i].split(":");
				var colName = rel[0];
				var fldName = rel[1];			
				
				if (document.all(fldName)) {
						document.all(fldName).value = rtn;
				}
			}
			return true;
		}
		return false;
	}
}

function selectDate(d) {
  var arg = new Object();
  arg.str_datetime = d;
  arg.time_comp = false;
  var rtn = window.showModalDialog(contextPath + '/script/calendar.html', arg, 'dialogWidth=400px;dialogHeight=240px;status:no;scroll=no;');
  //alert("rtn->"+ rtn);
  return (rtn == null ? "" : rtn);
}

function selectDatetime(d) {
  var arg = new Object();
  arg.str_datetime = d;
  arg.time_comp = true;
  var rtn = window.showModalDialog(contextPath + '/script/calendar.html', arg, 'dialogWidth=210px;dialogHeight=240px;status:no;scroll=no;');
  return (rtn == null ? "" : rtn);
}

function selectTime(t){
  var rtn = window.showModalDialog(contextPath + '/js/time.htm', t, 'dialogWidth=260px;dialogHeight=50px;status:no;scroll=no;');
  return (rtn == null ? "" : rtn);
}


function selectDeptEx(fieldId, fieldName, parentDept, multiSelect, selectChild, selectUrl) {
  if (fieldId == null) {
    return;
  }

  var rtn = selectDept(parentDept, multiSelect, selectChild, selectUrl);

  if (rtn == null || rtn == 'undefined') {
  }
  else if (rtn == '') {
    fieldId.value = '';
    if (fieldName != null) fieldName.value = '';
  }
  else {
    if (multiSelect != null && multiSelect) {
      fieldId.value = '';
      if (fieldName != null) fieldName.value = '';
      for (var i=0; i < rtn.length; i++) {
        var t = rtn[i].split(';');
        fieldId.value += t[0] + ';';
        if (fieldName != null) fieldName.value += t[1] + ';';
      }
    }
    else {
      var t = rtn.split(';');
      fieldId.value = t[0];
      if (fieldName != null) fieldName.value = t[1];
    }
  }
}

function selectDeptByChildEx(fieldId, fieldName, childDept, multiSelect, selectChild, selectUrl) {
  if (fieldId == null) {
    return;
  }

  var rtn = selectDeptByChild(childDept, multiSelect, selectChild, selectUrl);

  if (rtn == null || rtn == 'undefined') {
  }
  else if (rtn == '') {
    fieldId.value = '';
    if (fieldName != null) fieldName.value = '';
  }
  else {
    if (multiSelect != null && multiSelect) {
      fieldId.value = '';
      if (fieldName != null) fieldName.value = '';
      for (var i=0; i < rtn.length; i++) {
        var t = rtn[i].split(';');
        fieldId.value += t[0] + ';';
        if (fieldName != null) fieldName.value += t[1] + ';';
      }
    }
    else {
      var t = rtn.split(';');
      fieldId.value = t[0];
      if (fieldName != null) fieldName.value = t[1];
    }
  }
}


function selectGroupEx(fieldId, fieldName, type, multiSelect, selectUrl) {
  if (fieldId == null) {
    return;
  }

  var rtn = selectGroup(type, multiSelect, selectUrl);

  if (rtn == null || rtn == 'undefined') {
  }
  else if (rtn == '') {
    fieldId.value = '';
    if (fieldName != null) fieldName.value = '';
  }
  else {
    if (multiSelect != null && multiSelect) {
      fieldId.value = '';
      if (fieldName != null) fieldName.value = '';
      for (var i=0; i < rtn.length; i++) {
        var t = rtn[i].split(';');
        fieldId.value += t[0] + ';';
        if (fieldName != null) fieldName.value += t[1] + ';';
      }
    }
    else {
      var t = rtn.split(';');
      fieldId.value = t[0];
      if (fieldName != null) fieldName.value = t[1];
    }
  }
}


function selectUserEx(fieldId, fieldName, type, multiSelect, parentDept, selectChild) {
  if (fieldId == null) {
    return;
  }
  var rtn = selectUser(type, multiSelect, parentDept, selectChild);

  if (rtn == null || rtn == 'undefined') {
  }
  else if (rtn == '') {
    fieldId.value = '';
    if (fieldName != null) fieldName.value = '';
  }
  else {
    if (multiSelect != null && multiSelect) {
      fieldId.value = '';
      if (fieldName != null) fieldName.value = '';
      for (var i=0; i < rtn.length; i++) {
        var t = rtn[i].split(';');
        fieldId.value += t[0] + ';';
        if (fieldName != null) fieldName.value += t[1] + ';';
      }
    }
    else {
      var t = rtn.split(';');
      fieldId.value = t[0];
      if (fieldName != null) fieldName.value = t[1];
    }
  }
  
}

function selectAll(oldValue, multiSelect, selectChild) {
  wx = '600px';
  wy = '400px';
  var url = contextPath + '/core/department/select.action';
  
//  alert("oldValue->" + oldValue);
  var selectid = "";
  if(oldValue != null && oldValue != ""){
	 oldValue = oldValue.replace("(","");
   oldValue = oldValue.replace(")","");
   oldValue = oldValue.replace("{","");
   oldValue = oldValue.replace("}","");
   var tmp = oldValue.split(";");
   for (var i=0; i<tmp.length; i++) {
     var t = tmp[i].split("|");
     if(t != null && t[0] != ''){
		 		selectid = selectid + t[0] + ";";
		 }
   }
  }
  url = url + '?SELECTEDID=' + selectid;
  
  if (multiSelect != null && multiSelect) {
    url = url + '&MULTISELECT=TRUE';
  }
  if (selectChild != null && selectChild) {
    url = url + '&SELECTCHILD=TRUE';
  }
//
//  if (type == 'U' && parentDept != null) {
//    url = url + '&sm_deptid=' + parentDept;
//  }
  //alert("url->"+url);
  var rtn = showframe('', url);

  return rtn;
}

function selectAllEx(fieldId, fieldName, multiSelect, selectChild) {
  if (fieldId == null) {
    return;
  }

  var rtn = selectAll(fieldId.value, multiSelect, selectChild);

  if (rtn == null || rtn == 'undefined') {
  }
  else if (rtn == '') {
    fieldId.value = '';
    if (fieldName != null) fieldName.value = '';
  }
  else {
    if (multiSelect != null && multiSelect) {
      fieldId.value = '';
      if (fieldName != null) fieldName.value = '';
      for (var i=0; i < rtn.length; i++) {
        var t = rtn[i].split(';');
        fieldId.value += t[0] + ';';
        if (fieldName != null) fieldName.value += t[1] + ';';
      }
    }
    else {
      var t = rtn.split(';');
      fieldId.value = t[0];
      if (fieldName != null) fieldName.value = t[1];
    }
  }
}


function showframe(title,querystr) {
  var pth = window.location.pathname;
  var pos1 = pth.lastIndexOf("/");
  var pos2 = pth.lastIndexOf("\\");
  var pos = Math.max(pos1, pos2);
  querystr.title = title;
  if (querystr.url!=null){
    if (!(querystr.url.indexOf("/")==0 || querystr.url.indexOf("\\")==0))
      querystr.url = pth.substring(0,pos)+"/"+querystr.url;
  }
  else {
    if (!(querystr.indexOf("/")==0 || querystr.indexOf("\\")==0))
      querystr = pth.substring(0,pos)+"/"+querystr;
  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -