parent
4003bb1aab
commit
8829381ae9
@ -1,86 +1,53 @@
|
|||||||
import 'package:aku_new_community/model/common/img_model.dart';
|
import 'package:aku_new_community/model/common/img_model.dart';
|
||||||
|
import 'package:common_utils/common_utils.dart';
|
||||||
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
|
@JsonSerializable()
|
||||||
class CommitteeItemModel {
|
class CommitteeItemModel {
|
||||||
int? id;
|
final int? id;
|
||||||
int? positionId;
|
final String? name;
|
||||||
String? name;
|
final String? tel;
|
||||||
int? sexId;
|
final String? industryCommitteeTypeName;
|
||||||
int? age;
|
final String? buildingName;
|
||||||
int? educationId;
|
final String? unitName;
|
||||||
String? roomName;
|
final String? estateName;
|
||||||
String? profession;
|
final String? appointmentStartTime;
|
||||||
String? roomNumber;
|
final String? appointmentEndTime;
|
||||||
int? unitNo;
|
final String? createDate;
|
||||||
int? estateNo;
|
final List<ImgModel>? imgList;
|
||||||
List<ImgModel>? imgUrls;
|
|
||||||
|
|
||||||
String get sexValue {
|
factory CommitteeItemModel.fromJson(Map<String, dynamic> json) =>
|
||||||
if (sexId == 0 || sexId == null) return '未设置';
|
_$CommitteeItemModel(json);
|
||||||
if (sexId == 1) return '男';
|
DateTime? get appointmentStartDT => DateUtil.getDateTime(appointmentStartTime!);
|
||||||
if (sexId == 2) return '女';
|
DateTime? get appointmentEndDT => DateUtil.getDateTime(appointmentEndTime!);
|
||||||
return '未设置';
|
DateTime? get createDateDT => DateUtil.getDateTime(createDate!);
|
||||||
}
|
const CommitteeItemModel({
|
||||||
|
required this.id,
|
||||||
String get positionValue {
|
required this.name,
|
||||||
switch (positionId) {
|
required this.tel,
|
||||||
case 1:
|
required this.industryCommitteeTypeName,
|
||||||
return '业委会主任';
|
required this.buildingName,
|
||||||
case 2:
|
required this.unitName,
|
||||||
return '业委会副主任';
|
required this.estateName,
|
||||||
case 3:
|
required this.appointmentStartTime,
|
||||||
return '业委会委员';
|
required this.appointmentEndTime,
|
||||||
default:
|
required this.createDate,
|
||||||
return '';
|
required this.imgList,
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CommitteeItemModel({
|
|
||||||
this.id,
|
|
||||||
this.positionId,
|
|
||||||
this.name,
|
|
||||||
this.sexId,
|
|
||||||
this.age,
|
|
||||||
this.educationId,
|
|
||||||
this.roomName,
|
|
||||||
this.profession,
|
|
||||||
this.roomNumber,
|
|
||||||
this.unitNo,
|
|
||||||
this.estateNo,
|
|
||||||
this.imgUrls,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
CommitteeItemModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
id = json['id'];
|
|
||||||
positionId = json['positionId'];
|
|
||||||
name = json['name'];
|
|
||||||
sexId = json['sexId'];
|
|
||||||
age = json['age'];
|
|
||||||
educationId = json['educationId'];
|
|
||||||
roomName = json['roomName'];
|
|
||||||
profession = json['profession'];
|
|
||||||
roomNumber = json['roomNumber'];
|
|
||||||
unitNo = json['unitNo'];
|
|
||||||
estateNo = json['estateNo'];
|
|
||||||
if (json['imgUrls'] != null) {
|
|
||||||
imgUrls =
|
|
||||||
(json['imgUrls'] as List).map((e) => ImgModel.fromJson(e)).toList();
|
|
||||||
} else
|
|
||||||
imgUrls = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
||||||
data['id'] = this.id;
|
|
||||||
data['positionId'] = this.positionId;
|
|
||||||
data['name'] = this.name;
|
|
||||||
data['sexId'] = this.sexId;
|
|
||||||
data['age'] = this.age;
|
|
||||||
data['educationId'] = this.educationId;
|
|
||||||
data['roomName'] = this.roomName;
|
|
||||||
data['profession'] = this.profession;
|
|
||||||
data['roomNumber'] = this.roomNumber;
|
|
||||||
data['unitNo'] = this.unitNo;
|
|
||||||
data['estateNo'] = this.estateNo;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
CommitteeItemModel _$CommitteeItemModel(Map<String, dynamic> json) =>
|
||||||
|
CommitteeItemModel(
|
||||||
|
id: json['id'] as int,
|
||||||
|
name: json['name'] as String,
|
||||||
|
tel: json['tel'] as String,
|
||||||
|
industryCommitteeTypeName: json['industryCommitteeTypeName'] as String,
|
||||||
|
buildingName: json['buildingName'] as String,
|
||||||
|
unitName: json['unitName'] as String,
|
||||||
|
estateName: json['estateName'] as String,
|
||||||
|
appointmentStartTime: json['appointmentStartTime'] as String,
|
||||||
|
appointmentEndTime: json['appointmentEndTime'] as String,
|
||||||
|
createDate: json['createDate'] as String,
|
||||||
|
imgList: (json['imgList'] as List<dynamic>)
|
||||||
|
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
);
|
Loading…
Reference in new issue