/*************************************************************** *
ProName:EdorBBInput.js
*Title:被保险人重要资料变更
*Description:被保险人重要资料变更
*Copyright:Copyright (c) 2012
*Company:Sinosoft
* @author : weigh * @version : 8.0 * @date : 2014-06-13 ****************************************************************/ var showInfo; var turnPage = new turnPageClass(); var turnPage1 = new turnPageClass(); var turnPage2 = new turnPageClass(); var mOperate = "";//操作状态 var tSQLInfo = new SqlClass(); /** * 提交 */ function submitForm() { var i = 0; var showStr = i18nMessage("正在保存数据,请您稍候并且不要修改屏幕上的值或链接其他页面", "LIS-04525"); var urlStr = "../common/jsp/MessagePage.jsp?picture=C&content=" + encodeURIComponent(showStr); //showInfo = window.showModelessDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:250px"); 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(); document.all("Operate").value = mOperate; if (mOperate == "DELETE"){ document.getElementById("fm").action="../API/grp_pa/g_pos/EdorICSave/DELETE"; }else if (mOperate == "INSERT||UPDATE"){ document.getElementById("fm").action="../API/grp_pa/g_pos/EdorICSave/INSERTUPDATE"; } ajaxSubmit2(document.getElementById("fm")); } /** * 提交数据后返回操作 */ function afterSubmit(FlagStr, content) { if (typeof(showInfo)=="object" && typeof(showInfo)!="unknown") { 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:250px"); 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(); } else { var urlStr = "../common/jsp/MessagePage.jsp?picture=S&content="+ encodeURIComponent(content); //showModalDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:250px"); 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(); if(mOperate == "DELETE"){ queryOldClick(); queryUpdateClick(); clearPage(); }else if(mOperate =="INSERT||UPDATE" ){ queryOldClick(); queryUpdateClick(); clearPage(); } } } /** * 调用保险方案的方法 */ function showContPlanCode(cObj,cObjName,cObjCode){ return showCodeList('contplan',[cObj,cObjName,cObjCode],[0,1,2],null,document.all("GrpPropNo").value,'GrpContNo',1,null); } function showContPlanCodeName(cObj1,cObjName1,cObjCode1){ return showCodeListKey('contplan',[cObj1,cObjName1,cObjCode1],[0,1,2],null,document.all("GrpPropNo").value,'GrpContNo',1,null); } /** * 查询原被保人信息 */ function queryOldClick(){ tSQLInfo = new SqlClass(); tSQLInfo.setResourceName("g_pos.EdorICSql"); tSQLInfo.setModule("grp_pa"); tSQLInfo.setSqlId("EdorICSql1"); tSQLInfo.addSubPara(document.all("GrpPropNo").value); tSQLInfo.addSubPara(document.all("OldInsuredNameQ").value); tSQLInfo.addSubPara(document.all("OldInsuredIDNoQ").value); tSQLInfo.addSubPara(document.all("OldInsuredNoQ").value); tSQLInfo.addSubPara(document.all("ContPlanCodeOldQ").value); tSQLInfo.addSubPara(tEdorAppNo); // initOldInsuredInfoGrid(); // initUpdateInsuredInfoGrid(); clearPage(); document.all("SerialNo").value=""; turnPage1.queryModal(tSQLInfo.getString(), OldInsuredInfoGrid, 1, 1,10); // if (!turnPage1.strQueryResult) { // i18nAlert("未查询到符合条件的查询结果!", "LIS-03016"); // } var upArrResul; var tSelNo = UpdateInsuredInfoGrid.getSelNo(); if (tSelNo != '0'){ var InsuredNo = UpdateInsuredInfoGrid.getRowColData(tSelNo-1,7); if(InsuredNo != null){ tSQLInfo0 = new SqlClass(); tSQLInfo0.setResourceName("g_pos.EdorICSql"); tSQLInfo0.setModule("grp_pa"); tSQLInfo0.setSqlId("EdorICSql10"); tSQLInfo0.addSubPara(document.all("EdorAppNo").value); var upArrResul1= easyExecSql(tSQLInfo0.getString()); if (upArrResul1== null){ tSQLInfo1 = new SqlClass(); tSQLInfo1.setResourceName("g_pos.EdorICSql"); tSQLInfo1.setModule("grp_pa"); tSQLInfo1.setSqlId("EdorICSql11"); tSQLInfo1.addSubPara(document.all("GrpPropNo").value); tSQLInfo1.addSubPara(document.all("EdorAppNo").value); tSQLInfo1.addSubPara(InsuredNo); upArrResul= easyExecSql(tSQLInfo1.getString()); }else { tSQLInfo1 = new SqlClass(); tSQLInfo1.setResourceName("g_pos.EdorICSql"); tSQLInfo1.setModule("grp_pa"); tSQLInfo1.setSqlId("EdorICSql9"); tSQLInfo1.addSubPara(document.all("GrpPropNo").value); tSQLInfo1.addSubPara(document.all("EdorAppNo").value); tSQLInfo1.addSubPara(document.all("EdorType").value); tSQLInfo1.addSubPara(InsuredNo); upArrResul= easyExecSql(tSQLInfo1.getString()); } if(upArrResul != null) { document.all("OldInsuredName").value = upArrResul[0][0]; document.all("OldIDType").value = upArrResul[0][1]; document.all("OldIDTypeName").value = upArrResul[0][2]; document.all("OldIDNo").value = upArrResul[0][3]; document.all("OldInsuredGender").value = upArrResul[0][4]; document.all("OldInsuredGenderName").value = upArrResul[0][5]; document.all("OldInsuredBirthDay").value = upArrResul[0][6]; } } } } /** * 展示原被保人信息 */ function showOldInsuredList(){ initUpdateInsuredInfoGrid(); queryUpdateClick(2); clearPage(); var tSelNo = OldInsuredInfoGrid.getSelNo(); var tOldInsuredName = OldInsuredInfoGrid.getRowColData(tSelNo-1,2); var tOldIdno = OldInsuredInfoGrid.getRowColData(tSelNo-1,8); document.all("InsuredOldName").value =tOldInsuredName; document.all("IdOldNo").value = tOldIdno; document.all("OldInsuredName").value =OldInsuredInfoGrid.getRowColData(tSelNo-1,2); document.all("OldIDType").value =OldInsuredInfoGrid.getRowColData(tSelNo-1,6); document.all("OldIDTypeName").value =OldInsuredInfoGrid.getRowColData(tSelNo-1,7); document.all("OldIDNo").value = OldInsuredInfoGrid.getRowColData(tSelNo-1,8); document.all("OldInsuredGender").value =OldInsuredInfoGrid.getRowColData(tSelNo-1,3); document.all("OldInsuredGenderName").value =OldInsuredInfoGrid.getRowColData(tSelNo-1,4); document.all("OldInsuredBirthDay").value =OldInsuredInfoGrid.getRowColData(tSelNo-1,5); document.all("InsuredName").value =OldInsuredInfoGrid.getRowColData(tSelNo-1,2); document.all("IDType").value =OldInsuredInfoGrid.getRowColData(tSelNo-1,6); document.all("IDTypeName").value =OldInsuredInfoGrid.getRowColData(tSelNo-1,7); document.all("IDNo").value = OldInsuredInfoGrid.getRowColData(tSelNo-1,8); document.all("InsuredGender").value =OldInsuredInfoGrid.getRowColData(tSelNo-1,3); document.all("InsuredGenderName").value =OldInsuredInfoGrid.getRowColData(tSelNo-1,4); document.all("InsuredBirthDay").value =OldInsuredInfoGrid.getRowColData(tSelNo-1,5); //document.all("edorValDate").value = getCurrentDate(); document.all("InsuredNO").value =OldInsuredInfoGrid.getRowColData(tSelNo-1,12); document.all("SerialNo").value =""; } /** * 保存 */ function addRecord(){ if(!verifyForm("fm")){ return false; } var tSelNoOld = OldInsuredInfoGrid.getSelNo(); var tSelNoUpdate = UpdateInsuredInfoGrid.getRowColData(); if(tSelNoOld=='0' && tSelNoUpdate=='0'){ i18nAlert("请选中一条原被保人信息或修改后的被保人信息进行保存!", "LIS-03325"); return false; } if(!/^[\u4e00-\u9fa5A-Za-z]+(?:[·•\s'-][\u4e00-\u9fa5A-Za-z]+)*$/.test(document.all("InsuredName").value)){ i18nAlert("被保人姓名存在非法字符!", null); return false; } if (document.all("IDType").value != '') { if (document.all("IDType").value != '0') { if (!/[\u4e00-\u9fa5]/.test(document.all("IDNo").value) && !/^[0-9A-Za-zX]+$/.test(document.all("IDNo").value)) { i18nAlert("证件号存在汉字或非法字符!", "LIS-BQ-0085"); return false; } } else if (document.all("IDType").value == '0') { if (!checkIdCard(document.all("IDNo").value)) { return false; } // 进行日期比较 var content = chkIdNo(document.all("IDNo").value, document.all("InsuredBirthDay").value, document.all("InsuredGender").value) if (content!= "") { i18nAlert(content, null); return false; } } } document.all("InsuredOldName").value = document.all("OldInsuredName").value; document.all("IdOldNo").value = document.all("OldIDNo").value; mOperate = "INSERT||UPDATE"; submitForm(); } /** * 撤销 */ function deleteRecord(){ var tSelNo = UpdateInsuredInfoGrid.getSelNo(); if(tSelNo=='0'){ i18nAlert("请选择一条修改过的被保险人信息进行撤销!", "LIS-03326"); return false; } mOperate = "DELETE"; submitForm(); } /** * 查询修改后被保人信息 */ function queryUpdateClick(o){ tSQLInfo = new SqlClass(); tSQLInfo.setResourceName("g_pos.EdorICSql"); tSQLInfo.setModule("grp_pa"); tSQLInfo.setSqlId("EdorICSql4"); tSQLInfo.addSubPara(document.all("GrpPropNo").value); tSQLInfo.addSubPara(document.all("EdorAppNo").value); tSQLInfo.addSubPara(document.all("EdorType").value); tSQLInfo.addSubPara(NullToEmpty(document.all("EdorNo").value)); tSQLInfo.addSubPara(document.all("InsuredNameQ").value); tSQLInfo.addSubPara(document.all("InsuredIDNoQ").value); tSQLInfo.addSubPara(document.all("BatchNo").value); // initOldInsuredInfoGrid(); // initUpdateInsuredInfoGrid(); clearPage(); turnPage2.queryModal(tSQLInfo.getString(), UpdateInsuredInfoGrid, 1, 1,10); if(o=='1'){ if (!turnPage2.strQueryResult) { i18nAlert("未查询到符合条件的查询结果!", "LIS-03016"); } } } /** * 查询修改后被保人信息展示 */ function showUpdateInsuredList(){ initOldInsuredInfoGrid(); queryOldClick(); clearPage(); var tSelNo = UpdateInsuredInfoGrid.getSelNo(); var tSerialNo = UpdateInsuredInfoGrid.getRowColData(tSelNo-1,1); var tOldInsuredName = UpdateInsuredInfoGrid.getRowColData(tSelNo-1,2); var tOldIdno = UpdateInsuredInfoGrid.getRowColData(tSelNo-1,3); var tInsuredNo = UpdateInsuredInfoGrid.getRowColData(tSelNo-1,7); document.all("InsuredOldName").value = tOldInsuredName; document.all("IdOldNo").value = tOldIdno; document.all("SerialNo").value = tSerialNo; document.all("InsuredNO").value = tInsuredNo; tSQLInfo = new SqlClass(); tSQLInfo.setResourceName("g_pos.EdorICSql"); tSQLInfo.setModule("grp_pa"); tSQLInfo.setSqlId("EdorICSql6"); tSQLInfo.addSubPara(document.all("GrpPropNo").value); tSQLInfo.addSubPara(document.all("EdorType").value); tSQLInfo.addSubPara(document.all("EdorAppNo").value); tSQLInfo.addSubPara(tSerialNo); var upArrResul= easyExecSql(tSQLInfo.getString()); if(upArrResul != null){ //document.all("edorValDate").value = upArrResul[0][0]; document.all("InsuredName").value =upArrResul[0][1]; document.all("IDType").value =upArrResul[0][2]; document.all("IDTypeName").value =upArrResul[0][3]; document.all("IDNo").value = upArrResul[0][4]; document.all("InsuredGender").value =upArrResul[0][5]; document.all("InsuredGenderName").value =upArrResul[0][6]; document.all("InsuredBirthDay").value =upArrResul[0][7]; document.all("InsuredAppAge").value=upArrResul[0][8]; // document.all("OccupationCode").value =upArrResul[0][9]; // document.all("OccupationCodeName").value = upArrResul[0][10]; document.all("ServerArea").value = upArrResul[0][11]; document.all("ServiceArName").value = upArrResul[0][12]; document.all("Substandard").value =upArrResul[0][13]; document.all("SubstandardName").value =upArrResul[0][14]; document.all("Social").value =upArrResul[0][15]; document.all("SocialName").value =upArrResul[0][16]; // document.all("Salary").value =upArrResul[0][18]; var mySql; if (tActivityID === "null" || tActivityID == null) { mySql = wrapSql("g_pos.EdorICSql", "EdorICSql8", [upArrResul[0][19], document.all("GrpPropNo").value, tEdorNo, tEdorType], "grp_pa"); } else { mySql = wrapSql("g_pos.EdorICSql", "EdorICSql7", [upArrResul[0][19], document.all("GrpPropNo").value], "grp_pa"); } var strTemp = easyExecSql(mySql); if(strTemp != null) { // document.all("InsuredOldName").value =tOldInsuredName; // document.all("IdOldNo").value = tOldIdno; document.all("OldInsuredName").value = strTemp[0][0]; document.all("OldIDType").value = strTemp[0][1]; document.all("OldIDTypeName").value = strTemp[0][2]; document.all("OldIDNo").value = strTemp[0][3]; document.all("OldInsuredGender").value = strTemp[0][4]; document.all("OldInsuredGenderName").value = strTemp[0][5]; document.all("OldInsuredBirthDay").value = strTemp[0][6]; } } } /** * 清理页面 */ function clearPage(){ //document.all("edorValDate").value =""; document.all("InsuredName").value =""; document.all("IDType").value =""; document.all("IDTypeName").value =""; document.all("IDNo").value =""; document.all("InsuredGender").value =""; document.all("InsuredGenderName").value =""; document.all("InsuredBirthDay").value =""; document.all("InsuredAppAge").value =""; document.all("OccupationCode").value =""; document.all("OccupationCodeName").value =""; document.all("OccupationType").value =""; document.all("OccupationTypeName").value =""; document.all("ServerArea").value =""; document.all("ServiceArName").value =""; document.all("Substandard").value =""; document.all("SubstandardName").value =""; document.all("Social").value =""; document.all("SocialName").value =""; } /** * 人员清单校验 */ function insuredListCheck() { fm.Operate.value = "CHECKLIST"; tOperate = "CHECKLIST"; fm.action = "../API/grp_pa/g_pos/EdorInsuredDealSave/ADD"; ajaxSubmit2(document.getElementById("fm")); initForm(); } /** * 选择客户 --按回车键和Tab键时触发 */ function selectUser() { var keyCode = event.keyCode; if (keyCode=="13"|| keyCode=="9") { if (!selectUserInfo()) { return false; } } } /** * 选择客户详细方法 */ function selectUserInfo() { document.all("InsuredNameTemp").value = document.all("InsuredName").value; if (document.all("InsuredNameTemp").value != document.all("InsuredName").value.trim()) { i18nAlert("录入被保人姓名不能带空格!", "LIS-03351"); return false; } if (document.all("InsuredName").value!=null && document.all("InsuredName").value!='') { var arrResult = new Array(); tSQLInfo = new SqlClass(); tSQLInfo.setResourceName("g_pos.EdorNISql"); tSQLInfo.setModule("grp_pa"); tSQLInfo.setSqlId("EdorNISql3"); tSQLInfo.addSubPara(document.all("GrpPropNo").value); tSQLInfo.addSubPara(document.all("InsuredName").value); arrResult = easyExecSql(tSQLInfo.getString()); if(arrResult=='0'){ emptyCustInfo(); return ; } var n=arrResult[0]; if (n>1) { showLCInsuredInfo();//客户查询 emptyCustInfo();//清空被保人客户页面信息 } else if(n==1) { var arrResult = new Array(); tSQLInfo = new SqlClass(); tSQLInfo.setResourceName("g_pos.EdorNISql"); tSQLInfo.setModule("grp_pa"); tSQLInfo.setSqlId("EdorNISql5"); tSQLInfo.addSubPara(document.all("GrpPropNo").value); tSQLInfo.addSubPara(document.all("InsuredName").value); tSQLInfo.addSubPara(""); emptyCustInfo(); arrResult = new Array(); arrResult = easyExecSql(tSQLInfo.getString()); document.all("InsuredName").value = arrResult[0][0]; document.all("IDType").value = arrResult[0][1]; document.all("IDTypeName").value = arrResult[0][2]; document.all("IDNo").value = arrResult[0][3]; document.all("InsuredGender").value = arrResult[0][4]; document.all("InsuredGenderName").value = arrResult[0][5]; document.all("InsuredBirthDay").value = arrResult[0][6]; document.all("InsuredAppAge").value = arrResult[0][7]; document.all("InsuredNoS").value = arrResult[0][8]; document.all("ContNoS").value = arrResult[0][9]; } else { return; } } } /** * 客户姓名查出多条时,跳转到客户查询页面 */ function showLCInsuredInfo() { var tGrpPropNo=document.all("GrpPropNo").value; var tInsuredName=document.all("InsuredName").value; window.open("./EdorNIQueryMain.jsp?GrpPropNo="+tGrpPropNo+"&InsuredName="+tInsuredName+"&ManageCom="+tManageCom,"查询被保人信息",'width=950,height=520,top=0,left=0,toolbar=0,location=0,directories=0,menubar=0,scrollbars=1,resizable=1,status=0'); } /** * 清空被保人基本信息 */ function emptyCustInfo(){ document.all("InsuredName").value=""; document.all("IDType").value=""; document.all("IDTypeName").value=""; document.all("IDNo").value=""; document.all("InsuredGender").value=""; document.all("InsuredGenderName").value=""; document.all("InsuredBirthDay").value=""; document.all("InsuredAppAge").value=""; document.all("InsuredNoS").value =""; document.all("ContNoS").value =""; } //职业类别 function showOccupationCodeList(obj1,obj1Name,obj2,obj2Name){ var keycode = event.keyCode; //回车的ascii码是13 if(keycode!="13" && keycode!="9") { return; } showCodeList('occupationcode',[obj1,obj1Name,obj2,obj2Name],[0,1,2,3],null,document.all("OccupationCodeName").value,'OccupationName',1); } function showOccupationCodeListKey(obj1,obj1Name,obj2,obj2Name){ var keycode = event.keyCode; //回车的ascii码是13 if(keycode!="13" && keycode!="9") { return; } showCodeList('occupationcode',[obj1,obj1Name,obj2,obj2Name],[0,1,2,3],null,document.all("OccupationCodeName").value,'OccupationName',1); } /** * 清空关联查询的项目 */ function clearInput(codeInput,nameInput) { codeInput.value = ""; nameInput.value = ""; } /** * 校验身份证以及返回出生日期和性别、年龄 */ function checkidtype(){ if(document.all("IDNo").value.length>0 && document.all("IDType").value=="") { i18nAlert("请先选择证件类型!", "LIS-00574"); return false; } if(document.all("IDType").value=="0"&&document.all("IDNo").value.length>0) { if((document.all("IDNo").value.length!=18)){ i18nAlert("输入的身份证号位数错误", "LIS-00575"); document.all('IDNo').className = "warn"; return false; } if(!checkIdCard(document.all("IDNo").value)) { // document.all('IDNo').value=""; document.all('IDNo').className = "warn"; return false; }else { document.all("InsuredBirthDay").value =getBirthdatByIdNo(document.all("IDNo").value); document.all("InsuredGender").value = getSexByIDNo(document.all("IDNo").value); if(document.all("InsuredGender").value=='0'){ document.all("InsuredGenderName").value ='男'; }else if(document.all("InsuredGender").value=='1'){ document.all("InsuredGenderName").value ='女'; } document.all("InsuredAppAge").value = calAge(document.all("InsuredBirthDay").value); document.all('IDNo').className = "common"; } } } function getCurrentDate() { const today = new Date(); const year = today.getFullYear(); // 月份从0开始计数,所以需要加1,并且如果小于10前面补0 const month = String(today.getMonth() + 1).padStart(2, '0'); const day = String(today.getDate()).padStart(2, '0'); return `${year}-${month}-${day}`; }