86133 | aaa3f5d | 2025-04-20 21:33:29 +0800 | [diff] [blame] | 1 | import { request } from '@umijs/max'; |
| 2 | import { downLoadXlsx } from '@/utils/downloadfile'; |
| 3 | |
| 4 | // 查询菜单权限列表 |
| 5 | export async function getMenuList(params?: API.System.MenuListParams, options?: { [key: string]: any }) { |
| 6 | return request<API.System.MenuPageResult>('/api/system/menu/list', { |
| 7 | method: 'GET', |
| 8 | headers: { |
| 9 | 'Content-Type': 'application/json;charset=UTF-8', |
| 10 | }, |
| 11 | params, |
| 12 | ...(options || {}), |
| 13 | }); |
| 14 | } |
| 15 | |
| 16 | // 查询菜单权限详细 |
| 17 | export function getMenu(menuId: number, options?: { [key: string]: any }) { |
| 18 | return request<API.System.MenuInfoResult>(`/api/system/menu/${menuId}`, { |
| 19 | method: 'GET', |
| 20 | ...(options || {}) |
| 21 | }); |
| 22 | } |
| 23 | |
| 24 | // 新增菜单权限 |
| 25 | export async function addMenu(params: API.System.Menu, options?: { [key: string]: any }) { |
| 26 | return request<API.Result>('/api/system/menu', { |
| 27 | method: 'POST', |
| 28 | headers: { |
| 29 | 'Content-Type': 'application/json;charset=UTF-8', |
| 30 | }, |
| 31 | data: params, |
| 32 | ...(options || {}) |
| 33 | }); |
| 34 | } |
| 35 | |
| 36 | // 修改菜单权限 |
| 37 | export async function updateMenu(params: API.System.Menu, options?: { [key: string]: any }) { |
| 38 | return request<API.Result>('/api/system/menu', { |
| 39 | method: 'PUT', |
| 40 | headers: { |
| 41 | 'Content-Type': 'application/json;charset=UTF-8', |
| 42 | }, |
| 43 | data: params, |
| 44 | ...(options || {}) |
| 45 | }); |
| 46 | } |
| 47 | |
| 48 | // 删除菜单权限 |
| 49 | export async function removeMenu(ids: string, options?: { [key: string]: any }) { |
| 50 | return request<API.Result>(`/api/system/menu/${ids}`, { |
| 51 | method: 'DELETE', |
| 52 | ...(options || {}) |
| 53 | }); |
| 54 | } |
| 55 | |
| 56 | // 查询菜单权限详细 |
| 57 | export function getMenuTree() { |
| 58 | return request('/api/system/menu/treeselect', { |
| 59 | method: 'GET', |
| 60 | }); |
| 61 | } |