authorityManage.js
2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
* @Author: yangwei
* @Date: 2023-02-24 15:12:45
* @LastEditors: yangwei
* @LastEditTime: 2023-03-14 10:45:11
* @FilePath: \bdcjg-web\src\api\authorityManage.js
* @Description:
*
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
*/
import { getParams } from './util'
import {
api,
getAction,
deleteAction,
putAction
} from './manageApi'
/** 角色管理开始 */
/**
* @description: 获取角色列表 by categoryId
* @author: renchao
*/
export const getRolesById = categoryIdList => {
const conditionGroup = {
conditions: [
{
property: 'category',
value: categoryIdList,
operator: 'IN'
}
],
queryRelation: 'AND',
}
const params = getParams(conditionGroup)
return getAction(api.roles, params)
}
/** 角色管理结束 */
/** 授权管理开始 */
/**
* @description: 获取权限列表
* @param {*} productId
* @param {*} subsystemCode
* @author: renchao
*/
export const getAuthorityListAction = (productId, subsystemCode) => {
const conditionGroup = {
conditions: [
{
property: 'productId',
value: productId,
operator: 'EQ'
},
{
property: 'code',
value: subsystemCode + '_MENU',
operator: 'EQ'
}
],
queryRelation: 'AND'
}
const params = getParams(conditionGroup)
return getAction(api.resourceCategory, params)
}
/**
* @description: 获取角色的权限 id operationCodes resourceCategoryCode
* @param {*} id 授权id
* @param {*} operationCodes 操作符集合
* @param {*} resourceCategoryCode 菜单默认MENU
* @author: renchao
*/
export const getRoleAuthorityList = (
id,
operationCodes,
resourceCategoryCode
) => {
return getAction(`${api.rolePermissions}/${id}`, {
operationCodes: operationCodes,
resourceCategoryCode: resourceCategoryCode
})
}
/**
* @description: 角色授权
* @param {*} id
* @param {*} permissionDtos
* @author: renchao
*/
export const roleAuthority = (id, permissionDtos) => {
return putAction(`${api.rolePermissions}/${id}`, permissionDtos)
}
/**
* @description: 获取父级菜单
* @param {*} id 系统id
* @author: renchao
*/
export const getParentMenuListAction = (id) => {
let conditionGroup = {}
if (id && id !== '') {
conditionGroup = {
conditions: [
{
property: 'productId',
value: id,
operator: 'EQ'
}
],
queryRelation: 'AND'
}
}
const params = getParams(conditionGroup)
return getAction(api.menus, params)
}