瀏覽代碼

菜单开发完成

hurugang 5 年之前
父節點
當前提交
810edc2e33

+ 168 - 24
src/main/java/cn/hnthyy/thmz/controller/MenuController.java

@@ -4,8 +4,11 @@ import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.thmz.Menu;
 import cn.hnthyy.thmz.entity.thmz.User;
+import cn.hnthyy.thmz.entity.thmz.UserMenuRelation;
 import cn.hnthyy.thmz.service.thmz.MenuService;
 import cn.hnthyy.thmz.service.thmz.UserMenuRelationService;
+import cn.hnthyy.thmz.vo.MenuVo;
+import cn.hnthyy.thmz.vo.UserMenuRelationVo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,6 +28,7 @@ public class MenuController {
 
     /**
      * 获取所有的父菜单
+     *
      * @return
      */
     @UserLoginToken
@@ -48,6 +52,7 @@ public class MenuController {
 
     /**
      * 根据主键查询菜单
+     *
      * @return
      */
     @UserLoginToken
@@ -56,7 +61,7 @@ public class MenuController {
         Map<String, Object> resultMap = new HashMap<>();
         try {
             Menu menu = menuService.queryById(id);
-            if(menu==null){
+            if (menu == null) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "根据主键查询菜单失败,不存在该菜单");
                 return resultMap;
@@ -89,14 +94,14 @@ public class MenuController {
                 resultMap.put("message", "保存菜单数据失败,参数为空");
                 return resultMap;
             }
-            if(StringUtils.isBlank(menu.getName())){
+            if (StringUtils.isBlank(menu.getName())) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "保存菜单数据失败,菜单名称为空");
                 return resultMap;
             }
             resultMap.put("code", 0);
             resultMap.put("message", "保存菜单成功");
-            if(menu.getId()==null){
+            if (menu.getId() == null) {
                 User tokenUser = TokenUtil.getUser(httpServletRequest);
                 menu.setCreateId(tokenUser.getId());
             }
@@ -114,6 +119,7 @@ public class MenuController {
 
     /**
      * 查询菜单列表
+     *
      * @param menu
      * @return
      */
@@ -129,10 +135,10 @@ public class MenuController {
             }
             List<Menu> parentMenus = menuService.queryAllParentMenu();
             Map<Long, String> menuMap = null;
-            if(parentMenus!=null && parentMenus.size()>0){
+            if (parentMenus != null && parentMenus.size() > 0) {
                 menuMap = parentMenus.stream().collect(Collectors.toMap(Menu::getId, Menu::getName));
             }
-            List<Menu> menus= menuService.queryAllMenu(menu.getName());
+            List<Menu> menus = menuService.queryAllMenu(menu.getName());
             for (Menu m : menus) {
                 m.setPatentName(menuMap.get(m.getParentId()));
             }
@@ -150,10 +156,9 @@ public class MenuController {
     }
 
 
-
-
     /**
      * 查询菜单树
+     *
      * @return
      */
     @UserLoginToken
@@ -162,28 +167,28 @@ public class MenuController {
         Map<String, Object> resultMap = new HashMap<>();
         try {
             List<Menu> parentMenus = menuService.queryAllParentMenu();
-            List<Menu> menus= menuService.queryAllMenu(null);
-            List<Map<String,Object>> trees = new ArrayList<>();
-            Map<Long,Map<String,Object>> nodesMap = new HashMap<>();
-            for (Menu m:parentMenus){
-                Map<String,Object> tempParent = new HashMap<>();
-                tempParent.put("text",m.getName());
-                tempParent.put("icon",m.getClassCode());
-                tempParent.put("dataId",m.getId());
-                tempParent.put("nodes",new ArrayList<>());
+            List<Menu> menus = menuService.queryAllMenu(null);
+            List<Map<String, Object>> trees = new ArrayList<>();
+            Map<Long, Map<String, Object>> nodesMap = new HashMap<>();
+            for (Menu m : parentMenus) {
+                Map<String, Object> tempParent = new HashMap<>();
+                tempParent.put("text", m.getName());
+                tempParent.put("icon", m.getClassCode());
+                tempParent.put("dataId", m.getId());
+                tempParent.put("nodes", new ArrayList<>());
                 trees.add(tempParent);
-                nodesMap.put(m.getId(),tempParent);
+                nodesMap.put(m.getId(), tempParent);
             }
-            Set<Long> ids =nodesMap.keySet();
+            Set<Long> ids = nodesMap.keySet();
             for (Menu m : menus) {
-                if(ids.contains(m.getId())){
+                if (ids.contains(m.getId())) {
                     continue;
                 }
-                Map<String,Object> tempParent =nodesMap.get(m.getParentId());
-                List<Map<String,Object>> childList = (List<Map<String,Object>>)tempParent.get("nodes");
-                Map<String,Object> temp = new HashMap<>();
-                temp.put("text",m.getName());
-                temp.put("dataId",m.getId());
+                Map<String, Object> tempParent = nodesMap.get(m.getParentId());
+                List<Map<String, Object>> childList = (List<Map<String, Object>>) tempParent.get("nodes");
+                Map<String, Object> temp = new HashMap<>();
+                temp.put("text", m.getName());
+                temp.put("dataId", m.getId());
                 childList.add(temp);
             }
             resultMap.put("code", 0);
@@ -198,4 +203,143 @@ public class MenuController {
             return resultMap;
         }
     }
+
+
+    /**
+     * 保存用户与菜单关系
+     *
+     * @param userMenuRelationVo
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/saveUserMenuRelation", method = {RequestMethod.POST})
+    public Map<String, Object> saveUserMenuRelation(@RequestBody UserMenuRelationVo userMenuRelationVo, HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (userMenuRelationVo == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "保存用户与菜单关系失败,参数为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(userMenuRelationVo.getUserIds())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "保存用户与菜单关系失败,用户集参数为空");
+                return resultMap;
+            }
+            User tokenUser = TokenUtil.getUser(httpServletRequest);
+            userMenuRelationService.saveMenuRelation(userMenuRelationVo, tokenUser.getId());
+            resultMap.put("code", 0);
+            resultMap.put("message", "保存用户与菜单关系成功");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("保存用户与菜单关系失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "保存用户与菜单关系失败");
+            return resultMap;
+        }
+    }
+
+
+    /**
+     * 获取用户已有的菜单关系
+     *
+     * @param userMenuRelationVo
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getUserHadMenuRelation", method = {RequestMethod.POST})
+    public Map<String, Object> getUserHadMenuRelation(@RequestBody UserMenuRelationVo userMenuRelationVo) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (userMenuRelationVo == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "获取用户已有的菜单关系失败,参数为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(userMenuRelationVo.getUserIds())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "获取用户已有的菜单关系失败,用户集参数为空");
+                return resultMap;
+            }
+            if(userMenuRelationVo.getUserMenuRelationVos()==null || userMenuRelationVo.getUserMenuRelationVos().size()==0){
+                resultMap.put("code", -1);
+                resultMap.put("message", "获取用户已有的菜单关系失败,当前构造菜单树为空");
+                return resultMap;
+            }
+            List<String> userIds = Arrays.asList(userMenuRelationVo.getUserIds().split(","));
+            List<Long> userIdLs = userIds.stream().map(u -> Long.valueOf(u)).collect(Collectors.toList());
+            List<UserMenuRelation> userMenuRelationList=userMenuRelationService.queryByUserIds(userIdLs);
+            Set<Long> returnSet = new HashSet<>();
+            if(userMenuRelationList!=null && userMenuRelationList.size()>0){
+                Map<Long,Long> map = userMenuRelationVo.getUserMenuRelationVos().stream().collect(Collectors.toMap(UserMenuRelationVo::getDataId, UserMenuRelationVo::getNodeId));
+                for (UserMenuRelation userMenuRelation:userMenuRelationList){
+                    returnSet.add(map.get(userMenuRelation.getMenuId()));
+                }
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "获取用户已有的菜单关系成功");
+            resultMap.put("data", returnSet);
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("获取用户已有的菜单关系失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "获取用户已有的菜单关系失败");
+            return resultMap;
+        }
+    }
+
+
+
+    /**
+     * 获取当前用户的菜单权限
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getMenuRelationForCurrentUser", method = {RequestMethod.GET})
+    public Map<String, Object> getMenuRelationForCurrentUser(HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            User tokenUser = TokenUtil.getUser(httpServletRequest);
+            List<UserMenuRelation> userMenuRelationList=userMenuRelationService.queryByUserId(tokenUser.getId());
+            List<Long> menuIds=userMenuRelationList.stream().map(UserMenuRelation::getMenuId).collect(Collectors.toList());
+            List<Menu> menuList= menuService.queryByIds(menuIds);
+            List<MenuVo> resultList = new ArrayList<>();
+            Map<Long,MenuVo> tempMap = new HashMap<>();
+            for (Menu menu:menuList){
+                if(menu.getParentId()==null){
+                    //是父菜单
+                    MenuVo menuVo=tempMap.get(menu.getId());
+                    if(menuVo==null){
+                        menuVo=new MenuVo();
+                        menuVo.setMenuList(new ArrayList<>());
+                        resultList.add(menuVo);
+                        tempMap.put(menu.getId(),menuVo);
+                    }
+                    menuVo.setMenu(menu);
+                }else {
+                    MenuVo menuVo=tempMap.get(menu.getParentId());
+                    if(menuVo==null){
+                        menuVo=new MenuVo();
+                        menuVo.setMenuList(new ArrayList<>());
+                        resultList.add(menuVo);
+                        tempMap.put(menu.getId(),menuVo);
+                    }
+                    menuVo.getMenuList().add(menu);
+                }
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "获取当前用户的菜单权限成功");
+            resultMap.put("data",resultList);
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("获取当前用户的菜单权限失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "获取当前用户的菜单权限失败");
+            return resultMap;
+        }
+    }
 }

+ 4 - 0
src/main/java/cn/hnthyy/thmz/entity/thmz/UserMenuRelation.java

@@ -19,4 +19,8 @@ public class UserMenuRelation {
     private Date createTime;
     //创建人id
     private Long createId;
+
+
+
+
 }

+ 7 - 4
src/main/java/cn/hnthyy/thmz/mapper/thmz/MenuMapper.java

@@ -47,10 +47,12 @@ public interface MenuMapper {
      * @param ids
      * @return
      */
-    @Select("select * from t_menu where id in" +
-            "<foreach item='item' index='index' collection='ids' open='(' separator=',' close=')'>" +
-            "#{item}" +
-            "</foreach>")
+    @Select({"<script>",
+            "select * from t_menu where id in" +
+                    "<foreach item='item' index='index' collection='ids' open='(' separator=',' close=')'>" +
+                    "#{item}" +
+                    "</foreach>" +
+                    "</script>"})
     List<Menu> selectByIds(@Param("ids") List<Long> ids);
 
     /**
@@ -74,6 +76,7 @@ public interface MenuMapper {
 
     /**
      * 更新菜单
+     *
      * @param menu
      * @return
      */

+ 15 - 0
src/main/java/cn/hnthyy/thmz/mapper/thmz/UserMenuRelationMapper.java

@@ -29,6 +29,21 @@ public interface UserMenuRelationMapper {
     List<UserMenuRelation> selectByUserId(@Param("userId") Long userId);
 
 
+    /**
+     * 根据用户id集合查询菜单关系
+     *
+     * @param userIds
+     * @return
+     */
+    @Select({"<script>",
+            "select * from t_user_menu_relation where user_id in" +
+                    "<foreach item='item' index='index' collection='userIds' open='(' separator=',' close=')'>" +
+                    "#{item}" +
+                    "</foreach>" +
+                    "</script>"})
+    List<UserMenuRelation> selectByUserIds(@Param("userIds") List<Long> userIds);
+
+
     /**
      * 新增菜单关系
      *

+ 49 - 2
src/main/java/cn/hnthyy/thmz/service/impl/thmz/UserMenuRelationServiceImpl.java

@@ -1,30 +1,77 @@
 package cn.hnthyy.thmz.service.impl.thmz;
 
+import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.thmz.UserMenuRelation;
 import cn.hnthyy.thmz.mapper.thmz.UserMenuRelationMapper;
 import cn.hnthyy.thmz.service.thmz.UserMenuRelationService;
+import cn.hnthyy.thmz.vo.UserMenuRelationVo;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Arrays;
+import java.util.Date;
 import java.util.List;
+
 @Service
 public class UserMenuRelationServiceImpl implements UserMenuRelationService {
     @SuppressWarnings("all")
     @Autowired
     private UserMenuRelationMapper userMenuRelationMapper;
+
     @Override
     public UserMenuRelation queryById(Long id) {
         return userMenuRelationMapper.selectById(id);
     }
 
+    @Override
+    public List<UserMenuRelation> queryByUserIds(List<Long> userIds) {
+        return userMenuRelationMapper.selectByUserIds(userIds);
+    }
+
     @Override
     public List<UserMenuRelation> queryByUserId(Long userId) {
         return userMenuRelationMapper.selectByUserId(userId);
     }
 
+    @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
     @Override
-    public int saveMenuRelation(UserMenuRelation userMenuRelation) {
-        return userMenuRelationMapper.insertUserMenuRelation(userMenuRelation);
+    public int saveMenuRelation(UserMenuRelationVo userMenuRelationVo, Long createId) throws MzException {
+        if (StringUtils.isBlank(userMenuRelationVo.getUserIds())) {
+            throw new MzException("保存用户与菜单关系失败,用户集参数为空");
+        }
+        List<String> userIds = Arrays.asList(userMenuRelationVo.getUserIds().split(","));
+        List<String> menuIds =null;
+        if(userMenuRelationVo.getMenuIds()!=null){
+            menuIds = Arrays.asList(userMenuRelationVo.getMenuIds().split(","));
+        }
+        Date now = new Date();
+        for (String userId : userIds) {
+            if (StringUtils.isBlank(userId)) {
+                continue;
+            }
+            Long userIdL = Long.valueOf(userId);
+            userMenuRelationMapper.deleteByUserId(userIdL);
+            if (menuIds==null|| menuIds.size()==0) {
+                continue;
+            }
+            for (String menuId : menuIds) {
+                if (StringUtils.isBlank(menuId)) {
+                    continue;
+                }
+                Long menuIdL = Long.valueOf(menuId);
+                UserMenuRelation newUserMenuRelation = new UserMenuRelation();
+                newUserMenuRelation.setUserId(userIdL);
+                newUserMenuRelation.setMenuId(menuIdL);
+                newUserMenuRelation.setCreateTime(now);
+                newUserMenuRelation.setCreateId(createId);
+                userMenuRelationMapper.insertUserMenuRelation(newUserMenuRelation);
+            }
+        }
+        return 1;
     }
 
     @Override

+ 12 - 2
src/main/java/cn/hnthyy/thmz/service/thmz/UserMenuRelationService.java

@@ -1,6 +1,8 @@
 package cn.hnthyy.thmz.service.thmz;
 
+import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.thmz.UserMenuRelation;
+import cn.hnthyy.thmz.vo.UserMenuRelationVo;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Param;
@@ -20,6 +22,13 @@ public interface UserMenuRelationService {
      */
     UserMenuRelation queryById(Long id);
 
+    /**
+     * 根据用户id集合查询菜单关系
+     *
+     * @param userIds
+     * @return
+     */
+    List<UserMenuRelation> queryByUserIds(List<Long> userIds);
 
     /**
      * 根据userId查询菜单关系
@@ -33,10 +42,11 @@ public interface UserMenuRelationService {
     /**
      * 新增菜单关系
      *
-     * @param userMenuRelation
+     * @param userMenuRelationVo
+     * @param createId
      * @return
      */
-    int saveMenuRelation(UserMenuRelation userMenuRelation);
+    int saveMenuRelation(UserMenuRelationVo userMenuRelationVo, Long createId) throws MzException;
 
     /**
      * 删除菜单关系

+ 18 - 0
src/main/java/cn/hnthyy/thmz/vo/MenuVo.java

@@ -0,0 +1,18 @@
+package cn.hnthyy.thmz.vo;
+
+import cn.hnthyy.thmz.entity.thmz.Menu;
+import lombok.Data;
+
+import java.util.List;
+
+
+/**
+ * 菜单视图类
+ */
+@Data
+public class MenuVo{
+    //父菜单
+    private Menu menu;
+    //子菜单集合
+    private List<Menu> menuList;
+}

+ 21 - 0
src/main/java/cn/hnthyy/thmz/vo/UserMenuRelationVo.java

@@ -0,0 +1,21 @@
+package cn.hnthyy.thmz.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 用户与菜单关系参数类
+ */
+@Data
+public class UserMenuRelationVo {
+    //节点id 前端参数
+    private Long nodeId;
+    //数据本身的id 前端参数
+    private Long dataId;
+    //用户id字符串组合 前端参数
+    private String userIds;
+    //菜单id字符串组合 前端参数
+    private String menuIds;
+    private List<UserMenuRelationVo> userMenuRelationVos;
+}

+ 1 - 1
src/main/resources/static/js/custom-from-min.js

@@ -3904,7 +3904,7 @@ $.fn.popover.Constructor.prototype.leave = function(a) {
     $(document).ready(function() {
         init_sparklines(),
             init_flot_chart(),
-            init_sidebar(),
+            //init_sidebar(),
             init_wysiwyg(),
             init_InputMask(),
             init_JQVmap(),

+ 116 - 65
src/main/resources/static/js/menu.js

@@ -1,21 +1,21 @@
-var content_url=null;
+var content_url = null;
 //发票计数器
-var countReceiot=0;
-$(function (){
-    if(localStorage.getItem("token")==undefined){
-        window.location.href='/thmz/login/view'
+var countReceiot = 0;
+$(function () {
+    if (localStorage.getItem("token") == undefined) {
+        window.location.href = '/thmz/login/view'
     }
     $.ajax({
         type: "GET",
         contentType: "application/json;charset=UTF-8",
         url: "/thmz/getUserName",
-        headers:{'Accept': 'application/json','Authorization':'Bearer '+ localStorage.getItem("token")},
-        success: function(result) {
-            if(result=='401' || result==401){
-                window.location.href='/thmz/login/view'
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (result) {
+            if (result == '401' || result == 401) {
+                window.location.href = '/thmz/login/view'
                 return;
             }
-            if(result.code ==0){
+            if (result.code == 0) {
                 $(".current_user").html(result.data.userName);
             }
         }
@@ -27,37 +27,45 @@ $(function (){
     try {
         $("#mydropzone").dropzone({
             url: "/thmz/upload",
-            headers:{'Accept': 'application/json','Authorization':'Bearer '+ localStorage.getItem("token"),'fileType':localStorage.getItem("fileType")},
-            init: function() {
-                this.on("success", function(file,data) {
-                    if(data=='401' || data==401){
-                        window.location.href='/thmz/login/view'
+            headers: {
+                'Accept': 'application/json',
+                'Authorization': 'Bearer ' + localStorage.getItem("token"),
+                'fileType': localStorage.getItem("fileType")
+            },
+            init: function () {
+                this.on("success", function (file, data) {
+                    if (data == '401' || data == 401) {
+                        window.location.href = '/thmz/login/view'
                         return;
                     }
-                    if(data.code==0){
-                        if(localStorage.getItem("fileType")==0){
-                            window.location.href='/thmz/menu/view'
+                    if (data.code == 0) {
+                        if (localStorage.getItem("fileType") == 0) {
+                            window.location.href = '/thmz/menu/view'
                         }
                     }
                 });
             },
         });
-    } catch(e) {
-       console.error("出现一些未知错误")
+    } catch (e) {
+        console.error("出现一些未知错误")
     }
     imgFun("/thmz/download-profile", "headImage,headImage1,headImage2,headImage3,headImage4,headImage5");
+
+
+    //构造当前用户的菜单树
+    getCurrentUserMenu();
+
     //设置主页
     changeContent('/thmz/index');
     //$("#home").click();
 
 
-
-    $(document).keydown(function(event){ //监听键盘按下时的事件
+    $(document).keydown(function (event) { //监听键盘按下时的事件
         //按F4进行页面切换
-        if(event.keyCode ==115){
-            if(content_url=='/thmz/registration'){
+        if (event.keyCode == 115) {
+            if (content_url == '/thmz/registration') {
                 changeContent('/thmz/toll-administration');
-            }else {
+            } else {
                 changeContent('/thmz/registration');
             }
             return;
@@ -67,18 +75,62 @@ $(function (){
 
 });
 
+
+/**
+ * 构造当前用户的菜单树
+ */
+function getCurrentUserMenu() {
+    $.ajax({
+        type: "GET",
+        url: '/thmz/getMenuRelationForCurrentUser',
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            var html = "";
+            for (var i = 0; i < res.data.length; i++) {
+                var parentMenuVo = res.data[i];
+                var parentMenu = parentMenuVo.menu;
+                var menuList = parentMenuVo.menuList;
+                if (parentMenu.menuUrl == null || parentMenu.menuUrl == "" || parentMenu.menuUrl.length == 0) {
+                    html += '<li><a><i class="' + parentMenu.classCode + '"></i>' + parentMenu.name;
+                } else {
+                    html += '<li><a href="#" onclick="changeContent(\'' + parentMenu.menuUrl + '\')"><i class="' + parentMenu.classCode + '"></i>' + parentMenu.name;
+                }
+                if (menuList != null && menuList.length > 0) {
+                    html += '<span class="fa fa-chevron-down"></span></a><ul class="nav child_menu">';
+                    for (var j = 0; j < menuList.length; j++) {
+                        var childMenu = menuList[j];
+                        html += '<li><a href="#" onclick="changeContent(\'' + childMenu.menuUrl + '\')">' + childMenu.name + '</a></li>';
+                    }
+                    html += '</ul>';
+                } else {
+                    html += '</a>';
+                }
+                html += '</li>';
+            }
+            $("#menuBaseNode").html(html);
+            init_sidebar();
+        }
+    });
+}
+
+
 function loginOut() {
-    if(localStorage.getItem("token")==undefined){
-        window.location.href='/thmz/login/view'
+    if (localStorage.getItem("token") == undefined) {
+        window.location.href = '/thmz/login/view'
     }
     $.ajax({
         type: "POST",
         contentType: "application/json;charset=UTF-8",
         url: "/thmz/login-out",
-        headers:{'Accept': 'application/json','Authorization':'Bearer '+ localStorage.getItem("token")},
-        success: function(result) {
-            if(result=='401' || result==401 || result.code == 0){
-                window.location.href='/thmz/login/view'
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (result) {
+            if (result == '401' || result == 401 || result.code == 0) {
+                window.location.href = '/thmz/login/view'
                 return;
             }
         }
@@ -94,10 +146,10 @@ function editProfile() {
     try {
         $('#reportrange').data('daterangepicker').remove();
         $("div.datetimepicker").remove();
-    }catch (e) {
+    } catch (e) {
         console.log("不存在对应的日期选择器,无需销毁")
     }
-    $("#profileimage").css("display","none");
+    $("#profileimage").css("display", "none");
     $("#content").load("/thmz/html/profile.html");
     $.getScript('/thmz/js/profile.js');
     $.getScript('/thmz/js/message.js');
@@ -112,10 +164,10 @@ function editPassword() {
     try {
         $('#reportrange').data('daterangepicker').remove();
         $("div.datetimepicker").remove();
-    }catch (e) {
+    } catch (e) {
         console.log("不存在对应的日期选择器,无需销毁")
     }
-    $("#profileimage").css("display","none");
+    $("#profileimage").css("display", "none");
     $("#content").load("/thmz/html/password.html");
     $.getScript('/thmz/js/password.js');
     NProgress.done();
@@ -129,16 +181,16 @@ function editProfileImage() {
     try {
         $('#reportrange').data('daterangepicker').remove();
         $("div.datetimepicker").remove();
-    }catch (e) {
+    } catch (e) {
         console.log("不存在对应的日期选择器,无需销毁")
     }
     $("#content").html("");
-    $("#profileimage").css("display","block");
-    $("#mydropzone").css("display","none");
+    $("#profileimage").css("display", "block");
+    $("#mydropzone").css("display", "none");
     $(".x_content").append("<img id='headImage99'/>")
     imgFun("/thmz/download-profile", "headImage99");
     //设置文件类型为头像
-    localStorage.setItem("fileType","0");
+    localStorage.setItem("fileType", "0");
     NProgress.done();
 }
 
@@ -148,26 +200,26 @@ function editProfileImage() {
  */
 $('#alarm-fullscreen-toggler').on('click', function (e) {
     var element = document.documentElement;		// 返回 html dom 中的root 节点 <html>
-    if(!$('body').hasClass('full-screen')) {
+    if (!$('body').hasClass('full-screen')) {
         $('body').addClass('full-screen');
         $('#alarm-fullscreen-toggler').addClass('active');
         // 判断浏览器设备类型
-        if(element.requestFullscreen) {
+        if (element.requestFullscreen) {
             element.requestFullscreen();
-        } else if (element.mozRequestFullScreen){	// 兼容火狐
+        } else if (element.mozRequestFullScreen) {	// 兼容火狐
             element.mozRequestFullScreen();
-        } else if(element.webkitRequestFullscreen) {	// 兼容谷歌
+        } else if (element.webkitRequestFullscreen) {	// 兼容谷歌
             element.webkitRequestFullscreen();
         } else if (element.msRequestFullscreen) {	// 兼容IE
             element.msRequestFullscreen();
         }
-       $(this).attr("data-original-title","退出全屏");
+        $(this).attr("data-original-title", "退出全屏");
     } else {			// 退出全屏
         console.log(document);
         $('body').removeClass('full-screen');
         $('#alarm-fullscreen-toggler').removeClass('active');
         //	退出全屏
-        if(document.exitFullscreen) {
+        if (document.exitFullscreen) {
             document.exitFullscreen();
         } else if (document.mozCancelFullScreen) {
             document.mozCancelFullScreen();
@@ -176,33 +228,33 @@ $('#alarm-fullscreen-toggler').on('click', function (e) {
         } else if (document.msExitFullscreen) {
             document.msExitFullscreen();
         }
-        $(this).attr("data-original-title","全屏");
+        $(this).attr("data-original-title", "全屏");
     }
 });
 
 /**
  * 锁屏按钮点击事件
  */
-$("#lockScreen").on('click',function (t) {
+$("#lockScreen").on('click', function (t) {
     //默认10分钟不操作会锁屏
-    fcode.Time=600;
+    fcode.Time = 600;
     fcode.customHtml = '<div style="margin-top:80px;"><img src="/thmz/images/img.jpg" style="width:70px;height:70px;border-radius:100px"><br><br></div>';
     fcode.bgImage = '/thmz/images/backgrounds/back5.jpg'; //设置背景图片,优先于背景颜色
     $.ajax({
         type: "POST",
         contentType: "application/json;charset=UTF-8",
         url: "/thmz/user-info",
-        headers:{'Accept': 'application/json','Authorization':'Bearer '+ localStorage.getItem("token")},
-        success: function(result) {
-            if(result=='401' || result==401){
-                window.location.href='/thmz/login/view'
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (result) {
+            if (result == '401' || result == 401) {
+                window.location.href = '/thmz/login/view'
                 return;
             }
-            if(result.code == 0) {
-                if(result.data.lockScreenPassword!=null && result.data.lockScreenPassword!=""){
+            if (result.code == 0) {
+                if (result.data.lockScreenPassword != null && result.data.lockScreenPassword != "") {
                     fcode.bgImage = '/thmz/images/backgrounds/back6.jpg'; //设置背景图片,优先于背景颜色
                     fcode.Start(result.data.lockScreenPassword);
-                }else {
+                } else {
                     fcode.Uppwd();
                 }
             } else {
@@ -217,7 +269,7 @@ $("#lockScreen").on('click',function (t) {
  * @param url
  * @param imgs
  */
-function imgFun (url, imgs) {
+function imgFun(url, imgs) {
     var windowUrl = window.URL || window.webkitURL;//处理浏览器兼容性
     var xhr = new XMLHttpRequest();
     xhr.open("GET", url, true);
@@ -227,10 +279,10 @@ function imgFun (url, imgs) {
         //console.log(this);
         if (this.status == 200) {
             var blob = this.response;
-            var arr =imgs.split(",");
-            for (var i=0;i<arr.length;i++){
-                $("#"+arr[i]).load(function (e) {
-                    windowUrl.revokeObjectURL($("#"+arr[i]).src);
+            var arr = imgs.split(",");
+            for (var i = 0; i < arr.length; i++) {
+                $("#" + arr[i]).load(function (e) {
+                    windowUrl.revokeObjectURL($("#" + arr[i]).src);
                 }).attr("src", windowUrl.createObjectURL(blob));
             }
         }
@@ -242,13 +294,12 @@ function imgFun (url, imgs) {
  * 打开上传图片操纵框
  */
 function profileImage() {
-    $("#mydropzone").css("display","block");
+    $("#mydropzone").css("display", "block");
     $("#profileImageTitleInfo").removeClass('hide').addClass('in');
     $("#headImage99").remove();
 }
 
 
-
 /**
  * 页面跳转
  */
@@ -257,16 +308,16 @@ function changeContent(url) {
     try {
         $('#reportrange').data('daterangepicker').remove();
         $("div.datetimepicker").remove();
-    }catch (e) {
+    } catch (e) {
         console.log("不存在对应的日期选择器,无需销毁")
     }
-    $("#profileimage").css("display","none");
+    $("#profileimage").css("display", "none");
     $.ajax({
         type: "GET",
         url: url,
         dataType: 'html',
         success: function (result) {
-            content_url=url;
+            content_url = url;
             $("#content").html(result);
         }
     });

+ 2 - 1
src/main/resources/static/js/message.js

@@ -26,4 +26,5 @@ function successMesage(result) {
         type: 'success',
         styling: 'bootstrap3'
     });
-}
+}
+

+ 135 - 6
src/main/resources/static/js/user_menu_relation.js

@@ -34,6 +34,7 @@ function userNodeChecked(event, node) {
     checkAllParent("userTree",node);
     checkAllSon("userTree",node);
     userNodeCheckedSilent = false;
+    userCheckEd();
 }
 function userNodeUnchecked(event, node) {
     if (userNodeUncheckedSilent)
@@ -42,6 +43,7 @@ function userNodeUnchecked(event, node) {
     uncheckAllParent("userTree",node);
     uncheckAllSon("userTree",node);
     userNodeUncheckedSilent = false;
+    userCheckEd();
 }
 //人员树方法结束
 
@@ -127,6 +129,23 @@ $(function () {
     });
 
 
+    //菜单树
+    getMenuTree();
+
+
+    $("#btn_save").click(function (t) {
+        saveRelation();
+    });
+    $("#btn_clean").click(function (t) {
+        $('#userTree').treeview('uncheckAll', { silent: true });
+        $('#menuTree').treeview('uncheckAll', { silent: true });
+    });
+
+
+});
+
+
+function getMenuTree() {
     //菜单树
     $.ajax({
         type: "GET",
@@ -142,23 +161,133 @@ $(function () {
                 showCheckbox: true,//确认展示checkbox
                 data: res.data,//数据
                 onNodeChecked: menuNodeChecked,//当选中节点check时响应函数
-                onNodeUnchecked: menuNodeUnchecked//当不选中时响应函数,就是用于级联效果
+                onNodeUnchecked: menuNodeUnchecked,//当不选中时响应函数,就是用于级联效果
+                silent: true //折叠所有的节点,折叠整个树。
             });
 
         }
     });
-
-});
+}
 
 /**
  * 设置用户和菜单权限关系
  */
 function saveRelation() {
-    var userTree = $('#userTree').treeview('getSelected', nodeId);
-    var menuTree = $('#menuTree').treeview('getSelected', nodeId);
-
+    var userTree = $('#userTree').treeview('getChecked');
+    var menuTree = $('#menuTree').treeview('getChecked');
+    var userIds=null;
+    if(userTree.length>0){
+        for (var i=0;i<userTree.length;i++){
+            var dataId=userTree[i].dataId;
+            if(userIds==null){
+                userIds=dataId;
+            }else {
+                userIds+=","+dataId;
+            }
+        }
+    }
+    var menuIds=null;
+    if(menuTree.length>0){
+        for (var i=0;i<menuTree.length;i++){
+            var dataId=menuTree[i].dataId;
+            if(menuIds==null){
+                menuIds=dataId;
+            }else {
+                menuIds+=","+dataId;
+            }
+        }
+    }
+    if(userIds==null){
+        new PNotify({
+            title: '提示',
+            text: '您没有选择任何用户!',
+            styling: 'bootstrap3'
+        });
+        return;
+    }
+    if (!confirm("是否要修改当前用户权限变更操作?")) {
+        return;
+    }
+    $.ajax({
+        type: "POST",
+        url: '/thmz/saveUserMenuRelation',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data:  JSON.stringify({
+            userIds: userIds,
+            menuIds: menuIds
+        }),
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                successMesage(res);
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
 
 }
 
 
 
+function userCheckEd() {
+    var userTree = $('#userTree').treeview('getChecked');
+    var userIds=null;
+    if(userTree.length>0){
+        for (var i=0;i<userTree.length;i++){
+            var dataId=userTree[i].dataId;
+            if(userIds==null){
+                userIds=dataId;
+            }else {
+                userIds+=","+dataId;
+            }
+        }
+    }
+    if(userIds==null){
+        $('#menuTree').treeview('uncheckAll', { silent: true });
+    }
+    //先选中所有节点
+    $('#menuTree').treeview('checkAll', { silent: true });
+    var menuTree = $('#menuTree').treeview('getChecked');
+    //取消所有选中
+    $('#menuTree').treeview('uncheckAll', { silent: true });
+
+    var realParams = JSON.parse('{"userIds":"","userMenuRelationVos":[]}');
+    realParams.userIds = userIds;
+    for (var i = 0; i < menuTree.length; i++) {
+        var thisData = menuTree[i];
+        var tempJson = JSON.parse('{"nodeId":"","dataId":""}');
+        tempJson.nodeId = thisData.nodeId;
+        tempJson.dataId = thisData.dataId;
+        realParams.userMenuRelationVos[i] = tempJson;
+    }
+    $.ajax({
+        type: "POST",
+        url: '/thmz/getUserHadMenuRelation',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data:  JSON.stringify(realParams),
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                for (var i=0;i<res.data.length;i++){
+                    $('#menuTree').treeview('checkNode', res.data[i], {
+                        silent: true
+                    });
+                }
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
+}
+

+ 81 - 75
src/main/resources/templates/menu.html

@@ -58,84 +58,90 @@
                 <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
                     <div class="menu_section">
                         <h3>门诊业务</h3>
-                        <ul class="nav side-menu">
-                            <li><a href="#" onclick="changeContent('/thmz/index')" id="home"><i class="fa fa-home"></i> 首页 </a>
-                            </li>
-                            <li><a><i class="fa fa-edit"></i> 挂号管理 <span class="fa fa-chevron-down"></span></a>
-                                <ul class="nav child_menu">
-                                    <li><a href="#" onclick="changeContent('/thmz/registration')">挂号</a></li>
-                                    <li><a href="#" onclick="changeContent('/thmz/registration-list')">挂号列表</a></li>
-                                    <li><a href="#" onclick="changeContent('/thmz/request')">号表字典维护</a></li>
-                                </ul>
-                            </li>
-                            <li><a><i class="fa fa-rmb"></i> 收费管理 <span class="fa fa-chevron-down"></span></a>
-                                <ul class="nav child_menu">
-                                    <li><a href="#" onclick="changeContent('/thmz/toll-administration')">收费退费</a></li>
-                                    <li><a href="#" onclick="changeContent('/thmz/daily')">日结处理</a></li>
-                                    <li><a href="#" onclick="changeContent('/thmz/charge-list')">病人费用清单</a></li>
-                                </ul>
-                            </li>
-                            <li><a><i class="fa fa-bar-chart-o"></i>报表管理<span
-                                    class="fa fa-chevron-down"></span></a>
-                                <ul class="nav child_menu">
-                                    <li><a href="#" onclick="changeContent('/thmz/daily-repeat-print')">重打日结报表</a></li>
-                                    <li><a href="#" onclick="changeContent('/thmz/daily-collect')">日结汇总</a></li>
-                                    <li><a href="#" onclick="changeContent('/thmz/mzsrmx')">门诊明细收入</a></li>
-                                    <li><a href="#" onclick="changeContent('/thmz/mzhbtj')">门诊号别统计</a></li>
-                                    <li><a href="#" onclick="changeContent('/thmz/cash-work-count')">收费员工作量统计</a></li>
-                                    <li><a href="#" onclick="changeContent('/thmz/bissinessReport')">门诊科室核算报表</a></li>
-                                </ul>
-                            </li>
-                            <li><a><i class="fa fa-medkit"></i> 药品管理 <span class="fa fa-chevron-down"></span></a>
-                                <ul class="nav child_menu">
-                                    <li><a href="#" onclick="changeContent('/thmz/refund-medicine')">退药申请</a></li>
-                                </ul>
-                            </li>
-                            <li><a><i class="fa fa-table"></i> 列表管理 <span class="fa fa-chevron-down"></span></a>
-                                <ul class="nav child_menu">
-                                    <li><a href="#" onclick="changeContent('/thmz/unit-code')">科室列表</a></li>
-                                </ul>
-                            </li>
-                            <li><a><i class="fa fa-clone"></i>Layouts <span class="fa fa-chevron-down"></span></a>
-                                <ul class="nav child_menu">
-                                    <li><a href="fixed_sidebar.html">Fixed Sidebar</a></li>
-                                    <li><a href="fixed_footer.html">Fixed Footer</a></li>
-                                </ul>
-                            </li>
-                        </ul>
-                    </div>
-                    <div class="menu_section">
-                        <h3>系统管理</h3>
-                        <ul class="nav side-menu">
-                            <li><a><i class="fa fa-bug"></i> Additional Pages <span
-                                    class="fa fa-chevron-down"></span></a>
-                                <ul class="nav child_menu">
-                                    <li><a href="e_commerce.html">E-commerce</a></li>
-                                    <li><a href="projects.html">Projects</a></li>
-                                    <li><a href="project_detail.html">Project Detail</a></li>
-                                    <li><a href="contacts.html">Contacts</a></li>
-                                    <li><a href="profile.html">Profile</a></li>
-                                </ul>
-                            </li>
-                            <li><a><i class="fa fa-windows"></i> 菜单权限管理 <span class="fa fa-chevron-down"></span></a>
-                                <ul class="nav child_menu">
-                                    <li><a onclick="changeContent('/thmz/menu-manage')">菜单管理</a></li>
-                                    <li><a onclick="changeContent('/thmz/user-menu-relation')">管理用户权限管理</a></li>
-                                </ul>
-                            </li>
-                            <li><a><i class="fa fa-cog"></i> 基础设置 <span
-                                    class="fa fa-chevron-down"></span></a>
-                                <ul class="nav child_menu">
-                                    <li><a onclick="changeContent('/thmz/sfy-config')">收费参数设置</a></li>
-                                    <li><a onclick="changeContent('/thmz/receipt')">发票管理</a> </li>
-                                    <li><a href="#level1_2">Level One</a></li>
-                                </ul>
-                            </li>
-                            <li><a href="javascript:void(0)"><i class="fa fa-laptop"></i> Landing Page <span
-                                    class="label label-success pull-right">Coming Soon</span></a></li>
+                        <ul class="nav side-menu" id="menuBaseNode">
                         </ul>
                     </div>
 
+                    <!--<div class="menu_section">-->
+                        <!--<h3>门诊业务</h3>-->
+                        <!--<ul class="nav side-menu">-->
+                            <!--<li><a href="#" onclick="changeContent('/thmz/index')" id="home"><i class="fa fa-home"></i> 首页 </a>-->
+                            <!--</li>-->
+                            <!--<li><a><i class="fa fa-edit"></i> 挂号管理 <span class="fa fa-chevron-down"></span></a>-->
+                                <!--<ul class="nav child_menu">-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/registration')">挂号</a></li>-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/registration-list')">挂号列表</a></li>-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/request')">号表字典维护</a></li>-->
+                                <!--</ul>-->
+                            <!--</li>-->
+                            <!--<li><a><i class="fa fa-rmb"></i> 收费管理 <span class="fa fa-chevron-down"></span></a>-->
+                                <!--<ul class="nav child_menu">-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/toll-administration')">收费退费</a></li>-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/daily')">日结处理</a></li>-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/charge-list')">病人费用清单</a></li>-->
+                                <!--</ul>-->
+                            <!--</li>-->
+                            <!--<li><a><i class="fa fa-bar-chart-o"></i>报表管理<span-->
+                                    <!--class="fa fa-chevron-down"></span></a>-->
+                                <!--<ul class="nav child_menu">-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/daily-repeat-print')">重打日结报表</a></li>-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/daily-collect')">日结汇总</a></li>-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/mzsrmx')">门诊明细收入</a></li>-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/mzhbtj')">门诊号别统计</a></li>-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/cash-work-count')">收费员工作量统计</a></li>-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/bissinessReport')">门诊科室核算报表</a></li>-->
+                                <!--</ul>-->
+                            <!--</li>-->
+                            <!--<li><a><i class="fa fa-medkit"></i> 药品管理 <span class="fa fa-chevron-down"></span></a>-->
+                                <!--<ul class="nav child_menu">-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/refund-medicine')">退药申请</a></li>-->
+                                <!--</ul>-->
+                            <!--</li>-->
+                            <!--<li><a><i class="fa fa-table"></i> 列表管理 <span class="fa fa-chevron-down"></span></a>-->
+                                <!--<ul class="nav child_menu">-->
+                                    <!--<li><a href="#" onclick="changeContent('/thmz/unit-code')">科室列表</a></li>-->
+                                <!--</ul>-->
+                            <!--</li>-->
+                            <!--<li><a><i class="fa fa-clone"></i>Layouts <span class="fa fa-chevron-down"></span></a>-->
+                                <!--<ul class="nav child_menu">-->
+                                    <!--<li><a href="fixed_sidebar.html">Fixed Sidebar</a></li>-->
+                                    <!--<li><a href="fixed_footer.html">Fixed Footer</a></li>-->
+                                <!--</ul>-->
+                            <!--</li>-->
+                        <!--</ul>-->
+                    <!--</div>-->
+                    <!--<div class="menu_section">-->
+                        <!--<h3>系统管理</h3>-->
+                        <!--<ul class="nav side-menu">-->
+                            <!--<li><a><i class="fa fa-bug"></i> Additional Pages <span-->
+                                    <!--class="fa fa-chevron-down"></span></a>-->
+                                <!--<ul class="nav child_menu">-->
+                                    <!--<li><a href="e_commerce.html">E-commerce</a></li>-->
+                                    <!--<li><a href="projects.html">Projects</a></li>-->
+                                    <!--<li><a href="project_detail.html">Project Detail</a></li>-->
+                                    <!--<li><a href="contacts.html">Contacts</a></li>-->
+                                    <!--<li><a href="profile.html">Profile</a></li>-->
+                                <!--</ul>-->
+                            <!--</li>-->
+                            <!--<li><a><i class="fa fa-windows"></i> 菜单权限管理 <span class="fa fa-chevron-down"></span></a>-->
+                                <!--<ul class="nav child_menu">-->
+                                    <!--<li><a onclick="changeContent('/thmz/menu-manage')">菜单管理</a></li>-->
+                                    <!--<li><a onclick="changeContent('/thmz/user-menu-relation')">管理用户权限管理</a></li>-->
+                                <!--</ul>-->
+                            <!--</li>-->
+                            <!--<li><a><i class="fa fa-cog"></i> 基础设置 <span-->
+                                    <!--class="fa fa-chevron-down"></span></a>-->
+                                <!--<ul class="nav child_menu">-->
+                                    <!--<li><a onclick="changeContent('/thmz/sfy-config')">收费参数设置</a></li>-->
+                                    <!--<li><a onclick="changeContent('/thmz/receipt')">发票管理</a> </li>-->
+                                    <!--<li><a href="#level1_2">Level One</a></li>-->
+                                <!--</ul>-->
+                            <!--</li>-->
+                            <!--<li><a href="javascript:void(0)"><i class="fa fa-laptop"></i> Landing Page <span-->
+                                    <!--class="label label-success pull-right">Coming Soon</span></a></li>-->
+                        <!--</ul>-->
+                    <!--</div>-->
+
                 </div>
                 <!-- /sidebar menu -->
 

+ 3 - 0
src/main/resources/templates/user_menu_relation.html

@@ -11,6 +11,9 @@
     <div class="col-md-12 col-sm-12 col-xs-12">
         <div class="x_panel">
             <div class="panel-body text-center" >
+                <button type="button" style="margin-left:20px" id="btn_clean" class="btn btn-primary"
+                        title="重置"><i class="fa fa-rotate-left"></i>
+                </button>
                 <button type="button" style="margin-left:3px" id="btn_save" class="btn btn-primary"
                         title="提交"><i class="fa fa-check"></i>
                 </button>