From 4742874ad840d7e1e3ac79dc288b38e9a642319d Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期一, 02 六月 2025 19:11:00 +0800 Subject: [PATCH] bug修改 --- cloud-server-management/src/main/webapp/static/modular/system/user/user_info.js | 170 ++++++++++++++++++++++++++++++++------------------------ 1 files changed, 98 insertions(+), 72 deletions(-) diff --git a/cloud-server-management/src/main/webapp/static/modular/system/user/user_info.js b/cloud-server-management/src/main/webapp/static/modular/system/user/user_info.js index c81798b..372195a 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/user/user_info.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/user/user_info.js @@ -1,14 +1,14 @@ /** * 用户详情对话框(可用于添加和修改对话框) */ -var language =$("#language").val() +var language =1 var UserInfoDlg = { userInfoData: {}, validateFields: { - account: { + phone: { validators: { notEmpty: { - message: language==1?'账户不能为空':(language==2?"The account cannot be empty":"Akaun tidak dapat kosong") + message: language==1?'联系电话不能为空':(language==2?"The account cannot be empty":"Akaun tidak dapat kosong") } } }, @@ -26,25 +26,17 @@ } } },*/ - password: { + birthday: { validators: { notEmpty: { - message: '密码不能为空' - }, - regexp: { - regexp: /(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,30}/, - message: '密码中必须包含大小字母、数字、特称字符,至少8个字符,最多30个字符' + message: '生日不能为空' }, } }, - rePassword: { + idCard: { validators: { notEmpty: { - message: '密码不能为空' - }, - regexp: { - regexp: /(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,30}/, - message: '密码中必须包含大小字母、数字、特称字符,至少8个字符,最多30个字符' + message: '身份证号不能为空' }, } } @@ -168,8 +160,8 @@ * 收集数据 */ UserInfoDlg.collectData = function () { - this.set('id').set('account').set('sex').set('password').set('avatar') - .set('email').set('name').set('birthday').set('rePassword').set('deptid').set('phone'); + this.set('id').set('account').set('sex').set('password').set('avatar').set("deptid") + .set('email').set('name').set('birthday').set('rePassword').set('roleid').set('phone').set('idCard'); }; /** @@ -205,43 +197,60 @@ if (!this.validate()) { return; } - - - - var birthday = $("#birthday").val(); - if ("" == birthday){ - if(language==1){ - Feng.info("出生日期不能为空!"); - }else if(language==2){ - Feng.info("The date of birth cannot be empty!"); - }else { - Feng.info("Tanggal lahir tidak bisa kosong!"); - } - + if($("#name").val()==''){ + Feng.info("请输入员工姓名") return; } - - var citySel = $("#citySel").val(); - if ("" == citySel){ - if(language==1){ - Feng.info("部门不能为空!"); - }else if(language==2){ - Feng.info("The department cannot be empty!"); - }else { - Feng.info("Departemen tidak bisa kosong!"); - } - + var phonePattern = /^1[3-9]\d{9}$/; + if (!phonePattern.test($("#phone").val())) { + Feng.info("请输入合法手机号") + return ; + } + if($("#phone").val()==''){ + Feng.info("请输入员工电话") return; } - + if($("#birthday").val()==''){ + Feng.info("请选择员工生日") + return; + } + var avatar = $("#avatar").val(); + if(avatar==''){ + Feng.info("请上传照片") + return; + } + var sex = $("#sex").val(); + if(sex==''){ + Feng.info("请选择性别") + return; + } + // 当前登陆人类型 如果不是平台 不校验角色选择 + var role = $("#role").val(); + if (role==1){ + var roleid = $("#roleid").val(); + if(roleid==''){ + Feng.info("请选择角色") + return; + } + } + var dept = $("#deptid").val(); + if(dept==''){ + Feng.info("请选择部门") + return; + } + console.log(this.userInfoData) //提交信息 var ajax = new $ax(Feng.ctxPath + "/mgr/add", function (data) { - Feng.success("添加成功!"); - window.parent.MgrUser.table.refresh(); - UserInfoDlg.close(); - $(".img-circle").each(function () { - $(this).attr("src",Feng.ctxPath+$("#avatar").val()); - }) + if (data==5001){ + Feng.error("该手机号已存在!"); + }else{ + Feng.success("添加成功!"); + window.parent.MgrUser.table.refresh(); + UserInfoDlg.close(); + $(".img-circle").each(function () { + $(this).attr("src",Feng.ctxPath+$("#avatar").val()); + }) + } }, function (data) { Feng.error("添加失败!" + data.responseJSON.message + "!"); }); @@ -260,41 +269,57 @@ if (!this.validate()) { return; } + console.log(this.userInfoData) - var birthday = $("#birthday").val(); - if ("" == birthday){ - if(language==1){ - Feng.info("出生日期不能为空!"); - }else if(language==2){ - Feng.info("The date of birth cannot be empty!"); - }else { - Feng.info("Tanggal lahir tidak bisa kosong!"); - } + if($("#name").val()==''){ + Feng.info("请输入员工姓名") + return; + } + var phonePattern = /^1[3-9]\d{9}$/; + if (!phonePattern.test($("#phone").val())) { + Feng.info("请输入合法手机号") + return ; + } + if($("#phone").val()==''){ + Feng.info("请输入员工电话") + return; + } + if($("#birthday").val()==''){ + Feng.info("请选择员工生日") return; } - var citySel = $("#citySel").val(); - if ("" == citySel){ - if(language==1){ - Feng.info("部门不能为空!"); - }else if(language==2){ - Feng.info("The department cannot be empty!"); - }else { - Feng.info("Departemen tidak bisa kosong!"); - } + var sex = $("#sex").val(); + if(sex==''){ + Feng.info("请选择性别") return; } - + // 当前登陆人类型 如果不是平台 不校验角色选择 + var role = $("#role").val(); + if (role==1){ + var roleid = $("#roleid").val(); + if(roleid==''){ + Feng.info("请选择角色") + return; + } + } + var dept = $("#deptid").val(); + if(dept==''){ + Feng.info("请选择部门") + return; + } //提交信息 var ajax = new $ax(Feng.ctxPath + "/mgr/edit", function (data) { - Feng.success("修改成功!"); - if (window.parent.MgrUser != undefined) { + if (data==5001){ + Feng.error("该手机号已存在!"); + }else{ + Feng.success("修改成功!"); window.parent.MgrUser.table.refresh(); UserInfoDlg.close(); + $(".img-circle").each(function () { + $(this).attr("src",Feng.ctxPath+$("#avatar").val()); + }) } - window.parent.$(".img-circle").each(function () { - $(this).attr("src",$("#avatar").val()); - }) window.parent.$("#userNameTab").text($("#name").val()); }, function (data) { @@ -368,4 +393,5 @@ avatarUp.setUploadBarId("progressBar"); avatarUp.init(); + document.getElementById('roleid').value = $("#roleid_").val(); }); -- Gitblit v1.7.1