Merge branch 'zhang'

# Conflicts:
#	lib/const/api.dart
hmxc
张萌 4 years ago
commit 6c47308790

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

@ -104,4 +104,30 @@ class _Manage {
class _Upload {
///
String get avatar => '/user/upload/butlerAppHeadSculpture';
///id
String get repairDetail => '/user/repair/findById';
///-
String get dispatchListDetailType => '/manage/dataDictionary/findSysDispatchListDetailType';
///(id and name)
String get workOrderTimeLimit => '/user/repair/findWorkOrderTimeLimit';
///
String get workOrderTypeDetail => '/user/repair/findWorkOrderTypeDetail';
///
String get repairDispatch => '/user/repair/dispatch';
///
String get repairReassignment => '/user/repair/reassignment';
///
String get recevingOrders => '/user/repair/receivingOrders';
///
String get applyDelayed => '/user/repair/applyDelayed';
///
String get handleResult => '/user/repair/handleResult';
}

@ -17,7 +17,7 @@ enum FIX_ENUM {
///
DONE,
}
@deprecated
class FixModel {
static Map<FIX_ENUM, String> managerRoleMap = {
FIX_ENUM.HAND_OUT: '待派单',
@ -206,7 +206,7 @@ Map<String, FIX_DATE_LIMIT> fixDateLimitStringMap = {
'12小时内处理': FIX_DATE_LIMIT.HOUR_12,
'8小时内处理': FIX_DATE_LIMIT.HOUR_8,
};
@deprecated
class FixDetailModel {
///
String userName;

@ -0,0 +1,21 @@
class DispatchDetialModel {
String showName;
int showValue;
String remarks;
DispatchDetialModel({this.showName, this.showValue, this.remarks});
DispatchDetialModel.fromJson(Map<String, dynamic> json) {
showName = json['showName'];
showValue = json['showValue'];
remarks = json['remarks'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['showName'] = this.showName;
data['showValue'] = this.showValue;
data['remarks'] = this.remarks;
return data;
}
}

@ -0,0 +1,27 @@
class DispatchReportModel {
int dispatchListId;
int workOrderTyoe;
int workOrderTypeDetail;
int workOrderTimeLimit;
int type;
int operato;
String remark;
DispatchReportModel.zero() {
dispatchListId = -1;
workOrderTyoe = -1;
workOrderTypeDetail = -1;
workOrderTimeLimit = -1;
type = -1;
operato = -1;
remark = '';
}
DispatchReportModel(
{this.dispatchListId,
this.operato,
this.remark,
this.type,
this.workOrderTimeLimit,
this.workOrderTyoe,
this.workOrderTypeDetail});
}

@ -0,0 +1,239 @@
class FixedDetailModel {
HandlingSituation handlingSituation;
DispatchType dispatchType;
CostDetail costDetail;
RepairDetail repairDetail;
String evaluateInfo;
int type;
List<ProcessRecord> processRecord;
FixedDetailModel(
{this.handlingSituation,
this.dispatchType,
this.costDetail,
this.repairDetail,
this.evaluateInfo,
this.type,
this.processRecord});
FixedDetailModel.fromJson(Map<String, dynamic> json) {
handlingSituation = json['handlingSituation'] != null
? new HandlingSituation.fromJson(json['handlingSituation'])
: null;
dispatchType = json['dispatchType'] != null
? new DispatchType.fromJson(json['dispatchType'])
: null;
costDetail = json['costDetail'] != null
? new CostDetail.fromJson(json['costDetail'])
: null;
repairDetail = json['repairDetail'] != null
? new RepairDetail.fromJson(json['repairDetail'])
: null;
evaluateInfo = json['evaluateInfo'];
type = json['type'];
if (json['processRecord'] != null) {
processRecord = new List<ProcessRecord>();
json['processRecord'].forEach((v) {
processRecord.add(new ProcessRecord.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.handlingSituation != null) {
data['handlingSituation'] = this.handlingSituation.toJson();
}
if (this.dispatchType != null) {
data['dispatchType'] = this.dispatchType.toJson();
}
if (this.costDetail != null) {
data['costDetail'] = this.costDetail.toJson();
}
if (this.repairDetail != null) {
data['repairDetail'] = this.repairDetail.toJson();
}
data['evaluateInfo'] = this.evaluateInfo;
data['type'] = this.type;
if (this.processRecord != null) {
data['processRecord'] =
this.processRecord.map((v) => v.toJson()).toList();
}
return data;
}
}
class HandlingSituation {
int id;
String detail;
String materialList;
List<ImgUrls> imgUrls;
HandlingSituation({this.id, this.detail, this.materialList, this.imgUrls});
HandlingSituation.fromJson(Map<String, dynamic> json) {
id = json['id'];
detail = json['detail'];
materialList = json['materialList'];
if (json['imgUrls'] != null) {
imgUrls = new List<ImgUrls>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgUrls.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['detail'] = this.detail;
data['materialList'] = this.materialList;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
return data;
}
}
class ImgUrls {
String url;
String size;
int longs;
int paragraph;
int sort;
ImgUrls({this.url, this.size, this.longs, this.paragraph, this.sort});
ImgUrls.fromJson(Map<String, dynamic> json) {
url = json['url'];
size = json['size'];
longs = json['longs'];
paragraph = json['paragraph'];
sort = json['sort'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
data['size'] = this.size;
data['longs'] = this.longs;
data['paragraph'] = this.paragraph;
data['sort'] = this.sort;
return data;
}
}
class DispatchType {
int dispatchType;
String workOrderLimitName;
String workOrderSubclassName;
DispatchType(
{this.dispatchType, this.workOrderLimitName, this.workOrderSubclassName});
DispatchType.fromJson(Map<String, dynamic> json) {
dispatchType = json['dispatchType'];
workOrderLimitName = json['workOrderLimitName'];
workOrderSubclassName = json['workOrderSubclassName'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['dispatchType'] = this.dispatchType;
data['workOrderLimitName'] = this.workOrderLimitName;
data['workOrderSubclassName'] = this.workOrderSubclassName;
return data;
}
}
class CostDetail {
int laborCost;
int materialCost;
int totalCost;
CostDetail({this.laborCost, this.materialCost, this.totalCost});
CostDetail.fromJson(Map<String, dynamic> json) {
laborCost = json['laborCost'];
materialCost = json['materialCost'];
totalCost = json['totalCost'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['laborCost'] = this.laborCost;
data['materialCost'] = this.materialCost;
data['totalCost'] = this.totalCost;
return data;
}
}
class RepairDetail {
int id;
int dispatchId;
String name;
String tel;
int type;
int status;
List<ImgUrls> imgUrls;
RepairDetail(
{this.id,
this.dispatchId,
this.name,
this.tel,
this.type,
this.status,
this.imgUrls});
RepairDetail.fromJson(Map<String, dynamic> json) {
id = json['id'];
dispatchId = json['dispatchId'];
name = json['name'];
tel = json['tel'];
type = json['type'];
status = json['status'];
if (json['imgUrls'] != null) {
imgUrls = new List<ImgUrls>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgUrls.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['dispatchId'] = this.dispatchId;
data['name'] = this.name;
data['tel'] = this.tel;
data['type'] = this.type;
data['status'] = this.status;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
return data;
}
}
class ProcessRecord {
int id;
int operationType;
String operationDate;
ProcessRecord({this.id, this.operationType, this.operationDate});
ProcessRecord.fromJson(Map<String, dynamic> json) {
id = json['id'];
operationType = json['operationType'];
operationDate = json['operationDate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['operationType'] = this.operationType;
data['operationDate'] = this.operationDate;
return data;
}
}

@ -0,0 +1,18 @@
class WorkOrderTypeModel {
int id;
String name;
WorkOrderTypeModel({this.id, this.name});
WorkOrderTypeModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}

@ -0,0 +1,18 @@
class WorkTimeLimitModel {
int id;
String name;
WorkTimeLimitModel({this.id, this.name});
WorkTimeLimitModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}

@ -1,4 +1,5 @@
class AkuMap {
///
static String fixStatus(bool canOpention, bool canPickup, int status) {
if (canOpention) {
switch (status) {
@ -57,4 +58,22 @@ class AkuMap {
}
}
}
///
static Map<int, String> fixAreaType = {1: '公区维修', 2: '家庭维修'};
///-
static Map<int, String> operationType = {
1: '提交报修',
2: '派单',
3: '开始处理',
4: '处理完成',
5: '确认',
6: '回访',
7: '回退',
8: '作废',
9: '取消'
};
static Map<int, String> dispatchType = {1: '无偿服务', 2: '有偿服务'};
}

@ -1,5 +1,5 @@
// Flutter imports:
import 'package:aku_community_manager/models/manager/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:flutter/material.dart';
// Project imports:

@ -1,5 +1,5 @@
// Flutter imports:
import 'package:aku_community_manager/models/manager/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

@ -1,29 +1,39 @@
// Flutter imports:
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/dispatch_detail_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/dispatch_report_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/fixed_detail_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/work_order_type_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/work_time_limit_model.dart';
import 'package:aku_community_manager/tools/aku_map.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_more_time_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_work_finish_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fixer_department_page.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/manage_func.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
// Project imports:
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_more_time_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_work_finish_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fixer_department_page.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart';
import 'package:aku_community_manager/ui/widgets/inner/show_bottom_sheet.dart';
class BusinessAndFixDetailPage extends StatefulWidget {
final FixModel model;
final BussinessAndFixModel model;
BusinessAndFixDetailPage({Key key, this.model}) : super(key: key);
@override
@ -37,103 +47,91 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
return userProvider.userInfoModel.role;
}
bool get isHandOut => widget.model.type == FIX_ENUM.HAND_OUT;
FixDetailModel get detailModel => widget.model.detail;
bool get isHandOut => widget.model.status == 1;
FixedDetailModel _detailModel;
bool _onload = true;
EasyRefreshController _easyRefreshController;
String get fixType {
switch (detailModel.type) {
case FIX_PAYMENT_TYPE.FREE:
return '无偿服务';
break;
case FIX_PAYMENT_TYPE.PAY:
return '有偿服务';
break;
default:
return '';
break;
}
List<DispatchDetialModel> _dispatchModels;
List<WorkTimeLimitModel> _timeLimitModels;
List<WorkOrderTypeModel> _workTypeModels;
DispatchReportModel _reportModel = DispatchReportModel.zero();
@override
void initState() {
super.initState();
_easyRefreshController = EasyRefreshController();
}
String get dateLimit {
switch (detailModel.limit) {
case FIX_DATE_LIMIT.HOUR_24:
return '24小时内处理';
break;
case FIX_DATE_LIMIT.HOUR_12:
return '12小时内处理';
break;
case FIX_DATE_LIMIT.HOUR_8:
return '8小时内处理';
break;
default:
return '';
break;
}
@override
void dispose() {
_easyRefreshController?.dispose();
super.dispose();
}
String get subType {
switch (detailModel.subType) {
case FIX_SUB_TYPE.NORMAL:
return '一般单';
break;
case FIX_SUB_TYPE.HURRY:
return '加急单';
break;
default:
return '';
break;
}
Widget fixTypeWidget() {
UserProvider userProvider =
Provider.of<UserProvider>(context, listen: false);
return Text(
AkuMap.fixStatus(userProvider.infoModel.canOperation,
userProvider.infoModel.canPickUpTicket, widget.model.status),
style: TextStyle(
color: widget.model.status < 4
? Color(0XFFFF4501)
: AppStyle.minorTextColor,
),
);
}
Widget get fixTypeWidget {
if (userRole == USER_ROLE.MANAGER) {
return Text(
FixModel.managerRoleMap[widget.model.type],
style: TextStyle(
color: widget.model.type != FIX_ENUM.DONE
? Color(0XFFFF4501)
: AppStyle.minorTextColor,
),
);
} else {
return Text(
FixModel.otherRoleMap[widget.model.type],
style: TextStyle(
color: widget.model.type != FIX_ENUM.DONE
? Color(0XFFFF4501)
: AppStyle.minorTextColor,
),
);
}
Widget _empty() {
return Container();
}
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '报修详情',
body: ListView(
padding: EdgeInsets.symmetric(vertical: 16.w),
children: [
_buildInfo(),
_buildType(widget.model.type == FIX_ENUM.HAND_OUT),
_buildProcess(),
detailModel.result == null ? SizedBox() : _buildResult(),
detailModel.review == null ? SizedBox() : _buildRating(),
],
body: EasyRefresh(
firstRefresh: true,
controller: _easyRefreshController,
header: MaterialHeader(),
onRefresh: () async {
_detailModel = await ManageFunc.repairDetail(widget.model.id);
_reportModel.dispatchListId = widget.model.id;
_reportModel.workOrderTyoe = 1;
_onload = false;
setState(() {});
},
child: _onload
? _empty()
: ListView(
padding: EdgeInsets.symmetric(vertical: 16.w),
children: [
_buildInfo(),
_buildType(widget.model.status == 1),
_buildProcess(),
_detailModel.handlingSituation == null
? SizedBox()
: _buildResult(),
_detailModel.evaluateInfo == null
? SizedBox()
: _buildRating(),
],
),
),
bottom: Builder(
builder: (context) {
final userProvider =
Provider.of<UserProvider>(context, listen: false);
if (widget.model.type == FIX_ENUM.HAND_OUT) {
if (userProvider.infoModel.canOperation&&widget.model.status<2) {
return AkuMaterialButton(
color: AppStyle.primaryColor,
nullColor: AppStyle.minorColor,
onPressed: detailModel.type != null &&
detailModel.subType != null &&
detailModel.limit != null
onPressed: _reportModel.type != null &&
_reportModel.workOrderTyoe != null &&
_reportModel.workOrderTimeLimit != null
? () {
Get.to(FixerDepartmentPage(model: widget.model));
Get.to(FixerDepartmentPage(model: _reportModel));
}
: null,
child: Text(
@ -143,14 +141,14 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
),
),
);
} else if (widget.model.type == FIX_ENUM.WAIT_PICKUP) {
if (userProvider.userInfoModel.role == USER_ROLE.MANAGER) {
} else if (widget.model.status == 2) {
if (userProvider.infoModel.canOperation) {
return AkuMaterialButton(
color: AppStyle.primaryColor,
nullColor: AppStyle.minorColor,
onPressed: () {
Get.to(FixerDepartmentPage(
model: widget.model,
model: _reportModel,
changeType: true,
));
},
@ -165,15 +163,14 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
return AkuMaterialButton(
color: AppStyle.primaryColor,
nullColor: AppStyle.minorColor,
onPressed: () {
final userProvider =
Provider.of<UserProvider>(context, listen: false);
detailModel.fixStatuses.add(FixStatus(
title: '${userProvider.userInfoModel.nickName}已接单',
date: DateTime.now(),
));
widget.model.type = FIX_ENUM.PROCESSING;
Get.back();
onPressed: () async {
BaseModel baseModel =
await ManageFunc.recevingOrders(widget.model.dispatchId);
if (baseModel.status) {
Get.back();
} else {
BotToast.showText(text: baseModel.message);
}
},
child: Text(
'立即接单',
@ -183,8 +180,8 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
),
);
}
} else if (widget.model.type == FIX_ENUM.PROCESSING &&
userProvider.userInfoModel.role == USER_ROLE.FIXER)
} else if ((widget.model.status==3) &&
userProvider.infoModel.canPickUpTicket)
return Container(
height: 96.w,
alignment: Alignment.center,
@ -212,7 +209,8 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
),
),
onPressed: () {
Get.to(FixMoreTimePage(model: widget.model));
Get.to(
FixMoreTimePage(dispatchId: widget.model.dispatchId));
},
child: Text(
'申请延时',
@ -228,7 +226,11 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
radius: 4.w,
color: AppStyle.primaryColor,
onPressed: () {
Get.to(FixWorkFinishPage(model: widget.model));
Get.to(FixWorkFinishPage(
fixModel: widget.model,
model: _detailModel,
dispatchType:
_detailModel.dispatchType.dispatchType == 1));
},
child: Text(
'处理完成',
@ -251,27 +253,27 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
_buildInfo() {
return AkuTitleBox(
title: '报修信息',
suffix: fixTypeWidget,
suffix: fixTypeWidget(),
children: [
AkuBox.h(16),
_buildTile(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
'报修人',
widget.model.detail.userName,
_detailModel.repairDetail.name,
),
_buildTile(
R.ASSETS_MESSAGE_IC_PHONE_PNG,
'联系电话',
widget.model.detail.userPhoneNumber,
_detailModel.repairDetail.tel,
),
_buildTile(
R.ASSETS_MESSAGE_IC_AREA_PNG,
'报修区域',
widget.model.detail.fixArea,
AkuMap.fixAreaType[_detailModel.repairDetail.type],
),
AkuBox.h(8),
Text(
widget.model.title,
widget.model.reportDetail,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontWeight: FontWeight.bold,
@ -285,10 +287,11 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
crossAxisSpacing: 16.w,
mainAxisSpacing: 16.w,
),
children: widget.model.imgs.map((e) {
children: _detailModel.repairDetail.imgUrls.map((e) {
return ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: (e is String) ? Image.asset(e) : Image.file(e),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP, image: e.url),
);
}).toList(),
shrinkWrap: true,
@ -304,54 +307,93 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
children: [
_buildTypeTile(
'派单类型',
fixType,
canTap
? _dispatchModels == null
? null
: _dispatchModels[_dispatchModels.indexWhere(
(element) => element.showValue == _reportModel.type)]
.showName
: AkuMap.dispatchType[_detailModel.dispatchType.dispatchType],
canTap,
helpContent: '请选择服务类型',
onTap: () {
onTap: () async {
List models = await ManageFunc.dispatchListDetailType();
_dispatchModels =
models.map((e) => DispatchDetialModel.fromJson(e)).toList();
showItemSheet(
title: '派单类型',
items: ['无偿服务', '有偿服务'],
selectItem: fixPaymentMap[detailModel.type],
items: _dispatchModels.map((e) => e.showName).toList(),
ids: _dispatchModels.map((e) => e.showValue).toList(),
selectItem: _reportModel.type,
onTap: (result) {
detailModel.type = fixPaymentStringMap[result];
_reportModel.type = result;
},
).then((_) {
if (_reportModel.type == -1) {
_dispatchModels = null;
}
setState(() {});
});
},
),
_buildTypeTile(
'工单时限',
dateLimit,
canTap
? _timeLimitModels == null
? null
: _timeLimitModels[_timeLimitModels.indexWhere((element) =>
element.id == _reportModel.workOrderTimeLimit)]
?.name
: _detailModel.dispatchType.workOrderLimitName,
canTap,
helpContent: '请选择工单时限',
onTap: () {
onTap: () async {
List models = await ManageFunc.workOrderTimeType();
_timeLimitModels =
models.map((e) => WorkTimeLimitModel.fromJson(e)).toList();
showItemSheet(
title: '工单时限',
items: ['24小时内处理', '12小时内处理', '8小时内处理'],
selectItem: fixDateLimitMap[detailModel.limit],
items: _timeLimitModels.map((e) => e.name).toList(),
ids: _timeLimitModels.map((e) => e.id).toList(),
selectItem: _reportModel.workOrderTimeLimit,
onTap: (result) {
detailModel.limit = fixDateLimitStringMap[result];
_reportModel.workOrderTimeLimit = result;
},
).then((_) {
if (_reportModel.workOrderTimeLimit == -1) {
_timeLimitModels = null;
}
setState(() {});
});
},
),
_buildTypeTile(
'工单子类',
subType,
canTap
? _workTypeModels == null
? null
: _workTypeModels[_workTypeModels.indexWhere((element) =>
element.id == _reportModel.workOrderTypeDetail)]
.name
: _detailModel.dispatchType.workOrderSubclassName,
canTap,
helpContent: '请选择工单子类',
onTap: () {
onTap: () async {
List models = await ManageFunc.workOrderTypeDetail(widget.model.id);
_workTypeModels =
models.map((e) => WorkOrderTypeModel.fromJson(e)).toList();
showItemSheet(
title: '工单子类',
items: ['一般单', '加急单'],
selectItem: fixSubTypeMap[detailModel.subType],
items: _workTypeModels.map((e) => e.name).toList(),
ids: _workTypeModels.map((e) => e.id).toList(),
selectItem: _reportModel.workOrderTypeDetail,
onTap: (result) {
detailModel.subType = fixSubTypeStringMap[result];
_reportModel.workOrderTypeDetail = result;
},
).then((_) {
if (_reportModel.workOrderTypeDetail == -1) {
_workTypeModels = null;
}
setState(() {});
});
},
@ -363,10 +405,11 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
_buildProcess() {
return AkuTitleBox(
title: '报修进程',
children: detailModel.fixStatuses.map((e) {
children: _detailModel.processRecord.map((e) {
return _buildProcessTile(
e.title,
DateUtil.formatDate(e.date, format: 'yyyy-MM-dd HH:mm:ss'),
AkuMap.operationType[e.operationType],
DateUtil.formatDateStr(e.operationDate,
format: 'yyyy-MM-dd HH:mm:ss'),
);
}).toList(),
);
@ -386,7 +429,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
),
AkuBox.h(8),
Text(
detailModel.result.detail,
_detailModel.handlingSituation.detail,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.w,
@ -403,7 +446,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
),
AkuBox.h(8),
Text(
detailModel.result.material,
_detailModel.handlingSituation.materialList,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.w,
@ -425,19 +468,11 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
),
children: detailModel.result.imgs.map((e) {
children: _detailModel.handlingSituation.imgUrls.map((e) {
return ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: (e is String)
? Image.asset(
e,
fit: BoxFit.cover,
)
: Image.file(
e,
fit: BoxFit.cover,
),
);
borderRadius: BorderRadius.circular(4.w),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP, image: e.url));
}).toList(),
),
],
@ -459,7 +494,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
),
),
Spacer(),
_buildStar(detailModel.review.rate),
_buildStar(5),
],
),
AkuBox.h(24),
@ -472,7 +507,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
),
AkuBox.h(8),
Text(
detailModel.review.content,
_detailModel.evaluateInfo,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.w,

@ -1,11 +1,13 @@
// Flutter imports:
import 'package:aku_community_manager/models/manager/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/tools/aku_map.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:common_utils/common_utils.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
// Project imports:
@ -62,7 +64,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
final userProvider = Provider.of<UserProvider>(context, listen: false);
return GestureDetector(
onTap: () {
// Get.to(BusinessAndFixDetailPage(model: widget.model));
Get.to(BusinessAndFixDetailPage(model: widget.model));
},
child: Container(
padding: EdgeInsets.all(24.w),

@ -1,5 +1,5 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart';
import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart';
import 'package:flutter/material.dart';

@ -1,23 +1,23 @@
// Flutter imports:
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/manage_func.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
// Project imports:
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:get/get.dart';
class FixMoreTimePage extends StatefulWidget {
final FixModel model;
FixMoreTimePage({Key key, @required this.model}) : super(key: key);
final int dispatchId;
FixMoreTimePage({Key key, @required this.dispatchId}) : super(key: key);
@override
_FixMoreTimePageState createState() => _FixMoreTimePageState();
@ -25,6 +25,20 @@ class FixMoreTimePage extends StatefulWidget {
class _FixMoreTimePageState extends State<FixMoreTimePage> {
String _nowSelect = '24h';
List<String> _delayList = ['24h', '48h', '72h', '未知'];
TextEditingController _textEditingController;
@override
void initState() {
super.initState();
_textEditingController = TextEditingController();
}
@override
void dispose() {
_textEditingController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return AkuScaffold(
@ -56,7 +70,7 @@ class _FixMoreTimePageState extends State<FixMoreTimePage> {
AkuBox.h(24),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: ['24h', '48h', '72h', '未知'].map((e) {
children: _delayList.map((e) {
return GestureDetector(
onTap: () {
setState(() {
@ -131,6 +145,10 @@ class _FixMoreTimePageState extends State<FixMoreTimePage> {
child: TextField(
minLines: 7,
maxLines: 7,
controller: _textEditingController,
onChanged: (_) {
setState(() {});
},
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
@ -141,15 +159,24 @@ class _FixMoreTimePageState extends State<FixMoreTimePage> {
Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: AkuMaterialButton(
onPressed: () {
final userProvider =
Provider.of<UserProvider>(context, listen: false);
widget.model.detail.fixStatuses.add(
FixStatus(
title: '${userProvider.userInfoModel.nickName}申请延时',
date: DateTime.now()),
);
Get.back();
onPressed: () async {
// final userProvider =
// Provider.of<UserProvider>(context, listen: false);
// widget.model.detail.fixStatuses.add(
// FixStatus(
// title: '${userProvider.userInfoModel.nickName}申请延时',
// date: DateTime.now()),
// );
// Get.back();
BaseModel baseModel = await ManageFunc.applyDelayed(
widget.dispatchId,
_delayList.indexOf(_nowSelect) + 1,
_textEditingController.text ?? '');
if (baseModel.status) {
Get.back();
} else {
BotToast.showText(text: baseModel.message);
}
},
radius: 8.w,
child: Text(

@ -0,0 +1,29 @@
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:aku_community_manager/const/resource.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class FixSubmitFinishPage extends StatelessWidget {
final BussinessAndFixModel model;
const FixSubmitFinishPage({Key key, this.model}) : super(key: key);
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '处理完成',
body:Container(
width:double.infinity,
child: Column(
children: [
Image.asset(R.ASSETS_MANAGE_SUBMIT_SUCCESS_PNG,width:587.w,height:350.w),
'您已处理完成该报修'.text.black.size(40.sp).bold.make(),
120.w.heightBox,
BusinessFixCard(model: this.model),
],
),
),
);
}
}

@ -2,26 +2,39 @@
import 'dart:io';
// Flutter imports:
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/fixed_detail_model.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_submit_finish_page.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/manage_func.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:common_utils/common_utils.dart';
import 'package:get/get.dart';
// Project imports:
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart';
import 'package:aku_community_manager/ui/widgets/inner/pick_image.dart';
import 'package:get/get.dart';
import 'package:aku_community_manager/tools/extensions/router_extension_tool.dart';
class FixWorkFinishPage extends StatefulWidget {
final FixModel model;
FixWorkFinishPage({Key key, @required this.model}) : super(key: key);
final FixedDetailModel model;
final BussinessAndFixModel fixModel;
final bool dispatchType;
FixWorkFinishPage(
{Key key,
@required this.model,
@required this.dispatchType,
@required this.fixModel})
: super(key: key);
@override
_FixWorkFinishPageState createState() => _FixWorkFinishPageState();
@ -34,6 +47,9 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
TextEditingController _humanController = TextEditingController();
TextEditingController _materialPriceController = TextEditingController();
double humanPrice;
double materialPrice;
@override
void dispose() {
_descriptionController?.dispose();
@ -57,7 +73,7 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
spacing: 24,
children: [
Text(
widget.model.title,
widget.fixModel.reportDetail,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.w,
@ -73,13 +89,15 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
mainAxisSpacing: 16.w,
),
itemBuilder: (context, index) {
final img = widget.model.imgs[index];
// final img = widget.model.imgs[index];
return ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: (img is String) ? Image.asset(img) : Image.file(img),
);
borderRadius: BorderRadius.circular(4.w),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: widget.model.repairDetail.imgUrls[index].url,
));
},
itemCount: widget.model.imgs.length,
itemCount: widget.model.repairDetail.imgUrls.length,
),
],
),
@ -262,87 +280,87 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
)
],
),
// widget.model.detail.type == FIX_PAYMENT_TYPE.FREE
// ? SizedBox()
// :
AkuTitleBox(
title: '费用明细',
spacing: 16,
children: [
Row(
children: [
AkuBox.h(96),
Text('人工费'),
Expanded(
child: TextField(
controller: _humanController,
onChanged: (_) => setState(() {}),
keyboardType: TextInputType.number,
textAlign: TextAlign.end,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入',
hintStyle: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28.sp,
color: AppStyle.minorTextColor,
widget.dispatchType
? SizedBox()
: AkuTitleBox(
title: '费用明细',
spacing: 16,
children: [
Row(
children: [
AkuBox.h(96),
Text('人工费'),
Expanded(
child: TextField(
controller: _humanController,
onChanged: (_) => setState(() {}),
keyboardType: TextInputType.number,
textAlign: TextAlign.end,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入',
hintStyle: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28.sp,
color: AppStyle.minorTextColor,
),
),
),
),
),
],
),
),
],
),
Divider(height: 1.w),
Row(
children: [
AkuBox.h(96),
Text('材料费'),
Expanded(
child: TextField(
onChanged: (_) => setState(() {}),
controller: _materialPriceController,
textAlign: TextAlign.end,
keyboardType: TextInputType.number,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入',
hintStyle: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28.sp,
color: AppStyle.minorTextColor,
Divider(height: 1.w),
Row(
children: [
AkuBox.h(96),
Text('材料费'),
Expanded(
child: TextField(
onChanged: (_) => setState(() {}),
controller: _materialPriceController,
textAlign: TextAlign.end,
keyboardType: TextInputType.number,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入',
hintStyle: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28.sp,
color: AppStyle.minorTextColor,
),
),
),
),
),
],
),
),
],
),
Divider(height: 1.w),
Row(
children: [
AkuBox.h(96),
Text('总计费用'),
Spacer(),
Builder(
builder: (context) {
double humanPrice =
double.tryParse(_humanController.text);
double materialPrice =
double.tryParse(_materialPriceController.text);
Divider(height: 1.w),
Row(
children: [
AkuBox.h(96),
Text('总计费用'),
Spacer(),
Builder(
builder: (context) {
humanPrice = double.tryParse(_humanController.text);
materialPrice =
double.tryParse(_materialPriceController.text);
if (TextUtil.isEmpty(_humanController.text) ||
TextUtil.isEmpty(_materialPriceController.text)) {
return Text('人工费或材料费不能为空');
} else if (humanPrice == null || materialPrice == null)
return Text('输入有误');
else
return Text(
'¥${(humanPrice + materialPrice).toStringAsFixed(2)}');
},
),
],
),
],
),
if (TextUtil.isEmpty(_humanController.text) ||
TextUtil.isEmpty(
_materialPriceController.text)) {
return Text('人工费或材料费不能为空');
} else if (humanPrice == null ||
materialPrice == null)
return Text('输入有误');
else
return Text(
'¥${(humanPrice + materialPrice).toStringAsFixed(2)}');
},
),
],
),
],
),
],
),
bottom: AkuMaterialButton(
@ -356,19 +374,35 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
),
height: 96.w,
color: AppStyle.primaryColor,
onPressed: () {
widget.model.detail.result = FixResult(
detail: _descriptionController.text,
material: _materialController.text,
imgs: _imgs,
);
widget.model.type = FIX_ENUM.DONE;
if (widget.model.detail.type == FIX_PAYMENT_TYPE.PAY)
widget.model.detail.priceDetail = FixPriceDetail(
humanPrice: double.parse(_humanController.text),
materialPrice: double.parse(_materialController.text),
);
Get.back();
onPressed: () async {
// widget.model.detail.result = FixResult(
// detail: _descriptionController.text,
// material: _materialController.text,
// imgs: _imgs,
// );
// widget.model.type = FIX_ENUM.DONE;
// if (widget.model.detail.type == FIX_PAYMENT_TYPE.PAY)
// widget.model.detail.priceDetail = FixPriceDetail(
// humanPrice: double.parse(_humanController.text),
// materialPrice: double.parse(_materialController.text),
// );
// Get.back();
BaseModel baseModel = await ManageFunc.handleResult(
widget.model.repairDetail.dispatchId,
_descriptionController.text,
_materialController.text,
humanPrice,
materialPrice,
humanPrice + materialPrice,
1, []);
if (baseModel.status) {
FixSubmitFinishPage(
model:widget.fixModel,
).to();
} else {
BotToast.showText(text: baseModel.message);
}
},
),
);

@ -1,8 +1,11 @@
// Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/dispatch_report_model.dart';
import 'package:aku_community_manager/models/manager/fixer_item_model.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/manage_func.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
// Package imports:
@ -13,14 +16,13 @@ import 'package:get/get.dart';
// Project imports:
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
class FixerDepartmentPage extends StatefulWidget {
final FixModel model;
final DispatchReportModel model;
final bool changeType;
FixerDepartmentPage({Key key, @required this.model, this.changeType = false})
: super(key: key);
@ -30,9 +32,26 @@ class FixerDepartmentPage extends StatefulWidget {
}
class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
DispatchReportModel _reportModel;
List<RepairmanVos> _pickedFixers = [];
List<FixerItemModel> _fixerItems = [];
bool get canDispatch {
if (_reportModel?.operato==null) {
return false;
} else if (_reportModel.type == -1) {
return false;
} else if (_reportModel.workOrderTimeLimit == -1) {
return false;
} else if (_reportModel.workOrderTyoe == -1) {
return false;
} else if (_reportModel.workOrderTypeDetail == -1) {
return false;
}
return true;
}
@override
Widget build(BuildContext context) {
return AkuScaffold(
@ -45,6 +64,7 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
_fixerItems = (model.data as List)
.map((e) => FixerItemModel.fromJson(e))
.toList();
_reportModel = widget.model;
setState(() {});
},
child: ListView.builder(
@ -57,29 +77,51 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
),
bottom: AkuMaterialButton(
height: 96.w,
onPressed: _pickedFixers.isEmpty
? null
: () {
onPressed: canDispatch
? () async {
if (widget.changeType) {
Get.back();
_pickedFixers.forEach((element) {
widget.model.detail.fixStatuses.add(
FixStatus(
title: '改派给${element.name}', date: DateTime.now()),
);
});
BaseModel baseModel = await ManageFunc.repairReassignment(
_reportModel.dispatchListId, _reportModel.operato);
if (baseModel.status) {
Get.back();
} else {
BotToast.showText(text: baseModel.message);
}
} else {
Get.back();
Get.back();
widget.model.type = FIX_ENUM.WAIT_PICKUP;
_pickedFixers.forEach((element) {
widget.model.detail.fixStatuses.add(
FixStatus(
title: '分配给${element.name}', date: DateTime.now()),
);
});
BaseModel baseModel =
await ManageFunc.repairDispatch(_reportModel);
if (baseModel.status) {
Get.back();
Get.back();
} else {
BotToast.showText(text: baseModel.message);
}
}
},
}
: null,
// onPressed: _pickedFixers.isEmpty
// ? null
// : () {
// if (widget.changeType) {
// Get.back();
// _pickedFixers.forEach((element) {
// widget.model.detail.fixStatuses.add(
// FixStatus(
// title: '改派给${element.name}', date: DateTime.now()),
// );
// });
// } else {
// Get.back();
// Get.back();
// widget.model.type = FIX_ENUM.WAIT_PICKUP;
// _pickedFixers.forEach((element) {
// widget.model.detail.fixStatuses.add(
// FixStatus(
// title: '分配给${element.name}', date: DateTime.now()),
// );
// });
// }
// },
color: AppStyle.primaryColor,
nullColor: AppStyle.primaryColor.withOpacity(0.5),
child: Text(
@ -139,13 +181,14 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
AkuMaterialButton(
height: 96.w,
onPressed: () {
if (_pickedFixers
.indexWhere((element) => element.id == e.id) ==
-1) {
_pickedFixers.add(e);
} else {
_pickedFixers.remove(e);
}
// if (_pickedFixers
// .indexWhere((element) => element.id == e.id) ==
// -1) {
// _pickedFixers.add(e);
// } else {
// _pickedFixers.remove(e);
// }
_reportModel.operato = e.id;
setState(() {});
},
child: Row(
@ -154,12 +197,17 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
Checkbox(
checkColor: AppStyle.primaryTextColor,
activeColor: AppStyle.primaryColor,
value: _pickedFixers.indexOf(e) != -1,
value: _reportModel.operato == e.id,
onChanged: (state) {
if (_pickedFixers.indexOf(e) == -1) {
_pickedFixers.add(e);
// if (_pickedFixers.indexOf(e) == -1) {
// _pickedFixers.add(e);
// } else {
// _pickedFixers.remove(e);
// }
if (_reportModel.operato == e.id) {
_reportModel.operato = -1;
} else {
_pickedFixers.remove(e);
_reportModel.operato = e.id;
}
setState(() {});
},

@ -58,8 +58,9 @@ Future showNormalSheet(String title, List<Widget> children) async {
Future showItemSheet({
String title,
List<String> items,
String selectItem,
Function(String result) onTap,
List<int> ids,
int selectItem,
Function(int result) onTap,
}) async {
await showNormalSheet(
title,
@ -69,14 +70,14 @@ Future showItemSheet({
minWidth: double.infinity,
onPressed: () {
Get.back();
onTap(e);
onTap(ids[items.indexOf(e)]);
},
child: Text(
e,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 32.sp,
color: e == selectItem
color: items.indexOf(e)==ids.indexOf(selectItem)
? AppStyle.secondaryColor
: AppStyle.primaryTextColor,
),

@ -0,0 +1,104 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/dispatch_report_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/fixed_detail_model.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:dio/dio.dart';
class ManageFunc {
///
static Future repairDetail(int id) async {
Response response =
await NetUtil().dio.get(API.manage.repairDetail, queryParameters: {
'repairId': id,
});
return FixedDetailModel.fromJson(response.data);
}
///
static Future dispatchListDetailType() async {
Response response = await NetUtil().dio.get(
'http://test.akuhotel.com:8804/IntelligentCommunity' +
API.manage.dispatchListDetailType);
return response.data as List;
}
///
static Future workOrderTimeType() async {
BaseModel baseModel = await NetUtil().get(API.manage.workOrderTimeLimit);
return baseModel.data as List;
}
///
static Future workOrderTypeDetail(int id) async {
BaseModel baseModel =
await NetUtil().get(API.manage.workOrderTypeDetail, params: {
'workOrderTypeId': id,
});
return baseModel.data as List;
}
///
static Future repairDispatch(DispatchReportModel model) async {
BaseModel baseModel =
await NetUtil().get(API.manage.repairDispatch, params: {
'dispatchListId': model.dispatchListId,
'workOrderType': model.workOrderTyoe,
'workOrderTypeDetail': model.workOrderTypeDetail,
'workOrderTimeLimit': model.workOrderTimeLimit,
'type': model.type,
'operator': model.operato,
'remake': model.remark,
});
return baseModel;
}
///
static Future repairReassignment(int id, int operato) async {
BaseModel baseModel = await NetUtil().get(API.manage.repairReassignment,
params: {'dispatchListId': id, 'operator': operato});
return baseModel;
}
///
static Future recevingOrders(int id) async {
BaseModel basemodel = await NetUtil()
.get(API.manage.recevingOrders, params: {'dispatchListId': id});
return basemodel;
}
///
static Future applyDelayed(int id, int delayed, String remark) async {
BaseModel baseModel =
await NetUtil().post(API.manage.applyDelayed, params: {
'dispatchListId': id,
'delayedTime': delayed,
'remake': remark,
});
return baseModel;
}
///
static Future handleResult(
int dispatchListId,
String detail,
String materialList,
double laborCost,
double materialCost,
double totalCost,
int repairResult,
List<String> fileUrls) async {
BaseModel baseModel =
await NetUtil().post(API.manage.handleResult, params: {
'dispatchListId': dispatchListId,
'detail': detail,
'materialList': materialList,
'laborCost': laborCost,
'materialCost': materialCost,
'totalCost': totalCost,
'repairResult': repairResult,
'fileUrls': fileUrls,
});
return baseModel;
}
}

@ -104,8 +104,15 @@ class NetUtil {
}) async {
try {
Response res = await _dio.get(path, queryParameters: params);
BaseListModel baseListModel = BaseListModel.fromJson(res.data);
return baseListModel;
if ((res.data as Map<String, dynamic>).containsKey('status') &&
(res.data as Map<String, dynamic>).containsKey('data') &&
(res.data as Map<String, dynamic>).containsKey('message')) {
BaseModel baseModel = BaseModel.fromJson(res.data);
_parseRequestError(baseModel);
} else {
BaseListModel baseListModel = BaseListModel.fromJson(res.data);
return baseListModel;
}
} on DioError catch (e) {
_parseErr(e);
}

Loading…
Cancel
Save