| 30 | import type { MenuAttributes } from '@/utils/types/system'; |
| 31 | @Table({ tableName: 'xmw_menu', underscored: false }) |
| 32 | export class XmwMenu |
| 33 | extends Model<MenuAttributes, MenuAttributes> |
| 34 | implements MenuAttributes { |
| 35 | @IsUUID(4) |
| 36 | @PrimaryKey |
| 37 | @Column({ |
| 38 | type: DataType.UUID, |
| 39 | allowNull: false, |
| 40 | defaultValue: DataType.UUIDV4, |
| 41 | comment: '菜单id', |
| 42 | }) |
| 43 | menu_id: string; |
| 44 | |
| 45 | //国际化对应的name |
| 46 | @IsUUID(4) |
| 47 | @ForeignKey(() => XmwInternational) |
| 48 | @Column({ |
| 49 | type: DataType.UUID, |
| 50 | allowNull: false, |
| 51 | comment: '国际化对应的name', |
| 52 | }) |
| 53 | name: string; |
| 54 | |
| 55 | //菜单类型 |
| 56 | @IsIn({ |
| 57 | args: [['dir', 'menu', 'button']], |
| 58 | msg: '菜单类型:menu_type 字段值错误', |
| 59 | }) |
| 60 | @Column({ |
| 61 | type: DataType.ENUM, |
| 62 | values: ['dir', 'menu', 'button'], |
| 63 | allowNull: false, |
| 64 | comment: '菜单类型(dir:目录,menu:菜单,button:按钮)', |
| 65 | }) |
| 66 | menu_type: MenuTypes; |
| 67 | |
| 68 | //路由url |
| 69 | @Column({ type: DataType.STRING(100), comment: '路由url' }) |
| 70 | path?: string; |
| 71 | |
| 72 | //菜单图标 |
| 73 | @Column({ type: DataType.STRING(50), comment: '菜单图标' }) |
| 74 | icon?: string; |
| 75 | |
| 76 | //菜单对应的文件路径 |
| 77 | @Column({ type: DataType.STRING(200), comment: '菜单对应的文件路径' }) |
| 78 | component?: string; |
| 79 | |
| 80 | //路由重定向地址 |
| 81 | @Column({ type: DataType.STRING(100), comment: '路由重定向地址' }) |
| 82 | redirect?: string; |
| 83 | |
| 84 | //父级id |
| 85 | @IsUUID(4) |
| 86 | @Column({ type: DataType.UUID, comment: '父级id' }) |
| 87 | parent_id?: string; |
| 88 | |
| 89 | //当path是一个url,点击新窗口打开 |
nothing calls this directly
no outgoing calls
no test coverage detected