mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-13 14:57:16 +08:00
新增:新增系统管理/角色管理(分页、查看详情、创建、修改、删除)
This commit is contained in:
58
continew-admin-ui/src/api/system/role.ts
Normal file
58
continew-admin-ui/src/api/system/role.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
const BASE_URL = '/system/role';
|
||||
|
||||
export interface RoleRecord {
|
||||
roleId?: number;
|
||||
roleName: string;
|
||||
roleCode?: string;
|
||||
dataScope: number;
|
||||
dataScopeDeptIds?: string;
|
||||
description?: string;
|
||||
roleSort: number;
|
||||
status?: number;
|
||||
createUserString?: string;
|
||||
createTime?: string;
|
||||
updateUserString?: string;
|
||||
updateTime?: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export interface RoleParam {
|
||||
roleName?: string;
|
||||
status?: number;
|
||||
page: number;
|
||||
size: number;
|
||||
sort: Array<string>;
|
||||
}
|
||||
|
||||
export interface RoleListRes {
|
||||
list: RoleRecord[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function listRole(params: RoleParam) {
|
||||
return axios.get<RoleListRes>(`${BASE_URL}`, {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function getRole(id: number) {
|
||||
return axios.get<RoleRecord>(`${BASE_URL}/${id}`);
|
||||
}
|
||||
|
||||
export function createRole(req: RoleRecord) {
|
||||
return axios.post(BASE_URL, req);
|
||||
}
|
||||
|
||||
export function updateRole(req: RoleRecord) {
|
||||
return axios.put(BASE_URL, req);
|
||||
}
|
||||
|
||||
export function deleteRole(ids: number | Array<number>) {
|
||||
return axios.delete(`${BASE_URL}/${ids}`);
|
||||
}
|
Reference in New Issue
Block a user