class MaintenanceDetailEntity { String createDate; String creatorId; String updateDate; String updateId; String id; String mtPlanId; String liftId; String projectId; String mtCompanyId; String workerId; String code; int liftType; int type; String planDate; String workDate; String stopDate; String recoveryDate; String maintenanceAdvice; String maintenanceOption; String position; String status; int isRegular; String workerId1; int isRepair; String repairReason; String signatureImg1; String signatureImg2; String sparepart; double partsCost; double manCost; String safetyConfirm; int hasEvaluate; List mtRecordCosts; String projectName; String projectCode; String mtCompanyName; String useCompanyCode; int category; String registrationCode; String workerName; int repairDiff; String repairDuration; List mtOptions; List mtRecordImgs; Evaluation evaluation; MaintenanceDetailEntity( {this.createDate, this.creatorId, this.updateDate, this.updateId, this.id, this.mtPlanId, this.liftId, this.projectId, this.mtCompanyId, this.workerId, this.code, this.liftType, this.type, this.planDate, this.workDate, this.stopDate, this.recoveryDate, this.maintenanceAdvice, this.maintenanceOption, this.position, this.status, this.isRegular, this.workerId1, this.isRepair, this.repairReason, this.signatureImg1, this.signatureImg2, this.sparepart, this.partsCost, this.manCost, this.safetyConfirm, this.hasEvaluate, this.mtRecordCosts, this.projectName, this.projectCode, this.mtCompanyName, this.useCompanyCode, this.category, this.registrationCode, this.workerName, this.repairDiff, this.repairDuration, this.mtOptions, this.mtRecordImgs, this.evaluation}); Map getMaintenanceOptionArr(){ Map map = Map(); List list = maintenanceOption.replaceAll(" ", "").split(","); for (var i = 0; i < list.length; ++i) { var item = list[i]; List kv = item.split(":"); map[kv[0]] = int.parse(kv[1]); } print("================="); print(map); print("================="); return map; } MaintenanceDetailEntity.fromJsonMap(Map json) { createDate = json['createDate']; creatorId = json['creatorId']; updateDate = json['updateDate']; updateId = json['updateId']; id = json['id']; mtPlanId = json['mtPlanId']; liftId = json['liftId']; projectId = json['projectId']; mtCompanyId = json['mtCompanyId']; workerId = json['workerId']; code = json['code']; liftType = json['liftType']; type = json['type']; planDate = json['planDate']; workDate = json['workDate']; stopDate = json['stopDate']; recoveryDate = json['recoveryDate']; maintenanceAdvice = json['maintenanceAdvice']; maintenanceOption = json['maintenanceOption']; position = json['position']; status = json['status']; isRegular = json['isRegular']; workerId1 = json['workerId1']; isRepair = json['isRepair']; repairReason = json['repairReason']; signatureImg1 = json['signatureImg1']; signatureImg2 = json['signatureImg2']??""; sparepart = json['sparepart']; partsCost = json['partsCost']; manCost = json['manCost']; safetyConfirm = json['safetyConfirm']; hasEvaluate = json['hasEvaluate']; if (json['mtRecordCosts'] != null) { mtRecordCosts = new List(); json['mtRecordCosts'].forEach((v) { mtRecordCosts.add(new MtRecordCosts.fromJsonMap(v)); }); } projectName = json['projectName']; projectCode = json['projectCode']; mtCompanyName = json['mtCompanyName']; useCompanyCode = json['useCompanyCode']; category = json['category']; registrationCode = json['registrationCode']; workerName = json['workerName']; repairDiff = json['repairDiff']; repairDuration = json['repairDuration']; if (json['mtOptions'] != null) { mtOptions = new List(); json['mtOptions'].forEach((v) { mtOptions.add(new MtOptions.fromJsonMap(v)); }); } if (json['mtRecordImgs'] != null) { mtRecordImgs = new List(); json['mtRecordImgs'].forEach((v) { mtRecordImgs.add(new MtRecordImgs.fromJsonMap(v)); }); } evaluation = json['evaluation'] != null ? new Evaluation.fromJsonMap(json['evaluation']) : null; } Map toJson() { final Map data = new Map(); data['createDate'] = this.createDate; data['creatorId'] = this.creatorId; data['updateDate'] = this.updateDate; data['updateId'] = this.updateId; data['id'] = this.id; data['mtPlanId'] = this.mtPlanId; data['liftId'] = this.liftId; data['projectId'] = this.projectId; data['mtCompanyId'] = this.mtCompanyId; data['workerId'] = this.workerId; data['code'] = this.code; data['liftType'] = this.liftType; data['type'] = this.type; data['planDate'] = this.planDate; data['workDate'] = this.workDate; data['stopDate'] = this.stopDate; data['recoveryDate'] = this.recoveryDate; data['maintenanceAdvice'] = this.maintenanceAdvice; data['maintenanceOption'] = this.maintenanceOption; data['position'] = this.position; data['status'] = this.status; data['isRegular'] = this.isRegular; data['workerId1'] = this.workerId1; data['isRepair'] = this.isRepair; data['repairReason'] = this.repairReason; data['signatureImg1'] = this.signatureImg1; data['signatureImg2'] = this.signatureImg2; data['sparepart'] = this.sparepart; data['partsCost'] = this.partsCost; data['manCost'] = this.manCost; data['safetyConfirm'] = this.safetyConfirm; data['hasEvaluate'] = this.hasEvaluate; if (this.mtRecordCosts != null) { data['mtRecordCosts'] = this.mtRecordCosts.map((v) => v.toJson()).toList(); } data['projectName'] = this.projectName; data['projectCode'] = this.projectCode; data['mtCompanyName'] = this.mtCompanyName; data['useCompanyCode'] = this.useCompanyCode; data['category'] = this.category; data['registrationCode'] = this.registrationCode; data['workerName'] = this.workerName; data['repairDiff'] = this.repairDiff; data['repairDuration'] = this.repairDuration; if (this.mtOptions != null) { data['mtOptions'] = this.mtOptions.map((v) => v.toJson()).toList(); } if (this.mtRecordImgs != null) { data['mtRecordImgs'] = this.mtRecordImgs.map((v) => v.toJson()).toList(); } if (this.evaluation != null) { data['evaluation'] = this.evaluation.toJson(); } return data; } } class MtRecordCosts { String createDate; String updateDate; String id; String mtRecordId; String sparepart; int partsCost; int manCost; MtRecordCosts( {this.createDate, this.updateDate, this.id, this.mtRecordId, this.sparepart, this.partsCost, this.manCost}); MtRecordCosts.fromJsonMap(Map json) { createDate = json['createDate']; updateDate = json['updateDate']; id = json['id']; mtRecordId = json['mtRecordId']; sparepart = json['sparepart']; partsCost = json['partsCost']; manCost = json['manCost']; } Map toJson() { final Map data = new Map(); data['createDate'] = this.createDate; data['updateDate'] = this.updateDate; data['id'] = this.id; data['mtRecordId'] = this.mtRecordId; data['sparepart'] = this.sparepart; data['partsCost'] = this.partsCost; data['manCost'] = this.manCost; return data; } } class MtOptions { String id; String content; String mtCompanyId; int type; int liftCategory; int sort; int status; String signage; String item; int opt; MtOptions( {this.id, this.content, this.mtCompanyId, this.type, this.liftCategory, this.sort, this.status, this.signage, this.item, this.opt}); MtOptions.fromJsonMap(Map json) { id = json['id']; content = json['content']; mtCompanyId = json['mtCompanyId']; type = json['type']; liftCategory = json['liftCategory']; sort = json['sort']; status = json['status']; signage = json['signage']; item = json['item']; opt = json['opt']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['content'] = this.content; data['mtCompanyId'] = this.mtCompanyId; data['type'] = this.type; data['liftCategory'] = this.liftCategory; data['sort'] = this.sort; data['status'] = this.status; data['signage'] = this.signage; data['item'] = this.item; data['opt'] = this.opt; return data; } } class MtRecordImgs { String id; String mtRecordId; String imgUrl; // int sort; MtRecordImgs({this.id, this.mtRecordId, this.imgUrl}); MtRecordImgs.fromJsonMap(Map json) { id = json['id']; mtRecordId = json['mtRecordId']; imgUrl = json['imgUrl']; // sort = json['sort']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['mtRecordId'] = this.mtRecordId; data['imgUrl'] = this.imgUrl; // data['sort'] = this.sort; return data; } } class Evaluation { String id; String liftId; String recordId; int source; int type; String advice; int serviceLevel; int starLevel; String imgUrl; String postDate; String userId; Evaluation( {this.id, this.liftId, this.recordId, this.source, this.type, this.advice, this.serviceLevel, this.starLevel, this.imgUrl, this.postDate, this.userId}); Evaluation.fromJsonMap(Map json) { id = json['id']; liftId = json['liftId']; recordId = json['recordId']; source = json['source']; type = json['type']; advice = json['advice']; serviceLevel = json['serviceLevel']; starLevel = json['starLevel']; imgUrl = json['imgUrl']; postDate = json['postDate']; userId = json['userId']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['liftId'] = this.liftId; data['recordId'] = this.recordId; data['source'] = this.source; data['type'] = this.type; data['advice'] = this.advice; data['serviceLevel'] = this.serviceLevel; data['starLevel'] = this.starLevel; data['imgUrl'] = this.imgUrl; data['postDate'] = this.postDate; data['userId'] = this.userId; return data; } } class MaintenanceCache{ String id; String options; String advice; String sign1; String sign2; List images; MaintenanceCache( {this.id="", this.options="", this.advice="", this.sign1="", this.sign2="", this.images}); Map getMaintenanceOptionArr(){ Map map = Map(); if(!options.contains(",")){ return map; } List list = options.replaceAll(" ", "").split(","); for (var i = 0; i < list.length; ++i) { var item = list[i]; List kv = item.split(":"); map[kv[0]] = int.parse(kv[1]); } print("================="); print(map); print("================="); return map; } MaintenanceCache.fromJsonMap(Map json) { id = json['id']; options = json['options']; advice = json['advice']; sign1 = json['sign1']; sign2 = json['sign2']; images = json['images'].cast(); } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['options'] = this.options; data['advice'] = this.advice; data['sign1'] = this.sign1; data['sign2'] = this.sign2; data['images'] = this.images; return data; } }