fix(用户组和权限): 用户组修改

This commit is contained in:
shiziyuan9527 2021-05-25 16:05:05 +08:00 committed by 刘瑞斌
parent a3fd15fd84
commit a9c395cc18
3 changed files with 22 additions and 6 deletions

View File

@ -107,6 +107,9 @@ public class GroupService {
} }
public void editGroup(EditGroupRequest request) { public void editGroup(EditGroupRequest request) {
if (StringUtils.equals(request.getId(), "admin")) {
MSException.throwException("系统管理员无法编辑!");
}
checkGroupExist(request); checkGroupExist(request);
Group group = new Group(); Group group = new Group();
request.setScopeId(null); request.setScopeId(null);
@ -116,6 +119,9 @@ public class GroupService {
} }
public void deleteGroup(String id) { public void deleteGroup(String id) {
if (StringUtils.equals(id, "admin")) {
MSException.throwException("系统管理员无法删除!");
}
groupMapper.deleteByPrimaryKey(id); groupMapper.deleteByPrimaryKey(id);
UserGroupPermissionExample example = new UserGroupPermissionExample(); UserGroupPermissionExample example = new UserGroupPermissionExample();
example.createCriteria().andGroupIdEqualTo(id); example.createCriteria().andGroupIdEqualTo(id);

View File

@ -1,6 +1,6 @@
<template> <template>
<el-dialog :close-on-click-modal="false" :visible.sync="dialogVisible" width="50%" <el-dialog :close-on-click-modal="false" :visible.sync="dialogVisible" width="50%"
:title="dialogTitle" :title="title"
:destroy-on-close="true"> :destroy-on-close="true">
<el-form ref="form" :model="form" label-width="auto" size="small" :rules="rules"> <el-form ref="form" :model="form" label-width="auto" size="small" :rules="rules">
<el-row> <el-row>
@ -11,7 +11,7 @@
</el-col> </el-col>
<el-col :span="11" :offset="2"> <el-col :span="11" :offset="2">
<el-form-item label="所属类型" prop="type"> <el-form-item label="所属类型" prop="type">
<el-select v-model="form.type" placeholder="请选择所属类型" style="width: 100%" @change="changeGroup"> <el-select v-model="form.type" placeholder="请选择所属类型" style="width: 100%" @change="changeGroup" :disabled="dialogType === 'edit'">
<el-option label="系统" value="SYSTEM"></el-option> <el-option label="系统" value="SYSTEM"></el-option>
<el-option label="组织" value="ORGANIZATION"></el-option> <el-option label="组织" value="ORGANIZATION"></el-option>
<el-option label="工作空间" value="WORKSPACE"></el-option> <el-option label="工作空间" value="WORKSPACE"></el-option>
@ -70,7 +70,8 @@ export default {
dialogType: '', dialogType: '',
isSystem: false, isSystem: false,
show: true, show: true,
organizations: [] organizations: [],
title: '创建用户组'
} }
}, },
props: { props: {
@ -117,7 +118,8 @@ export default {
this.dialogVisible = false; this.dialogVisible = false;
}) })
}, },
open(row, type) { open(row, type, title) {
this.title = title;
this.isSystem = false; this.isSystem = false;
this.show = true; this.show = true;
this.dialogVisible = true; this.dialogVisible = true;

View File

@ -102,10 +102,14 @@ export default {
}); });
}, },
create() { create() {
this.$refs.editUserGroup.open({}, 'create'); this.$refs.editUserGroup.open({}, 'create', '创建用户组');
}, },
edit(row) { edit(row) {
this.$refs.editUserGroup.open(row, 'edit'); if (row.id === "admin") {
this.$warning("系统管理员不支持编辑!");
return ;
}
this.$refs.editUserGroup.open(row, 'edit', '编辑用户组');
}, },
_handleDel(row) { _handleDel(row) {
this.result = this.$get("/user/group/delete/" + row.id, () => { this.result = this.$get("/user/group/delete/" + row.id, () => {
@ -114,6 +118,10 @@ export default {
}); });
}, },
del(row) { del(row) {
if (row.id === "admin") {
this.$warning("系统管理员不支持删除!");
return ;
}
this.$refs.deleteConfirm.open(row); this.$refs.deleteConfirm.open(row);
}, },
copy(row) { copy(row) {