|
@@ -0,0 +1,127 @@
|
|
|
+import { Rule, RuleType } from '@midwayjs/validate';
|
|
|
+import { ApiProperty } from '@midwayjs/swagger';
|
|
|
+import { SearchBase } from 'free-midway-component';
|
|
|
+import get = require('lodash/get');
|
|
|
+const dealVO = (cla, data) => {
|
|
|
+ for (const key in cla) {
|
|
|
+ const val = get(data, key);
|
|
|
+ if (val || val === 0) cla[key] = val;
|
|
|
+ }
|
|
|
+};
|
|
|
+export class FVO_menus {
|
|
|
+ constructor(data: object) {
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+ @ApiProperty({ description: '数据id' })
|
|
|
+ _id: string = undefined;
|
|
|
+ @ApiProperty({ description: '菜单名称' })
|
|
|
+ 'name': string = undefined;
|
|
|
+ @ApiProperty({ description: '路由名称' })
|
|
|
+ 'route_name': string = undefined;
|
|
|
+ @ApiProperty({ description: '国际化编码' })
|
|
|
+ 'i18n_code': string = undefined;
|
|
|
+ @ApiProperty({ description: '父级菜单' })
|
|
|
+ 'parent_id': string = undefined;
|
|
|
+ @ApiProperty({ description: '显示顺序' })
|
|
|
+ 'order_num': number = undefined;
|
|
|
+ @ApiProperty({ description: '路由地址' })
|
|
|
+ 'path': string = undefined;
|
|
|
+ @ApiProperty({ description: '组件地址' })
|
|
|
+ 'component': string = undefined;
|
|
|
+ @ApiProperty({ description: '菜单类型' })
|
|
|
+ 'type': string = undefined;
|
|
|
+ @ApiProperty({ description: '图标' })
|
|
|
+ 'icon': string = undefined;
|
|
|
+ @ApiProperty({ description: '功能列表' })
|
|
|
+ 'config': Array<any> = undefined;
|
|
|
+ @ApiProperty({ description: '是否为默认菜单' })
|
|
|
+ 'is_default': string = undefined;
|
|
|
+ @ApiProperty({ description: '备注' })
|
|
|
+ 'remark': string = undefined;
|
|
|
+ @ApiProperty({ description: '是否启用' })
|
|
|
+ 'is_use': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class QDTO_menus extends SearchBase {
|
|
|
+ constructor() {
|
|
|
+ const like_prop = [];
|
|
|
+ const props = ['parent_id', 'type', 'is_use'];
|
|
|
+ const mapping = [];
|
|
|
+ super({ like_prop, props, mapping });
|
|
|
+ }
|
|
|
+ @ApiProperty({ description: '父级菜单' })
|
|
|
+ 'parent_id': string = undefined;
|
|
|
+ @ApiProperty({ description: '菜单类型' })
|
|
|
+ 'type': string = undefined;
|
|
|
+ @ApiProperty({ description: '是否启用' })
|
|
|
+ 'is_use': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class QVO_menus extends FVO_menus {
|
|
|
+ constructor(data: object) {
|
|
|
+ super(data);
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class CDTO_menus {
|
|
|
+ @ApiProperty({ description: '菜单名称' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'name': string = undefined;
|
|
|
+ @ApiProperty({ description: '路由名称' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'route_name': string = undefined;
|
|
|
+ @ApiProperty({ description: '国际化编码' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'i18n_code': string = undefined;
|
|
|
+ @ApiProperty({ description: '父级菜单' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'parent_id': string = undefined;
|
|
|
+ @ApiProperty({ description: '显示顺序' })
|
|
|
+ @Rule(RuleType['number']().empty(''))
|
|
|
+ 'order_num': number = undefined;
|
|
|
+ @ApiProperty({ description: '路由地址' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'path': string = undefined;
|
|
|
+ @ApiProperty({ description: '组件地址' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'component': string = undefined;
|
|
|
+ @ApiProperty({ description: '菜单类型' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'type': string = undefined;
|
|
|
+ @ApiProperty({ description: '图标' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'icon': string = undefined;
|
|
|
+ @ApiProperty({ description: '功能列表' })
|
|
|
+ @Rule(RuleType['array']().empty(''))
|
|
|
+ 'config': Array<any> = undefined;
|
|
|
+ @ApiProperty({ description: '是否为默认菜单' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'is_default': string = undefined;
|
|
|
+ @ApiProperty({ description: '备注' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'remark': string = undefined;
|
|
|
+ @ApiProperty({ description: '是否启用' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'is_use': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class CVO_menus extends FVO_menus {
|
|
|
+ constructor(data: object) {
|
|
|
+ super(data);
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class UDTO_menus extends CDTO_menus {
|
|
|
+ @ApiProperty({ description: '数据id' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ _id: string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class UVAO_menus extends FVO_menus {
|
|
|
+ constructor(data: object) {
|
|
|
+ super(data);
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+}
|