376 lines
13 KiB
Plaintext

<%@page import="com.tenwa.reckon.util.UUIDUtil"%>
<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %>
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%>
<%@ page import="com.amarsoft.app.util.*" %>
<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List00;Describe=注释区;]~*/%>
<%
/*
Author:guosl 2017-05-09
Tester:
Content: 项目基本信息-担保单位信息
Input Param:
Output param:
History Log:
*/
%>
<%/*~END~*/%>
<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%>
<%
String PG_TITLE = "项目基本信息-担保单位信息"; // 浏览器窗口标题 <title> PG_TITLE </title>
%>
<%/*~END~*/%>
<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%>
<%
String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号
BizObject flow= GetFlowAction.getFlowBussinessObject(sFlowUnid);
String productid=flow.getAttribute("productId").getString();
String customerid = UUIDUtil.getUUID();
if(sFlowUnid == null)sFlowUnid = "";
String ID = CurPage.getParameter("ID");//担保单位ID
if(ID == null)ID = "";
String sListTempletNo = CurPage.getParameter("ListTempletNo");//List页面模板号
if(sListTempletNo == null) sListTempletNo = "LBGuaranteeUnitListTemp_Car";
String ishistory=CurPage.getParameter("IsHistory");
String nodeNo=CurPage.getParameter("NodeNo");
String taskno=CurPage.getParameter("TaskNo");
String RightType= CurPage.getParameter("RightType");
%>
<%/*~END~*/%>
<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%>
<%
//String GuaranteeType=ProductParamUtil.getProductParameterValue(productid,"PRD0105","GuaranteeType");//担保类型
//String[] GuaranteeTypes=GuaranteeType.split(",");
//String s="";
//for(int i=0;i<GuaranteeTypes.length;i++){
// s=s+"'"+GuaranteeTypes[i]+"'"+",";
//}
//s=s.substring(0, s.length()-1);
String sTempletNo = "LBGuaranteeUnitInfoTemp_Car";//--模板号--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
doTemp.setDefaultValue("ASSUROR", customerid);
doTemp.setHtmlEvent("CERTID","onChange","changeCertid");
//doTemp.setHtmlEvent("DRIVERLICENSE","onchange","checkDriver");
//doTemp.setDDDWJbo("ASSURE_METHOD","jbo.sys.CODE_LIBRARY,itemno,itemname,codeno='GuaranteeType' and itemno in ("+s+") ");
if(null!=ishistory&&ishistory.equals("true")){
doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据
}
//字段事件
CurPage.getCurComp().setAttribute("RightType", null);
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
dwTemp.Style = "2";//freeform
if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){
dwTemp.ReadOnly = "-2";//只读模式
}
dwTemp.genHTMLObjectWindow(ID);
CurPage.getCurComp().setAttribute("RightType", RightType);
%>
<%/*~END~*/%>
<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%>
<%
String sButtons[][] = {
{"true","All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"},
{"true","","Button","返回","返回列表页面","goBack()","","","","btn_icon_return"}
};
sButtonPosition = "north";
%>
<%/*~END~*/%>
<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%>
<%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<%/*~END~*/%>
<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%>
<script type="text/javascript">
$(function(){
if("ReadOnly" != "<%=RightType%>"){
//checkDriver();
//checkAssure();
}
$("#FULLADDRESS").css("width",$("#FULLADDRESS").parent().parent().parent().parent()[0].clientWidth/2+200+"px");
$("#FULLADDRESS").attr("ReadOnly","true");
$("#WORKCORP")[0].width = $("#WORKCORP").parent().parent().parent()[0].clientWidth/2+200;
$("#TITLE")[0].width = $("#TITLE").parent().parent().parent()[0].clientWidth/2+200;
});
function changeCertid(){
var certid=getItemValue(0,0,"CERTID");
var result=RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerAction","checkCustomerByCertID",'certid='+certid);
if(result.length>0){
var newInput='<input type="button" id="copyCust" value="复制" onclick="copyCustomer(\''+result+'\',\'<%=sFlowUnid%>\')"/>';
$("#CERTID").parent().append(newInput);
}else{
$("#copyCust").remove();
}
}
function copyCustomer(custid,flowunid){
var ID=RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerAction","copyUnitInfo",'customerid='+custid+',flowunid='+flowunid+",custid="+getItemValue(0,0,"ASSUROR"));
alert("复制成功!");
var sUrl = "/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit_Car/LBGuaranteeUnitInfo.jsp";//要打开的URL
var sparam = "ID="+ID+'&FlowUnid='+'<%=sFlowUnid%>'+"&ListTempletNo="+"<%=sListTempletNo%>";//流程编号
var righttype="<%=RightType%>";
if(righttype=="ReadOnly"){sparam=sparam+"&RightType=<%=RightType%>";}
sparam=sparam+"&IsHistory=<%=ishistory%>&NodeNo=<%=nodeNo%>";
checkModified=function(){
return true;
}
AsControl.OpenView(sUrl,sparam,"_self","");
}
//校验驾驶证(是/否)
function checkDriver(){
var driverLicense = getItemValue(0,getRow(),"DRIVERLICENSE");
if(driverLicense=='2'){
setItemValue(0,getRow(),"LICENSENAME","");
setItemReadOnly(0, getRow(), "LICENSENAME", true);
setItemRequired(0, "LICENSENAME", false);
}else{
setItemReadOnly(0, getRow(), "LICENSENAME", false);
setItemRequired(0, "LICENSENAME", true);
}
}
//担保关系
function checkAssure(){
var assurerelation = getItemValue(0,getRow(),"ASSURE_RELATION");
if(assurerelation!='relation_type1'){
setItemRequired(0, "mobile", false);
setItemRequired(0,"DRIVERLICENSE",false);
setItemRequired(0,"LICENSENAME",false);
setItemRequired(0,"WORKADD",false);
setItemRequired(0,"title",false);
}else{
setItemRequired(0, "mobile", true);
setItemRequired(0,"DRIVERLICENSE",true);
setItemRequired(0,"WORKADD",true);
setItemRequired(0,"title",true);
}
}
/*~[Describe=保存记录;InputParam=无;OutPutParam=无;]~*/
function saveRecord(){
var sFlowUnid = "<%=sFlowUnid%>";
setItemValue(0,getRow(),"FlowUnid",sFlowUnid);//初始化流程编号
if(!checkCertInfo(true)) return ;
<%-- var certid=getItemValue(0,0,"CERTID");
var customerid=RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerAction","updateUnitId",'certid='+certid+',flowunid=<%=sFlowUnid%>,custid='+getItemValue(0,0,"ASSUROR"));
setItemValue(0,0,"ASSUROR",customerid); --%>
//as_save("myiframe0","");
as_save(0,"goBack()");
}
function setErrorTips(colName,tips){
if(tips==""){
setItemUnit(0,getRow(),colName,"");
return ;
}
setItemUnit(0,getRow(),colName,"<font color=red>"+tips+"</font>");
}
function selectHomeAddress(){
if(getItemValue(0,0,"fulladdress") == ""){
newRecord();
}else{
edit();
}
}
//新增
function newRecord(){
var sUrl = "/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerAddress.jsp";
var fulladdress = getItemValue(0,getRow(0),'fulladdress');
var country = getItemValue(0,getRow(0),'country');
var province = getItemValue(0,getRow(0),'province');
var dressdetail = getItemValue(0,getRow(0),'dressdetail');
var zipcode = getItemValue(0,getRow(0),'zipcode');
var provincename = getItemValue(0,getRow(0),'provincename');
AsDialog.PopView(sUrl,'customer_id='+getItemValue(0,0,"ASSUROR")+"&flowunid=<%=sFlowUnid%>&fulladdress="+fulladdress+"&country="+country+"&province="+province+"&dressdetail="+dressdetail+"&zipcode="+zipcode+"&provincename="+provincename,"resizable=yes;dialogWidth=600px;dialogHeight=355px;center:yes;status:no;statusbar:no",function(result){
if(result == "cancel"){
return;
}
if(result !== ""){
setItemValue(0,0,"addressid",result.split("@")[0]);
setItemValue(0,0,"fulladdress",result.split("@")[1]);
setItemValue(0,0,"country",result.split("@")[2]);
setItemValue(0,0,"province",result.split("@")[3]);
setItemValue(0,0,"dressdetail",result.split("@")[4]);
setItemValue(0,0,"zipcode",result.split("@")[5]);
setItemValue(0,0,"provincename",result.split("@")[6]);
}
},"新增地址信息");
}
//详情
function view(){
var sUrl = "/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerAddress.jsp";
var id = getItemValue(0,getRow(0),'addressid');
if(typeof(id)=="undefined" || id.length==0 ){
alert("请选择一条信息!");
return ;
}
AsDialog.PopView(sUrl,'id=' +id+'&rightType=ReadOnly&flowunid=<%=sFlowUnid%>',"resizable=yes;dialogWidth=600px;dialogHeight=355px;center:yes;status:no;statusbar:no",function(result){
if(result == "cancel"){
return;
}
if(result !== ""){
setItemValue(0,0,"addressid",result.split("@")[0]);
setItemValue(0,0,"fulladdress",result.split("@")[1]);
setItemValue(0,0,"country",result.split("@")[2]);
setItemValue(0,0,"province",result.split("@")[3]);
setItemValue(0,0,"dressdetail",result.split("@")[4]);
setItemValue(0,0,"zipcode",result.split("@")[5]);
setItemValue(0,0,"provincename",result.split("@")[6]);
}
},"地址详细信息");
}
//修改
function edit(){
var sUrl = "/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerAddress.jsp";
var id = getItemValue(0,getRow(0),'addressid');
var fulladdress = getItemValue(0,getRow(0),'fulladdress');
var country = getItemValue(0,getRow(0),'country');
var province = getItemValue(0,getRow(0),'province');
var dressdetail = getItemValue(0,getRow(0),'dressdetail');
var zipcode = getItemValue(0,getRow(0),'zipcode');
var provincename = getItemValue(0,getRow(0),'provincename');
var flag = "edit";
if(typeof(id)=="undefined" || id.length==0){
if(fulladdress.length == 0){
alert("请选择一条信息!");
return ;
}
}
AsDialog.PopView(sUrl,"id="+id+"&customer_id="+getItemValue(0,0,"ASSUROR")+"&flowunid=<%=sFlowUnid%>"+"&flag="+flag+"&fulladdress="+fulladdress+"&country="+country+"&province="+province+"&dressdetail="+dressdetail+"&zipcode="+zipcode+"&provincename="+provincename,"resizable=yes;dialogWidth=600px;dialogHeight=355px;center:yes;status:no;statusbar:no",function(result){
if(result == "cancel"){
return;
}
if(result !== ""){
setItemValue(0,0,"addressid",result.split("@")[0]);
setItemValue(0,0,"fulladdress",result.split("@")[1]);
setItemValue(0,0,"country",result.split("@")[2]);
setItemValue(0,0,"province",result.split("@")[3]);
setItemValue(0,0,"dressdetail",result.split("@")[4]);
setItemValue(0,0,"zipcode",result.split("@")[5]);
setItemValue(0,0,"provincename",result.split("@")[6]);
}
},"修改地址信息");
}
function checkCertInfo(flag){
if(typeof(flag)=="undefined") flag=false;
var certType = getItemValue(0,getRow(),"certtype");
var certid = getItemValue(0,getRow(),"certid");
//检查自然人证件
if(certType == 'Ind01'){
if (!checkIdCard(certid)){
setErrorTips("certid",getBusinessMessage('156'));
return false;
}else{
setErrorTips("certid","");
}
}
// 护照验证
if(certType == 'Ind03'){
if (!checkCard(certid)){
setErrorTips("certid","护照格式有误!");
return false;
}else{
setErrorTips("certid","");
}
}
//不可与承租人相同验证
var sReturn=RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerAction","checkCustomerByCertid","flowunid=<%=sFlowUnid%>,certid="+certid);
if(sReturn=="false"){
setErrorTips("certid","共同申请人证件号码不可与承租人相同!");
return false;
}
if(sReturn=="true"){
setErrorTips("certid","");
}
return true;
}
// 护照验证
function checkCard(value) {
var re1 = /^[a-zA-Z]{5,17}$/;
var re2 = /^[a-zA-Z0-9]{5,17}$/;
return (re2.test(value)) || re1.test(value);
}
function checkIdCard(value) {
var re = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
return re.test(value);
}
/*~[Describe=返回列表页面;InputParam=无;OutPutParam=无;]~*/
function goBack(){
//要跳转的url
var url="/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit_Car/LBGuaranteeUnitList.jsp";
//要传的参数
var sparam="FlowUnid="+"<%=sFlowUnid%>"+"&TempletNo="+"<%=sListTempletNo%>";
var righttype="<%=RightType%>";
if(righttype=="ReadOnly"){sparam=sparam+"&RightType=<%=RightType%>";}
sparam=sparam+"&IsHistory=<%=ishistory%>&NodeNo=<%=nodeNo%>&TaskNo=<%=taskno%>";
AsControl.OpenView(url,sparam,"_self","");
}
</script>
<%/*~END~*/%>
<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%>
<script type="text/javascript">
/*~[Describe=选择担保单位;InputParam=无;OutPutParam=无;]~*/
function selectGuaranteeUnit(){
AsDialog.OpenSelector("selectGuaranteeUnit","","dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn || sReturn == "_CANCEL_"||sReturn=="_NONE_"||sReturn=="_CLEAR_")
{
return;
}
sReturn = sReturn.split("@");
setItemValue(0,0,"ASSUROR",sReturn[0]);//初始化担保人ID
setItemValue(0,0,"customername", sReturn[1]); //初始化担保人姓名
},"请选担保单位");
}
</script>
<%/*~END~*/%>
<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%>
<script type="text/javascript">
</script>
<%/*~END~*/%>
<%@ include file="/Frame/resources/include/include_end.jspf"%>