From 4dc58305f73bb1fddad3a1652f741571c10498d7 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 09 九月 2022 22:19:14 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/crm/common/utils/TreeUtils.java              |   50 ++++++
 src/main/java/com/zy/crm/system/service/DeptService.java          |    3 
 src/main/resources/mapper/DeptMapper.xml                          |    9 
 src/main/java/com/zy/crm/common/web/BaseController.java           |   12 +
 src/main/webapp/static/js/deptTree.js                             |   85 ++++++++++
 src/main/java/com/zy/crm/system/entity/Permission.java            |    4 
 src/main/java/com/zy/crm/system/service/impl/DeptServiceImpl.java |   25 +++
 src/main/java/com/zy/crm/manager/entity/Tag.java                  |    4 
 src/main/java/com/zy/crm/system/entity/Dept.java                  |  191 ++++++-----------------
 src/main/java/com/zy/crm/system/controller/DeptController.java    |   18 ++
 src/main/webapp/views/user/user.html                              |    4 
 src/main/java/com/zy/crm/manager/entity/Node.java                 |    4 
 src/main/java/com/zy/crm/system/entity/Config.java                |    4 
 src/main/java/com/zy/crm/system/entity/OperateLog.java            |    4 
 src/main/java/com/zy/crm/system/entity/UserLogin.java             |    4 
 15 files changed, 263 insertions(+), 158 deletions(-)

diff --git a/src/main/java/com/zy/crm/common/utils/TreeUtils.java b/src/main/java/com/zy/crm/common/utils/TreeUtils.java
index eb5e668..4c97962 100644
--- a/src/main/java/com/zy/crm/common/utils/TreeUtils.java
+++ b/src/main/java/com/zy/crm/common/utils/TreeUtils.java
@@ -2,6 +2,8 @@
 
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.Wrapper;
+import com.zy.crm.system.entity.Dept;
+import com.zy.crm.system.service.DeptService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Component;
@@ -23,6 +25,8 @@
     private TagService tagService;
     @Autowired
     private NodeService nodeService;
+    @Autowired
+    private DeptService deptService;
 
     /******************************** 褰掔被鏍� *********************************/
 
@@ -116,6 +120,52 @@
         }
     }
 
+    /******************************** 閮ㄩ棬鏍� *********************************/
+
+    /**
+     * 鑾峰彇鏍戝浘鏁版嵁缁撴瀯
+     */
+    @Cacheable(cacheNames="deptTree",key="#id")
+    public ArrayList<Map> getDeptTree(String id, Long hostId){
+        ArrayList<Map> result = new ArrayList<>();
+        Dept dept = deptService.selectById(id);
+        // 涓昏妭鐐�
+        Map<String, Object> map = new HashMap<>();
+        map.put("title", dept.getName());
+        map.put("id", dept.getId());
+        map.put("spread", true);
+        List<Map> childrens = new ArrayList<>();
+        map.put("children", childrens);
+        dealDept(dept, childrens, hostId);
+        result.add(map);
+        // 寮�濮嬪鐞嗗瓧鑺傜偣
+//        deal(tag, childrens);
+        return result;
+    }
+
+    /**
+     * 閫掑綊鑾峰彇瀛愯妭鐐规暟鎹�
+     */
+    public void dealDept(Dept parent, List<Map> list, Long hostId) {
+        Wrapper<Dept> wrapper = new EntityWrapper<Dept>()
+                .eq("parent_id", parent.getId())
+                .eq("status", "1");
+        if (hostId != null) {
+            wrapper.eq("host_id", hostId);
+        }
+        List<Dept> depts = deptService.selectList(wrapper);
+        for (Dept dept : depts) {
+            Map<String, Object> map = new HashMap<>();
+            map.put("title", dept.getName());
+            map.put("id", dept.getId());
+            map.put("spread", true);
+            List<Map> childrens = new ArrayList<>();
+            map.put("children", childrens);
+            dealDept(dept, childrens, hostId);
+            list.add(map);
+        }
+    }
+
 
     // -------------------------------------------------------------------------------------------------------
 
diff --git a/src/main/java/com/zy/crm/common/web/BaseController.java b/src/main/java/com/zy/crm/common/web/BaseController.java
index 8fbe2a9..51e079a 100644
--- a/src/main/java/com/zy/crm/common/web/BaseController.java
+++ b/src/main/java/com/zy/crm/common/web/BaseController.java
@@ -7,6 +7,8 @@
 import com.core.common.Cools;
 import com.core.controller.AbstractBaseController;
 import com.core.exception.CoolException;
+import com.zy.crm.system.entity.Dept;
+import com.zy.crm.system.service.DeptService;
 import io.swagger.annotations.ApiModelProperty;
 import org.springframework.beans.factory.annotation.Autowired;
 import com.zy.crm.manager.entity.Node;
@@ -38,6 +40,8 @@
     private TagService tagService;
     @Autowired
     private NodeService nodeService;
+    @Autowired
+    private DeptService deptService;
     @Autowired
     private UserLoginService userLoginService;
 
@@ -101,6 +105,14 @@
         return node;
     }
 
+    protected Dept getOriginDept(){
+        Dept dept = deptService.getTop();
+        if (dept == null) {
+            throw new CoolException("閮ㄩ棬鏁版嵁閿欒");
+        }
+        return dept;
+    }
+
     protected <T> void hostEq(EntityWrapper<T> wrapper){
         Long hostId = getHostId();
         if (hostId != null) {
diff --git a/src/main/java/com/zy/crm/manager/entity/Node.java b/src/main/java/com/zy/crm/manager/entity/Node.java
index a0cf7fa..70d8534 100644
--- a/src/main/java/com/zy/crm/manager/entity/Node.java
+++ b/src/main/java/com/zy/crm/manager/entity/Node.java
@@ -29,9 +29,9 @@
     private Long id;
 
     /**
-     * 鎵�灞為」鐩�
+     * 鎵�灞炲晢鎴�
      */
-    @ApiModelProperty(value= "鎵�灞為」鐩�")
+    @ApiModelProperty(value= "鎵�灞炲晢鎴�")
     @TableField("host_id")
     private Long hostId;
 
diff --git a/src/main/java/com/zy/crm/manager/entity/Tag.java b/src/main/java/com/zy/crm/manager/entity/Tag.java
index bb3e312..3c7c012 100644
--- a/src/main/java/com/zy/crm/manager/entity/Tag.java
+++ b/src/main/java/com/zy/crm/manager/entity/Tag.java
@@ -29,9 +29,9 @@
     private Long id;
 
     /**
-     * 鎵�灞為」鐩�
+     * 鎵�灞炲晢鎴�
      */
-    @ApiModelProperty(value= "鎵�灞為」鐩�")
+    @ApiModelProperty(value= "鎵�灞炲晢鎴�")
     @TableField("host_id")
     private Long hostId;
 
diff --git a/src/main/java/com/zy/crm/system/controller/DeptController.java b/src/main/java/com/zy/crm/system/controller/DeptController.java
index aeb8487..decd896 100644
--- a/src/main/java/com/zy/crm/system/controller/DeptController.java
+++ b/src/main/java/com/zy/crm/system/controller/DeptController.java
@@ -10,12 +10,15 @@
 import com.core.common.Cools;
 import com.core.common.DateUtils;
 import com.core.common.R;
+import com.zy.crm.common.utils.ListUtils;
+import com.zy.crm.common.utils.TreeUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import com.zy.crm.common.web.BaseController;
 import com.zy.crm.system.entity.Dept;
 import com.zy.crm.system.service.DeptService;
 
+import java.io.IOException;
 import java.util.*;
 
 @RestController
@@ -23,6 +26,8 @@
 
     @Autowired
     private DeptService deptService;
+    @Autowired
+    private TreeUtils treeUtils;
 
     @RequestMapping(value = "/dept/{id}/auth")
     @ManagerAuth
@@ -131,4 +136,17 @@
         return R.ok();
     }
 
+    @PostMapping(value = "/dept/tree/auth")
+    @ManagerAuth
+    public R tree(@RequestParam(required = false, defaultValue = "") String condition) throws IOException, ClassNotFoundException {
+        ArrayList<Map> tree = treeUtils.getDeptTree(String.valueOf(getOriginDept().getId()), getHostId());
+        // 娣辨嫹璐�
+        List<Map> result = ListUtils.deepCopy(tree);
+        if (!Cools.isEmpty(condition)) {
+            treeUtils.remove(condition, result);
+            treeUtils.remove(condition, result);
+        }
+        return R.ok(result);
+    }
+
 }
diff --git a/src/main/java/com/zy/crm/system/entity/Config.java b/src/main/java/com/zy/crm/system/entity/Config.java
index 7dd10b6..a6d7e6b 100644
--- a/src/main/java/com/zy/crm/system/entity/Config.java
+++ b/src/main/java/com/zy/crm/system/entity/Config.java
@@ -23,9 +23,9 @@
     private Long id;
 
     /**
-     * 鎵�灞為」鐩�
+     * 鎵�灞炲晢鎴�
      */
-    @ApiModelProperty(value= "鎵�灞為」鐩�")
+    @ApiModelProperty(value= "鎵�灞炲晢鎴�")
     @TableField("host_id")
     private Long hostId;
 
diff --git a/src/main/java/com/zy/crm/system/entity/Dept.java b/src/main/java/com/zy/crm/system/entity/Dept.java
index c4656f9..379590d 100644
--- a/src/main/java/com/zy/crm/system/entity/Dept.java
+++ b/src/main/java/com/zy/crm/system/entity/Dept.java
@@ -10,11 +10,13 @@
 import com.zy.crm.system.service.DeptService;
 import com.zy.crm.system.service.HostService;
 import com.zy.crm.system.service.UserService;
+import lombok.Data;
 
 import java.io.Serializable;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+@Data
 @TableName("sys_dept")
 public class Dept implements Serializable {
 
@@ -28,24 +30,56 @@
     private Long id;
 
     /**
-     * 鎵�灞為」鐩�
+     * 鎵�灞炲晢鎴�
      */
-    @ApiModelProperty(value= "鎵�灞為」鐩�")
+    @ApiModelProperty(value= "鎵�灞炲晢鎴�")
     @TableField("host_id")
     private Long hostId;
 
     /**
-     * 鐖堕儴闂ㄧ紪鍙�
+     * 缂栧彿
      */
-    @ApiModelProperty(value= "鐖堕儴闂ㄧ紪鍙�")
-    @TableField("parent_id")
-    private Long parentId;
+    @ApiModelProperty(value= "缂栧彿")
+    private String uuid;
 
     /**
      * 閮ㄩ棬鍚嶇О
      */
     @ApiModelProperty(value= "閮ㄩ棬鍚嶇О")
     private String name;
+
+    /**
+     * 鐖堕儴闂ㄧ紪鍙�
+     */
+    @ApiModelProperty(value= "鐖剁骇")
+    @TableField("parent_id")
+    private Long parentId;
+
+    /**
+     * 鐖剁骇鍚嶇О
+     */
+    @ApiModelProperty(value= "鐖剁骇鍚嶇О")
+    @TableField("parent_name")
+    private String parentName;
+
+    /**
+     * 鍏宠仈璺緞
+     */
+    @ApiModelProperty(value= "鍏宠仈璺緞")
+    private String path;
+
+    /**
+     * 鍏宠仈璺緞鍚�
+     */
+    @ApiModelProperty(value= "鍏宠仈璺緞鍚�")
+    @TableField("name_path")
+    private String namePath;
+
+    /**
+     * 绛夌骇
+     */
+    @ApiModelProperty(value= "绛夌骇")
+    private Integer level;
 
     /**
      * 鏄剧ず椤哄簭
@@ -74,8 +108,8 @@
     /**
      * 閮ㄩ棬鐘舵�� 1: 姝e父;0
      */
-    @ApiModelProperty(value= "閮ㄩ棬鐘舵�� 1: 姝e父;0  ")
-    private Short status;
+    @ApiModelProperty(value= "閮ㄩ棬鐘舵�� 1: 姝e父;0: 绂佺敤")
+    private Integer status;
 
     /**
      * 鍒涘缓鑰�
@@ -105,52 +139,13 @@
     @TableField("update_time")
     private Date updateTime;
 
+    /**
+     * 澶囨敞
+     */
+    @ApiModelProperty(value= "澶囨敞")
+    private String memo;
+
     public Dept() {}
-
-    public Dept(Long hostId, Long parentId,String name,Integer sort,Long leader,String phone,String email,Short status,Long createBy,Date createTime,Long updateBy,Date updateTime) {
-        this.hostId = hostId;
-        this.parentId = parentId;
-        this.name = name;
-        this.sort = sort;
-        this.leader = leader;
-        this.phone = phone;
-        this.email = email;
-        this.status = status;
-        this.createBy = createBy;
-        this.createTime = createTime;
-        this.updateBy = updateBy;
-        this.updateTime = updateTime;
-    }
-
-//    Dept dept = new Dept(
-//            null,    // 鐖堕儴闂ㄧ紪鍙�
-//            null,    // 閮ㄩ棬鍚嶇О[闈炵┖]
-//            null,    // 鏄剧ず椤哄簭
-//            null,    // 璐熻矗浜�
-//            null,    // 鑱旂郴鐢佃瘽
-//            null,    // 閭
-//            null,    // 閮ㄩ棬鐘舵��
-//            null,    // 鍒涘缓鑰�
-//            null,    // 鍒涘缓鏃堕棿
-//            null,    // 鏇存柊鑰�
-//            null    // 鏇存柊鏃堕棿
-//    );
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Long getHostId() {
-        return hostId;
-    }
-
-    public void setHostId(Long hostId) {
-        this.hostId = hostId;
-    }
 
     public String getHostId$(){
         HostService service = SpringUtils.getBean(HostService.class);
@@ -159,10 +154,6 @@
             return String.valueOf(host.getName());
         }
         return null;
-    }
-
-    public Long getParentId() {
-        return parentId;
     }
 
     public String getParentId$() {
@@ -174,30 +165,6 @@
         return null;
     }
 
-    public void setParentId(Long parentId) {
-        this.parentId = parentId;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public Integer getSort() {
-        return sort;
-    }
-
-    public void setSort(Integer sort) {
-        this.sort = sort;
-    }
-
-    public Long getLeader() {
-        return leader;
-    }
-
     public String getLeader$(){
         UserService service = SpringUtils.getBean(UserService.class);
         User user = service.selectById(this.leader);
@@ -207,56 +174,16 @@
         return null;
     }
 
-    public void setLeader(Long leader) {
-        this.leader = leader;
-    }
-
-    public String getPhone() {
-        return phone;
-    }
-
-    public void setPhone(String phone) {
-        this.phone = phone;
-    }
-
-    public String getEmail() {
-        return email;
-    }
-
-    public void setEmail(String email) {
-        this.email = email;
-    }
-
-    public Short getStatus() {
-        return status;
-    }
-
     public String getStatus$(){
         if (null == this.status){ return null; }
         switch (this.status){
             case 1:
                 return "姝e父";
             case 0:
-                return "鍋滅敤";
+                return "绂佺敤";
             default:
                 return String.valueOf(this.status);
         }
-    }
-
-    public void setStatus(Short status) {
-        this.status = status;
-    }
-
-    public Long getCreateBy() {
-        return createBy;
-    }
-
-    public void setCreateBy(Long createBy) {
-        this.createBy = createBy;
-    }
-
-    public Date getCreateTime() {
-        return createTime;
     }
 
     public String getCreateTime$(){
@@ -266,31 +193,11 @@
         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
     }
 
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    public Long getUpdateBy() {
-        return updateBy;
-    }
-
-    public void setUpdateBy(Long updateBy) {
-        this.updateBy = updateBy;
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
     public String getUpdateTime$(){
         if (Cools.isEmpty(this.updateTime)){
             return "";
         }
         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
-    }
-
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
     }
 
 }
diff --git a/src/main/java/com/zy/crm/system/entity/OperateLog.java b/src/main/java/com/zy/crm/system/entity/OperateLog.java
index 5cc3653..31040b0 100644
--- a/src/main/java/com/zy/crm/system/entity/OperateLog.java
+++ b/src/main/java/com/zy/crm/system/entity/OperateLog.java
@@ -26,9 +26,9 @@
     private Long id;
 
     /**
-     * 鎵�灞為」鐩�
+     * 鎵�灞炲晢鎴�
      */
-    @ApiModelProperty(value= "鎵�灞為」鐩�")
+    @ApiModelProperty(value= "鎵�灞炲晢鎴�")
     @TableField("host_id")
     private Long hostId;
 
diff --git a/src/main/java/com/zy/crm/system/entity/Permission.java b/src/main/java/com/zy/crm/system/entity/Permission.java
index 902d61a..a5de9f6 100644
--- a/src/main/java/com/zy/crm/system/entity/Permission.java
+++ b/src/main/java/com/zy/crm/system/entity/Permission.java
@@ -24,9 +24,9 @@
     private Long id;
 
     /**
-     * 鎵�灞為」鐩�
+     * 鎵�灞炲晢鎴�
      */
-    @ApiModelProperty(value= "鎵�灞為」鐩�")
+    @ApiModelProperty(value= "鎵�灞炲晢鎴�")
     @TableField("host_id")
     private Long hostId;
 
diff --git a/src/main/java/com/zy/crm/system/entity/UserLogin.java b/src/main/java/com/zy/crm/system/entity/UserLogin.java
index 46e3896..bb66952 100644
--- a/src/main/java/com/zy/crm/system/entity/UserLogin.java
+++ b/src/main/java/com/zy/crm/system/entity/UserLogin.java
@@ -26,9 +26,9 @@
     private Long id;
 
     /**
-     * 鎵�灞為」鐩�
+     * 鎵�灞炲晢鎴�
      */
-    @ApiModelProperty(value= "鎵�灞為」鐩�")
+    @ApiModelProperty(value= "鎵�灞炲晢鎴�")
     @TableField("host_id")
     private Long hostId;
 
diff --git a/src/main/java/com/zy/crm/system/service/DeptService.java b/src/main/java/com/zy/crm/system/service/DeptService.java
index 109cad5..caebb94 100644
--- a/src/main/java/com/zy/crm/system/service/DeptService.java
+++ b/src/main/java/com/zy/crm/system/service/DeptService.java
@@ -1,10 +1,13 @@
 package com.zy.crm.system.service;
 
 import com.baomidou.mybatisplus.service.IService;
+import com.zy.crm.manager.entity.Node;
 import com.zy.crm.system.entity.Dept;
 
 public interface DeptService extends IService<Dept> {
 
+    Dept getTop();
+
     int getMemberCount(Long deptId);
 
 }
diff --git a/src/main/java/com/zy/crm/system/service/impl/DeptServiceImpl.java b/src/main/java/com/zy/crm/system/service/impl/DeptServiceImpl.java
index 2ffcf9a..d78c883 100644
--- a/src/main/java/com/zy/crm/system/service/impl/DeptServiceImpl.java
+++ b/src/main/java/com/zy/crm/system/service/impl/DeptServiceImpl.java
@@ -1,6 +1,9 @@
 package com.zy.crm.system.service.impl;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.core.exception.CoolException;
+import com.zy.crm.manager.entity.Node;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.zy.crm.system.entity.Dept;
@@ -8,6 +11,8 @@
 import com.zy.crm.system.service.DeptService;
 import com.zy.crm.system.service.UserService;
 
+import java.util.Date;
+
 @Service("deptService")
 public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements DeptService {
 
@@ -15,6 +20,26 @@
     private UserService userService;
 
     @Override
+    public Dept getTop() {
+        Dept top = this.selectOne(new EntityWrapper<Dept>().eq("level", 0));
+        if (top == null) {
+            top = new Dept();
+            top.setName("鍏ㄩ儴");
+            top.setUuid("鍏ㄩ儴");
+            top.setLevel(0);
+            top.setSort(0);
+            top.setStatus(1);
+            top.setCreateTime(new Date());
+            top.setUpdateTime(new Date());
+            Integer insert = this.baseMapper.insert(top);
+            if (insert == 0) {
+                throw new CoolException("鏈嶅姟鍣ㄥ紓甯�");
+            }
+        }
+        return top;
+    }
+
+    @Override
     public int getMemberCount(Long deptId) {
         Dept dept = selectById(deptId);
         return 0;
diff --git a/src/main/resources/mapper/DeptMapper.xml b/src/main/resources/mapper/DeptMapper.xml
index 606cb34..e2f07ad 100644
--- a/src/main/resources/mapper/DeptMapper.xml
+++ b/src/main/resources/mapper/DeptMapper.xml
@@ -6,8 +6,13 @@
     <resultMap id="BaseResultMap" type="com.zy.crm.system.entity.Dept">
         <id column="id" property="id" />
         <result column="host_id" property="hostId" />
-        <result column="parent_id" property="parentId" />
+        <result column="uuid" property="uuid" />
         <result column="name" property="name" />
+        <result column="parent_id" property="parentId" />
+        <result column="parent_name" property="parentName" />
+        <result column="path" property="path" />
+        <result column="name_path" property="namePath" />
+        <result column="level" property="level" />
         <result column="sort" property="sort" />
         <result column="leader" property="leader" />
         <result column="phone" property="phone" />
@@ -17,7 +22,7 @@
         <result column="create_time" property="createTime" />
         <result column="update_by" property="updateBy" />
         <result column="update_time" property="updateTime" />
-
+        <result column="memo" property="memo" />
     </resultMap>
 
 </mapper>
diff --git a/src/main/webapp/static/js/deptTree.js b/src/main/webapp/static/js/deptTree.js
new file mode 100644
index 0000000..0f5e93e
--- /dev/null
+++ b/src/main/webapp/static/js/deptTree.js
@@ -0,0 +1,85 @@
+var currentDeptId;
+var currentDeptName;
+var init = false;
+
+layui.config({
+    base: baseUrl + "/static/layui/lay/modules/"  // 閰嶇疆妯″潡鎵�鍦ㄧ殑鐩綍
+}).use(['table','laydate', 'form', 'tree', 'xmSelect'], function() {
+    var table = layui.table;
+    var $ = layui.jquery;
+    var layer = layui.layer;
+    var layDate = layui.laydate;
+    var form = layui.form;
+    var tree = layui.tree;
+    var xmSelect = layui.xmSelect;
+    var selObj, treeData;  // 宸︽爲閫変腑鏁版嵁
+
+    var organizationTree;
+    window.loadTree = function(condition){
+        var loadIndex = layer.load(2);
+        $.ajax({
+            url: baseUrl+"/dept/tree/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                'condition': condition
+            },
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200){
+                    layer.close(loadIndex);
+                    // 鏍戝舰鍥�
+                    organizationTree = tree.render({
+                        elem: '#organizationTree',
+                        id: 'organizationTree',
+                        onlyIconControl: true,
+                        data: res.data,
+                        click: function (obj) {
+                            currentDeptId = obj.data.id;
+                            currentDeptName = obj.data.title.split(" - ")[0];
+                            // currentTemSsbm = obj.data.title.split(" - ")[1];
+                            selObj = obj;
+                            $('#organizationTree').find('.ew-tree-click').removeClass('ew-tree-click');
+                            $(obj.elem).children('.layui-tree-entry').addClass('ew-tree-click');
+                            tableIns.reload({
+                                where: {dept_id: obj.data.id},
+                                page: {curr: 1}
+                            });
+                        }
+                    });
+                    treeData = res.data;
+                    if (isEmpty(condition) && init) {
+                        tableIns.reload({
+                            where: {dept_id: ""},
+                            page: {curr: 1}
+                        });
+                    }
+                    if (!init) {
+                        init = true;
+                    }
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/";
+                } else {
+                    layer.msg(res.msg)
+                }
+            }
+        })
+    }
+    loadTree();
+
+    /* 鏍戝舰鍥鹃噸缃� */
+    $('#treeReset').click(function () {
+        $("#condition").val("");
+        loadTree("");
+    })
+
+})
+
+function closeDialog() {
+    layer.closeAll();
+}
+
+/* 鏍戝舰鍥炬悳绱� */
+function findData(el) {
+    var condition = $(el).val();
+    loadTree(condition)
+}
\ No newline at end of file
diff --git a/src/main/webapp/views/user/user.html b/src/main/webapp/views/user/user.html
index d0a15c0..2496bc8 100644
--- a/src/main/webapp/views/user/user.html
+++ b/src/main/webapp/views/user/user.html
@@ -132,10 +132,10 @@
                 </div>
 
                 <div class="layui-form-item">
-                    <label class="layui-form-label">鎵�灞為」鐩�: </label>
+                    <label class="layui-form-label">鎵�灞炲晢鎴�: </label>
                     <div class="layui-input-block cool-auto-complete">
                         <input name="hostId" class="layui-input" style="display: none">
-                        <input id="hostName" name="hostName" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="璇烽�夋嫨鎵�灞為」鐩�" onfocus=this.blur()>
+                        <input id="hostName" name="hostName" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="璇烽�夋嫨鎵�灞炲晢鎴�" onfocus=this.blur()>
                         <div class="cool-auto-complete-window">
                             <input class="cool-auto-complete-window-input" data-key="hostQueryByhostId" onkeyup="autoLoad(this.getAttribute('data-key'))">
                             <select class="cool-auto-complete-window-select" data-key="hostQueryByhostIdSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">

--
Gitblit v1.9.1