You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
1.8 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
1 week ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. import { IMenu } from '@/types/system/menus'
  2. import { QueryClient } from '@tanstack/react-query'
  3. import { Router } from '@tanstack/react-router'
  4. import { RouteOptions } from '@tanstack/react-router/src/route.ts'
  5. import { Attributes, ReactNode } from 'react'
  6. import { System } from '@/types'
  7. export type LayoutType = 'list' | 'form' | 'tree' | 'normal'
  8. export type IAppData = {
  9. name: string;
  10. version: string;
  11. language: string;
  12. baseUrl: string;
  13. token: string;
  14. device: string;
  15. currentUser: System.IUser
  16. }
  17. export type TRouter = {
  18. router: Router & {
  19. context: IRootContext
  20. }
  21. }
  22. export type IPage = {
  23. page?: number
  24. pageSize?: number
  25. }
  26. export type IPageResult<T = any> = IPage & {
  27. rows: T[]
  28. total: number
  29. }
  30. export type IListAllResult<T = any> = {
  31. list: T[]
  32. }
  33. export type IBoolResult = {
  34. success: boolean
  35. }
  36. export type IApiResult<T = any> = {
  37. code: number;
  38. data: T;
  39. message: string;
  40. }
  41. export type IError = {
  42. code: number;
  43. message: string;
  44. }
  45. export type TreeItem<T> = {
  46. children?: TreeItem<T>[];
  47. [key: keyof T]: T[keyof T];
  48. }
  49. export type FlattenData<T> = TreeItem<T> & {
  50. key: string,
  51. title?: string,
  52. label?: string,
  53. level?: number,
  54. [key: keyof T]: T[keyof T];
  55. }
  56. export type FiledNames = {
  57. key?: string;
  58. title?: string;
  59. children?: string
  60. }
  61. export type IDataProps<T = any> = {
  62. value?: T;
  63. onChange?: (value: T) => void;
  64. }
  65. export type Props = Attributes & {
  66. children?: ReactNode
  67. };
  68. export interface IRootContext {
  69. menuData: MenuItem[];
  70. queryClient: QueryClient;
  71. }
  72. interface MenuItem extends IMenu {
  73. routes?: MenuItem[];
  74. parent?: IMenu
  75. }
  76. interface IAuth {
  77. isLogin: boolean;
  78. authKey?: string[];
  79. }
  80. declare module '@tanstack/react-router' {
  81. interface Register {
  82. router: TRouter
  83. }
  84. interface AnyRoute {
  85. options: RouteOptions & {
  86. menu: MenuItem
  87. }
  88. }
  89. }