增加权限类别名称,初始化数据 SQL

perf/export-docx
Jimmy Liow 1 year ago
parent e9289bbe80
commit 4afb1d4371

@ -45,14 +45,34 @@ VALUES ('技术研发部')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category]) INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('所有权限', '*', 'system') VALUES ('所有权限', '*', 'system')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category]) INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('最新团计划', '/reservation/newest', 'oversea') VALUES ('管理账号', '/account/management', 'system')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category]) INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('账单', '/invoice', 'oversea') VALUES ('新增账号', '/account/new', 'system')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('禁用账号', '/account/disable', 'system')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('重置密码', '/account/reset-password', 'system')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('管理角色', '/account/role-new', 'system')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('所有海外功能', '/oversea/all', 'oversea')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('所有国内功能', '/domestic/all', 'domestic')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('所有机票功能', '/air-ticket/all', 'air-ticket')
-- 价格管理
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('管理产品', '/products/*', 'products')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('审核信息', '/products/info/audit', 'products')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('录入信息', '/products/info/put', 'products')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category]) INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('账号权限管理', '/account/management', 'system') VALUES ('审核价格', '/products/offer/audit', 'products')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category]) INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('新增角色', '/account/new-role', 'system') VALUES ('录入价格', '/products/offer/put', 'products')
INSERT INTO [dbo].[auth_permission] ([role_id] ,[res_id]) INSERT INTO [dbo].[auth_permission] ([role_id] ,[res_id])
VALUES (1, 1) VALUES (1, 1)

@ -18,7 +18,7 @@ export const PERM_ACCOUNT_MANAGEMENT = '/account/management'
export const PERM_ACCOUNT_NEW = '/account/new' export const PERM_ACCOUNT_NEW = '/account/new'
export const PERM_ACCOUNT_DISABLE = '/account/disable' export const PERM_ACCOUNT_DISABLE = '/account/disable'
export const PERM_ACCOUNT_RESET_PASSWORD = '/account/reset-password' export const PERM_ACCOUNT_RESET_PASSWORD = '/account/reset-password'
export const PERM_ROLE_NEW = '/account/role/new' export const PERM_ROLE_NEW = '/account/role-new'
// 海外供应商 // 海外供应商
// category: oversea // category: oversea

@ -59,6 +59,14 @@ function RoleList() {
setDataLoading(false) setDataLoading(false)
}) })
const categoryMap = new Map([
['system', '系统管理'],
['oversea', '海外供应商'],
['domestic', '国内供应商'],
['air-ticket', '机票供应商'],
['products', '产品价格'],
]);
const permissionTree = [] const permissionTree = []
fetchPermissionList() fetchPermissionList()
.then(r => { .then(r => {
@ -69,7 +77,7 @@ function RoleList() {
categoryKeys.forEach((categoryName) => { categoryKeys.forEach((categoryName) => {
const permissisonList = groupPermissionData[categoryName] const permissisonList = groupPermissionData[categoryName]
const categoryGroup = { const categoryGroup = {
title: categoryName, title: categoryMap.get(categoryName),
value: categoryName, value: categoryName,
key: categoryName, key: categoryName,
children: permissisonList.map(p => { children: permissisonList.map(p => {
@ -77,7 +85,7 @@ function RoleList() {
disableCheckbox: p.res_id == 1, disableCheckbox: p.res_id == 1,
title: p.res_name, title: p.res_name,
value: p.res_id, value: p.res_id,
key: p.res_id, key: p.res_name,
} }
}) })
} }

Loading…
Cancel
Save