/** * Namespace Api * * All backend api type */ declare namespace Api { namespace Common { /** common params of paginating */ interface PaginatingCommonParams { /** total count */ total: number; } /** common params of paginating query list data */ interface PaginatingQueryRecord extends PaginatingCommonParams { rows: T[]; } /** * enable status * * - "0": enabled * - "1": disabled */ type EnableStatus = '1' | '0'; /** common record */ type CommonRecord = { /** record creator */ createBy: string; /** record create time */ createTime: string; /** record updater */ updateBy: string; /** record update time */ updateTime: string; /** record status */ status: EnableStatus; } & T; type CommonTree = { id: number; label: string; children?: CommonTree[]; }[]; } namespace Department { interface Dept { createBy: any; createTime: any; updateBy: any; updateTime: any; remark: any; deptId: number; parentId: number; ancestors: string; deptName: string; orderNum: number; leader: string; phone: any; email: any; status: string; delFlag: any; parentName: any; children: any[]; } } /** * Namespace Auth * * Backend api module: "auth" */ namespace Auth { interface LoginToken { access_token: string; refreshToken: string; } /** User info */ interface UserInfo { user: User | null; roles: string[]; /** permissions */ permissions: string[]; } interface User { createBy: string; createTime: string; updateBy: any; updateTime: any; remark: string; userId: number; deptId: number; userName: string; nickName: string; email: string; phonenumber: string; sex: string; avatar: string; password: string; status: '0' | '1'; delFlag: string; loginIp: string; loginDate: string; birthDate:string; dept: Department.Dept; roles: Role[]; roleId: string; postIds: number[]; roleIds: number[]; admin: boolean; } interface Role { remark: any; roleId: number; roleName: string; roleKey: string; roleSort: number; dataScope: string; menuCheckStrictly: boolean; deptCheckStrictly: boolean; status: string; delFlag: '0' | '1'; flag: boolean; menuIds: number[] | null; deptIds: number[] | null; permissions: any; admin: boolean; } interface LoginBody { username: string; password: string; code: string; uuid: string; authType: string; wanfiRedirectParams: any; } interface RegisterBody{ username: string; password: string; authType:string; email: string; fullName?: string; age: number; address?: string; sex?: string; phonenumber?: string; } interface EmailCaptcha{ email:string; } interface CheckBody{ username?: string; email?: string; phonenumber?:string; authType: string; } interface ChangeInfoBody{ userId:number; userName: string; nickName?: string|undefined; email: string; phonenumber?: string|undefined; sex?: string|undefined; birthDate?:string|undefined; age?:number; } } /** * Namespace Route * * Backend api module: "route" */ namespace Route { type ElegantConstRoute = import('@elegant-router/types').ElegantConstRoute; interface MenuRoute extends ElegantConstRoute { id: string; } interface UserRoute { routes: MenuRoute[]; home: import('@elegant-router/types').LastLevelRouteKey; } } /** * namespace SystemManage * * backend api module: "systemManage" */ namespace SystemManage { type CommonSearchParams = { /** page number */ pageNum: number; /** page size */ pageSize: number; }; /** role */ type Role = Common.CommonRecord<{ remark: string; roleId: number; roleName: string; roleKey: string; roleSort: number; dataScope: string; menuCheckStrictly: boolean; deptCheckStrictly: boolean; status: string; delFlag: '0' | '1'; flag: boolean; menuIds: number[] | null; deptIds: number[] | null; permissions: string; admin: boolean; }>; /** role search params */ type RoleSearchParams = Partial< Pick & CommonSearchParams >; /** role list */ type RoleList = Common.PaginatingQueryRecord; /** all role */ type AllRole = Pick; /** * user gender * * - "1": "male" * - "2": "female" */ type UserGender = '1' | '2'; /** user */ type UserInfo = Common.CommonRecord<{ /** user name */ username: string; /** user gender */ userGender: UserGender | null; /** user nick name */ nickName: string; /** user phone */ userPhone: string; /** user email */ userEmail: string; /** user role code collection */ userRoles: string[]; }>; /** user search params */ type UserSearchParams = Partial< Pick & CommonSearchParams >; /** user list */ type UserList = Common.PaginatingQueryRecord; type UserPostsAndRoles = { posts: Post[]; roles: Role[]; postIds: number[]; roleIds: number[]; }; /** * menu type * * - "1": directory * - "2": menu */ type MenuType = 'M' | 'C' | 'F'; type MenuButton = { /** * button code * * it can be used to control the button permission */ code: string; /** button description */ desc: string; }; /** * icon type * * - "1": iconify icon * - "2": local icon */ type IconType = '1' | '2'; type Menu = Common.CommonRecord<{ /** parent menu id */ parentId: number; /** menu type */ menuType: MenuType; /** menu name */ menuName: string; /** route name */ routeName: string; /** route path */ routePath: string; /** component */ component?: string; menuId: number; path: string; /** * i18n key * * it is for internationalization */ i18nKey?: App.I18n.I18nKey; /** iconify icon name or local icon name */ icon: string; /** icon type */ iconType: IconType; /** menu order */ orderNum: number; /** whether to cache the route */ keepAlive?: '0' | '1'; /** outer link */ href?: string; /** whether to retain the route */ status: '0' | '1'; /** whether to hide the route in the menu */ hideInMenu?: '0' | '1'; /** * The menu key will be activated when entering the route * * The route is not in the menu * * @example * the route is "user_detail", if it is set to "user_list", the menu "user_list" will be activated */ activeMenu?: import('@elegant-router/types').LastLevelRouteKey; /** By default, the same route path will use one tab, if set to true, it will use multiple tabs */ multiTab?: boolean; /** If set, the route will be fixed in tabs, and the value is the order of fixed tabs */ fixedIndexInTab?: number; /** menu buttons */ buttons?: MenuButton[]; /** children menu */ children?: Menu[]; /** is external link */ isFrame: '0' | '1'; /** perms to request api */ perms: string; /** menu name(path combine) */ name: string; isCache: '0' | '1'; visible: '0' | '1'; }>; /** menu list */ type MenuList = Common.PaginatingQueryRecord; type MenuTree = { id: number; label: string; pId: number; children?: MenuTree[]; }; // dept api /** dept */ type Dept = { createBy: string; createTime: string; updateBy: string; updateTime: string; remark: string; deptId: number; parentId: number; ancestors: string; deptName: string; orderNum: number; leader: string; phone: string; email: string; status: '0' | '1'; delFlag: string; parentName: string; children: Dept[]; }; type DeptList = Common.PaginatingQueryRecord; /** dept search params */ type DeptSearchParams = Partial & CommonSearchParams>; // post api type Post = { createBy: string; createTime: string; updateBy: any; updateTime: any; remark: string; postId: number; postCode: string; postName: string; postSort: number; status: '0' | '1'; flag: boolean; }; type PostSearchParams = Partial & CommonSearchParams>; type PostList = Common.PaginatingQueryRecord; // dict api type Dict = { createBy: string; createTime: string; updateBy: string; updateTime: string; remark: string; dictId: number; dictName: string; dictType: string; status: '0' | '1'; delFlag: string; }; type DictSearchParams = Partial & CommonSearchParams>; type DictList = Common.PaginatingQueryRecord; } /** * Namespace Dashboard * * Backend api module: "dashboard" */ namespace Dashboard { /** Dashboard gauge data */ interface GaugeData { /** Balance amount */ balance: number; /** Total traffic amount (bytes) */ traffic: number; /** Used traffic amount (bytes) */ trafficUsed: number; /** Current traffic rate (B/s) */ activity: number; /** Peak traffic rate (B/s) */ peakTrafficRate: number; /** Number of connected devices */ clientNum: number; } } /** * Namespace Device * * Backend api module: "device" */ namespace Device { /** Device information */ interface DeviceInfo { /** Device unique key */ key: string; /** Device name */ deviceName: string; /** MAC address */ macAddress: string; /** Current speed */ speed: string; } /** Device list response */ interface DeviceListResponse { /** List of devices */ rows: DeviceInfo[]; /** Total count */ total: number; } /** Historical device information */ interface HistoricalDeviceInfo { /** Device unique key */ key: string; /** Device name */ deviceName: string; /** MAC address */ macAddress: string; /** Connection time */ connectionTime: string; /** Disconnection time */ disconnectionTime: string; /** Data usage */ dataUsage: string; } /** Historical device list response */ interface HistoricalDeviceListResponse { /** List of historical devices */ rows: HistoricalDeviceInfo[]; /** Total count */ total: number; } interface DeviceInfo { id: number; clientName: string; clientMac: string; clientDeviceType: string; activity: number; } interface DeviceResponse { total: number; rows: DeviceInfo[]; } interface HistoricalDeviceInfo { id: number; clientName: string; clientMac: string; startTime: number; // 时间戳 endTime: number; // 时间戳 duration: number; // 流量使用量(bytes) } interface HistoricalDeviceResponse { total: number; rows: HistoricalDeviceInfo[]; } } namespace CDR { /** CDR record information */ interface CDRRecord { /** Record ID */ id: number; /** AP name */ ap_name: string; /** Upload traffic */ traffic_up: number; /** Download traffic */ traffic_down: number; /** Up time */ up_time: string; /** Last seen time */ last_seen_time: string; } interface CDRRecord { /** Record ID */ id: number; /** Client name */ clientName: string; /** Client MAC address */ clientMac: string; /** Upload traffic in bytes */ trafficUp: number; /** Download traffic in bytes */ trafficDown: number; /** Start time timestamp */ startTime: number; /** End time timestamp */ endTime: number; } /** CDR record list response */ interface CDRListResponse { /** List of CDR records */ rows: CDRRecord[]; /** Total count */ total: number; } /** CDR query params */ interface CDRQueryParams { /** Page number */ pageNum: number; /** Page size */ pageSize: number; } } namespace Package { interface PackageItem { id: string; amount: number; price: number; description?: string; } interface PackageListResponse { code: number; msg: string; data: PackageItem[]; total?: number; } interface OrderSubmitParams { packageId: string; type: 0; // 限定为字面量类型 0 } } namespace Order { /** Order type enum */ type OrderType = 0 | 1 | 2; // 根据实际需要添加其他类型 /** Base order params */ interface BaseOrderParams { type: OrderType; } /** Package order params */ interface PackageOrderParams extends BaseOrderParams { type: 0; packageId: string; } /** Recharge order params */ interface RechargeOrderParams extends BaseOrderParams { type: 1; orderAmount: number; } /** Combined order params type */ type SubmitOrderParams = PackageOrderParams | RechargeOrderParams; } /** * Namespace Bill * * Backend api module: "bill" */ namespace Bill { /** Bill record information */ interface BillRecord { id: string; startTime: string | null; endTime: string | null; traffic: string | null; amount: string; status: number; createTime: string; } /** Bill list response */ interface BillListResponse { rows: BillRecord[]; total: number; } /** Bill query parameters */ interface BillQueryParams { pageNum: number; pageSize: number; } } }