239 lines
3.7 KiB
TypeScript
239 lines
3.7 KiB
TypeScript
import request from "@/utils/request";
|
|
const baseURL = "account/admin/role";
|
|
|
|
const RoleApi = {
|
|
/** 获取当前用户菜单列表*/
|
|
getList(params: getListRequest) {
|
|
return request<any, getListResponse>({
|
|
url: `${baseURL}/list`,
|
|
method: "get",
|
|
params,
|
|
});
|
|
},
|
|
add(data: addRequest) {
|
|
return request<any, addResponse>({
|
|
url: `${baseURL}`,
|
|
method: "post",
|
|
data,
|
|
});
|
|
},
|
|
update(id: number | string | null, data: editRequest) {
|
|
const requestData = { ...data, id };
|
|
return request<any>({
|
|
url: `${baseURL}`,
|
|
method: "put",
|
|
data: requestData,
|
|
});
|
|
},
|
|
delete(data: delRequest) {
|
|
return request<any, delResponse>({
|
|
url: `${baseURL}`,
|
|
method: "delete",
|
|
data,
|
|
});
|
|
},
|
|
// 获取角色对应的菜单id
|
|
getMenu(id: number) {
|
|
return request<any>({
|
|
url: `${baseURL}/menu`,
|
|
method: "get",
|
|
params: { id },
|
|
});
|
|
},
|
|
};
|
|
|
|
export default RoleApi;
|
|
|
|
/** getList start*/
|
|
export interface getListRequest {
|
|
/**
|
|
* 结束时间
|
|
*/
|
|
endTime?: string;
|
|
/**
|
|
* 角色名称或描述
|
|
*/
|
|
key?: string;
|
|
page: number;
|
|
size: number;
|
|
/**
|
|
* 开始时间
|
|
*/
|
|
startTime?: string;
|
|
[property: string]: any;
|
|
}
|
|
|
|
/**
|
|
* 分页参数
|
|
*
|
|
* CzgResult«Page«SysRole»»
|
|
*/
|
|
export interface getListResponse {
|
|
code?: number | null;
|
|
data?: PageSysRole;
|
|
msg?: null | string;
|
|
[property: string]: any;
|
|
}
|
|
|
|
/**
|
|
* Page«SysRole»
|
|
*/
|
|
export interface PageSysRole {
|
|
maxPageSize?: number | null;
|
|
optimizeCountQuery?: boolean | null;
|
|
pageNumber?: number | null;
|
|
pageSize?: number | null;
|
|
records?: SysRole[] | null;
|
|
totalPage?: number | null;
|
|
totalRow?: number | null;
|
|
[property: string]: any;
|
|
}
|
|
|
|
/**
|
|
* 角色表 实体类。
|
|
*
|
|
* SysRole
|
|
*/
|
|
export interface SysRole {
|
|
/**
|
|
* 创建日期
|
|
*/
|
|
createTime?: null | string;
|
|
/**
|
|
* 创建者
|
|
*/
|
|
createUserId?: number | null;
|
|
/**
|
|
* 描述
|
|
*/
|
|
description?: null | string;
|
|
/**
|
|
* ID
|
|
*/
|
|
id?: number | null;
|
|
/**
|
|
* 角色级别
|
|
*/
|
|
level?: number | null;
|
|
/**
|
|
* 名称
|
|
*/
|
|
name?: null | string;
|
|
/**
|
|
* 商户id
|
|
*/
|
|
shopId?: number | null;
|
|
/**
|
|
* 更新时间
|
|
*/
|
|
updateTime?: null | string;
|
|
/**
|
|
* 更新者
|
|
*/
|
|
updateUserId?: number | null;
|
|
[property: string]: any;
|
|
}
|
|
|
|
/** getList end*/
|
|
|
|
/** add start*/
|
|
/**
|
|
* 角色信息
|
|
*
|
|
* RoleAddDTO
|
|
*/
|
|
export interface addRequest {
|
|
/**
|
|
* 描述
|
|
*/
|
|
description?: null | string;
|
|
/**
|
|
* 角色等级
|
|
*/
|
|
level?: number | null;
|
|
/**
|
|
* 菜单id集合
|
|
*/
|
|
menuIdList: number[] | null;
|
|
/**
|
|
* 角色名称
|
|
*/
|
|
name: null | string;
|
|
[property: string]: any;
|
|
id?: number | null;
|
|
}
|
|
/**
|
|
* 是否成功
|
|
*
|
|
* CzgResult«Boolean»
|
|
*/
|
|
export interface addResponse {
|
|
code?: number | null;
|
|
data?: boolean | null;
|
|
msg?: null | string;
|
|
[property: string]: any;
|
|
}
|
|
/**add end */
|
|
|
|
/** edit start*/
|
|
/**
|
|
* 角色信息
|
|
*
|
|
* RoleEditDTO
|
|
*/
|
|
export interface editRequest {
|
|
description?: null | string;
|
|
/**
|
|
* 角色id
|
|
*/
|
|
id: number | null;
|
|
/**
|
|
* 角色等级
|
|
*/
|
|
level?: number | null;
|
|
menuIdList: number[] | null;
|
|
/**
|
|
* 角色名称
|
|
*/
|
|
name: null | string;
|
|
[property: string]: any;
|
|
}
|
|
/**
|
|
* 是否成功
|
|
*
|
|
* CzgResult«Boolean»
|
|
*/
|
|
export interface editResponse {
|
|
code?: number | null;
|
|
data?: boolean | null;
|
|
msg?: null | string;
|
|
[property: string]: any;
|
|
}
|
|
/** edit end */
|
|
/** delete start*/
|
|
/**
|
|
* 角色信息
|
|
*
|
|
* RoleRemoveDTO
|
|
*/
|
|
export interface delRequest {
|
|
/**
|
|
* 角色id
|
|
*/
|
|
id: number | null;
|
|
[property: string]: any;
|
|
}
|
|
/**
|
|
* 是否成功
|
|
*
|
|
* CzgResult«Boolean»
|
|
*/
|
|
export interface delResponse {
|
|
code?: number | null;
|
|
data?: boolean | null;
|
|
msg?: null | string;
|
|
[property: string]: any;
|
|
}
|
|
/** delete end */
|
|
|