diff --git a/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs b/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs
index 800ad0f..8859cc3 100644
--- a/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs
@@ -7,7 +7,6 @@ using ZR.Common;
using ZR.Admin.WebApi.Filters;
using ZR.Model;
using ZR.Model.System;
-using ZR.Model.Vo;
using ZR.Service.System.IService;
using ZR.Admin.WebApi.Extensions;
@@ -129,6 +128,8 @@ namespace ZR.Admin.WebApi.Controllers.System
if (sysRoleDto == null || sysRoleDto.RoleId <= 0) return ToResponse(ApiResult.Error(101, "请求参数错误"));
sysRoleDto.Create_by = HttpContext.GetName();
+ sysRoleService.CheckRoleAllowed(sysRoleDto);
+
bool result = sysRoleService.UseTran2(() =>
{
//删除角色菜单
@@ -162,9 +163,10 @@ namespace ZR.Admin.WebApi.Controllers.System
///
[HttpPut("changeStatus")]
[Log(Title = "修改角色状态", BusinessType = BusinessType.UPDATE)]
- [ActionPermissionFilter(Permission = "system:role:update")]
+ [ActionPermissionFilter(Permission = "system:role:edit")]
public IActionResult ChangeStatus([FromBody] SysRole roleDto)
{
+ sysRoleService.CheckRoleAllowed(roleDto);
int result = sysRoleService.UpdateRoleStatus(roleDto);
return ToResponse(ToJson(result));
@@ -176,7 +178,7 @@ namespace ZR.Admin.WebApi.Controllers.System
///
[Log(BusinessType = BusinessType.EXPORT, IsSaveResponseData = false, Title = "角色导出")]
[HttpGet("export")]
- [ActionPermissionFilter(Permission = "system:role:export")]
+ //[ActionPermissionFilter(Permission = "system:role:export")]
public IActionResult Export()
{
var list = sysRoleService.SelectRoleAll();
diff --git a/ZR.Admin.WebApi/Controllers/System/SysUserRoleController.cs b/ZR.Admin.WebApi/Controllers/System/SysUserRoleController.cs
index bb40707..e554afd 100644
--- a/ZR.Admin.WebApi/Controllers/System/SysUserRoleController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/SysUserRoleController.cs
@@ -1,11 +1,8 @@
using Infrastructure;
using Infrastructure.Attribute;
using Microsoft.AspNetCore.Mvc;
-using System.Linq;
using ZR.Admin.WebApi.Filters;
-using ZR.Model;
using ZR.Model.System.Dto;
-using ZR.Model.System;
using ZR.Service.System.IService;
namespace ZR.Admin.WebApi.Controllers.System
@@ -31,7 +28,7 @@ namespace ZR.Admin.WebApi.Controllers.System
///
///
[HttpGet("list")]
- [ActionPermissionFilter(Permission = "system:roleusers:query")]
+ [ActionPermissionFilter(Permission = "system:roleusers:list")]
public IActionResult GetList([FromQuery] RoleUserQueryDto roleUserQueryDto)
{
var list = SysUserRoleService.GetSysUsersByRoleId(roleUserQueryDto);
@@ -59,7 +56,7 @@ namespace ZR.Admin.WebApi.Controllers.System
///
///
[HttpPost("delete")]
- [ActionPermissionFilter(Permission = "system:roleusers:del")]
+ [ActionPermissionFilter(Permission = "system:roleusers:remove")]
[Log(Title = "删除角色用户", BusinessType = Infrastructure.Enums.BusinessType.DELETE)]
public IActionResult Delete([FromBody] RoleUsersCreateDto roleUsersCreateDto)
{
diff --git a/ZR.Model/System/SysRole.cs b/ZR.Model/System/SysRole.cs
index 6f26887..4dc7ba8 100644
--- a/ZR.Model/System/SysRole.cs
+++ b/ZR.Model/System/SysRole.cs
@@ -44,7 +44,10 @@ namespace ZR.Model.System
///
[SugarColumn(IsOnlyIgnoreInsert = true, IsOnlyIgnoreUpdate = true)]
public string DelFlag { get; set; }
-
+ ///
+ /// 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 )
+ ///
+ public string DataScope { get; set; }
///
/// 菜单组
///
diff --git a/ZR.Service/System/IService/ISysRoleService.cs b/ZR.Service/System/IService/ISysRoleService.cs
index 2df2b54..b343c0f 100644
--- a/ZR.Service/System/IService/ISysRoleService.cs
+++ b/ZR.Service/System/IService/ISysRoleService.cs
@@ -45,7 +45,7 @@ namespace ZR.Service.System.IService
///
/// 更改角色权限状态
///
- ///
+ ///
///
public int UpdateRoleStatus(SysRole roleDto);
diff --git a/ZR.Vue/src/assets/styles/index.scss b/ZR.Vue/src/assets/styles/index.scss
index bfcf783..01a8951 100644
--- a/ZR.Vue/src/assets/styles/index.scss
+++ b/ZR.Vue/src/assets/styles/index.scss
@@ -521,4 +521,15 @@ aside {
.el-dialog__wrapper .el-dialog {
width: 95% !important;
}
+}
+
+/** 表格更多操作下拉样式 */
+.el-table .el-dropdown-link {
+ cursor: pointer;
+ color: #409EFF;
+ margin-left: 5px;
+}
+
+.el-table .el-dropdown, .el-icon-arrow-down {
+ font-size: 12px;
}
\ No newline at end of file
diff --git a/ZR.Vue/src/main.js b/ZR.Vue/src/main.js
index 4ee9e8a..c0f8b07 100644
--- a/ZR.Vue/src/main.js
+++ b/ZR.Vue/src/main.js
@@ -11,6 +11,7 @@ import App from './App'
import store from './store'
import router from './router'
import permission from './directive/permission'
+import plugins from './plugins' // plugins
import './assets/icons' // icon
import './permission' // permission control
@@ -63,8 +64,9 @@ Vue.component('DictTag', DictTag)
Vue.component('Editor', Editor)
Vue.component('UploadImage', UploadImage)
Vue.component('UploadFile', UploadFile)
-Vue.use(permission)
+Vue.use(permission)
+Vue.use(plugins)
Vue.use(Element, {
size: Cookies.get('size') || 'small' // set element-ui default size
})
diff --git a/ZR.Vue/src/utils/auth.js b/ZR.Vue/src/utils/auth.js
index 40e6249..23926b8 100644
--- a/ZR.Vue/src/utils/auth.js
+++ b/ZR.Vue/src/utils/auth.js
@@ -1,5 +1,5 @@
-import Cookies from 'js-cookie'
+// import Cookies from 'js-cookie'
const TokenKey = 'ZR-Token'
diff --git a/ZR.Vue/src/views/system/dept/index.vue b/ZR.Vue/src/views/system/dept/index.vue
index 0bb2d7b..4f2c974 100644
--- a/ZR.Vue/src/views/system/dept/index.vue
+++ b/ZR.Vue/src/views/system/dept/index.vue
@@ -42,7 +42,7 @@
- 修改
+ 修改
新增
删除
diff --git a/ZR.Vue/src/views/system/role/index.vue b/ZR.Vue/src/views/system/role/index.vue
index 7a8766f..3289159 100644
--- a/ZR.Vue/src/views/system/role/index.vue
+++ b/ZR.Vue/src/views/system/role/index.vue
@@ -23,13 +23,10 @@
新增
-
- 导出
-
-
+
@@ -41,13 +38,21 @@
-
- 修改
- 删除
- 数据权限
+
+ 修改
+
+ 删除
+
+
+ handleCommand(command, scope.row)" v-hasPermi="['system:role:edit']">
+
+ 更多
+
+
+ 数据权限
+ 分配用户
+
+
@@ -58,7 +63,12 @@
{{form.roleKey}}
-
+
+
+
+
+
+
展开/折叠
全选/全不选
父子联动
@@ -68,6 +78,7 @@
@@ -159,26 +170,26 @@ export default {
showRoleScope: false,
// 数据范围选项
dataScopeOptions: [
- {
- value: "1",
- label: "全部数据权限",
- },
+ // {
+ // value: "1",
+ // label: "全部数据权限",
+ // },
{
value: "2",
label: "自定数据权限",
},
- {
- value: "3",
- label: "本部门数据权限",
- },
- {
- value: "4",
- label: "本部门及以下数据权限",
- },
- {
- value: "5",
- label: "仅本人数据权限",
- },
+ // {
+ // value: "3",
+ // label: "本部门数据权限",
+ // },
+ // {
+ // value: "4",
+ // label: "本部门及以下数据权限",
+ // },
+ // {
+ // value: "5",
+ // label: "仅本人数据权限",
+ // },
],
// 菜单列表
menuOptions: [],
@@ -302,6 +313,7 @@ export default {
// 取消按钮
cancel() {
this.open = false;
+ this.showRoleScope = false;
this.reset();
},
// 表单重置
@@ -344,6 +356,19 @@ export default {
this.single = selection.length != 1;
this.multiple = !selection.length;
},
+ // 更多操作触发
+ handleCommand(command, row) {
+ switch (command) {
+ case "handleDataScope":
+ this.handleDataScope(row);
+ break;
+ case "handleAuthUser":
+ this.handleAuthUser(row);
+ break;
+ default:
+ break;
+ }
+ },
// 树权限(展开/折叠)
handleCheckedTreeExpand(value, type) {
if (type == "menu") {
@@ -396,6 +421,12 @@ export default {
this.title = "修改角色";
});
},
+ /** 选择角色权限范围触发 */
+ dataScopeSelectChange(value) {
+ if (value !== "2") {
+ this.$refs.dept.setCheckedKeys([]);
+ }
+ },
/** 分配角色权限按钮操作 */
//新增 和上面代码基本相同
handleDataScope(row) {
@@ -420,9 +451,15 @@ export default {
roleId: row.roleId,
roleName: row.roleName,
roleKey: row.roleKey,
+ dataScope: row.dataScope,
menuCheckStrictly: true,
};
},
+ /** 分配用户操作 */
+ handleAuthUser: function (row) {
+ const roleId = row.roleId;
+ this.$router.push({ path: "/system/roleusers", query: { roleId } });
+ },
/** 提交按钮 */
submitForm: function () {
this.$refs["form"].validate((valid) => {
@@ -460,8 +497,7 @@ export default {
dataScope(this.form).then((response) => {
this.msgSuccess("修改成功");
this.getList();
- this.showRoleScope = false;
- this.handleDataScope({ roleId: this.form.roleId });
+ this.cancel();
});
} else {
this.msgError("请选择角色");
diff --git a/ZR.Vue/src/views/system/roleusers/index.vue b/ZR.Vue/src/views/system/roleusers/index.vue
index d9737dd..c396a5a 100644
--- a/ZR.Vue/src/views/system/roleusers/index.vue
+++ b/ZR.Vue/src/views/system/roleusers/index.vue
@@ -1,53 +1,72 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+
+
+
+
+
+
+ 添加用户
+
-
-
-
- 添加用户
-
-
- 批量取消授权
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 取消授权
-
-
-
-
+
+
+ 批量取消授权
+
+
+ 关闭
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消授权
+
+
+
+
+
-
+
-
+
@@ -64,7 +83,8 @@
-
+