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-07-19 22:33:54 +08:00
|
|
|
export const getRolePageApi = (params) => {
|
|
|
|
return request.get({ url: '/system/role/page', params })
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 查询角色详情
|
|
|
|
export const getRoleApi = (id: number) => {
|
2022-07-19 22:33:54 +08:00
|
|
|
return request.get({ url: '/system/role/get?id=' + id })
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 新增角色
|
2022-07-19 22:33:54 +08:00
|
|
|
export const createRoleApi = (data: RoleVO) => {
|
|
|
|
return request.post({ url: '/system/role/create', data })
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 修改角色
|
2022-07-19 22:33:54 +08:00
|
|
|
export const updateRoleApi = (data: RoleVO) => {
|
|
|
|
return request.put({ url: '/system/role/update', data })
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 修改角色状态
|
2022-07-19 22:33:54 +08:00
|
|
|
export const updateRoleStatusApi = (data: RoleVO) => {
|
|
|
|
return request.put({ url: '/system/role/update-status', data })
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 删除角色
|
|
|
|
export const deleteRoleApi = (id: number) => {
|
2022-07-19 22:33:54 +08:00
|
|
|
return request.delete({ url: '/system/role/delete?id=' + id })
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|