Files
platforms/frontend/platform_admin/src/api/platform.ts

27 lines
1.3 KiB
TypeScript
Raw Normal View History

2026-07-27 00:18:42 +08:00
import { request } from './http';
import { resourceApi } from './resource';
/** 平台角色、菜单、账号和工作台接口。 */
export type PlatformRole = { identity: string; role_code: string; name: string; data_scope: string; is_system: boolean; status: string };
export type PlatformMenu = { identity: string; parent_identity?: string; menu_code: string; name: string; icon: string; path: string; sort_no: number };
2026-07-27 00:18:42 +08:00
export const platformApi = {
overview: () => request<Record<string, number>>('/dashboard/overview'),
listAccount: () => request<{ total: number; list: Record<string, unknown>[] }>('/platfrom_account'),
listRole: () => resourceApi.list<PlatformRole>('/platform_role'),
createRole: (data: Record<string, unknown>) => resourceApi.create<PlatformRole>('/platform_role', data),
listMenu: () => request<{ total: number; list: PlatformMenu[] }>('/platform_menu'),
2026-07-27 12:48:35 +08:00
listRoleMenuIdentities: (identity: string) =>
request<{ menu_identities: string[] }>(
`/platform_role/${identity}/menu`,
2026-07-27 12:48:35 +08:00
),
replaceRoleMenus: (identity: string, menuIdentities: string[]) =>
request<{ updated: boolean }>(
`/platform_role/${identity}/menu`,
2026-07-27 12:48:35 +08:00
{
method: 'PUT',
body: JSON.stringify({ menu_identities: menuIdentities }),
},
),
};