99 lines
2.3 KiB
Dart
99 lines
2.3 KiB
Dart
class ResourceModel {
|
|
ResourceModel({
|
|
required this.id,
|
|
required this.path,
|
|
required this.component,
|
|
required this.name,
|
|
required this.meta,
|
|
required this.redirect,
|
|
required this.children,
|
|
});
|
|
|
|
final int? id;
|
|
final String? path;
|
|
final String? component;
|
|
final String? name;
|
|
final Meta? meta;
|
|
final String? redirect;
|
|
final List<ResourceModel> children;
|
|
|
|
factory ResourceModel.fromJson(Map<String, dynamic> json) {
|
|
return ResourceModel(
|
|
id: json["id"],
|
|
path: json["path"],
|
|
component: json["component"],
|
|
name: json["name"],
|
|
meta: json["meta"] == null ? null : Meta.fromJson(json["meta"]),
|
|
redirect: json["redirect"],
|
|
children: json["children"] == null
|
|
? []
|
|
: List<ResourceModel>.from(
|
|
json["children"]!.map((x) => ResourceModel.fromJson(x))),
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"path": path,
|
|
"component": component,
|
|
"name": name,
|
|
"meta": meta?.toJson(),
|
|
"redirect": redirect,
|
|
"children": children.map((x) => x?.toJson()).toList(),
|
|
};
|
|
}
|
|
|
|
class Meta {
|
|
Meta({
|
|
required this.title,
|
|
required this.icon,
|
|
required this.isExt,
|
|
required this.extOpenMode,
|
|
required this.type,
|
|
required this.orderNo,
|
|
required this.show,
|
|
required this.activeMenu,
|
|
required this.status,
|
|
required this.keepAlive,
|
|
});
|
|
|
|
final String? title;
|
|
final String? icon;
|
|
final bool? isExt;
|
|
final int? extOpenMode;
|
|
final int? type;
|
|
final int? orderNo;
|
|
final int? show;
|
|
final String? activeMenu;
|
|
final int? status;
|
|
final int? keepAlive;
|
|
|
|
factory Meta.fromJson(Map<String, dynamic> json) {
|
|
return Meta(
|
|
title: json["title"],
|
|
icon: json["icon"],
|
|
isExt: json["isExt"],
|
|
extOpenMode: json["extOpenMode"],
|
|
type: json["type"],
|
|
orderNo: json["orderNo"],
|
|
show: json["show"],
|
|
activeMenu: json["activeMenu"],
|
|
status: json["status"],
|
|
keepAlive: json["keepAlive"],
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"title": title,
|
|
"icon": icon,
|
|
"isExt": isExt,
|
|
"extOpenMode": extOpenMode,
|
|
"type": type,
|
|
"orderNo": orderNo,
|
|
"show": show,
|
|
"activeMenu": activeMenu,
|
|
"status": status,
|
|
"keepAlive": keepAlive,
|
|
};
|
|
}
|