万材erp项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

149 lines
5.6 KiB

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('新增联系人明细')"/>
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-contacts-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">客户/企业代码:</label>
<div class="col-sm-8">
<select name="enterpriseCode" class="form-control m-b" required>
<option value="">请选择客户代码</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">客户/企业名称:</label>
<div class="col-sm-8">
<input name="enterpriseName" class="form-control" type="text" required readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">姓名:</label>
<div class="col-sm-8">
<input name="customerName" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">职务:</label>
<div class="col-sm-8">
<input name="customerPosition" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">生日:</label>
<div class="col-sm-8">
<input name="customerBirthday" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">办公电话:</label>
<div class="col-sm-8">
<input name="officeTelephone" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">家中电话:</label>
<div class="col-sm-8">
<input name="homePhone" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">手机号:</label>
<div class="col-sm-8">
<input name="cellPhone" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">传真:</label>
<div class="col-sm-8">
<input name="customerFax" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备用电话1:</label>
<div class="col-sm-8">
<input name="standbyTelephoneOne" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备用电话2:</label>
<div class="col-sm-8">
<input name="standbyTelephoneTwo" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">常用Email:</label>
<div class="col-sm-8">
<input name="commonEmail" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备用Email:</label>
<div class="col-sm-8">
<input name="alternateEmail" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="customerRemarks" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<script th:inline="javascript">
var prefix = ctx + "system/contacts"
$("#form-contacts-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-contacts-add').serialize());
}
}
//客户信息
var customerodata = []
$.ajax({
url: ctx + "system/customer/list",
type: "POST",
success: function (res) {
// console.log(res)
if (res.rows.length > 0) {
customerodata = res.rows;
//alert(JSON.stringify(data));
console.log(res.rows)
for (let i in customerodata) {
$("select[name='enterpriseCode']").append("<option value='" + customerodata[i].enterpriseCode + "'>" + customerodata[i].enterpriseCode + "</option>");
}
} else {
$.modal.msgError(res.msg);
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
})
$("select[name='enterpriseCode']").change(function () {
var enterpriseCode = $(this).val();
for (i = 0; i < customerodata.length; i++) {
if (customerodata[i].enterpriseCode === enterpriseCode) {
$("input[name='enterpriseName']").val(customerodata[i].enterpriseName)
}
}
})
</script>
</body>
</html>