diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/permission/PermissionAssignUserRoleReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/permission/PermissionAssignUserRoleReqVO.java index 75671bcd2..93cc8ffa2 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/permission/PermissionAssignUserRoleReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/permission/PermissionAssignUserRoleReqVO.java @@ -12,8 +12,8 @@ import java.util.Set; @Data public class PermissionAssignUserRoleReqVO { - @ApiModelProperty(value = "角色编号", required = true, example = "1") - @NotNull(message = "角色编号不能为空") + @ApiModelProperty(value = "用户编号", required = true, example = "1") + @NotNull(message = "用户编号不能为空") private Long userId; @ApiModelProperty(value = "角色编号列表", example = "1,3,5") diff --git a/yudao-ui-admin-vue3/src/api/system/permission/index.ts b/yudao-ui-admin-vue3/src/api/system/permission/index.ts new file mode 100644 index 000000000..f498826ea --- /dev/null +++ b/yudao-ui-admin-vue3/src/api/system/permission/index.ts @@ -0,0 +1,33 @@ +import { useAxios } from '@/hooks/web/useAxios' +import type { + PermissionAssignRoleDataScopeReqVO, + PermissionAssignRoleMenuReqVO, + PermissionAssignUserRoleReqVO +} from './types' + +const request = useAxios() + +// 查询角色拥有的菜单权限 +export const listRoleMenusApi = async (roleId: number) => { + return await request.get({ url: '/system/permission/list-role-resources?roleId=' + roleId }) +} + +// 赋予角色菜单权限 +export const assignRoleMenuApi = async (data: PermissionAssignRoleMenuReqVO) => { + return await request.post({ url: '/system/permission/assign-role-menu', data }) +} + +// 赋予角色数据权限 +export const assignRoleDataScopeApi = async (data: PermissionAssignRoleDataScopeReqVO) => { + return await request.post({ url: '/system/permission/assign-role-data-scope', data }) +} + +// 查询用户拥有的角色数组 +export const listUserRolesApi = async (userId: number) => { + return await request.get({ url: '/system/permission/list-user-roles?userId=' + userId }) +} + +// 赋予用户角色 +export const aassignUserRoleApi = async (data: PermissionAssignUserRoleReqVO) => { + return await request.post({ url: '/system/permission/assign-user-role', data }) +} diff --git a/yudao-ui-admin-vue3/src/api/system/permission/types.ts b/yudao-ui-admin-vue3/src/api/system/permission/types.ts new file mode 100644 index 000000000..1050c39e2 --- /dev/null +++ b/yudao-ui-admin-vue3/src/api/system/permission/types.ts @@ -0,0 +1,15 @@ +export type PermissionAssignUserRoleReqVO = { + userId: number + roleIds: number[] +} + +export type PermissionAssignRoleMenuReqVO = { + roleId: number + menuIds: number[] +} + +export type PermissionAssignRoleDataScopeReqVO = { + roleId: number + dataScope: number + dataScopeDeptIds: number[] +} diff --git a/yudao-ui-admin-vue3/src/api/system/role/index.ts b/yudao-ui-admin-vue3/src/api/system/role/index.ts index 99c8a2d93..c5b3589f0 100644 --- a/yudao-ui-admin-vue3/src/api/system/role/index.ts +++ b/yudao-ui-admin-vue3/src/api/system/role/index.ts @@ -4,31 +4,36 @@ import type { RoleVO } from './types' const request = useAxios() // 查询角色列表 -export const getRolePageApi = (params) => { - return request.get({ url: '/system/role/page', params }) +export const getRolePageApi = async (params) => { + return await request.get({ url: '/system/role/page', params }) +} + +// 查询角色(精简)列表 +export const listSimpleRolesApi = async () => { + return await request.get({ url: '/system/role/list-all-simple' }) } // 查询角色详情 -export const getRoleApi = (id: number) => { - return request.get({ url: '/system/role/get?id=' + id }) +export const getRoleApi = async (id: number) => { + return await request.get({ url: '/system/role/get?id=' + id }) } // 新增角色 -export const createRoleApi = (data: RoleVO) => { - return request.post({ url: '/system/role/create', data }) +export const createRoleApi = async (data: RoleVO) => { + return await request.post({ url: '/system/role/create', data }) } // 修改角色 -export const updateRoleApi = (data: RoleVO) => { - return request.put({ url: '/system/role/update', data }) +export const updateRoleApi = async (data: RoleVO) => { + return await request.put({ url: '/system/role/update', data }) } // 修改角色状态 -export const updateRoleStatusApi = (data: RoleVO) => { - return request.put({ url: '/system/role/update-status', data }) +export const updateRoleStatusApi = async (data: RoleVO) => { + return await request.put({ url: '/system/role/update-status', data }) } // 删除角色 -export const deleteRoleApi = (id: number) => { - return request.delete({ url: '/system/role/delete?id=' + id }) +export const deleteRoleApi = async (id: number) => { + return await request.delete({ url: '/system/role/delete?id=' + id }) } diff --git a/yudao-ui-admin-vue3/src/components/CountTo/src/CountTo.vue b/yudao-ui-admin-vue3/src/components/CountTo/src/CountTo.vue index 7d8d37b1e..cab8ea965 100644 --- a/yudao-ui-admin-vue3/src/components/CountTo/src/CountTo.vue +++ b/yudao-ui-admin-vue3/src/components/CountTo/src/CountTo.vue @@ -157,7 +157,7 @@ const count = (timestamp: number) => { } else { state.printVal = state.printVal > endVal ? endVal : state.printVal } - state.displayValue = formatNumber(state.printVal) + state.displayValue = formatNumber(state.printVal!) if (progress < (state.localDuration as number)) { state.rAF = requestAnimationFrame(count) } else { diff --git a/yudao-ui-admin-vue3/src/views/system/role/index.vue b/yudao-ui-admin-vue3/src/views/system/role/index.vue index 12e3f0eb6..dfae295b1 100644 --- a/yudao-ui-admin-vue3/src/views/system/role/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/role/index.vue @@ -1,14 +1,6 @@