369 lines
5.7 KiB
TypeScript
369 lines
5.7 KiB
TypeScript
import request from "@/utils/request";
|
||
import { Account_BaseUrl } from "@/api/config";
|
||
const baseURL = Account_BaseUrl + "/admin/menus";
|
||
const MenuApi = {
|
||
/** 获取当前用户菜单列表*/
|
||
getRoutes() {
|
||
return request<any, RouteVO[]>({
|
||
url: `${baseURL}`,
|
||
method: "get",
|
||
});
|
||
},
|
||
getCashMenus() {
|
||
return request<any, CashMenu[]>({
|
||
url: `${baseURL}/list/cash`,
|
||
method: "get",
|
||
});
|
||
},
|
||
/**获取所有菜单 */
|
||
getList(data: getListRequest) {
|
||
return request<any, MenuVO[]>({
|
||
url: `${baseURL}/list`,
|
||
method: "get",
|
||
params: data
|
||
});
|
||
},
|
||
get(id: string) {
|
||
return request<any, SysMenu>({
|
||
url: `${baseURL}/detail`,
|
||
method: "get",
|
||
params: { id }
|
||
});
|
||
},
|
||
add(data: addRequest) {
|
||
return request<any>({
|
||
url: `${baseURL}`,
|
||
method: "post",
|
||
data
|
||
});
|
||
},
|
||
edit(id: string | number, data: editRequest) {
|
||
return request<any>({
|
||
url: `${baseURL}`,
|
||
method: "put",
|
||
data: { ...data, id }
|
||
});
|
||
},
|
||
delete(id: number) {
|
||
return request<any>({
|
||
url: `${baseURL}`,
|
||
method: "delete",
|
||
data: { id }
|
||
});
|
||
},
|
||
};
|
||
|
||
export default MenuApi;
|
||
export interface CashMenu {
|
||
component?: null | string;
|
||
menuId: number;
|
||
name: null | string;
|
||
path?: null | string;
|
||
[property: string]: any;
|
||
}
|
||
|
||
/** RouteVO,路由对象 */
|
||
export interface RouteVO {
|
||
/** 子路由列表 */
|
||
children: RouteVO[];
|
||
/** 组件路径 */
|
||
component?: string;
|
||
/** 路由属性 */
|
||
meta?: Meta;
|
||
/** 路由名称 */
|
||
name?: string;
|
||
/** 路由路径 */
|
||
path?: string;
|
||
/** 跳转链接 */
|
||
redirect?: string;
|
||
title: string,
|
||
menuId: string | number,
|
||
}
|
||
/** Meta,路由属性 */
|
||
export interface Meta {
|
||
/** 【目录】只有一个子路由是否始终显示 */
|
||
alwaysShow?: boolean;
|
||
/** 是否隐藏(true-是 false-否) */
|
||
hidden?: boolean;
|
||
/** ICON */
|
||
icon?: string;
|
||
/** 【菜单】是否开启页面缓存 */
|
||
keepAlive?: boolean;
|
||
/** 路由title */
|
||
title?: string;
|
||
}
|
||
|
||
export interface getListRequest {
|
||
/**
|
||
* 结束时间
|
||
*/
|
||
endTime?: string;
|
||
/**
|
||
* 开始时间
|
||
*/
|
||
startTime?: string;
|
||
/**
|
||
* 菜单名称
|
||
*/
|
||
title?: string;
|
||
[property: string]: any;
|
||
}
|
||
|
||
/**
|
||
* MenuAddDTO
|
||
*/
|
||
export interface addRequest {
|
||
/**
|
||
* 是否选中父级菜单
|
||
*/
|
||
activeMenu?: null | string;
|
||
/**
|
||
* 是否缓存
|
||
*/
|
||
cache: number | string;
|
||
/**
|
||
* 组件
|
||
*/
|
||
component: number | string;
|
||
/**
|
||
* 是否隐藏
|
||
*/
|
||
hidden: number | string;
|
||
/**
|
||
* 图标
|
||
*/
|
||
icon: string;
|
||
/**
|
||
* 是否外链
|
||
*/
|
||
iFrame: number | string;
|
||
/**
|
||
* 菜单排序
|
||
*/
|
||
menuSort: number;
|
||
/**
|
||
* 组件名称
|
||
*/
|
||
name: string;
|
||
/**
|
||
* 链接地址
|
||
*/
|
||
path: number | string;
|
||
/**
|
||
* 权限表示
|
||
*/
|
||
permission?: null | string;
|
||
/**
|
||
* 上级菜单,不传递则为顶级菜单
|
||
*/
|
||
pid?: number | string;
|
||
title: string | string;
|
||
/**
|
||
* 菜单类型 0 菜单 1按钮 2接口
|
||
*/
|
||
type: number | string;
|
||
[property: string]: any;
|
||
}
|
||
/**
|
||
* MenuEditDTO
|
||
*/
|
||
export interface editRequest extends addRequest {
|
||
id: number | string;
|
||
}
|
||
|
||
/**
|
||
* 菜单结构
|
||
*
|
||
* CzgResult«List«MenuVO»»
|
||
*/
|
||
export interface getListResponse {
|
||
code?: number | null;
|
||
data?: MenuVO[] | null;
|
||
msg?: null | string;
|
||
[property: string]: any;
|
||
}
|
||
|
||
/**
|
||
* MenuVO
|
||
*/
|
||
export interface MenuVO {
|
||
/**
|
||
* 是否选中父级菜单
|
||
*/
|
||
activeMenu?: string;
|
||
/**
|
||
* 缓存
|
||
*/
|
||
cache?: boolean;
|
||
/**
|
||
* 子菜单
|
||
*/
|
||
children?: MenuVO[];
|
||
/**
|
||
* 组件
|
||
*/
|
||
component?: string;
|
||
/**
|
||
* 创建者
|
||
*/
|
||
createBy?: string;
|
||
/**
|
||
* 创建日期
|
||
*/
|
||
createTime?: string;
|
||
/**
|
||
* 隐藏
|
||
*/
|
||
hidden?: boolean;
|
||
/**
|
||
* 图标
|
||
*/
|
||
icon?: string;
|
||
/**
|
||
* 是否外链
|
||
*/
|
||
iFrame?: boolean;
|
||
/**
|
||
* 商户使用 0:否;1:是;
|
||
*/
|
||
isShop?: number;
|
||
/**
|
||
* ID
|
||
*/
|
||
menuId?: number;
|
||
/**
|
||
* 排序
|
||
*/
|
||
menuSort?: number;
|
||
/**
|
||
* 组件名称
|
||
*/
|
||
name?: string;
|
||
/**
|
||
* 链接地址
|
||
*/
|
||
path?: string;
|
||
/**
|
||
* 权限
|
||
*/
|
||
permission?: string;
|
||
/**
|
||
* 权限集合
|
||
*/
|
||
permissions?: string[];
|
||
/**
|
||
* 上级菜单ID
|
||
*/
|
||
pid?: number;
|
||
/**
|
||
* 子菜单数目
|
||
*/
|
||
subCount?: number;
|
||
/**
|
||
* 菜单标题
|
||
*/
|
||
title?: string;
|
||
/**
|
||
* 菜单类型 0 菜单 1按钮 3接口
|
||
*/
|
||
type?: number;
|
||
/**
|
||
* 更新者
|
||
*/
|
||
updateBy?: string;
|
||
/**
|
||
* 更新时间
|
||
*/
|
||
updateTime?: string;
|
||
[property: string]: any;
|
||
}
|
||
|
||
/**
|
||
* 菜单结构
|
||
*
|
||
* CzgResult«SysMenu»
|
||
*/
|
||
|
||
export interface SysMenu {
|
||
/**
|
||
* 是否选中父级菜单
|
||
*/
|
||
activeMenu?: null | string;
|
||
/**
|
||
* 缓存
|
||
*/
|
||
cache?: boolean | null;
|
||
/**
|
||
* 组件
|
||
*/
|
||
component?: null | string;
|
||
/**
|
||
* 创建者
|
||
*/
|
||
createBy?: null | string;
|
||
/**
|
||
* 创建日期
|
||
*/
|
||
createTime?: null | string;
|
||
/**
|
||
* 隐藏
|
||
*/
|
||
hidden?: boolean | null;
|
||
/**
|
||
* 图标
|
||
*/
|
||
icon?: null | string;
|
||
/**
|
||
* 是否外链
|
||
*/
|
||
iFrame?: boolean | null;
|
||
/**
|
||
* 商户使用 0:否;1:是;
|
||
*/
|
||
isShop?: number | null;
|
||
/**
|
||
* ID
|
||
*/
|
||
menuId?: number | null;
|
||
/**
|
||
* 排序
|
||
*/
|
||
menuSort?: number | null;
|
||
/**
|
||
* 组件名称
|
||
*/
|
||
name?: null | string;
|
||
/**
|
||
* 链接地址
|
||
*/
|
||
path?: null | string;
|
||
/**
|
||
* 权限
|
||
*/
|
||
permission?: null | string;
|
||
/**
|
||
* 上级菜单ID
|
||
*/
|
||
pid?: number | null;
|
||
/**
|
||
* 子菜单数目
|
||
*/
|
||
subCount?: number | null;
|
||
/**
|
||
* 菜单标题
|
||
*/
|
||
title?: null | string;
|
||
/**
|
||
* 菜单类型 0 菜单 1按钮 3接口
|
||
*/
|
||
type?: number | null;
|
||
/**
|
||
* 更新者
|
||
*/
|
||
updateBy?: null | string;
|
||
/**
|
||
* 更新时间
|
||
*/
|
||
updateTime?: null | string;
|
||
[property: string]: any;
|
||
} |