📄 clientsideapp.js
字号:
//屏蔽鼠标右键
//document.oncontextmenu = contextmenu ;
/**
* 弹出日历管理对话筐
*
*/
function fPopUpCalendarDlg(obj){
var ctrlobj
if(obj.tagName==null)
ctrlobj=document.all(obj);
else
ctrlobj=obj;
showx = event.screenX - event.offsetX -160//+ 25; // + deltaX;
showy = event.screenY - event.offsetY + 18; // + deltaY;
retval = window.showModalDialog("/js/CalendarDlg.htm", "", "dialogWidth:195px; dialogHeight:230px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:0;" );
if( retval != null ){
ctrlobj.value = retval;
}else{
//alert("canceled");
}
}
/**
*单选人员
*/
function fPopUpPersonDlg(idf,namef){
idobj=document.all(idf);
nameobj=document.all(namef);
showx = event.screenX - event.offsetX -160//+ 25; // + deltaX;
showy = event.screenY - event.offsetY + 18; // + deltaY;
retval = window.showModalDialog("/per/perQuery.do", null, "dialogWidth:800px; dialogHeight:400px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:0;resizable:yes;" );
if( retval != null ){
var s=retval.split("|");
idobj.value = s[0];
nameobj.value=s[1];
}else{
idobj.value = "";
nameobj.value="";
}
}
/**
* 弹出新窗口
*
*/
function windowOpen(theURL,winName,features,width,hight,scrollbars,top,left){
var parameter=features+" top="+top+",left="+left+",width="+width+",height="+hight;
if(scrollbars=="no"){
parameter+=",scrollbars=no";
}else{
parameter+=",scrollbars=yes";
}
window.open(theURL,winName,parameter);
}
/**
* 弹出代码管理对话筐
*
*/
function fPopUpCodeDlg(obj){
var ctrlobj=document.all(obj);
showx = event.screenX - event.offsetX - 150; // + deltaX;
showy = event.screenY - event.offsetY + 18; // + deltaY;
var arg="dict_num="+ctrlobj.dict_num;
arg+="&curCode="+ctrlobj.code;
if(ctrlobj.layer!="undefined"&&ctrlobj.layer!=null){
arg+="&layer="+ctrlobj.layer;
}
retval = window.showModalDialog("/jsp/common/codeDlg.jsp?"+arg,"" , "dialogWidth:215px; dialogHeight:230px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:0;resizable:yes" );
if( retval != null ){
rs = retval.split(",");
ctrlobj.value = rs[1];
ctrlobj.code = rs[0];
if(ctrlobj.next!=null&&document.all(ctrlobj.next)!=null){
//document.all(ctrlobj.next).focus();
nextInput(ctrlobj);
}
}
}
/**
* 重新加载代码项
*
*/
function reloadCSApp(obj){
parent.code.location="/jsp/common/codeInterpret.jsp";
}
/**
* 对象获得焦点
*
*/
function obtainFocus(obj){
try{
var obj=obj;//document.all(obj_name);
if(obj!=null){
if(obj.readonly==true){
if(obj.next!=null&&document.all(obj.next)!=null){
document.all(obj.next).focus();
}
}else{
if(obj.formula!=null&&obj.formula!=''){
if(obj.value==null||obj.value==""){
methodInvoke(obj);
}
}else if(obj.value!="" && obj.dict_num!="" && obj.dict=="yes"){
getShowCode(obj.dict_num,obj.value,obj);
}else{
obj.focus();
return;
}
}
}
}catch(e){}
}
var win = window;
var n = 0;
function forSearch(str){
//if(event.keyCode!=13){//回车
// return
//}
var txt, i, found;
if (str == "")
return false;
txt = win.document.body.createTextRange();
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart("character", 1);
txt.moveEnd("textedit");
}
if (found) {
txt.moveStart("character", -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}else {
if (n > 0) {
n = 0;
forSearch(str);
}else{
document.forms(0).searchName.value="";
alert("抱歉!没有找到");
return false;
}
}
return false;
}
function matchInput(curobj){
obj=curobj;
var matchbl = false;
if(obj.value==""||obj.value==null){//if
obj.code = "";
obj.value = "";
matchbl=true;
}else{
if(obj.dict_num==null||obj.dict_num==''){
matchbl = true;
}else{
matchbl = getShowCode(obj.dict_num,obj.value,obj);
}
}
if(matchbl == false){
curobj.value="";
alert("没有匹配的代码项,请重新输入");
curobj.focus();
return false;
}else{
return true;
}
}
function nextInput(curobj){
try{
obj=curobj;
if(matchInput(curobj)){
//跳转到下一个input对象
if(obj.next==null){
return;
}else{
var nextObj=document.all(obj.next);
while(nextObj!=null){
if(nextObj.type!='hidden'&& nextObj.readOnly==false && nextObj.disabled==false){
nextObj.focus();
break;
}else{
if(nextObj.next!=null){
nextObj=document.all(nextObj.next);
}else{
return;
}
}
}
}
}
}catch(e){
}
}
/**
* 回车跳转到下一个对象
*
*/
function gotoNextInput(curobj){
if(event.keyCode!=13){//回车
return
}
nextInput(curobj);
}
/**
*代码翻译:代码值翻译成描述符。
*主要用在onload处。
*/
function interpret(form){
var i=0;
try{
for(var num = 0; num < form.length; num++){
var obj =form.elements[num];
if(obj.value!="" && obj.dict_num!="" && obj.dict=="yes"&&obj.value.indexOf("*****")<0){
try{
var codeset = CSApp.get(obj.dict_num) ;
var code = codeset.get(obj.value) ;
obj.code=code.id;
obj.value=code.name;
}catch(e){
}
}
i++;
}
}catch(e){
return "";
}
}
/**
*代码翻译:描述符译成代码值
*用在onsubmit处。
*/
function code(form){
for(var num = 0; num < form.length; num++){
var obj =form.elements[num];
if(obj.value!=""&&obj.code!="" && obj.dict=="yes"){
obj.value=obj.code;
}
}
return true;
}
/**
*代码翻译:根据具体的代码编号和代码值,翻译成描述符
*根据代码得到页面显示项(开始)
*/
function getShowValue(dict_num,code){
var strShowValue;
if(dict_num==""||dict_num==null){
return code;
}else if(code==""||code==null||code.indexOf("***")>-1){
return code;
}
try{
var codeSet = CSApp.get(dict_num);
strShowValue = codeSet.get(code);
return strShowValue.name;
}catch(e){
//alert('代码错误'+code);
return code ;
}
}
function getShowSpell(code,orgFlag){
if(code==null||code==""||code.indexOf("***")>-1){
return "";
}
if(orgFlag ==null||orgFlag=="" ){
orgFlag =false;
}
try{
if(orgFlag){
var codeSet = CSApp.get("OU");
strShowValue = codeSet.get(code);
return strShowValue.spell;
}else{
//var codeSet = CSApp.get("All");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -