You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

396 lines
13 KiB

// 该文件中包含客户端需要处理的函数和事件
var mDebug="0";
var mOperate="";
var showInfo;
window.onfocus=myonfocus;
// var mySql = new SqlClass();
//使得从该窗口弹出的窗口能够聚焦
function myonfocus()
{
if(showInfo!=null)
{
try
{
showInfo.focus();
}
catch(ex)
{
showInfo=null;
}
}
}
//提交,保存按钮对应操作
function submitForm()
{
if(mOperate=="")
{
addClick();
}
if (!beforeSubmit())
return false;
/* if (!changeGroup())
return false;
if(mOperate=="INSERT||MAIN")
{
if(!CheckBranchValid())
return false;
}
*/
var i = 0;
var showStr=i18nMessage("正在保存数据,请您稍候并且不要修改屏幕上的值或链接其他页面", "LIS-04525");
var urlStr="../common/jsp/MessagePage.jsp?picture=C&content=" + encodeURIComponent(showStr);
// showModalDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:350px");
// showInfo=window.open(urlStr,"newwindow","height=250;width=550;top=0;left=0;toolbar=no;menubar=no;scrollbars=no;resizable=no;alwaysRaised:yes;");
var name='提示'; //网页名称,可为空;
var iWidth=550; //弹出窗口的宽度;
var iHeight=250; //弹出窗口的高度;
var iTop = (window.screen.availHeight - iHeight) / 2; //获得窗口的垂直位置
var iLeft = (window.screen.availWidth - iWidth) / 2; //获得窗口的水平位置
showInfo = window.open (urlStr,name, "status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no,height="+ iHeight+",width="+iWidth+",innerHeight="+iHeight+",innerWidth=" +iWidth+",left="+iLeft+",top="+iTop,false);
showInfo.focus();
fm.fmtransact.value=mOperate;
// if (fm.hideOperate.value=="")
// {
// i18nAlert("操作控制数据丢失!", "LIS-01300");
// }
//showSubmitFrame(mDebug);
//fm.fmtransact.value = "INSERT||COM";
//document.getElementById("fm").submit(); //提交
fm.action = "../API/systemmanage/sys/ComSave/ADD";
ajaxSubmit2(document.getElementById("fm"));
}
//提交后操作,服务器数据返回后执行的操作
function afterSubmit( FlagStr, content )
{
// showInfo.close();
if (FlagStr == "Fail" )
{
var urlStr="../common/jsp/MessagePage.jsp?picture=C&content=" + encodeURIComponent(content);
// showModalDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:350px");
var name='提示'; //网页名称,可为空;
var iWidth=550; //弹出窗口的宽度;
var iHeight=350; //弹出窗口的高度;
var iTop = (window.screen.availHeight - iHeight) / 2; //获得窗口的垂直位置
var iLeft = (window.screen.availWidth - iWidth) / 2; //获得窗口的水平位置
showInfo = window.open (urlStr,name, "status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no,height="+ iHeight+",width="+iWidth+",innerHeight="+iHeight+",innerWidth=" +iWidth+",left="+iLeft+",top="+iTop,false);
showInfo.focus();
}
else
{
var urlStr="../common/jsp/MessagePage.jsp?picture=S&content=" + encodeURIComponent(content);
//parent.fraInterface.initForm();
// showModalDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:350px");
var name='提示'; //网页名称,可为空;
var iWidth=550; //弹出窗口的宽度;
var iHeight=350; //弹出窗口的高度;
var iTop = (window.screen.availHeight - iHeight) / 2; //获得窗口的垂直位置
var iLeft = (window.screen.availWidth - iWidth) / 2; //获得窗口的水平位置
showInfo = window.open (urlStr,name, "status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no,height="+ iHeight+",width="+iWidth+",innerHeight="+iHeight+",innerWidth=" +iWidth+",left="+iLeft+",top="+iTop,false);
showInfo.focus();
showDiv(operateButton,"true");
showDiv(inputButton,"false");
//执行下一步操作
}
}
//重置按钮对应操作,Form的初始化函数在功能名+Init.jsp文件中实现,函数的名称为initForm()
function resetForm()
{
try
{
// showDiv(operateButton,"true");
// showDiv(inputButton,"false");
initForm();
}
catch(re)
{
i18nAlert("{0}函数中发生异常:初始化界面错误!", "LIS-01177", "OLDCom.js-->resetForm");
}
}
//取消按钮对应操作
function cancelForm()
{
// window.location="../common/html/Blank.html";
showDiv(operateButton,"true");
showDiv(inputButton,"false");
}
//提交前的校验、计算
function beforeSubmit()
{
var ComCode;
var ComGrade;
//添加操作
if (!verifyInput()) return false;
//alert(mOperate);
if(trim(mOperate)== 'INSERT||COM'){
//校验机构代码是否存在
var mySql = wrapSql("sys.ComInputSql", "ComSql1", [fm.ComCode.value], "systemmanage");
var strQueryResult = easyQueryVer3(mySql, 1, 1, 1);
//alert(strSQL);
if (strQueryResult) {
i18nAlert("该管理机构代码已存在!", "LIS-06231");
document.getElementById('ComCode').value = '';
return false;
}
}
if (trim(mOperate) == 'INSERT||COM' ||trim(mOperate) == 'UPDATE||COM')
{
//校验代码输入和级别是否一致
ComCode = document.getElementById('ComCode').value;
ComGrade = document.getElementById('ComGrade').value;
if(ComCode.substring(0,2) !='86'){
alert("管理机构应该以86开头!");
document.getElementById('ComCode').value = '';
return false;
}
if(ComGrade=='01') //总公司
{
if(ComCode.length!=2)
{
i18nAlert("该级别的机构编码长度不符合要求!", "LIS-06232");
document.getElementById('ComCode').value = '';
return false;
}
}
else if(ComGrade=='02') //分公司
{
if(ComCode.length!=4)
{
i18nAlert("该级别的机构编码长度不符合要求!", "LIS-06232");
document.getElementById('ComCode').value = '';
return false;
}
}
else if(ComGrade=='03') //中支
{
if(ComCode.length!=6)
{
i18nAlert("该级别的机构编码长度不符合要求!", "LIS-06232");
document.getElementById('ComCode').value = '';
return false;
}
}
else if (ComGrade=='04')//营销服务部
{
if(ComCode.length!=8)
{
i18nAlert("该级别的机构编码长度不符合要求!", "LIS-06232");
document.getElementById('ComCode').value = '';
return false;
}
}
}
return true;
}
//显示frmSubmit框架,用来调试
function showSubmitFrame(cDebug)
{
if(cDebug=="1")
{
parent.fraMain.rows = "0,0,50,82,*";
}
else {
parent.fraMain.rows = "0,0,0,82,*";
}
}
//Click事件,当点击增加图片时触发该函数
function addClick()
{
if(!verifyForm("fm")){
return false;
}
if (!validateOutComCode(document.getElementById("OutComCode").value)) {
alert("对外公布的机构代码必须以86开头");
return false;
}
//下面增加相应的代码
mOperate="INSERT||COM";
//showDiv(operateButton,"false");
//showDiv(inputButton,"true");
fm.fmtransact.value = mOperate;
// submitForm();
if(!beforeSubmit()){
return;
}
fm.action = "../API/systemmanage/sys/ComSave/ADD";
ajaxSubmit2(document.getElementById("fm"));
}
//Click事件,当点击“修改”图片时触发该函数
function updateClick()
{
//下面增加相应的代码
if (i18nConfirm("您确实想修改该记录吗?", "LIS-00609"))
{
if(!verifyForm("fm")){
return false;
}
if (!validateOutComCode(document.getElementById("OutComCode").value)) {
alert("对外公布的机构代码必须以86开头");
return false;
}
mOperate = "UPDATE||COM";
fm.fmtransact.value = mOperate;
fm.action = "../API/systemmanage/sys/ComSave/ADD";
ajaxSubmit2(document.getElementById("fm"));
}
else
{
mOperate="";
i18nAlert("您取消了修改操作!", "LIS-01291");
}
}
function validateOutComCode(code) {
return typeof code === 'string' && code.startsWith('86');
}
//Click事件,当点击“查询”图片时触发该函数
function queryClick()
{
//下面增加相应的代码
mOperate="QUERY||MAIN";
showInfo=window.open("./ComQuery.html","" ,"toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes");
}
//Click事件,当点击“删除”图片时触发该函数
function deleteClick()
{
//下面增加相应的删除代码
if (i18nConfirm("您确实想删除该记录吗?", "LIS-00610"))
{
var i = 0;
var showStr=i18nMessage("正在删除数据,请您稍候并且不要修改屏幕上的值或链接其他页面", "LIS-04527");
var urlStr="../common/jsp/MessagePage.jsp?picture=C&content=" + encodeURIComponent(showStr);
// showModalDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:350px");
// showInfo=window.open(urlStr,"newwindow","height=250;width=550;top=0;left=0;toolbar=no;menubar=no;scrollbars=no;resizable=no;alwaysRaised:yes;");
var name='提示'; //网页名称,可为空;
var iWidth=550; //弹出窗口的宽度;
var iHeight=250; //弹出窗口的高度;
var iTop = (window.screen.availHeight - iHeight) / 2; //获得窗口的垂直位置
var iLeft = (window.screen.availWidth - iWidth) / 2; //获得窗口的水平位置
showInfo = window.open (urlStr,name, "status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no,height="+ iHeight+",width="+iWidth+",innerHeight="+iHeight+",innerWidth=" +iWidth+",left="+iLeft+",top="+iTop,false);
showInfo.focus();
//showSubmitFrame(mDebug);
fm.fmtransact.value = "DELETE||COM";
document.getElementById("fm").submit(); //提交
initForm();
}
else
{
//mOperate="";
i18nAlert("您取消了删除操作!", "LIS-01292");
}
}
//显示div,第一个参数为一个div的引用,第二个参数为是否显示,如果为"true"则显示,否则不显示
function showDiv(cDiv,cShow)
{
if (cShow=="true")
{
cDiv.style.display="";
}
else
{
cDiv.style.display="none";
}
}
/*********************************************************************
* 查询返回明细信息时执行的函数,查询返回一个2维数组,数组下标从[0][0]开始
* 参数 : 查询返回的二维数组
* 返回值: 无
*********************************************************************
*/
function afterQuery( arrQueryResult )
{
var arrResult = new Array();
if( arrQueryResult != null )
{
arrResult = arrQueryResult;
document.getElementById( 'ComCode' ).value = arrResult[0][0];
document.getElementById('OutComCode').value = arrResult[0][1];
document.getElementById('Name').value = arrResult[0][2];
document.getElementById('ShortName').value = arrResult[0][3];
document.getElementById('Address').value = arrResult[0][4];
document.getElementById('ZipCode').value = arrResult[0][5];
document.getElementById('Phone').value = arrResult[0][6];
document.getElementById('Fax').value = arrResult[0][7];
document.getElementById('EMail').value = arrResult[0][8];
document.getElementById('WebAddress').value = arrResult[0][9];
document.getElementById('SatrapName').value = arrResult[0][10];
document.getElementById('Sign').value = arrResult[0][11];
//document.all('ComAreaType').value = arrResult[0][12];
document.getElementById('ComCitySize').value = arrResult[0][12];
document.getElementById('UpComCode').value = arrResult[0][13];
document.getElementById('ComGrade').value = arrResult[0][14];
document.getElementById('IsDirUnder').value = arrResult[0][15];
document.getElementById('ComNature').value = arrResult[0][16];
document.getElementById('HeadNo').value = arrResult[0][17];
document.getElementById('CompanyCode1').value = arrResult[0][18];
document.getElementById('CompanyCode2').value = arrResult[0][19];
//showOneCodeName('ComAreaType','ComAreaType','ComAreaTypeName');
showOneCodeName('ComCitySize','ComCitySize','ComCitySizeName');
showOneCodeName('ComLevel','ComGrade','ComGradeName');
showOneCodeName('comdirectattr','IsDirUnder','IsDirUnderName');
showOneCodeName('comuwtype','ComNature','ComNatureName');
showOneCodeName('yesorno','Sign','SignName');
}
}
function afterQuery1( arrQueryResult )
{
if( arrQueryResult != null )
{
document.getElementById( 'UpComCode' ).value = arrQueryResult;
}
}
function SelectCom(){
showInfo=window.open('./SelectSysCategory.jsp','newwindow','height=300, width=600, top='+(screen.availHeight-300)/2+',left='+(screen.availWidth-600)/2+', toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
}