2022-11-03 16:55:01 +08:00
|
|
|
import request from '@/config/axios'
|
2022-11-15 20:12:22 +08:00
|
|
|
|
|
|
|
export type RoleVO = {
|
|
|
|
id: number
|
|
|
|
name: string
|
|
|
|
code: string
|
|
|
|
sort: number
|
|
|
|
status: number
|
|
|
|
type: number
|
|
|
|
createTime: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface RolePageReqVO extends PageParam {
|
|
|
|
name?: string
|
|
|
|
code?: string
|
|
|
|
status?: number
|
|
|
|
createTime?: string[]
|
|
|
|
}
|
2022-07-18 19:06:37 +08:00
|
|
|
|
|
|
|
// 查询角色列表
|
2022-11-15 20:12:22 +08:00
|
|
|
export const getRolePageApi = async (params: RolePageReqVO) => {
|
2022-08-01 19:03:27 +08:00
|
|
|
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
|
|
|
}
|