Browse Source

角色树

v6
yanyan 1 year ago
parent
commit
41f28ceac3
  1. 9
      lib/EmergencyService/zdxtEmergencyAuthService/src/main/resources/mapper/system/RoleMapper.xml
  2. 86
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/role/roleNew.html

9
lib/EmergencyService/zdxtEmergencyAuthService/src/main/resources/mapper/system/RoleMapper.xml

@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectRoleContactVo">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope,
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope,r.user_id,r.dept_id,
r.status, r.del_flag, r.create_time, r.remark ,r.tenant_code,r.role_code,r.is_role_sys
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
@ -35,7 +35,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<sql id="selectRoleVo">
select r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status, r.del_flag, r.create_time, r.remark,r.role_code,r.is_role_sys
select r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status,
r.del_flag, r.create_time,r.user_id,r.dept_id, r.remark,r.role_code,r.is_role_sys
from sys_role r
</sql>
@ -80,12 +81,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="checkRoleNameUnique" parameterType="String" resultMap="RoleResult">
<include refid="selectRoleVo"/>
where r.role_name=#{roleName}
where r.role_name=#{roleName} and r.del_flag = '0'
</select>
<select id="checkRoleKeyUnique" parameterType="String" resultMap="RoleResult">
<include refid="selectRoleVo"/>
where r.role_key=#{roleKey}
where r.role_key=#{roleKey} and r.del_flag = '0'
</select>
<delete id="deleteRoleById" parameterType="Long">

86
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/role/roleNew.html

@ -244,39 +244,77 @@
$.modal.openTab("部门管理", url);
}
/* 用户管理-重置密码 */
function resetPwd(userId) {
var url = prefix + '/resetPwd/' + userId;
$.modal.open("重置密码", url, '800', '300');
//角色id
var roleId = "";
//业务字典选择
function dictionary(roleId) {
roleId = roleId;
var options = {
title: '业务字典',
width: "1120",
url: prefix + "/dictionary/" + roleId,
callBack: doSubmit
};
$.modal.openOptions(options);
function doSubmit(index, layero) {
var body = layer.getChildFrame('body', index);
var dictList = body.find('#dictList').val();
var di = dictList.split(",");
dictList = "";
for(var i=0; i<di.length; i++){
if(di[i] != ""){
dictList += di[i] + ",";
}
}
dictList == ""? "":dictList.substring(0,dictList.length-1);
$.operate.post(prefix + "/updateDictionary", { "roleId": roleId, "dictList": dictList });
layer.close(index);
}
}
/* 用户状态显示 */
function statusTools(row) {
if (row.status == 1) {
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.userId + '\')"></i> ';
} else {
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.userId + '\')"></i> ';
}
/* 用户管理-部门 */
function dept() {
var url = ctx + "system/dept";
$.modal.openTab("部门管理", url);
}
/* 用户管理-停用 */
function disable(userId) {
$.modal.confirm("确认要停用用户吗?", function() {
$.operate.post(prefix + "/changeStatus", { "userId": userId, "status": 1 });
})
/* 角色管理-分配数据权限 */
function authDataScope(roleId) {
var url = prefix + '/authDataScope/' + roleId;
$.modal.open("分配数据权限", url);
}
/* 角色管理-分配用户 */
function authUser(roleId) {
var url = prefix + '/authUser/' + roleId;
$.modal.openTab("分配用户", url);
}
/* 角色状态显示 */
function statusTools(row) {
if (row.status == 1) {
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.roleId + '\')"></i> ';
} else {
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.roleId + '\')"></i> ';
}
}
function updateLawCertificateNum(userId) {
$.modal.confirm("确认要更新用户吗?", function () {
$.operate.post(prefix + "/updateZfcode", { "userId": userId });
/* 角色管理-停用 */
function disable(roleId) {
$.modal.confirm("确认要停用角色吗?", function() {
$.operate.post(prefix + "/changeStatus", { "roleId": roleId, "status": 1 });
})
}
/* 用户管理启用 */
function enable(userId) {
$.modal.confirm("确认要启用用户吗?", function() {
$.operate.post(prefix + "/changeStatus", { "userId": userId, "status": 0 });
})
/* 角色管理启用 */
function enable(roleId) {
$.modal.confirm("确认要启用角色吗?", function() {
$.operate.post(prefix + "/changeStatus", { "roleId": roleId, "status": 0 });
})
}
// 异步加载完成后的 事件
function zTreeOnAsyncSuccess(event, treeId, treeNode, msg) {
var treeObjtt = $.fn.zTree.getZTreeObj("tree");

Loading…
Cancel
Save