diff --git a/src/api/menu.ts b/src/api/menu.ts index 6a950d92d5abc65a15c00483d1e76793c2367f84..c612318c5fe8fb4c634c1a657c41c415b5edb371 100644 --- a/src/api/menu.ts +++ b/src/api/menu.ts @@ -2,24 +2,11 @@ import { Menu } from '../types/menu' import request, { QuickResponseData } from '../utils/request' const Api = { - permissionMenuList: '/api/menu/getPermission', list: '/api/menu/getList', add: '/api/menu/add', update: '/api/menu/update', delete: '/api/menu/delete', } - -export const getPermissionMenuList = ( - userId: string -): Promise>> => { - return request>>({ - url: Api.permissionMenuList, - method: 'GET', - params: { - id: userId, - }, - }) -} export const getMenuList = (): Promise>> => { return request>>({ url: Api.list, diff --git a/src/api/role.ts b/src/api/role.ts index 64b7e7aa94650887512feda4e15c1da472997f99..0c70ab8abb7d466136fce2df711ceae057ab97b9 100644 --- a/src/api/role.ts +++ b/src/api/role.ts @@ -1,12 +1,29 @@ +import { Menu } from '@/types/menu' import { Role } from '../types/role' import request, { QuickResponseData } from '../utils/request' const Api = { + menuList: '/api/role/getMenuPermission', + userList: '/api/role/getUserPermission', list: '/api/role/getList', add: '/api/role/add', update: '/api/role/update', delete: '/api/role/delete', + assignPermission: '/api/role/assignPermission', + assignUser: '/api/role/assignUser', } +export const getMenuPermission = ( + roleId: string +): Promise>> => { + return request>>({ + url: Api.menuList, + method: 'GET', + params: { + id: roleId, + }, + }) +} + export const getRoleList = (): Promise>> => { return request>>({ url: Api.list, @@ -37,3 +54,17 @@ export const deleteRole = (id: string) => { }, }) } +export const assignPermission = (data: any) => { + return request({ + url: Api.assignPermission, + method: 'POST', + data, + }) +} +export const assignUser = (data: any) => { + return request({ + url: Api.assignUser, + method: 'POST', + data, + }) +} diff --git a/src/api/user.ts b/src/api/user.ts index 96692d974af4d1e1a6f4bdbbce05ee8e06f9f703..9b6fab333fe7367483d8fb325b0cf8783ab0484b 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -1,3 +1,4 @@ +import { Menu } from '@/types/menu' import { ChangePassword, User } from '../types/user' import request, { QuickResponseData } from '../utils/request' @@ -15,12 +16,14 @@ const Api = { enabled: '/api/user/enabled', disable: '/api/user/disable', } -export const getPermission = (userId: string) => { +export const getPermission = ( + userId: string +): Promise>> => { return request({ url: Api.permission, method: 'GET', - data: { - userId, + params: { + id: userId, }, }) } diff --git a/src/components/QuickCrud/index.vue b/src/components/QuickCrud/index.vue index 6dc6f2ac7efdff5c8ba016df9632512e1272f4c2..92cd07a5854cc116ed465fb08e8222a6c302ef8f 100644 --- a/src/components/QuickCrud/index.vue +++ b/src/components/QuickCrud/index.vue @@ -411,107 +411,120 @@ onActivated(() => { }) + diff --git a/src/components/QuickForm/index.vue b/src/components/QuickForm/index.vue index 45e41f741cc42b2d38cba8a8274675cc096693d4..29f9373eaf1054f502355d68d02c37616e858e0e 100644 --- a/src/components/QuickForm/index.vue +++ b/src/components/QuickForm/index.vue @@ -171,6 +171,9 @@ defineExpose({ handleSubmit }) " /> +