|
@@ -9,19 +9,6 @@
|
|
|
<title>客户信息管理</title>
|
|
|
<meta name="decorator" content="default"/>
|
|
|
<script src="${ctxStatic}/layer-v2.3/layui/xmSelect.js" charset="utf-8"></script>
|
|
|
- <%--<style type="text/css">--%>
|
|
|
- <%--.btn-file{--%>
|
|
|
- <%--margin-top:8px;--%>
|
|
|
- <%--}--%>
|
|
|
- <%--.btn-default:hover, .btn-default:focus, .btn-default:active, .btn-default.active, .open .dropdown-toggle.btn-default {--%>
|
|
|
- <%--background-color:#fff;--%>
|
|
|
- <%--color: #110F0F;--%>
|
|
|
- <%--}--%>
|
|
|
- <%--.btn-default{--%>
|
|
|
- <%--background-color:#fff;--%>
|
|
|
- <%--color: #110F0F;--%>
|
|
|
- <%--}--%>
|
|
|
- <%--</style>--%>
|
|
|
<link href="${ctxStatic}/bootstrap-select-1.12.4/css/bootstrap-select.min.css" rel="stylesheet" />
|
|
|
<style>
|
|
|
#companyType-error{
|
|
@@ -40,114 +27,25 @@
|
|
|
<script src="${ctxStatic}/bootstrap-select-1.12.4/js/bootstrap-select.min.js"></script>
|
|
|
<script type="text/javascript">
|
|
|
var validateForm;
|
|
|
- var exitName = true;
|
|
|
- function doSubmit(){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
|
|
|
+ function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
|
|
|
if(validateForm.form()){
|
|
|
- var jobTypeStr = $("#jobTypeStr").val();
|
|
|
- if (jobTypeStr == null || "" == jobTypeStr) {
|
|
|
- parent.layer.msg("请选择联系人类型!", {icon: 5});
|
|
|
- return false;
|
|
|
- }
|
|
|
- var telephone = $("#telephone").val();
|
|
|
- if(!/(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/.test(telephone) && !/^([0-9]{3,4}-)?[0-9]{7,8}$/.test(telephone)){
|
|
|
- parent.layer.msg("公司电话有误,请重新填写!", {icon: 5});
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- var tableObj = document.getElementById('contentTable').rows[1];
|
|
|
- var contentTableLength = $("table#contentTable tr:visible").length;
|
|
|
- if (tableObj == null || contentTableLength == 1) {
|
|
|
- parent.layer.msg("请填写联系人信息!", {icon: 5});
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if(!exitName){
|
|
|
- return false;
|
|
|
+ if(obj == 1) {
|
|
|
+ $("#flag").val("yes");
|
|
|
+ }else {
|
|
|
+ if(obj == 2){
|
|
|
+ $("#flag").val("no1");
|
|
|
+ }else {
|
|
|
+ $("#flag").val("no2");
|
|
|
+ }
|
|
|
}
|
|
|
$("#inputForm").submit();
|
|
|
return true;
|
|
|
- }else {
|
|
|
- parent.layer.msg("信息未填写完整!", {icon: 5});
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
$(document).ready(function() {
|
|
|
- contentDetailTypeShow();
|
|
|
- checkContentKeyUp('unitIntroduction',500);
|
|
|
- $.validator.messages["orUnicode"] = true;
|
|
|
- $.validator.methods["orUnicode"] = function( value, element ) {
|
|
|
- return this.optional( element ) || /^[a-z0-9A-Z\-]*$/.test( value );
|
|
|
- }
|
|
|
- $.validator.messages["fax"] = true;
|
|
|
- $.validator.methods["fax"] = function( value, element ) {
|
|
|
- return this.optional( element ) || /^[0-9\-]*$/.test( value );
|
|
|
- }
|
|
|
- $.validator.messages["telephone"] = true;
|
|
|
- $.validator.methods["telephone"] = function( value, element ) {
|
|
|
- return this.optional( element ) || /^[0-9\-]*$/.test( value );
|
|
|
- }
|
|
|
- $.validator.messages["ourBank"] = true;
|
|
|
- $.validator.methods["ourBank"] = function( value, element ) {
|
|
|
- return this.optional( element ) || /^[\u4e00-\u9fa5]*$/.test( value );
|
|
|
- }
|
|
|
- $.validator.messages["taxId"] = true;
|
|
|
- $.validator.methods["taxId"] = function( value, element ) {
|
|
|
- return this.optional( element ) || /^[a-z0-9A-Z]*$/.test( value );
|
|
|
- }
|
|
|
-
|
|
|
- jQuery.validator.addMethod("isUscCode", function(value, element) {
|
|
|
- if (this.optional(element)){
|
|
|
- return true;
|
|
|
- }
|
|
|
- var uscCode = /^((\w{15})|(\w{18})|(\w{20}))$/;
|
|
|
- return uscCode.test(value);
|
|
|
- }, "请填写正确的统一社会信用代码");
|
|
|
-
|
|
|
validateForm = $("#inputForm").validate({
|
|
|
- rules:{
|
|
|
- orUnicode:{
|
|
|
- orUnicode:true
|
|
|
- },
|
|
|
- zipCode:{
|
|
|
- digits:true
|
|
|
- },
|
|
|
- email:{
|
|
|
- email:true
|
|
|
- },
|
|
|
- fax:{
|
|
|
- fax:true
|
|
|
- },
|
|
|
- telephone:{
|
|
|
- telephone:true
|
|
|
- },
|
|
|
- taxId:{
|
|
|
- taxId:true
|
|
|
- }
|
|
|
- <%--uscCode:{remote: "${ctx}/workclientinfo/workClientInfo/checkUscCode?oldUscCode=" + encodeURIComponent($("#oldUscCode").val())}--%>
|
|
|
- },
|
|
|
- messages:{
|
|
|
- orUnicode:{
|
|
|
- orUnicode:"仅允许输入数字、大写拉丁字母、符号“-”"
|
|
|
- },
|
|
|
- zipCode:{
|
|
|
- required:"必须输入数字"
|
|
|
- },
|
|
|
- email:{
|
|
|
- email:"请输入合法的邮箱地址"
|
|
|
- },
|
|
|
- fax:{
|
|
|
- fax:"仅允许输入数字、符号“-”"
|
|
|
- },
|
|
|
- telephone:{
|
|
|
- telephone:"仅允许输入数字、符号“-”"
|
|
|
- },
|
|
|
- taxId:{
|
|
|
- taxId:"仅允许输入数字、大写拉丁字母"
|
|
|
- }
|
|
|
- // uscCode:{remote:"重复的统一社会信用代码"}
|
|
|
- },
|
|
|
submitHandler: function(form){
|
|
|
loading('正在提交,请稍等...');
|
|
|
form.submit();
|
|
@@ -162,284 +60,6 @@
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- $("#attachment_btn").click(function () {
|
|
|
- $("#attachment_file").click();
|
|
|
- });
|
|
|
- $('input[name="hasUscc"]').on('ifChecked', function(event){
|
|
|
- disUscc(event.target.defaultValue);
|
|
|
- });
|
|
|
- disUscc($('input[name="hasUscc"]:checked').val());
|
|
|
- if($("#uscCode").val()!=null&&$("#uscCode").val()!='') {
|
|
|
- $("#inputForm").validate().element($("#uscCode"));
|
|
|
- }
|
|
|
- // $("#name").blur(function(){
|
|
|
- // checkName();
|
|
|
- // })
|
|
|
- $("#name").on("change",function(){
|
|
|
- var id = $("#id").val();
|
|
|
- var name = $("#name").val();
|
|
|
- var uscCode = $("#uscCode").val();
|
|
|
- $.ajax({
|
|
|
- url:"${ctx}/workclientinfo/workClientInfo/checkClient",
|
|
|
- type:"post",
|
|
|
- data:{"id":id,
|
|
|
- "name":name,
|
|
|
- "uscCode":uscCode},
|
|
|
- success:function(data){
|
|
|
- if(data==="false"){
|
|
|
- exitName=false
|
|
|
- $("#ph").html("该客户已存在");
|
|
|
- }else {
|
|
|
- exitName=true
|
|
|
- $("#ph").html('');
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- )
|
|
|
- <%--var arr="${workClientInfo.clientType}".split(',');--%>
|
|
|
- // $('#clientType').selectpicker('val',arr);
|
|
|
-
|
|
|
- /*新增代码传送统一社会信用代码*/
|
|
|
- $("#uscCode").on("change",function(){
|
|
|
- var id = $("#id").val();
|
|
|
- var name = $("#name").val();
|
|
|
- var uscCode= $("#uscCode").val();
|
|
|
-
|
|
|
- $.ajax({
|
|
|
- url:"${ctx}/workclientinfo/workClientInfo/checkClientUscCode",
|
|
|
- type:"post",
|
|
|
- data:{"id":id,
|
|
|
- "name":name,
|
|
|
- "uscCode":uscCode},
|
|
|
- success:function(data){
|
|
|
- if(data.code==="false"){
|
|
|
- exitName=false
|
|
|
- $("#uscPh").html("该客户已存在");
|
|
|
- console.log(data);
|
|
|
-
|
|
|
- layer.confirm('该客户信息已存在是否进行信息修改?', {
|
|
|
- btn: ['确定', '取消'] //可以无限个按钮
|
|
|
-
|
|
|
- }, function(index, layero){
|
|
|
- /*var linkType=${linkType};
|
|
|
- console.log("---------"+linkType);*/
|
|
|
- var typeId=data.workClientInfo.id;
|
|
|
- window.location.href="${ctx}/workclientinfo/workClientInfo/formTwo?id="+typeId+"¶m=1";
|
|
|
-
|
|
|
- }, function(index){
|
|
|
- return "false";
|
|
|
- });
|
|
|
-
|
|
|
- }else {
|
|
|
- exitName=true
|
|
|
- $("#uscPh").html('');
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- )
|
|
|
-
|
|
|
- dismissDiv();
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
- function testOurBank(value){
|
|
|
- if(!/^[\u4e00-\u9fa5]*$/.test( value )){
|
|
|
- parent.layer.msg("开户银行必须输入汉字",{icon:6});
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 只允许输入数字
|
|
|
- * @param value
|
|
|
- */
|
|
|
- function testBankNumber(value){
|
|
|
- if(!/^\d*$/.test( value )){
|
|
|
- parent.layer.msg("开户帐号必须输入数字",{icon:6});
|
|
|
- }
|
|
|
- }
|
|
|
- function addRow(list, idx, tpl, row){
|
|
|
- var idx1 = $("#workClientBankList tr").length;
|
|
|
- if(list == '#workClientBankList'){
|
|
|
- bornTemplete(list, idx, tpl, row, idx1);
|
|
|
- }
|
|
|
- var idx2 = $("#workClientLinkmanList tr").length;
|
|
|
- if(list == '#workClientLinkmanList'){
|
|
|
- bornTemplete(list, idx, tpl, row, idx2);
|
|
|
- }
|
|
|
- }
|
|
|
- function bornTemplete(list, idx, tpl, row, idx1){
|
|
|
- $(list).append(Mustache.render(tpl, {
|
|
|
- idx: idx, delBtn: true, row: row,
|
|
|
- order:idx1 + 1
|
|
|
- }));
|
|
|
- $(list+idx).find("select").each(function(){
|
|
|
- $(this).val($(this).attr("data-value"));
|
|
|
- });
|
|
|
- $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
|
|
|
- var ss = $(this).attr("data-value").split(',');
|
|
|
- for (var i=0; i<ss.length; i++){
|
|
|
- if($(this).val() == ss[i]){
|
|
|
- $(this).attr("checked","checked");
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- function delRow(obj, prefix){
|
|
|
- var id = $(prefix+"_id");
|
|
|
- var delFlag = $(prefix+"_delFlag");
|
|
|
- if (id.val() == ""){
|
|
|
- $(obj).parent().parent().remove();
|
|
|
- }else if(delFlag.val() == "0"){
|
|
|
- delFlag.val("1");
|
|
|
- $(obj).html("÷").attr("title", "撤回删除");
|
|
|
- $(obj).parent().parent().addClass("error");
|
|
|
- $(obj).parent().parent().addClass("hide");
|
|
|
- }else if(delFlag.val() == "1"){
|
|
|
- delFlag.val("0");
|
|
|
- $(obj).html("×").attr("title", "删除");
|
|
|
- $(obj).parent().parent().removeClass("error");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- function urlRedict(file,attach){
|
|
|
- parent.layer.confirm('确定删除吗?', {
|
|
|
- btn: ['确认', '取消'] //可以无限个按钮
|
|
|
- }, function(index, layero){
|
|
|
- var index1 = parent.layer.load(0, {shade: false});
|
|
|
- $.post("${ctx}/workfullmanage/workFullManage/deleteFile",
|
|
|
- {"file":file,"attach":attach},
|
|
|
- function(result){
|
|
|
- var d = JSON.parse(result);
|
|
|
- if(d.str){
|
|
|
- location.reload();
|
|
|
- parent.layer.msg("删除成功!!!",{icon:6});
|
|
|
- parent.layer.close(index1);
|
|
|
- parent.layer.close(index);
|
|
|
- }
|
|
|
- });
|
|
|
- }, function(index){
|
|
|
- parent.layer.close(index)
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- function checkName() {
|
|
|
- var id = $("#id").val();
|
|
|
- var name = $("#name").val();
|
|
|
- var uscCode = $("#uscCode").val();
|
|
|
- $.ajax({
|
|
|
- url:"${ctx}/workclientinfo/workClientInfo/checkClient",
|
|
|
- type:"post",
|
|
|
- data:{"id":id,
|
|
|
- "name":name,
|
|
|
- "uscCode":uscCode},
|
|
|
- success:function(data){
|
|
|
-
|
|
|
- if(data=="false"){
|
|
|
- exitName=false
|
|
|
- $("#ph").html("该客户已存在");
|
|
|
- }else {
|
|
|
- exitName=true
|
|
|
- $("#ph").html('');
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- function insertTitle(tValue){
|
|
|
- var list = "${workClientInfo.workAttachments}";
|
|
|
- var size = (list.split('url')).length-1;
|
|
|
- var files = $("#attachment_file")[0].files;
|
|
|
- for(var i = 0;i<files.length;i++) {
|
|
|
- var file = files[i];
|
|
|
- var attachmentId = "";
|
|
|
- var attachmentFlag = "5";
|
|
|
- console.log(file);
|
|
|
- var timestamp = new Date().getTime();
|
|
|
-
|
|
|
- var storeAs = "workClientInfo";
|
|
|
- var uploadPath = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/" + storeAs;
|
|
|
- /*将这段字符串存到数据库即可*/
|
|
|
- var divId = "_attachment";
|
|
|
- $("#addFile" + divId).show();
|
|
|
- multipartUploadWithSts(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, size);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function disUscc(hasUscc) {
|
|
|
- if("2"==hasUscc){
|
|
|
- $(".companyType_uscCode").hide();
|
|
|
- /*$('input[name="uscCode"]').attr("class","form-control");*/
|
|
|
- $('input[name="uscCode"]').val("");
|
|
|
- }else {
|
|
|
- $(".companyType_uscCode").show();
|
|
|
- /*$('input[name="uscCode"]').attr("class","form-control required isUscCode layui-input");*/
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 模糊查询下拉框
|
|
|
- var code=null;
|
|
|
- function fuzzyQuery(){
|
|
|
- var keyword = $("#name").val();
|
|
|
- if (keyword == null || keyword === "") {
|
|
|
- return;
|
|
|
- }
|
|
|
- $.post(
|
|
|
- "${ctx}/workclientinfo/workClientInfo/enterpriseSearchByName",
|
|
|
- {"keyword": keyword},
|
|
|
- function (result) {
|
|
|
- if (result == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- var json = eval(result.data.items);
|
|
|
- //如果精准查询,只有一条数据,则不显示模糊查询div,直接赋值
|
|
|
- if (json.length == 1) {
|
|
|
- var id = json[0].id;
|
|
|
- $.getJSON(
|
|
|
- "${ctx}/workclientinfo/workClientInfo/enterpriseTicketInfo",
|
|
|
- {"id": id},
|
|
|
- function (data) {
|
|
|
- $("#name").val(data.ENTNAME).change();
|
|
|
- $("#uscCode").val(data.TAXNUMBER).change();
|
|
|
- $("#registerAddress").val(data.OPLOC);
|
|
|
- }
|
|
|
- );
|
|
|
- return;
|
|
|
- }
|
|
|
- var html = "<ul>";
|
|
|
- for (var i = 0; i < json.length; i++) {
|
|
|
- html += "<li value=" + json[i].id + ">" + json[i].entname + "</li>";
|
|
|
- }
|
|
|
- html += "</ul>";
|
|
|
- $("#fuzzyQuerySelect").show().html(html);
|
|
|
-
|
|
|
- //鼠标移动到某行上改变颜色
|
|
|
- $("li").bind("mouseover", function () {
|
|
|
- $(this).css("background-color", "grey");
|
|
|
- });
|
|
|
- $("li").bind("mouseout", function () {
|
|
|
- $(this).css("background-color", "white");
|
|
|
- });
|
|
|
- //单击某行
|
|
|
- $("li").bind("click", function () {
|
|
|
- $("#fuzzyQuerySelect").hide();
|
|
|
- var id = $(this).val();
|
|
|
- $.getJSON(
|
|
|
- "${ctx}/workclientinfo/workClientInfo/enterpriseTicketInfo",
|
|
|
- {"id": id},
|
|
|
- function (data) {
|
|
|
- $("#name").val(data.ENTNAME).change();
|
|
|
- $("#uscCode").val(data.TAXNUMBER).change();
|
|
|
- $("#registerAddress").val(data.OPLOC);
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
- });
|
|
|
- }, "json");
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
</script>
|
|
|
|