common.ts 1.8 KB

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