2022-07-19 22:33:54 +08:00
|
|
|
import { useAxios } from '@/hooks/web/useAxios'
|
2022-07-18 19:06:37 +08:00
|
|
|
import type { RoleVO } from './types'
|
|
|
|
|
2022-07-19 22:33:54 +08:00
|
|
|
const request = useAxios()
|
|
|
|
|
2022-07-18 19:06:37 +08:00
|
|
|
// 查询角色列表
|
2022-08-01 19:03:27 +08:00
|
|
|
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' })
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 查询角色详情
|
2022-08-01 19:03:27 +08:00
|
|
|
export const getRoleApi = async (id: number) => {
|
|
|
|
return await request.get({ url: '/system/role/get?id=' + id })
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 新增角色
|
2022-08-01 19:03:27 +08:00
|
|
|
export const createRoleApi = async (data: RoleVO) => {
|
|
|
|
return await request.post({ url: '/system/role/create', data })
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 修改角色
|
2022-08-01 19:03:27 +08:00
|
|
|
export const updateRoleApi = async (data: RoleVO) => {
|
|
|
|
return await request.put({ url: '/system/role/update', data })
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 修改角色状态
|
2022-08-01 19:03:27 +08:00
|
|
|
export const updateRoleStatusApi = async (data: RoleVO) => {
|
|
|
|
return await request.put({ url: '/system/role/update-status', data })
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 删除角色
|
2022-08-01 19:03:27 +08:00
|
|
|
export const deleteRoleApi = async (id: number) => {
|
|
|
|
return await request.delete({ url: '/system/role/delete?id=' + id })
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|