crm_customer_contactedit.jsp

来自「java开发的办公系统 1.系统管理 (地区管理,部门管理,菜单管理,用户管理」· JSP 代码 · 共 348 行

JSP
348
字号
<%@ include file="../../include/configuration.jsp"%>
<%@ include file="../../include/authorizemanager.jsp"%>
<%@ page import="com.vere.crm.customer.bean.*"%>
<%@ page import="com.vere.crm.customer.item.*"%>
<%@ page contentType="text/html; charset=gb2312" %>
<%
	SessionFactory sessionFactory=(SessionFactory)session.getAttribute("sessionFactory");
	String message="";
	ParameterUtils.setCharacterEncoding(request);
	String status=ParameterUtils.getString(request,"status");
	String linkflag=ParameterUtils.getString(request,"linkflag");
	//修改
	if(status.equals("edit"))
	{
		String id=ParameterUtils.getString(request,"id");//
		String customer_id=ParameterUtils.getString(request,"customer_id");//客户名
		String contact_name=ParameterUtils.getString(request,"contact_name");//联系人姓名
		String sex=ParameterUtils.getString(request,"sex");//性别
		String department=ParameterUtils.getString(request,"department");//所在部门
		String duty=ParameterUtils.getString(request,"duty");//职务
		String office_telephone=ParameterUtils.getString(request,"office_telephone");//办公电话
		String mobie=ParameterUtils.getString(request,"mobie");//手机
		String email=ParameterUtils.getString(request,"email");//电子邮箱
		String qq=ParameterUtils.getString(request,"qq");//QQ
		String msm=ParameterUtils.getString(request,"msm");//MSN
		String skype=ParameterUtils.getString(request,"skype");//skype
		String is_main=ParameterUtils.getString(request,"is_main");//是否主联系人
		String home_telephone=ParameterUtils.getString(request,"home_telephone");//家庭电话
		String born=ParameterUtils.getString(request,"born");//联系生日
		String idcard=ParameterUtils.getString(request,"idcard");//身份证号码
		String address=ParameterUtils.getString(request,"address");//地址
		String introduction=ParameterUtils.getString(request,"introduction");//联系人简介
		String register_date=DateUtils.getDateTime();//登记日期
		String register_username=sessionFactory.getManager_usersItem().getUsername();//登记用户
		String register_name=sessionFactory.getManager_usersItem().getName();//登记人
		String register_department_id=sessionFactory.getManager_usersItem().getDepartment_id();//登记部门编号
		String register_department_nodepath=sessionFactory.getManager_usersItem().getDepartment_nodepath();//登记部门路径
		String register_department=sessionFactory.getManager_usersItem().getManager_departmentItem().getName();//登记部门
		String register_area_id=sessionFactory.getManager_usersItem().getArea_id();//登记地区编号
		String register_area_nodepath=sessionFactory.getManager_usersItem().getArea_nodepath();//登记地区路径
		String register_area=sessionFactory.getManager_usersItem().getManager_areaItem().getName();//登记地区
		if(customer_id==null||customer_id.equals("")){
			out.print("customer_id 客户名不能为空");
			return;
		}
		if(contact_name==null||contact_name.equals("")){
			out.print("contact_name 联系人姓名不能为空");
			return;
		}
		/*if(department==null||department.equals("")){
			out.print("department 所在部门不能为空");
			return;
		}
		if(duty==null||duty.equals("")){
			out.print("duty 职务不能为空");
			return;
		}
		if(office_telephone==null||office_telephone.equals("")){
			out.print("office_telephone 办公电话不能为空");
			return;
		}
		if(mobie==null||mobie.equals("")){
			out.print("mobie 手机不能为空");
			return;
		}
		if(email==null||email.equals("")){
			out.print("email 电子邮箱不能为空");
			return;
		}
		if(born==null||!Check.isDateTime(born)){
			out.print("born 联系生日只能是短日期,形如 (2003-12-05)");
			return;
		}*/
		Crm_customer_contactItem item=new Crm_customer_contactItem();
		item.setId(id);
		item.setCustomer_id(customer_id);
		item.setContact_name(contact_name);
		item.setSex(sex);
		item.setDepartment(department);
		item.setDuty(duty);
		item.setOffice_telephone(office_telephone);
		item.setMobie(mobie);
		item.setEmail(email);
		item.setQq(qq);
		item.setMsm(msm);
		item.setSkype(skype);
		item.setIs_main(is_main);
		item.setHome_telephone(home_telephone);
		item.setBorn(born);
		item.setIdcard(idcard);
		item.setAddress(address);
		item.setIntroduction(introduction);
		item.setRegister_date(register_date);
		item.setRegister_username(register_username);
		item.setRegister_name(register_name);
		item.setRegister_department_id(register_department_id);
		item.setRegister_department_nodepath(register_department_nodepath);
		item.setRegister_department(register_department);
		item.setRegister_area_id(register_area_id);
		item.setRegister_area_nodepath(register_area_nodepath);
		item.setRegister_area(register_area);
		Crm_customer_contactBean bean=new Crm_customer_contactBean();
		boolean b=bean.updateItem(item);
        if(b){
          message="1";
        }
	}
		String id=ParameterUtils.getString(request,"id");
		Crm_customer_contactBean bean=new Crm_customer_contactBean();
		Crm_customer_contactItem item=bean.find(id);
		Oa_dictionaryXmlBean oa_dictionaryXmlBean=new Oa_dictionaryXmlBean();
		List oa_dictionaryXmlList=oa_dictionaryXmlBean.findXmlByArray("17,18");
%>
<html>
<head>
<title><%=titleName%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../css/css.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../../js/check.js"></script>
<link href="../../css/date.css" rel="stylesheet" type="text/css">
<script src="../../js/ShowDate.js"></script>
<script language="javascript">
    init();
</script>
</head>
<script language="javascript">
	function back()
	{
		if('<%=linkflag%>'=='')
			location="crm_customer_contact.jsp";
		if('<%=linkflag%>'=='my')
			location="crm_customer_mycontact.jsp";
	}

	function Check()
	{
		var form=form1;
		if(form.customer_id.value=="")
		{
			alert("请输入客户名!");
			form.customer_id.focus();
			return;
		}
		if(form.contact_name.value=="")
		{
			alert("请输入联系人姓名!");
			form.contact_name.focus();
			return;
		}
		/*if(form.department.value=="")
		{
			alert("请输入所在部门!");
			form.department.focus();
			return;
		}
		if(form.duty.value=="")
		{
			alert("请输入职务!");
			form.duty.focus();
			return;
		}
		if(form.office_telephone.value=="")
		{
			alert("请输入办公电话!");
			form.office_telephone.focus();
			return;
		}
		if(form.mobie.value=="")
		{
			alert("请输入手机!");
			form.mobie.focus();
			return;
		}
		if(!isEmail(form.email.value))
		{
			alert("请输入正确的电子邮箱!");
			form.email.focus();
			return;
		}
		if(form.born.value!=""&&!isDateTime(form.born.value))
		{
			alert("联系生日只能是短日期,形如 (2003-12-05)!");
			form.born.focus();
			return;
		}*/
		form.status.value="edit";
		form.submit();
	}
</script>
<body>
<form action=""  method="post"  name="form1">
	<table class="firsttable">
		<tr>
			<td align="center" valign="top">
				<table class="centertable">
					<tr>
						<td></td>
					</tr>
					<tr>
						<td align="center" class="addborder">
							<table  class="addTable">
								<tr align="center" >
									<td colspan="2">
                  					<font  class="message">
										<%
											if(message.equals("1"))
											{
												out.println("修改成功:继续");
											}
										%>
										</font>
									</td>
								</tr>
								<tr >
									<td >客户名:</td>
									<td >
									<select name="customer_id" id="customer_id">
									<%
										Crm_customer_infoBean crm_customer_infoBean=new Crm_customer_infoBean();
										Crm_customer_infoItem crm_customer_infoItem=new Crm_customer_infoItem();
										crm_customer_infoItem.setRegister_area_nodepath(sessionFactory.getManager_usersItem().getArea_id());
										List crm_customer_infoList=crm_customer_infoBean.find(crm_customer_infoItem);
										for(int i=0;i<crm_customer_infoList.size();i++){
											crm_customer_infoItem=(Crm_customer_infoItem)crm_customer_infoList.get(i);
											if(item.getCustomer_id().equals(crm_customer_infoItem.getId()))
												out.println("<option value='"+crm_customer_infoItem.getId()+"' selected>"+crm_customer_infoItem.getCustomer_name()+"</option>");
											else
												out.println("<option value='"+crm_customer_infoItem.getId()+"' >"+crm_customer_infoItem.getCustomer_name()+"</option>");
										}
									%>
									</select>
									</td>
								</tr>
								<tr >
									<td >联系人姓名:</td>
									<td ><input name="contact_name" type="text" id="contact_name" value="<%=item.getContact_name()%>"></td>
								</tr>
								<tr >
									<td >性别:</td>
									<td >
									<%
										for(int i=0;i<oa_dictionaryXmlList.size();i++){
											Oa_dictionaryItem oa_dictionaryItem=(Oa_dictionaryItem)oa_dictionaryXmlList.get(i);
											if(oa_dictionaryItem.getNum().equals("17"))
											{
												if(item.getSex().equals(oa_dictionaryItem.getCode()))
													out.println("<input type='radio' name='sex' value='"+oa_dictionaryItem.getCode()+"' checked>"+oa_dictionaryItem.getCode_name());
												else
													out.println("<input type='radio' name='sex' value='"+oa_dictionaryItem.getCode()+"' >"+oa_dictionaryItem.getCode_name());
											}
										}
									%>
									</td>
								</tr>
								<tr >
									<td >所在部门:</td>
									<td ><input name="department" type="text" id="department" value="<%=item.getDepartment()%>"></td>
								</tr>
								<tr >
									<td >职务:</td>
									<td ><input name="duty" type="text" id="duty" value="<%=item.getDuty()%>"></td>
								</tr>
								<tr >
									<td >办公电话:</td>
									<td ><input name="office_telephone" type="text" id="office_telephone" value="<%=item.getOffice_telephone()%>"></td>
								</tr>
								<tr >
									<td >手机:</td>
									<td ><input name="mobie" type="text" id="mobie" value="<%=item.getMobie()%>"></td>
								</tr>
								<tr >
									<td >电子邮箱:</td>
									<td ><input name="email" type="text" id="email" value="<%=item.getEmail()%>"></td>
								</tr>
								<tr >
									<td >QQ:</td>
									<td ><input name="qq" type="text" id="qq" value="<%=item.getQq()%>"></td>
								</tr>
								<tr >
									<td >MSN:</td>
									<td ><input name="msm" type="text" id="msm" value="<%=item.getMsm()%>"></td>
								</tr>
								<tr >
									<td >skype:</td>
									<td ><input name="skype" type="text" id="skype" value="<%=item.getSkype()%>"></td>
								</tr>
								<tr >
									<td >是否主联系人:</td>
									<td >
									<%
										for(int i=0;i<oa_dictionaryXmlList.size();i++){
											Oa_dictionaryItem oa_dictionaryItem=(Oa_dictionaryItem)oa_dictionaryXmlList.get(i);
											if(oa_dictionaryItem.getNum().equals("18"))
											{
												if(item.getIs_main().equals(oa_dictionaryItem.getCode()))
													out.println("<input type='radio' name='is_main' value='"+oa_dictionaryItem.getCode()+"' checked>"+oa_dictionaryItem.getCode_name());
												else
													out.println("<input type='radio' name='is_main' value='"+oa_dictionaryItem.getCode()+"' >"+oa_dictionaryItem.getCode_name());
											}
										}
									%>
									</td>
								</tr>
								<tr >
									<td >家庭电话:</td>
									<td ><input name="home_telephone" type="text" id="home_telephone" value="<%=item.getHome_telephone()%>"></td>
								</tr>
								<tr >
									<td >联系生日:</td>
									<td >
									<input name="born" type="text"  size="10" value="<%=DateUtils.formatString(item.getBorn())%>"><a href="javascript:" onClick="show_cele_date(born,'','',born)"><img src='../../icon/cal.gif' border=0></a>
									</td>
								</tr>
								<tr >
									<td >身份证号码:</td>
									<td ><input name="idcard" type="text" id="idcard" value="<%=item.getIdcard()%>"></td>
								</tr>
								<tr >
									<td  width=100>地址:</td>
									<td ><input name="address" type="text" id="address" value="<%=item.getAddress()%>" size="70"></td>
								</tr>
								<tr >
									<td  width=100>联系人简介:</td>
									<td ><textarea name="introduction" cols="70" rows="10" id="introduction"><%=item.getIntroduction()%></textarea></td>
								</tr>
								<tr >
									<td colspan="2" align="center">
										<input name="Button" type="button" class="button" onClick="Check()" value="确定">
										&nbsp;&nbsp;&nbsp;&nbsp;
										<input name="Submit2" type="button" class="button" onClick="back()" value="返回">
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
<input type="hidden" name="status" >
<input type="hidden" name="id" value=<%=id%>>
</form>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?