2 Commits 373e971861 ... 6b9a920d19

Auteur SHA1 Message Date
  user4 6b9a920d19 Merge remote-tracking branch 'origin/master' il y a 5 ans
  user4 82096f592b 项目登记,界面微调 il y a 5 ans

+ 1 - 1
src/main/webapp/webpage/modules/projectrecord/projectRecordsForm.jsp

@@ -518,7 +518,7 @@
                        class="nav-btn nav-btn-add"><i class="fa fa-plus"></i> 新增客户</a>
                 </div>
 
-                <div class="layui-item layui-col-xs12 form-table-container">
+                <div class="layui-item layui-col-xs12 form-table-container" style="padding:0px">
                     <table id="contentTable1" class="table table-bordered table-condensed details">
                         <thead>
                         <tr>

+ 65 - 49
src/main/webapp/webpage/modules/workstaff/workStaffBasicInfoForm.jsp

@@ -16,38 +16,28 @@
         // var officeId;
         var validateForm;
         var existStaff = false;
+        //  true 存在手机号重复,,false,手机号不重复
+        var existMobile = false;
+
         function doSubmit(index1){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             if(validateForm.form()){
                 if(existStaff){
-                    layer.msg("该员工在职,不能提交入职信息,请确认身份证信息",{icon:2})
+                    layer.msg("该员工在职,不能提交入职信息,请确认身份证信息",{icon:2});
                     return false;
                 }
-                // parent.layer.confirm('是否发起个人信息完善?发起后,该成员将收到待办。',
-                //     {btn: ['确定']},
-                // //     function(index) {
-                // //     $("#notifyFlag").val("0");
-                // //     $("#inputForm").submit();
-                // //     parent.layer.close(index);
-                // //     setTimeout(function(){top.layer.close(index1)}, 100);
-                // // },
-                //     function(index){
-                //     $("#notifyFlag").val("1");
-                //     $("#inputForm").submit();
-                //     parent.layer.close(index);
-                //     setTimeout(function(){top.layer.close(index1)}, 100);
-                // });
-                var flag = $("#updateFlag").val();
-                if(flag === '1'){
-                    $("#inputForm").submit();
-                    parent.layer.closeAll();
-                }else {
-                    parent.layer.alert('该成员将收到信息完善待办。',
-                        function (index) {
-                            $("#notifyFlag").val("1");
-                            $("#inputForm").submit();
-                            parent.layer.closeAll();
-                            // setTimeout(function(){top.layer.close(index1)}, 100);
-                        });
+                if(!existMobile){
+                    var  flag = $("#updateFlag").val();
+                    if(flag === '1'){
+                        $("#inputForm").submit();
+                        parent.layer.closeAll();
+                    }else {
+                        parent.layer.alert('该成员将收到信息完善待办。',
+                            function (index) {
+                                $("#notifyFlag").val("1");
+                                $("#inputForm").submit();
+                                parent.layer.closeAll();
+                            });
+                    }
                 }
                 return false;
             }
@@ -60,12 +50,6 @@
                     loading('正在提交,请稍等...');
                     form.submit();
                 },
-                rules: {
-                    mobile: {remote: "${ctx}/workstaff/workStaffBasicInfo/checkMobile?id="+$("#id").val()},//设置了远程验证,在初始化时必须预先调用一次。
-                },
-                messages: {
-                    mobile: {remote: "手机号已存在"},
-                },
                 errorContainer: "#messageBox",
                 errorPlacement: function(error, element) {
                     $("#messageBox").text("输入有误,请先更正。");
@@ -124,31 +108,62 @@
             }
 
 
-
-            $('#officeId').on("change",function(){
+            $('#officeId').on("change", function () {
                 // $("#roleId").find("option:selected").remove();
                 // var maxIndex=$("#roleId option:last").attr("index")
                 // console.log(maxIndex)
-                $("#roleId").empty()
-                var officeId = $(this).val()
+                $("#roleId").empty();
+                var officeId = $(this).val();
                 $.ajax({
-                type: 'POST',
-                url: '${ctx}/sys/role/getByOfficeId',
-                data: {'id':officeId},
-                success: function(result){
-                var data1 = result.data
-                var html = "";
-                for (var e in data1) {
-                html += '<option value=' + data1[e].id+ '>' + data1[e].name + '</option>'
-                }
-                $("#roleId").append(html);
-                }
+                    type: 'POST',
+                    url: '${ctx}/sys/role/getByOfficeId',
+                    data: {'id': officeId},
+                    success: function (result) {
+                        var data1 = result.data
+                        var html = "";
+                        for (var e in data1) {
+                            html += '<option value=' + data1[e].id + '>' + data1[e].name + '</option>'
+                        }
+                        $("#roleId").append(html);
+                    }
                 });
-            })
+            });
+
+            //第一次,验证手机号
+           checkMobile();
+
+            $("#mobile").on('keyup',function(){
+                $("#ph").html("");
+                var mob = $(this).val();
+                if (mob.length !== 11) {
+                    return ;
+                }
+                checkMobile();
+
+            });
 
         });
     </script>
     <script type="text/javascript">
+        function checkMobile(){
+            $.ajax({
+                url:"${ctx}/workstaff/workStaffBasicInfo/checkMobile",
+                data:{"id":$("#id").val(),"mobile":$("#mobile").val()},
+                success:function(data){
+                    if(data==="false"){
+                        //没通过
+                        $("#ph").html("手机号已存在");
+                        existMobile = true;
+                        return ;
+                    }else{
+                        $("#ph").html("");
+                        existMobile = false;
+                        return ;
+                    }
+                }
+            });
+        }
+
         //上传用户头像
         function this_upload_image_button(index){
             $("#this_upload_file_"+index).click();
@@ -426,6 +441,7 @@
                     <label class="layui-form-label"><span class="require-item">*</span>移动电话:</label>
                     <div class="layui-input-block">
                         <form:input path="mobile" id="mobile" htmlEscape="false" class="form-control layui-input required isPhone"/>
+                        <span id="ph" style="color: red"></span>
                     </div>
                 </div>
                 <div class="layui-item layui-col-sm6 lw7">