正在显示
12 个修改的文件
包含
123 行增加
和
12 行删除
| @@ -37,6 +37,12 @@ public class SysRole extends BaseEntity | @@ -37,6 +37,12 @@ public class SysRole extends BaseEntity | ||
| 37 | @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限") | 37 | @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限") |
| 38 | private String dataScope; | 38 | private String dataScope; |
| 39 | 39 | ||
| 40 | + /** 菜单树选择项是否关联显示(0:父子互相关联显示 1:父子不互相关联显示) */ | ||
| 41 | + private boolean menuCheckStrictly; | ||
| 42 | + | ||
| 43 | + /** 部门树选择项是否关联显示(0:父子互相关联显示 1:父子不互相关联显示) */ | ||
| 44 | + private boolean deptCheckStrictly; | ||
| 45 | + | ||
| 40 | /** 角色状态(0正常 1停用) */ | 46 | /** 角色状态(0正常 1停用) */ |
| 41 | @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") | 47 | @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") |
| 42 | private String status; | 48 | private String status; |
| @@ -128,6 +134,26 @@ public class SysRole extends BaseEntity | @@ -128,6 +134,26 @@ public class SysRole extends BaseEntity | ||
| 128 | this.dataScope = dataScope; | 134 | this.dataScope = dataScope; |
| 129 | } | 135 | } |
| 130 | 136 | ||
| 137 | + public boolean isMenuCheckStrictly() | ||
| 138 | + { | ||
| 139 | + return menuCheckStrictly; | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + public void setMenuCheckStrictly(boolean menuCheckStrictly) | ||
| 143 | + { | ||
| 144 | + this.menuCheckStrictly = menuCheckStrictly; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public boolean isDeptCheckStrictly() | ||
| 148 | + { | ||
| 149 | + return deptCheckStrictly; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + public void setDeptCheckStrictly(boolean deptCheckStrictly) | ||
| 153 | + { | ||
| 154 | + this.deptCheckStrictly = deptCheckStrictly; | ||
| 155 | + } | ||
| 156 | + | ||
| 131 | public String getStatus() | 157 | public String getStatus() |
| 132 | { | 158 | { |
| 133 | return status; | 159 | return status; |
| @@ -23,9 +23,10 @@ public interface SysDeptMapper | @@ -23,9 +23,10 @@ public interface SysDeptMapper | ||
| 23 | * 根据角色ID查询部门树信息 | 23 | * 根据角色ID查询部门树信息 |
| 24 | * | 24 | * |
| 25 | * @param roleId 角色ID | 25 | * @param roleId 角色ID |
| 26 | + * @param deptCheckStrictly 部门树选择项是否关联显示 | ||
| 26 | * @return 选中部门列表 | 27 | * @return 选中部门列表 |
| 27 | */ | 28 | */ |
| 28 | - public List<Integer> selectDeptListByRoleId(Long roleId); | 29 | + public List<Integer> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); |
| 29 | 30 | ||
| 30 | /** | 31 | /** |
| 31 | * 根据部门ID查询信息 | 32 | * 根据部门ID查询信息 |
| @@ -61,9 +61,10 @@ public interface SysMenuMapper | @@ -61,9 +61,10 @@ public interface SysMenuMapper | ||
| 61 | * 根据角色ID查询菜单树信息 | 61 | * 根据角色ID查询菜单树信息 |
| 62 | * | 62 | * |
| 63 | * @param roleId 角色ID | 63 | * @param roleId 角色ID |
| 64 | + * @param menuCheckStrictly 菜单树选择项是否关联显示 | ||
| 64 | * @return 选中菜单列表 | 65 | * @return 选中菜单列表 |
| 65 | */ | 66 | */ |
| 66 | - public List<Integer> selectMenuListByRoleId(Long roleId); | 67 | + public List<Integer> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly); |
| 67 | 68 | ||
| 68 | /** | 69 | /** |
| 69 | * 根据菜单ID查询信息 | 70 | * 根据菜单ID查询信息 |
| @@ -10,9 +10,11 @@ import com.ruoyi.common.annotation.DataScope; | @@ -10,9 +10,11 @@ import com.ruoyi.common.annotation.DataScope; | ||
| 10 | import com.ruoyi.common.constant.UserConstants; | 10 | import com.ruoyi.common.constant.UserConstants; |
| 11 | import com.ruoyi.common.core.domain.TreeSelect; | 11 | import com.ruoyi.common.core.domain.TreeSelect; |
| 12 | import com.ruoyi.common.core.domain.entity.SysDept; | 12 | import com.ruoyi.common.core.domain.entity.SysDept; |
| 13 | +import com.ruoyi.common.core.domain.entity.SysRole; | ||
| 13 | import com.ruoyi.common.exception.CustomException; | 14 | import com.ruoyi.common.exception.CustomException; |
| 14 | import com.ruoyi.common.utils.StringUtils; | 15 | import com.ruoyi.common.utils.StringUtils; |
| 15 | import com.ruoyi.system.mapper.SysDeptMapper; | 16 | import com.ruoyi.system.mapper.SysDeptMapper; |
| 17 | +import com.ruoyi.system.mapper.SysRoleMapper; | ||
| 16 | import com.ruoyi.system.service.ISysDeptService; | 18 | import com.ruoyi.system.service.ISysDeptService; |
| 17 | 19 | ||
| 18 | /** | 20 | /** |
| @@ -26,6 +28,9 @@ public class SysDeptServiceImpl implements ISysDeptService | @@ -26,6 +28,9 @@ public class SysDeptServiceImpl implements ISysDeptService | ||
| 26 | @Autowired | 28 | @Autowired |
| 27 | private SysDeptMapper deptMapper; | 29 | private SysDeptMapper deptMapper; |
| 28 | 30 | ||
| 31 | + @Autowired | ||
| 32 | + private SysRoleMapper roleMapper; | ||
| 33 | + | ||
| 29 | /** | 34 | /** |
| 30 | * 查询部门管理数据 | 35 | * 查询部门管理数据 |
| 31 | * | 36 | * |
| @@ -93,7 +98,8 @@ public class SysDeptServiceImpl implements ISysDeptService | @@ -93,7 +98,8 @@ public class SysDeptServiceImpl implements ISysDeptService | ||
| 93 | @Override | 98 | @Override |
| 94 | public List<Integer> selectDeptListByRoleId(Long roleId) | 99 | public List<Integer> selectDeptListByRoleId(Long roleId) |
| 95 | { | 100 | { |
| 96 | - return deptMapper.selectDeptListByRoleId(roleId); | 101 | + SysRole role = roleMapper.selectRoleById(roleId); |
| 102 | + return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly()); | ||
| 97 | } | 103 | } |
| 98 | 104 | ||
| 99 | /** | 105 | /** |
| @@ -13,12 +13,14 @@ import org.springframework.stereotype.Service; | @@ -13,12 +13,14 @@ import org.springframework.stereotype.Service; | ||
| 13 | import com.ruoyi.common.constant.UserConstants; | 13 | import com.ruoyi.common.constant.UserConstants; |
| 14 | import com.ruoyi.common.core.domain.TreeSelect; | 14 | import com.ruoyi.common.core.domain.TreeSelect; |
| 15 | import com.ruoyi.common.core.domain.entity.SysMenu; | 15 | import com.ruoyi.common.core.domain.entity.SysMenu; |
| 16 | +import com.ruoyi.common.core.domain.entity.SysRole; | ||
| 16 | import com.ruoyi.common.core.domain.entity.SysUser; | 17 | import com.ruoyi.common.core.domain.entity.SysUser; |
| 17 | import com.ruoyi.common.utils.SecurityUtils; | 18 | import com.ruoyi.common.utils.SecurityUtils; |
| 18 | import com.ruoyi.common.utils.StringUtils; | 19 | import com.ruoyi.common.utils.StringUtils; |
| 19 | import com.ruoyi.system.domain.vo.MetaVo; | 20 | import com.ruoyi.system.domain.vo.MetaVo; |
| 20 | import com.ruoyi.system.domain.vo.RouterVo; | 21 | import com.ruoyi.system.domain.vo.RouterVo; |
| 21 | import com.ruoyi.system.mapper.SysMenuMapper; | 22 | import com.ruoyi.system.mapper.SysMenuMapper; |
| 23 | +import com.ruoyi.system.mapper.SysRoleMapper; | ||
| 22 | import com.ruoyi.system.mapper.SysRoleMenuMapper; | 24 | import com.ruoyi.system.mapper.SysRoleMenuMapper; |
| 23 | import com.ruoyi.system.service.ISysMenuService; | 25 | import com.ruoyi.system.service.ISysMenuService; |
| 24 | 26 | ||
| @@ -36,6 +38,9 @@ public class SysMenuServiceImpl implements ISysMenuService | @@ -36,6 +38,9 @@ public class SysMenuServiceImpl implements ISysMenuService | ||
| 36 | private SysMenuMapper menuMapper; | 38 | private SysMenuMapper menuMapper; |
| 37 | 39 | ||
| 38 | @Autowired | 40 | @Autowired |
| 41 | + private SysRoleMapper roleMapper; | ||
| 42 | + | ||
| 43 | + @Autowired | ||
| 39 | private SysRoleMenuMapper roleMenuMapper; | 44 | private SysRoleMenuMapper roleMenuMapper; |
| 40 | 45 | ||
| 41 | /** | 46 | /** |
| @@ -124,7 +129,8 @@ public class SysMenuServiceImpl implements ISysMenuService | @@ -124,7 +129,8 @@ public class SysMenuServiceImpl implements ISysMenuService | ||
| 124 | @Override | 129 | @Override |
| 125 | public List<Integer> selectMenuListByRoleId(Long roleId) | 130 | public List<Integer> selectMenuListByRoleId(Long roleId) |
| 126 | { | 131 | { |
| 127 | - return menuMapper.selectMenuListByRoleId(roleId); | 132 | + SysRole role = roleMapper.selectRoleById(roleId); |
| 133 | + return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly()); | ||
| 128 | } | 134 | } |
| 129 | 135 | ||
| 130 | /** | 136 | /** |
| @@ -44,12 +44,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -44,12 +44,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 44 | order by d.parent_id, d.order_num | 44 | order by d.parent_id, d.order_num |
| 45 | </select> | 45 | </select> |
| 46 | 46 | ||
| 47 | - <select id="selectDeptListByRoleId" parameterType="Long" resultType="Integer"> | ||
| 48 | - select d.dept_id, d.parent_id | 47 | + <select id="selectDeptListByRoleId" resultType="Integer"> |
| 48 | + select d.dept_id | ||
| 49 | from sys_dept d | 49 | from sys_dept d |
| 50 | left join sys_role_dept rd on d.dept_id = rd.dept_id | 50 | left join sys_role_dept rd on d.dept_id = rd.dept_id |
| 51 | where rd.role_id = #{roleId} | 51 | where rd.role_id = #{roleId} |
| 52 | + <if test="deptCheckStrictly"> | ||
| 52 | and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId}) | 53 | and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId}) |
| 54 | + </if> | ||
| 53 | order by d.parent_id, d.order_num | 55 | order by d.parent_id, d.order_num |
| 54 | </select> | 56 | </select> |
| 55 | 57 |
| @@ -82,12 +82,14 @@ | @@ -82,12 +82,14 @@ | ||
| 82 | order by m.parent_id, m.order_num | 82 | order by m.parent_id, m.order_num |
| 83 | </select> | 83 | </select> |
| 84 | 84 | ||
| 85 | - <select id="selectMenuListByRoleId" parameterType="Long" resultType="Integer"> | ||
| 86 | - select m.menu_id, m.parent_id | 85 | + <select id="selectMenuListByRoleId" resultType="Integer"> |
| 86 | + select m.menu_id | ||
| 87 | from sys_menu m | 87 | from sys_menu m |
| 88 | left join sys_role_menu rm on m.menu_id = rm.menu_id | 88 | left join sys_role_menu rm on m.menu_id = rm.menu_id |
| 89 | where rm.role_id = #{roleId} | 89 | where rm.role_id = #{roleId} |
| 90 | + <if test="menuCheckStrictly"> | ||
| 90 | and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id = rm.menu_id and rm.role_id = #{roleId}) | 91 | and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id = rm.menu_id and rm.role_id = #{roleId}) |
| 92 | + </if> | ||
| 91 | order by m.parent_id, m.order_num | 93 | order by m.parent_id, m.order_num |
| 92 | </select> | 94 | </select> |
| 93 | 95 |
| @@ -10,6 +10,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -10,6 +10,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 10 | <result property="roleKey" column="role_key" /> | 10 | <result property="roleKey" column="role_key" /> |
| 11 | <result property="roleSort" column="role_sort" /> | 11 | <result property="roleSort" column="role_sort" /> |
| 12 | <result property="dataScope" column="data_scope" /> | 12 | <result property="dataScope" column="data_scope" /> |
| 13 | + <result property="menuCheckStrictly" column="menu_check_strictly" /> | ||
| 14 | + <result property="deptCheckStrictly" column="dept_check_strictly" /> | ||
| 13 | <result property="status" column="status" /> | 15 | <result property="status" column="status" /> |
| 14 | <result property="delFlag" column="del_flag" /> | 16 | <result property="delFlag" column="del_flag" /> |
| 15 | <result property="createBy" column="create_by" /> | 17 | <result property="createBy" column="create_by" /> |
| @@ -20,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -20,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 20 | </resultMap> | 22 | </resultMap> |
| 21 | 23 | ||
| 22 | <sql id="selectRoleVo"> | 24 | <sql id="selectRoleVo"> |
| 23 | - select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, | 25 | + select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly, |
| 24 | r.status, r.del_flag, r.create_time, r.remark | 26 | r.status, r.del_flag, r.create_time, r.remark |
| 25 | from sys_role r | 27 | from sys_role r |
| 26 | left join sys_user_role ur on ur.role_id = r.role_id | 28 | left join sys_user_role ur on ur.role_id = r.role_id |
| @@ -95,6 +97,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -95,6 +97,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 95 | <if test="roleKey != null and roleKey != ''">role_key,</if> | 97 | <if test="roleKey != null and roleKey != ''">role_key,</if> |
| 96 | <if test="roleSort != null and roleSort != ''">role_sort,</if> | 98 | <if test="roleSort != null and roleSort != ''">role_sort,</if> |
| 97 | <if test="dataScope != null and dataScope != ''">data_scope,</if> | 99 | <if test="dataScope != null and dataScope != ''">data_scope,</if> |
| 100 | + <if test="menuCheckStrictly != null and menuCheckStrictly != ''">menu_check_strictly,</if> | ||
| 101 | + <if test="deptCheckStrictly != null and deptCheckStrictly != ''">dept_check_strictly,</if> | ||
| 98 | <if test="status != null and status != ''">status,</if> | 102 | <if test="status != null and status != ''">status,</if> |
| 99 | <if test="remark != null and remark != ''">remark,</if> | 103 | <if test="remark != null and remark != ''">remark,</if> |
| 100 | <if test="createBy != null and createBy != ''">create_by,</if> | 104 | <if test="createBy != null and createBy != ''">create_by,</if> |
| @@ -105,6 +109,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -105,6 +109,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 105 | <if test="roleKey != null and roleKey != ''">#{roleKey},</if> | 109 | <if test="roleKey != null and roleKey != ''">#{roleKey},</if> |
| 106 | <if test="roleSort != null and roleSort != ''">#{roleSort},</if> | 110 | <if test="roleSort != null and roleSort != ''">#{roleSort},</if> |
| 107 | <if test="dataScope != null and dataScope != ''">#{dataScope},</if> | 111 | <if test="dataScope != null and dataScope != ''">#{dataScope},</if> |
| 112 | + <if test="menuCheckStrictly != null">#{menu_check_strictly},</if> | ||
| 113 | + <if test="deptCheckStrictly != null">#{dept_check_strictly},</if> | ||
| 108 | <if test="status != null and status != ''">#{status},</if> | 114 | <if test="status != null and status != ''">#{status},</if> |
| 109 | <if test="remark != null and remark != ''">#{remark},</if> | 115 | <if test="remark != null and remark != ''">#{remark},</if> |
| 110 | <if test="createBy != null and createBy != ''">#{createBy},</if> | 116 | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| @@ -119,6 +125,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -119,6 +125,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 119 | <if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if> | 125 | <if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if> |
| 120 | <if test="roleSort != null and roleSort != ''">role_sort = #{roleSort},</if> | 126 | <if test="roleSort != null and roleSort != ''">role_sort = #{roleSort},</if> |
| 121 | <if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if> | 127 | <if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if> |
| 128 | + <if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if> | ||
| 129 | + <if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if> | ||
| 122 | <if test="status != null and status != ''">status = #{status},</if> | 130 | <if test="status != null and status != ''">status = #{status},</if> |
| 123 | <if test="remark != null">remark = #{remark},</if> | 131 | <if test="remark != null">remark = #{remark},</if> |
| 124 | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> | 132 | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| @@ -92,6 +92,14 @@ | @@ -92,6 +92,14 @@ | ||
| 92 | padding: 10px 20px !important; | 92 | padding: 10px 20px !important; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | +/* tree border */ | ||
| 96 | +.tree-border { | ||
| 97 | + margin-top: 5px; | ||
| 98 | + border: 1px solid #e5e6e7; | ||
| 99 | + background: #FFFFFF none; | ||
| 100 | + border-radius:4px; | ||
| 101 | +} | ||
| 102 | + | ||
| 95 | .pagination-container .el-pagination { | 103 | .pagination-container .el-pagination { |
| 96 | right: 0; | 104 | right: 0; |
| 97 | position: absolute; | 105 | position: absolute; |
| @@ -175,11 +175,16 @@ | @@ -175,11 +175,16 @@ | ||
| 175 | </el-radio-group> | 175 | </el-radio-group> |
| 176 | </el-form-item> | 176 | </el-form-item> |
| 177 | <el-form-item label="菜单权限"> | 177 | <el-form-item label="菜单权限"> |
| 178 | + <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox> | ||
| 179 | + <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox> | ||
| 180 | + <el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')">父子联动</el-checkbox> | ||
| 178 | <el-tree | 181 | <el-tree |
| 182 | + class="tree-border" | ||
| 179 | :data="menuOptions" | 183 | :data="menuOptions" |
| 180 | show-checkbox | 184 | show-checkbox |
| 181 | ref="menu" | 185 | ref="menu" |
| 182 | node-key="id" | 186 | node-key="id" |
| 187 | + :check-strictly="!form.menuCheckStrictly" | ||
| 183 | empty-text="加载中,请稍后" | 188 | empty-text="加载中,请稍后" |
| 184 | :props="defaultProps" | 189 | :props="defaultProps" |
| 185 | ></el-tree> | 190 | ></el-tree> |
| @@ -214,12 +219,17 @@ | @@ -214,12 +219,17 @@ | ||
| 214 | </el-select> | 219 | </el-select> |
| 215 | </el-form-item> | 220 | </el-form-item> |
| 216 | <el-form-item label="数据权限" v-show="form.dataScope == 2"> | 221 | <el-form-item label="数据权限" v-show="form.dataScope == 2"> |
| 222 | + <el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">展开/折叠</el-checkbox> | ||
| 223 | + <el-checkbox v-model="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">全选/全不选</el-checkbox> | ||
| 224 | + <el-checkbox v-model="form.deptCheckStrictly" @change="handleCheckedTreeConnect($event, 'dept')">父子联动</el-checkbox> | ||
| 217 | <el-tree | 225 | <el-tree |
| 226 | + class="tree-border" | ||
| 218 | :data="deptOptions" | 227 | :data="deptOptions" |
| 219 | show-checkbox | 228 | show-checkbox |
| 220 | default-expand-all | 229 | default-expand-all |
| 221 | ref="dept" | 230 | ref="dept" |
| 222 | node-key="id" | 231 | node-key="id" |
| 232 | + :check-strictly="!form.deptCheckStrictly" | ||
| 223 | empty-text="加载中,请稍后" | 233 | empty-text="加载中,请稍后" |
| 224 | :props="defaultProps" | 234 | :props="defaultProps" |
| 225 | ></el-tree> | 235 | ></el-tree> |
| @@ -262,6 +272,10 @@ export default { | @@ -262,6 +272,10 @@ export default { | ||
| 262 | open: false, | 272 | open: false, |
| 263 | // 是否显示弹出层(数据权限) | 273 | // 是否显示弹出层(数据权限) |
| 264 | openDataScope: false, | 274 | openDataScope: false, |
| 275 | + menuExpand: false, | ||
| 276 | + menuNodeAll: false, | ||
| 277 | + deptExpand: true, | ||
| 278 | + deptNodeAll: false, | ||
| 265 | // 日期范围 | 279 | // 日期范围 |
| 266 | dateRange: [], | 280 | dateRange: [], |
| 267 | // 状态数据字典 | 281 | // 状态数据字典 |
| @@ -413,6 +427,10 @@ export default { | @@ -413,6 +427,10 @@ export default { | ||
| 413 | if (this.$refs.menu != undefined) { | 427 | if (this.$refs.menu != undefined) { |
| 414 | this.$refs.menu.setCheckedKeys([]); | 428 | this.$refs.menu.setCheckedKeys([]); |
| 415 | } | 429 | } |
| 430 | + this.menuExpand = false, | ||
| 431 | + this.menuNodeAll = false, | ||
| 432 | + this.deptExpand = true, | ||
| 433 | + this.deptNodeAll = false, | ||
| 416 | this.form = { | 434 | this.form = { |
| 417 | roleId: undefined, | 435 | roleId: undefined, |
| 418 | roleName: undefined, | 436 | roleName: undefined, |
| @@ -421,6 +439,7 @@ export default { | @@ -421,6 +439,7 @@ export default { | ||
| 421 | status: "0", | 439 | status: "0", |
| 422 | menuIds: [], | 440 | menuIds: [], |
| 423 | deptIds: [], | 441 | deptIds: [], |
| 442 | + menuCheckStrictly: true, | ||
| 424 | remark: undefined | 443 | remark: undefined |
| 425 | }; | 444 | }; |
| 426 | this.resetForm("form"); | 445 | this.resetForm("form"); |
| @@ -442,6 +461,36 @@ export default { | @@ -442,6 +461,36 @@ export default { | ||
| 442 | this.single = selection.length!=1 | 461 | this.single = selection.length!=1 |
| 443 | this.multiple = !selection.length | 462 | this.multiple = !selection.length |
| 444 | }, | 463 | }, |
| 464 | + // 树权限(展开/折叠) | ||
| 465 | + handleCheckedTreeExpand(value, type) { | ||
| 466 | + if (type == 'menu') { | ||
| 467 | + let treeList = this.menuOptions; | ||
| 468 | + for (let i = 0; i < treeList.length; i++) { | ||
| 469 | + this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value; | ||
| 470 | + } | ||
| 471 | + } else if (type == 'dept') { | ||
| 472 | + let treeList = this.deptOptions; | ||
| 473 | + for (let i = 0; i < treeList.length; i++) { | ||
| 474 | + this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value; | ||
| 475 | + } | ||
| 476 | + } | ||
| 477 | + }, | ||
| 478 | + // 树权限(全选/全不选) | ||
| 479 | + handleCheckedTreeNodeAll(value, type) { | ||
| 480 | + if (type == 'menu') { | ||
| 481 | + this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []); | ||
| 482 | + } else if (type == 'dept') { | ||
| 483 | + this.$refs.dept.setCheckedNodes(value ? this.deptOptions: []); | ||
| 484 | + } | ||
| 485 | + }, | ||
| 486 | + // 树权限(父子联动) | ||
| 487 | + handleCheckedTreeConnect(value, type) { | ||
| 488 | + if (type == 'menu') { | ||
| 489 | + this.form.menuCheckStrictly = value ? true: false; | ||
| 490 | + } else if (type == 'dept') { | ||
| 491 | + this.form.deptCheckStrictly = value ? true: false; | ||
| 492 | + } | ||
| 493 | + }, | ||
| 445 | /** 新增按钮操作 */ | 494 | /** 新增按钮操作 */ |
| 446 | handleAdd() { | 495 | handleAdd() { |
| 447 | this.reset(); | 496 | this.reset(); |
| @@ -93,7 +93,7 @@ | @@ -93,7 +93,7 @@ | ||
| 93 | </el-col> | 93 | </el-col> |
| 94 | <el-col :span="12"> | 94 | <el-col :span="12"> |
| 95 | <el-form-item label="归属部门" prop="deptId"> | 95 | <el-form-item label="归属部门" prop="deptId"> |
| 96 | - <treeselect v-model="form.deptId" :options="deptOptions" :disable-branch-nodes="true" :show-count="true" placeholder="请选择归属部门" /> | 96 | + <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" /> |
| 97 | </el-form-item> | 97 | </el-form-item> |
| 98 | </el-col> | 98 | </el-col> |
| 99 | </el-row> | 99 | </el-row> |
| @@ -107,6 +107,8 @@ create table sys_role ( | @@ -107,6 +107,8 @@ create table sys_role ( | ||
| 107 | role_key varchar(100) not null comment '角色权限字符串', | 107 | role_key varchar(100) not null comment '角色权限字符串', |
| 108 | role_sort int(4) not null comment '显示顺序', | 108 | role_sort int(4) not null comment '显示顺序', |
| 109 | data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', | 109 | data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', |
| 110 | + menu_check_strictly tinyint(1) default 1 comment '菜单树选择项是否关联显示', | ||
| 111 | + dept_check_strictly tinyint(1) default 1 comment '部门树选择项是否关联显示', | ||
| 110 | status char(1) not null comment '角色状态(0正常 1停用)', | 112 | status char(1) not null comment '角色状态(0正常 1停用)', |
| 111 | del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', | 113 | del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', |
| 112 | create_by varchar(64) default '' comment '创建者', | 114 | create_by varchar(64) default '' comment '创建者', |
| @@ -120,8 +122,8 @@ create table sys_role ( | @@ -120,8 +122,8 @@ create table sys_role ( | ||
| 120 | -- ---------------------------- | 122 | -- ---------------------------- |
| 121 | -- 初始化-角色信息表数据 | 123 | -- 初始化-角色信息表数据 |
| 122 | -- ---------------------------- | 124 | -- ---------------------------- |
| 123 | -insert into sys_role values('1', '超级管理员', 'admin', 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '超级管理员'); | ||
| 124 | -insert into sys_role values('2', '普通角色', 'common', 2, 2, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '普通角色'); | 125 | +insert into sys_role values('1', '超级管理员', 'admin', 1, 1, 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '超级管理员'); |
| 126 | +insert into sys_role values('2', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '普通角色'); | ||
| 125 | 127 | ||
| 126 | 128 | ||
| 127 | -- ---------------------------- | 129 | -- ---------------------------- |
-
请 注册 或 登录 后发表评论