1
0

menu.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import {
  2. IsInt,
  3. Min,
  4. Max,
  5. MinLength,
  6. IsString,
  7. IsBoolean,
  8. Allow,
  9. IsNumberString, IsOptional,
  10. } from 'class-validator';
  11. import { Expose } from 'class-transformer';
  12. /**
  13. * 增加菜单
  14. */
  15. export class CreateMenuDto {
  16. @IsInt()
  17. @Min(0)
  18. @Max(5)
  19. @Expose()
  20. type: number;
  21. @IsOptional()
  22. @IsInt()
  23. @Expose()
  24. parentId: number;
  25. @MinLength(2)
  26. @Expose()
  27. name: string;
  28. @IsInt()
  29. @Min(0)
  30. @Expose()
  31. orderNum: number;
  32. @IsOptional()
  33. @IsString()
  34. @Expose()
  35. router: string;
  36. @IsBoolean()
  37. @Expose()
  38. isShow: boolean;
  39. @IsOptional()
  40. @IsBoolean()
  41. @Expose()
  42. keepalive: boolean;
  43. @IsOptional()
  44. @IsString()
  45. @Expose()
  46. icon: string;
  47. @IsOptional()
  48. @IsString()
  49. @Expose()
  50. perms: string;
  51. @Allow()
  52. @Expose()
  53. viewPath: string;
  54. @IsInt()
  55. @Expose()
  56. status: string;
  57. }
  58. export class UpdateMenuDto extends CreateMenuDto {
  59. @IsInt()
  60. @Expose()
  61. menuId: number;
  62. }
  63. /**
  64. * 删除菜单
  65. */
  66. export class DeleteMenuDto {
  67. @IsInt()
  68. @Expose()
  69. menuId: number;
  70. }
  71. /**
  72. * 查询菜单
  73. */
  74. export class InfoMenuDto {
  75. @IsNumberString()
  76. @Expose()
  77. menuId: string;
  78. }