520 lines
18 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@page import="com.tenwa.reckon.util.UUIDUtil"%>
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><%
/*
Author: undefined 2018-06-27
Content: 示例详情页面
History Log:
*/
String sPrevUrl = CurPage.getParameter("PrevUrl");
String customerType = CurPage.getParameter("CustomerType");
String ProjectId = CurPage.getParameter("ProjectId");
String flowunid = CurPage.getParameter("FlowUnid");
String flowName = CurPage.getParameter("FlowName");
String contractid = CurPage.getParameter("ContractId");
String showtype = CurPage.getParameter("ShowType");
String sPhaseNo=CurPage.getParameter("PhaseNo");
String IsHistory = CurPage.getParameter("IsHistory");
String ishistoryNew = CurComp.getParameter("IsHistoryNew");
if(sPrevUrl == null) sPrevUrl = "";
String falg = "false";
if("0010".equals(sPhaseNo) || "0020".equals(sPhaseNo) ){
falg = "true";
}
if("合同制作流程".equals(flowName)){
falg = "false";
}
String sTempletNo = "CustomerFamilyJoinTempInfo";//--模板号--
//如果是合同查询则 查询正式表数据
if("flow_contract_sum_car".equals(showtype)){
sTempletNo = "CustomerFamilyJoinQueryInfo";//--模板号--
}
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
doTemp.setColTips("", "");
doTemp.setDefaultValue("project_id", ProjectId);
doTemp.setHtmlEvent("tel","onChange","checkTelRepeat");
doTemp.setHtmlEvent("certId","onChange","checkCertId");
doTemp.setHtmlEvent("suphone","onChange","checkSuphone");
doTemp.setHtmlEvent("certtype", "onChange", "setSexRead");
doTemp.setHtmlEvent("certid","onChange","ValidityCheck");
doTemp.setHtmlEvent("CERTTYPE","onChange","checkCertidSex");
doTemp.setHtmlEvent("IDEXPIRY_TYPE","onChange","changeIdexpiryType");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
dwTemp.Style = "2";//freeform
//dwTemp.ReadOnly = "-2";//只读模式
String FlowUnid = CurPage.getParameter("FlowUnid");
String customerid = Sqlca.getString("select customer_id from lb_union_lessee_temp where flowunid='"+FlowUnid+"'");
// dwTemp.genHTMLObjectWindow(CurPage.getParameter("FlowUnid"));flowunid + "," + customerid
String Partner = Sqlca.getString("select Partner_ from CUSTOMER_FAMILY_TEMP where flowunid='"+FlowUnid+"'");
if("flow_contract_sum_car".equals(showtype)){
dwTemp.genHTMLObjectWindow(contractid);
}else{
if(Partner==null){
dwTemp.genHTMLObjectWindow(FlowUnid);
}else if(Partner.equals("Y")){
dwTemp.genHTMLObjectWindow(FlowUnid + "," + customerid);
}else{
dwTemp.genHTMLObjectWindow(FlowUnid);
}
}
if ("true".equals(ishistoryNew)) falg = "false";
String sButtons[][] = {
//{"true","","Button","新增","新增","newRecord()","","","","btn_icon_add"},
{falg,"","Button","保存","保存","viewAndEdit()","","","","btn_icon_edit"},
//{"true","All","Button","保存","保存所有修改","save(0)","","","",""},
{falg,"","Button","删除","删除租赁物信息","deleteRecord()","","","","btn_icon_delete",""},
{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""}
};
//sButtonPosition = "south";
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">
$(function(){
$("#ID_ADDRESS").css("width",$("#ID_ADDRESS").parent().parent().parent().parent()[0].clientWidth/2+200+"px");
$("#ID_ADDRESS").attr("ReadOnly","true");
$("#WORKUNIT").css("width",$("#WORKUNIT").parent().parent().parent().parent()[0].clientWidth/2+200+"px");
$("#WORKUNIT").attr("ReadOnly","true");
$("#WORK_ADDRESS").css("width",$("#WORK_ADDRESS").parent().parent().parent().parent()[0].clientWidth/2+200+"px");
$("#WORK_ADDRESS").attr("ReadOnly","true");
var spouse = getItemValue(0,0,"Spouse_");
if("Y"==spouse){
// $("#ASSURE_RELATION").val("配偶");
// document.getElementById("ASSURE_RELATION").readOnly=true;
setItemReadOnly(0,0,"ASSURE_RELATION",true);
setItemReadOnly(0,0,"MARRY_TYPE",true);
setItemReadOnly(0,0,"CHILDRENS_NUMBER",true);
setItemReadOnly(0,0,"CERTID",true);
setItemReadOnly(0,0,"NAME",true);
setItemReadOnly(0,0,"CERTTYPE",true);
setItemReadOnly(0,0,"SEX",true);
}
if("0030"=="<%=sPhaseNo%>" ||"0040"=="<%=sPhaseNo%>"||"0050"=="<%=sPhaseNo%>"||"0060"=="<%=sPhaseNo%>"|| ("0070"=="<%=sPhaseNo%>" && "false"=="<%=IsHistory%>")){//经销商阶段看不见标红,初审、复审、信审可以标红
var mobile = getItemValue(0,getRow(),"TEL");
var mobileResult = checkMobileAll(mobile);
if(mobileResult=="6"){
//$("#FULLNAME").attr("style","color:red;");
$("#TEL").css("color","red");
}
var certResult = checkCertIdAll();
if(certResult=="4"){
//$("#FULLNAME").attr("style","color:red;");
$("#CERTID").css("color","red");
}
}
var certType = getItemValue(0,getRow(),"CERTTYPE");
if("Ind01"==certType){
setItemReadOnly(0,0,"SEX",true);
}
//页面初始化的时候,判断证件有效期类型,默认为短期
var idexpiry_type = getItemValue(0,0,"IDEXPIRY_TYPE");
if(idexpiry_type==""){
$("#IDEXPIRY_TYPE_0").prop("checked", "checked");
}
changeIdexpiryType();
birthdayCheck();
});
function changeIdexpiryType(){
var idexpiry_type = getItemValue(0,0,"IDEXPIRY_TYPE");
if("1" == idexpiry_type){//短期
setItemReadOnly(0,0,"IDEXPIRY",false);
var idexpiry = getItemValue(0,0,"IDEXPIRY");
if("0000" == idexpiry){
setItemValue(0,0,"IDEXPIRY","");
}
}else {
setItemReadOnly(0,0,"IDEXPIRY",true);
setItemValue(0,0,"IDEXPIRY","2100/12/31");
}
}
function selectDuties(){
AsDialog.OpenSelector("codeLibraryListByCodeNo","codeno,duties","dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.4) + "px",function(sReturn){
if(!sReturn || sReturn == "_CANCEL_"){
return;
}
sReturn = sReturn.split("@");
setItemValue(0,0,"SPOSITION",sReturn[1]);
},"请选择职务");
}
function selectPersonContacts(){
var spouse = getItemValue(0,0,"Spouse_");
if("Y"==spouse){
alert("请前往申请人信息页面修改婚姻状况!");
return;
}
AsDialog.OpenSelector("codeLibraryListByCodeNo","codeno,personContact","dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.4) + "px",function(sReturn){
if(!sReturn || sReturn == "_CANCEL_"){
return;
}
sReturn = sReturn.split("@");
setItemValue(0,0,"ASSURE_RELATION",sReturn[1]);
},"请选择与承租人关系");
}
function setSexRead(){
var certtye=getItemValue(0,getRow(0),"certtype");
if("Ind01"==certtye){
$('#SEX_0').attr("disabled","disabled"); //男
$('#SEX_2').attr("disabled","disabled"); //女
}else{
$('#SEX_0').attr("disabled",false); //男
$('#SEX_2').attr("disabled",false); //女
}
}
// 风控中台对接相关代码 单位地址
function selectWorkAddress(){
let workAddressId = getItemValue(0,0,"work_address_id");
AsDialog.PopView("/Tenwa/Lease/Flow/Project/BusinessApplication/personAddress.jsp",
'addressId='+workAddressId,
"resizable=yes;dialogWidth=600px;dialogHeight=355px;center:yes;status:no;statusbar:no",
function(result){
if(result == "cancel"){
return;
}
if(result !== ""){
setItemValue(0,0,"work_address_id",result.split("@")[0]);
setItemValue(0,0,"work_address_code",result.split("@")[1]);
setItemValue(0,0,"work_address",result.split("@")[2]);
}
},
(!workAddressId?"新增":"修改")+"单位地址");
}
// 风控中台对接相关代码 户籍地址
function selectIdAddress(){
let workAddressId = getItemValue(0,0,"id_address_id");
AsDialog.PopView("/Tenwa/Lease/Flow/Project/BusinessApplication/personAddress.jsp",
'addressId='+workAddressId,
"resizable=yes;dialogWidth=600px;dialogHeight=355px;center:yes;status:no;statusbar:no",
function(result){
if(result == "cancel"){
return;
}
if(result !== ""){
setItemValue(0,0,"id_address_id",result.split("@")[0]);
setItemValue(0,0,"id_address_code",result.split("@")[1]);
setItemValue(0,0,"id_address",result.split("@")[2]);
}
},
(!workAddressId?"新增":"修改")+"户籍地址");
}
// 风控中台对接相关代码 居住地址
function selectLiveAddress(){
let workAddressId = getItemValue(0,0,"live_address_id");
AsDialog.PopView("/Tenwa/Lease/Flow/Project/BusinessApplication/personAddress.jsp",
'addressId='+workAddressId,
"resizable=yes;dialogWidth=600px;dialogHeight=355px;center:yes;status:no;statusbar:no",
function(result){
if(result == "cancel"){
return;
}
if(result !== ""){
setItemValue(0,0,"live_address_id",result.split("@")[0]);
setItemValue(0,0,"live_address_code",result.split("@")[1]);
setItemValue(0,0,"workunit",result.split("@")[2]);
}
},
(!workAddressId?"新增":"修改")+"居住地址");
}
function checkCertId(){//校验共同申请人证件号格式
var certId = getItemValue(0,getRow(0),"certid");
var certtype = getItemValue(0,getRow(0),"CERTTYPE");
if(certId==""){
setErrorTips("certId","证件号不能为空!");
return true;
}
if("Ind01"==certtype){
if(certId.length!=18){
setErrorTips("certid","身份证必须是18位");
return false;
}
if(CheckLicense(certId)){
setErrorTips("certid","");
return true;
}else{
setErrorTips("certId","身份证格式不正确!");
return false;
}
}else{
return true;
}
}
function checkTel(){//校验共同申请人手机号格式
var tel = getItemValue(0,getRow(0),"tel");
if(tel==""){
// setErrorTips("tel","手机号不能为空!");
//alert("手机号不能为空!");
return true;
}
var phone = /^[1][2,3,4,5,6,7,8,9][0-9]{9}$/;
if(phone.test(tel)){
setErrorTips("tel","");
return true;
}else{
setErrorTips("tel","手机号格式不正确!");
//alert("手机号格式不正确!");
return false;
}
/* if(CheckPhoneCode(tel)){
setErrorTips("tel","");
return true;
}else{
setErrorTips("tel","手机号格式不正确!");
//alert("手机号格式不正确!");
return false;
} */
}
function checkSuphone(){//校验单位电话格式和不为空
var suphone = getItemValue(0,getRow(0),"suphone");
if(suphone==""){
// setErrorTips("suphone","单位电话不能为空!");
//alert("单位电话不能为空!");
return true;
}
if(CheckPhoneCode(suphone)){
setErrorTips("suphone","");
return true;
}else{
setErrorTips("suphone","单位电话格式不正确!");
//alert("单位电话格式不正确!");
return false;
}
}
function checkTelRepeat(){//校验共同申请人手机号重复
var customerType = "03";
var tel = getItemValue(0,getRow(),"tel");
var id = getItemValue(0,getRow(),"id");
var certid = getItemValue(0,getRow(),"certid");
var fullname = getItemValue(0,getRow(),"name");
var sParams = "certId="+id+",mobile="+tel+",customerType="+customerType+",flowunid="+"<%=FlowUnid%>"
+",certid="+certid +",FULLNAME="+fullname;
var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerInfoCheck","checkMobileRepeat",sParams);
if("SUCCESS"!=sReturnInfo){
//setErrorTips("tel","该手机号已重复!");
setErrorTips("tel",sReturnInfo);
//alert("该手机号已重复!");
return false;
}else{
setErrorTips("tel","");
return true;
}
}
function checkSex(){
var sexw = getItemValue(0,0,"sex");
var spouse = getItemValue(0,0,"Spouse_");
if("Y"==spouse){
if("<%=customerType%>"=="03"){
var sParams ="flowunid="+"<%=FlowUnid%>";
var message = RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerInfoCheck","checkSex",sParams);
if("error"==message){
alert("请先填写承租人性别!!");
return false;
}else{
if(sexw==message){
alert("承租人和配偶性别不能一致!!");
return false;
}
}
}
}
return true;
}
function newRecord(){//新增
var name = getItemValue(0,0,"name");
var certid = getItemValue(0,0,"certid");
var tel = getItemValue(0,0,"tel");
var shukou = getItemValue(0,0,"shukou");
var suname = getItemValue(0,0,"suname");
var suphone = getItemValue(0,0,"suphone");
var sposition = getItemValue(0,0,"sposition");
var smincome = getItemValue(0,0,"smincome");
if(name=="" || certid==""){
alert("请输入信息!");
return;
}
var sResult = RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerFamilyJoin","saveCustomerFamily",
"customerid=<%=UUIDUtil.getUUID()%>,flowunid=<%=FlowUnid%>,tel="+getItemValue(0,0,"tel")+",name="+getItemValue(0,0,"name")+",certid="+getItemValue(0,0,"certid")+",shukou="+getItemValue(0,0,"shukou")+",suname="+getItemValue(0,0,"suname")+",suphone="+getItemValue(0,getRow(0),"suphone")+",sposition="+getItemValue(0,getRow(0),"sposition")+",smincome="+getItemValue(0,getRow(0),"smincome"));
if(sResult == "1"){
alert("新增成功!");
reloadSelf();
}
if(sResult == "2"){
alert("已存在共同申请人!");
reloadSelf();
}
if(sResult == "3"){
alert("新增失败!");
reloadSelf();
}
}
function viewAndEdit(){//保存
var CertIdResult = checkCertId();
if(CertIdResult==false){
return;
}
var TelResult = checkTel();
if(TelResult==false){
return;
}
var SuphoneResult = checkSuphone();
if(SuphoneResult==false){
return;
}
var falgs = checkTelRepeat();
if(falgs==false){
return;
}
if(!checkSex()){
return;
}
if(!checkCertidRepeat()){
return;
}
var assurerelation = getItemValue(0,0,"ASSURE_RELATION");
if(assurerelation.length>10){
setErrorTips("ASSURE_RELATION","关系输入过长!!");
return;
}else{
setErrorTips("ASSURE_RELATION","");
}
/*var ID = getItemValue(0,getRow(0),'ID');
if("undefined"==ID||""==ID || null==ID){
AsDebug.showMessage("提示","请选中一条数据!","","",true);
return;
}
var sUrl = "/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerFamilyJoinTempInfo.jsp";
var sparam = 'ID='+ID;
AsControl.OpenView(sUrl,sparam,"_self","");
var name = getItemValue(0,0,"name");
var certid = getItemValue(0,0,"certid");
var tel = getItemValue(0,0,"tel");
var shukou = getItemValue(0,0,"shukou");
var suname = getItemValue(0,0,"suname");
var suphone = getItemValue(0,0,"suphone");
var sposition = getItemValue(0,0,"sposition");
var smincome = getItemValue(0,0,"smincome");
if(name=="" || certid=="" || tel==""){
alert("请输入共同申请人信息!");
return;
}else{ */
var flowunid = getItemValue(0,0,"flowunid");
var customerid = getItemValue(0,0,"customerid");
if(null==flowunid||""==flowunid){
setItemValue(0, 0, "flowunid", "<%=FlowUnid%>");
setItemValue(0, 0, "Partner_", "Y");
}
if(null==customerid||""==customerid){
setItemValue(0, 0, "customerid","<%=customerid%>");
}
as_save(0);
// }
}
function returnList(){
AsControl.OpenView("<%=sPrevUrl%>", "","_self","");
}
//根据身份证号判断性别
function ValidityCheck(){
var certID = getItemValue(0,getRow(),"CERTID");
var certType = getItemValue(0,getRow(),"CERTTYPE");
if("Ind01"==certType){
if(certID.length==18){
sex = certID.substring(16,17);
sex = parseInt(sex);
if(sex%2==0){//奇男偶女
setItemValue(0,getRow(),"SEX","2");
setItemReadOnly(0,0,"SEX",true);
}else{
setItemValue(0,getRow(),"SEX","1");
setItemReadOnly(0,0,"SEX",true);
}
}else if(certID.length==15){
sex = certID.substring(14,15);
sex = parseInt(sex);
if(sex%2==0){//奇男偶女
setItemValue(0,getRow(),"SEX","2");
setItemReadOnly(0,0,"SEX",true);
}else{
setItemValue(0,getRow(),"SEX","1");
setItemReadOnly(0,0,"SEX",true);
}
}
}else{
setItemReadOnly(0,0,"SEX",false);
}
checkCertidRepeat();
birthdayCheck();
}
function birthdayCheck(){
var birthday = getItemValue(0,0,"BIRTHDAY");
if(""!=birthday){
return;
}
//校验证件类型为身份证或临时身份证时,出生日期是否同证件编号中的日期一致
var certID = getItemValue(0,0,"CERTID");
//将身份证中的日期自动赋给出生日期,把身份证中的性别赋给性别
if(certID.length == 15){
certID = certID.substring(6,12);
certID = "19"+certID.substring(0,2)+"/"+certID.substring(2,4)+"/"+certID.substring(4,6);
setItemValue(0,0,"BIRTHDAY",certID);
}else if(certID.length == 18){
certID = certID.substring(6,14);
certID = certID.substring(0,4)+"/"+certID.substring(4,6)+"/"+certID.substring(6,8);
setItemValue(0,0,"BIRTHDAY",certID);
}
}
//选择证件类型后,如果证件号不为空,则去判断性别
function checkCertidSex(){
var certID = getItemValue(0,getRow(),"CERTID");
if(certID.length>0){
ValidityCheck();
}
}
function checkCertidRepeat(){
var id = getItemValue(0,getRow(),"ID");
var certId = getItemValue(0,getRow(),"CERTID");
var sParams ="id="+id+",certid="+certId+",flowunid=<%=flowunid%>";
var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerInfoCheck","checkCertidRepeat",sParams);
if("success"!=sReturnInfo){
setErrorTips("CERTID",sReturnInfo);
return false;
}
setErrorTips("CERTID","");
return true;
}
function checkMobileAll(mobile){//检验所有手机号
var sParams = "mobile="+mobile+",flowunid="+"<%=flowunid%>";
var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerInfoCheck","checkTel",sParams);
return sReturnInfo;
}
function checkCertIdAll(){//校验证件号
var certId = getItemValue(0,getRow(),"CERTID");
var sParams = "certId="+certId+",flowunid="+"<%=flowunid%>";
var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerInfoCheck","checkCertIdAll",sParams);
return sReturnInfo;
}
function deleteRecord(){
var ID = getItemValue(0,getRow(),"ID");
if(typeof(ID) == "undefined" || ID.length == 0 ){
alert("无数据可删除 ");
return ;
}else{
if(confirm("确定要删除?")){
as_delete(0,"alert('删除成功!')");
window.location.reload();
}
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>