diff --git a/lib/json_models/manager/house_keeping/house_keeping_list_model.dart b/lib/json_models/manager/house_keeping/house_keeping_list_model.dart new file mode 100644 index 0000000..fcf75f7 --- /dev/null +++ b/lib/json_models/manager/house_keeping/house_keeping_list_model.dart @@ -0,0 +1,120 @@ +import 'package:aku_community_manager/models/user/user_info_model.dart'; +import 'package:aku_community_manager/tools/user_tool.dart'; +import 'package:equatable/equatable.dart'; + +import 'package:aku_community_manager/models/common/img_model.dart'; +import 'package:json_annotation/json_annotation.dart'; +part 'house_keeping_list_model.g.dart'; + +@JsonSerializable() +class HouseKeepingListModel extends Equatable { + final int id; + final String proposerName; + final String proposerTel; + final String roomName; + final int type; + final String content; + final int status; + final int? completion; + final String? handlerName; + final String? handlerTel; + final String? processDescription; + final String? handlingTime; + final List handlerImgList; + final num? payFee; + final int? evaluation; + final String? evaluationContent; + final String? evaluationTime; + final List evaluationImgList; + final String createDate; + final List submitImgList; + HouseKeepingListModel({ + required this.id, + required this.proposerName, + required this.proposerTel, + required this.roomName, + required this.type, + required this.content, + required this.status, + this.completion, + this.handlerName, + this.handlerTel, + this.processDescription, + this.handlingTime, + required this.handlerImgList, + this.payFee, + this.evaluation, + this.evaluationContent, + this.evaluationTime, + required this.evaluationImgList, + required this.createDate, + required this.submitImgList, + }); + factory HouseKeepingListModel.fromJson(Map json) => + _$HouseKeepingListModelFromJson(json); + + String get statusString { + switch (this.status) { + case 1: + return '待派单'; + case 2: + if (UserTool.userProvider.infoModel!.houseKeepingAuthority == + HKAUTH.PICK) { + return '已派单'; + } else { + return '待接单'; + } + case 3: + return '处理中'; + case 4: + return '待支付'; + case 5: + return '待评价'; + case 6: + return '已完成'; + case 9: + return '已取消'; + case 10: + return '已作废'; + default: + return '未知'; + } + } + + String get typeString { + switch (this.type) { + case 1: + return '室内清洁'; + case 2: + return '洗涤护理'; + default: + return '未知'; + } + } + + @override + List get props { + return [ + id, + proposerName, + proposerTel, + roomName, + type, + content, + status, + completion, + handlerName, + handlerTel, + processDescription, + handlingTime, + handlerImgList, + payFee, + evaluation, + evaluationContent, + evaluationTime, + evaluationImgList, + createDate, + submitImgList, + ]; + } +} diff --git a/lib/json_models/manager/house_keeping/house_keeping_list_model.g.dart b/lib/json_models/manager/house_keeping/house_keeping_list_model.g.dart new file mode 100644 index 0000000..320043f --- /dev/null +++ b/lib/json_models/manager/house_keeping/house_keeping_list_model.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'house_keeping_list_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +HouseKeepingListModel _$HouseKeepingListModelFromJson( + Map json) { + return HouseKeepingListModel( + id: json['id'] as int, + proposerName: json['proposerName'] as String, + proposerTel: json['proposerTel'] as String, + roomName: json['roomName'] as String, + type: json['type'] as int, + content: json['content'] as String, + status: json['status'] as int, + completion: json['completion'] as int?, + handlerName: json['handlerName'] as String?, + handlerTel: json['handlerTel'] as String?, + processDescription: json['processDescription'] as String?, + handlingTime: json['handlingTime'] as String?, + handlerImgList: (json['handlerImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + payFee: json['payFee'] as num?, + evaluation: json['evaluation'] as int?, + evaluationContent: json['evaluationContent'] as String?, + evaluationTime: json['evaluationTime'] as String?, + evaluationImgList: (json['evaluationImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + createDate: json['createDate'] as String, + submitImgList: (json['submitImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + ); +} diff --git a/lib/json_models/system_message_green_model.dart b/lib/json_models/message/system_message_green_model.dart similarity index 100% rename from lib/json_models/system_message_green_model.dart rename to lib/json_models/message/system_message_green_model.dart diff --git a/lib/json_models/system_message_green_model.g.dart b/lib/json_models/message/system_message_green_model.g.dart similarity index 68% rename from lib/json_models/system_message_green_model.g.dart rename to lib/json_models/message/system_message_green_model.g.dart index 76f4716..9f69155 100644 --- a/lib/json_models/system_message_green_model.g.dart +++ b/lib/json_models/message/system_message_green_model.g.dart @@ -15,12 +15,3 @@ SystemMessageGreenModel _$SystemMessageGreenModelFromJson( areaName: json['areaName'] as String, ); } - -Map _$SystemMessageGreenModelToJson( - SystemMessageGreenModel instance) => - { - 'id': instance.id, - 'name': instance.name, - 'tel': instance.tel, - 'areaName': instance.areaName, - }; diff --git a/lib/json_models/system_message_hygience_model.dart b/lib/json_models/message/system_message_hygience_model.dart similarity index 100% rename from lib/json_models/system_message_hygience_model.dart rename to lib/json_models/message/system_message_hygience_model.dart diff --git a/lib/json_models/system_message_hygience_model.g.dart b/lib/json_models/message/system_message_hygience_model.g.dart similarity index 68% rename from lib/json_models/system_message_hygience_model.g.dart rename to lib/json_models/message/system_message_hygience_model.g.dart index 3d013c8..76748a2 100644 --- a/lib/json_models/system_message_hygience_model.g.dart +++ b/lib/json_models/message/system_message_hygience_model.g.dart @@ -15,12 +15,3 @@ SystemMessageHygineceModel _$SystemMessageHygineceModelFromJson( areaName: json['areaName'] as String, ); } - -Map _$SystemMessageHygineceModelToJson( - SystemMessageHygineceModel instance) => - { - 'id': instance.id, - 'name': instance.name, - 'tel': instance.tel, - 'areaName': instance.areaName, - }; diff --git a/lib/models/manager/house_keeping/house_keeping_list_model.dart b/lib/models/manager/house_keeping/house_keeping_list_model.dart deleted file mode 100644 index d74260d..0000000 --- a/lib/models/manager/house_keeping/house_keeping_list_model.dart +++ /dev/null @@ -1,44 +0,0 @@ -class HouseKeepingListModel { - int? id; - String? roomName; - int? num; - String? leaderName; - String? leaderTel; - String? content; - String? createName; - String? createDate; - - HouseKeepingListModel( - {required this.id, - this.roomName, - this.num, - this.leaderName, - this.leaderTel, - this.content, - this.createName, - this.createDate}); - - HouseKeepingListModel.fromJson(Map json) { - id = json['id']; - roomName = json['roomName']; - num = json['num']; - leaderName = json['leaderName']; - leaderTel = json['leaderTel']; - content = json['content']; - createName = json['createName']; - createDate = json['createDate']; - } - - Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['roomName'] = this.roomName; - data['num'] = this.num; - data['leaderName'] = this.leaderName; - data['leaderTel'] = this.leaderTel; - data['content'] = this.content; - data['createName'] = this.createName; - data['createDate'] = this.createDate; - return data; - } -}