common.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * @Author: LiZhiWei
  3. * @Date: 2026-01-13 15:01:49
  4. * @LastEditors: LiZhiWei
  5. * @LastEditTime: 2026-01-22 14:57:52
  6. * @Description:
  7. */
  8. declare global {
  9. type Card = {
  10. id?: string
  11. title: string
  12. desc: string
  13. icon: string
  14. }
  15. type CaseItem = {
  16. title: string
  17. desc: string
  18. img: string
  19. btnText: string
  20. points: {
  21. title: string
  22. itemDesc: string
  23. }[]
  24. }
  25. type HistoryEvent = {
  26. month: string
  27. content: string
  28. }
  29. type HistoryYear = {
  30. year: string
  31. events: HistoryEvent[]
  32. }
  33. type AbilityTab = {
  34. id: string
  35. title: string
  36. }
  37. type BasicResponse<T = any> = {
  38. code: number
  39. message: string
  40. data: T
  41. }
  42. /**
  43. * 接口返回数据模型
  44. */
  45. type ApiResponse<T = unknown> = {
  46. data: BasicResponse<T>
  47. }
  48. /**
  49. * table
  50. */
  51. type TableData<T = unknown> = {
  52. list: Array<T>
  53. pageSize?: number
  54. pageNum?: number
  55. pages?: number
  56. total?: number
  57. }
  58. type Page = {
  59. pageSize?: number
  60. pageNum?: number
  61. isPage?: boolean
  62. }
  63. /**
  64. * dialog数据
  65. */
  66. type ModalData<T = unknown> = {
  67. isShow?: boolean
  68. type?: string
  69. loading?: boolean
  70. row?: T
  71. title?: string
  72. }
  73. /**
  74. * 枚举
  75. */
  76. type IOption = {
  77. id?: string
  78. code?: string
  79. value?: string
  80. name?: string
  81. label?: string
  82. type?: string
  83. leaf?: boolean
  84. children?: IOption[]
  85. }
  86. /**
  87. * 表单验证
  88. */
  89. type IFormValidateCallback = {
  90. (message?: string | Error | undefined): Error | void
  91. }
  92. type IFormValidator = (
  93. rule: {
  94. field: string
  95. },
  96. value: string,
  97. callback: IFormValidateCallback
  98. ) => void
  99. type FormRuleItemParams = {
  100. required?: boolean
  101. message?: string
  102. validator?: IFormValidator
  103. trigger?: string
  104. }
  105. type AnyObject<T = unknown> = {
  106. [key: string]: T
  107. }
  108. }
  109. export {}