custom_add.jsp 4.0 KB
Newer Older
M
megagao 已提交
1 2 3 4 5 6 7
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<link href="js/kindeditor-4.1.10/themes/default/default.css" type="text/css" rel="stylesheet">
<script type="text/javascript" charset="utf-8" src="js/kindeditor-4.1.10/kindeditor-all-min.js"></script>
<script type="text/javascript" charset="utf-8" src="js/kindeditor-4.1.10/lang/zh_CN.js"></script>
<div style="padding:10px 10px 10px 10px">
	<form id="customAddForm" class="customForm" method="post">
	    <table cellpadding="5" >
M
megagao 已提交
8 9
	        <tr>
	            <td>客户编号:</td>
M
megagao 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
	            <td>
	            	<input class="easyui-textbox" type="text" name="customId" data-options="required:true"></input>
	            </td>
	        </tr>
	        <tr>
	            <td>客户名称:</td>
	            <td>
	            	<input class="easyui-textbox" type="text" name="customName" data-options="required:true"></input>
	            </td>
	        </tr>
	        <tr>
	            <td>客户全称:</td>
	            <td>
	            	<input class="easyui-textbox" type="text" name="fullName" style="width: 280px;"></input>
	            </td>
	        </tr>
	        <tr>
	            <td>地址:</td>
	            <td>
	            	<input class="easyui-textbox" type="text" name="address" style="width: 280px;"></input>
	            </td>
	        </tr>
	        <tr>
	            <td>传真:</td>
	            <td>
	            	<input class="easyui-textbox" type="text" name="fax"></input>
	            </td>
	        </tr>
	        <tr>
	            <td>邮箱:</td>
	            <td>
	            	<input class="easyui-textbox" type="text" name="email"></input>
	            </td>
	        </tr>
	        <tr>
	            <td>经理姓名:</td>
	            <td>
	            	<input class="easyui-textbox" type="text" name="ownerName"></input>
	            </td>
	        </tr>
	        <tr>
	            <td>联系电话:</td>
	            <td>
	            	<input class="easyui-textbox" type="text" name="ownerTel"></input>
	            </td>
	        </tr>
	        <tr>
	            <td>客户状态:</td>
	            <td>
M
megagao 已提交
59
		            <select id="cc" class="easyui-combobox" name="status" data-options="width:150">
M
megagao 已提交
60 61 62 63 64 65
						<option value="1">有效客户</option>
						<option value="2">无效客户</option>
					</select>
				</td>
	        </tr>
	        <tr>
M
megagao 已提交
66
	            <td>客户介绍:</td>
M
megagao 已提交
67 68 69 70 71 72 73 74
	            <td>
	                <textarea style="width:800px;height:300px;visibility:hidden;" name="note"></textarea>
	            </td>
	        </tr>
	    </table>
	    <input type="hidden" name="customParams"/>
	</form>
	<div style="padding:5px">
75
	    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitCustomAddForm()">提交</a>
M
megagao 已提交
76 77 78 79 80 81 82 83 84 85 86 87 88 89
	    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">重置</a>
	</div>
</div>
<script type="text/javascript">
	
	
	var customAddEditor ;
	//页面初始化完毕后执行此方法
	$(function(){
		//创建富文本编辑器
		//customAddEditor = TAOTAO.createEditor("#customAddForm [name=file]");
		customAddEditor = KindEditor.create("#customAddForm [name=note]", TT.kingEditorParams);
	});
	//提交表单
90
	function submitCustomAddForm(){
M
megagao 已提交
91 92 93 94 95
		//有效性验证
		if(!$('#customAddForm').form('validate')){
			$.messager.alert('提示','表单还未填写完成!');
			return ;
		}
M
megagao 已提交
96
		//同步文本框中的备注
M
megagao 已提交
97 98 99 100 101
		customAddEditor.sync();
		//ajax的post方式提交表单
		//$("#customAddForm").serialize()将表单序列号为key-value形式的字符串
		$.post("custom/insert",$("#customAddForm").serialize(), function(data){
			if(data.status == 200){
M
megagao 已提交
102
				$.messager.alert('提示','新增客户成功!');
M
megagao 已提交
103
				clearForm();
104 105
			}else{
				$.messager.alert('提示',data.msg);
M
megagao 已提交
106 107 108 109 110 111 112 113 114 115 116 117 118
			}
		});
	}
	
	function clearForm(){
		$('#customAddForm').form('reset');
		customAddEditor.html('');
	}
	$('#cc').combo({    
	    required:true,    
	    multiple:true   
	});
</script>