Просмотр исходного кода

bug:用户管理 职位显示数字

温红权 8 лет назад
Родитель
Сommit
db3d686c55

+ 39 - 30
VisualInspection/js/user/addUser.js

@@ -40,7 +40,7 @@ function loadUserData(nodedata) {
     });
 
     $("#user_add_btn").off("click");
-    $("#user_add_btn").on("click", function () {
+    $("#user_add_btn").on("click", function() {
         addUser();
     })
 
@@ -52,7 +52,7 @@ function resetform() {
     $("#user_workno").val("");
     $("#user_password").val("");
     $("#user_confirm_password").val("")
-    // $("#user_birth").val("")
+        // $("#user_birth").val("")
     $("#user_mobile").val("")
     $("#user_position").val("")
     $("#user_idno").val("")
@@ -61,6 +61,15 @@ function resetform() {
     $("#user_img_add").removeClass("hide");
     $("#user_img_pre").addClass("hide");
 
+
+    var html = "";
+    for (var i = 0; i < job_array.length; i++) {
+        html += "<option value='" + job_array[i].id + "'>" + job_array[i].name + "</option>"
+    }
+    $("#user_position").html(html);
+
+
+
 }
 
 function initUserInfo() {
@@ -70,7 +79,7 @@ function initUserInfo() {
     $("#user_workno").val(usertemp.workno);
     $("#user_password").val(usertemp.password);
     $("#user_confirm_password").val(usertemp.password)
-    // $("#user_birth").val(moment.unix(usertemp.birth / 1000).format("YYYY-MM-DD"))
+        // $("#user_birth").val(moment.unix(usertemp.birth / 1000).format("YYYY-MM-DD"))
     $("#user_mobile").val(usertemp.mobile)
     $("#user_position").val(usertemp.positionid)
     $("#user_idno").val(usertemp.idno)
@@ -79,13 +88,13 @@ function initUserInfo() {
     $("#user_img_pre2").html("")
     $("#user_img_add").removeClass("hide");
     $("#user_img_pre").addClass("hide");
-    if (typeof (usertemp.pic) != "undefinde" && usertemp.pic != null) {
+    if (typeof(usertemp.pic) != "undefinde" && usertemp.pic != null) {
         $("#user_img_pre").removeClass("hide");
         $("#user_img_add").addClass("hide");
         var $section = $("#user_img_pre2");
         var $span = $("<span class='up-span'>");
         $span.appendTo($section);
-        var $img0 = $("<img class='close-upimg'>").on("click", function (event) {
+        var $img0 = $("<img class='close-upimg'>").on("click", function(event) {
             event.preventDefault();
             event.stopPropagation();
             // $(".works-mask").show();
@@ -98,7 +107,7 @@ function initUserInfo() {
         });
         $img0.attr("src", "/js/lib/imageupload/img/a7.png").appendTo($section);
         var $img = $("<img class='up-img up-opcity' id='user_pic' style='height:200px;width: auto;'>");
-        $img.attr("src", base_image_server_url+usertemp.pic);
+        $img.attr("src", base_image_server_url + usertemp.pic);
         $img.appendTo($section);
         var $p = $("<p class='img-name-p'>");
         $p.html("image").appendTo($section);
@@ -118,11 +127,11 @@ function initUserInfo() {
             ii["title"] = usertemp.roles[j].des;
             attr.push(ii);
 
-            $("span[data-id='"+usertemp.roles[j].id+"']").find("input").prop('checked', true)
+            $("span[data-id='" + usertemp.roles[j].id + "']").find("input").prop('checked', true)
         }
     }
 
-    
+
 
     role_selectinput._selectedItems = attr;
     role_selectinput.refreshInputVal();
@@ -145,7 +154,7 @@ function addUser() {
     var userposition = $("#user_position").val();
     var usertruename = $("#user_true_name").val();
     var userroles = role_selectinput.getSelectedItemsId();
-    if (userpassword != null && typeof (userpassword) != "undefined" && userpassword != userconfirmpassword) {
+    if (userpassword != null && typeof(userpassword) != "undefined" && userpassword != userconfirmpassword) {
         layer.msg('密码不一致!', {
             time: 2000, //20s后自动关闭
         });
@@ -157,42 +166,42 @@ function addUser() {
         "truename": usertruename,
         "roleids": userroles
     }
-    if(!parm.roleids) {
+    if (!parm.roleids) {
         layer.msg('用户角色不能为空!', {
             time: 2000, //20s后自动关闭
         });
         return;
     }
-    if (userpassword != "" && userpassword != null && typeof (userpassword) != "undefined") {
+    if (userpassword != "" && userpassword != null && typeof(userpassword) != "undefined") {
         parm["password"] = userpassword;
-    }else{
-        layer.msg('密码不能为空!', {
-            time: 2000, //20s后自动关闭
-        });
-        return;
+    } else {
+        // layer.msg('密码不能为空!', {
+        //     time: 2000, //20s后自动关闭
+        // });
+        // return;
     }
-    if (usermobile != null && typeof (usermobile) != "undefined") {
+    if (usermobile != null && typeof(usermobile) != "undefined") {
         parm["mobile"] = usermobile;
         parm["phone"] = usermobile;
     }
-    if (username != "" && username != null && typeof (username) != "undefined") {
+    if (username != "" && username != null && typeof(username) != "undefined") {
         parm["username"] = username;
-    }else{
+    } else {
         layer.msg('账号不能为空!', {
             time: 2000, //20s后自动关闭
         });
         return;
     }
-    if (userworkno != null && typeof (userworkno) != "undefined") {
+    if (userworkno != null && typeof(userworkno) != "undefined") {
         parm["workno"] = userworkno;
     }
-    if (useridno != null && typeof (useridno) != "undefined") {
+    if (useridno != null && typeof(useridno) != "undefined") {
         parm["idno"] = useridno;
     }
-    if (useremail != null && typeof (useremail) != "undefined") {
+    if (useremail != null && typeof(useremail) != "undefined") {
         parm["email"] = useridno;
     }
-    if (userpic != null && typeof (userpic) != "undefined") {
+    if (userpic != null && typeof(userpic) != "undefined") {
         parm["pic"] = userpic;
     }
 
@@ -201,28 +210,28 @@ function addUser() {
 
     if (edittype == "edit") {
         parm["id"] = usertemp.id;
-        UserUpdate(parm, function (data) {
+        UserUpdate(parm, function(data) {
             layer.msg('修改成功!', {
                 time: 2000, //20s后自动关闭
-            }, function () {
+            }, function() {
                 $('#addUserModal').modal('hide')
                 updateUser(dept_selectinput.value)
             });
-        }, function (error) {
+        }, function(error) {
 
         });
 
         return;
     }
 
-    UserAdd(parm, function (data) {
+    UserAdd(parm, function(data) {
         layer.msg('添加成功!', {
             time: 2000, //20s后自动关闭
-        }, function(data) { 
+        }, function(data) {
             $('#addUserModal').modal('hide');
-            updateUser(dept_selectinput.value);           
+            updateUser(dept_selectinput.value);
         });
-    }, function (error) {
+    }, function(error) {
         layer.msg('添加失败!输入参数不正确!', {
             time: 2000, //20s后自动关闭
         });

+ 10 - 0
VisualInspection/js/user/userManager.js

@@ -50,6 +50,7 @@
 
  var roles = [];
  $(document).ready(function() {
+     getJob();
 
      //  $("#main_content_title").html("用户管理")
 
@@ -354,4 +355,13 @@
  function stringlimit(string, linmit) {
      if (string.length < linmit) return string;
      return string.substr(0, linmit / 2) + "..." + string.substr(string.length - linmit / 2, linmit / 2)
+ }
+
+ var job_array = new Array();
+
+ function getJob() {
+     post_common_service("/job/getList", {}, function(data) {
+         job_array = data;
+         console.log(data)
+     }, function(error) {});
  }

+ 6 - 3
VisualInspection/view/user/addUser.html

@@ -33,13 +33,13 @@
                 </div>
 
                 <div class="form-group">
-                    <label for="exampleInputAccount4" class="col-sm-3 ll required">密码:</label>
+                    <label for="exampleInputAccount4" class="col-sm-3 ll ">密码:</label>
                     <div class="col-md-9 col-sm-9">
                         <input type="text" id="user_password" class="form-control" placeholder="密码" maxlength="20">
                     </div>
                 </div>
                 <div class="form-group">
-                    <label for="exampleInputAccount4" class="col-sm-3 ll required">确定密码:</label>
+                    <label for="exampleInputAccount4" class="col-sm-3 ll ">确定密码:</label>
                     <div class="col-md-9 col-sm-9">
                         <input type="text" id="user_confirm_password" class="form-control" placeholder="确认密码" maxlength="20">
                     </div>
@@ -99,7 +99,10 @@
         <div class="form-group">
             <label for="exampleInputAccount4" class="col-sm-2  ll">职位:</label>
             <div class="col-md-10 col-sm-10">
-                <input type="text" id="user_position" class="form-control" placeholder="职位">
+                <select id="user_position" data-placeholder="选择职位" class="chosen-select form-control">
+
+                </select>
+                <!-- <input type="text" id="user_position" class="form-control" placeholder="职位"> -->
             </div>
         </div>
         <div class="form-group">

+ 1 - 1
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/JobController.java

@@ -33,7 +33,7 @@ public class JobController extends BaseController {
      * @since  1.0.0
      */
     @RequestMapping(value = "/getList")
-    public String add(@Valid @RequestBody Job job){
+    public String add(@Valid @RequestBody(required = false) Job job){
     	List<Job> jlist = jobService.getJobList(job) ;
     	return super.returnSuccessResult(jlist);
     }