对接:派单

hmxc
张萌 4 years ago
parent bec70947a3
commit 7a2bc773f9

@ -72,5 +72,8 @@ class _Manage {
///
String get workOrderTypeDetail => '/user/repair/findWorkOrderTypeDetail';
///
String get repairDispatch => '/user/repair/dispatch';
}

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

@ -6,6 +6,7 @@ import 'package:aku_community_manager/models/manager/bussiness_and_fix/fixed_det
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/fixer_department_page.dart';
import 'package:aku_community_manager/utils/network/manage_func.dart';
import 'package:flutter/material.dart';
@ -13,6 +14,7 @@ import 'package:flutter/material.dart';
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:
@ -63,51 +65,6 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
super.dispose();
}
// String get fixType {
// switch (detailModel.type) {
// case FIX_PAYMENT_TYPE.FREE:
// return '无偿服务';
// break;
// case FIX_PAYMENT_TYPE.PAY:
// return '有偿服务';
// break;
// default:
// return '';
// break;
// }
// }
// 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;
// }
// }
// 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);
@ -136,10 +93,10 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
header: MaterialHeader(),
onRefresh: () async {
_detailModel = await ManageFunc.repairDetail(widget.model.id);
_reportModel.dispatchListId = widget.model.id;
_reportModel.workOrderTyoe = 1;
_onload = false;
setState(() {
});
setState(() {});
},
child: _onload
? _empty()
@ -170,7 +127,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
_reportModel.workOrderTyoe != null &&
_reportModel.workOrderTimeLimit != null
? () {
// Get.to(FixerDepartmentPage(model: widget.model));
Get.to(FixerDepartmentPage(model: _reportModel));
}
: null,
child: Text(
@ -342,9 +299,11 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
children: [
_buildTypeTile(
'派单类型',
_dispatchModels==null
_dispatchModels == null
? null
: _dispatchModels[_reportModel.type]?.showName,
: _dispatchModels[_dispatchModels.indexWhere(
(element) => element.showValue == _reportModel.type)]
.showName,
canTap,
helpContent: '请选择服务类型',
onTap: () async {
@ -354,20 +313,26 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
showItemSheet(
title: '派单类型',
items: _dispatchModels.map((e) => e.showName).toList(),
ids: _dispatchModels.map((e) => e.showValue).toList(),
selectItem: _reportModel.type,
onTap: (result) {
_reportModel.type = result;
},
).then((_) {
if (_reportModel.type == -1) {
_dispatchModels = null;
}
setState(() {});
});
},
),
_buildTypeTile(
'工单时限',
_timeLimitModels==null
_timeLimitModels == null
? null
: _timeLimitModels[_reportModel.workOrderTimeLimit]?.name,
: _timeLimitModels[_timeLimitModels.indexWhere((element) =>
element.id == _reportModel.workOrderTimeLimit)]
?.name,
canTap,
helpContent: '请选择工单时限',
onTap: () async {
@ -377,20 +342,26 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
showItemSheet(
title: '工单时限',
items: _timeLimitModels.map((e) => e.name).toList(),
ids: _timeLimitModels.map((e) => e.id).toList(),
selectItem: _reportModel.workOrderTimeLimit,
onTap: (result) {
_reportModel.workOrderTimeLimit = result;
},
).then((_) {
if (_reportModel.workOrderTimeLimit == -1) {
_timeLimitModels = null;
}
setState(() {});
});
},
),
_buildTypeTile(
'工单子类',
_workTypeModels==null
_workTypeModels == null
? null
: _workTypeModels[_reportModel.workOrderTyoe].name,
: _workTypeModels[_workTypeModels.indexWhere((element) =>
element.id == _reportModel.workOrderTypeDetail)]
.name,
canTap,
helpContent: '请选择工单子类',
onTap: () async {
@ -400,11 +371,15 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
showItemSheet(
title: '工单子类',
items: _workTypeModels.map((e) => e.name).toList(),
selectItem: _reportModel.workOrderTyoe,
ids: _workTypeModels.map((e) => e.id).toList(),
selectItem: _reportModel.workOrderTypeDetail,
onTap: (result) {
_reportModel.workOrderTyoe = result;
_reportModel.workOrderTypeDetail = result;
},
).then((_) {
if (_reportModel.workOrderTypeDetail == -1) {
_workTypeModels = null;
}
setState(() {});
});
},

@ -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,6 +32,7 @@ class FixerDepartmentPage extends StatefulWidget {
}
class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
DispatchReportModel _reportModel;
List<RepairmanVos> _pickedFixers = [];
List<FixerItemModel> _fixerItems = [];
@ -45,6 +48,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 +61,41 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
),
bottom: AkuMaterialButton(
height: 96.w,
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()),
);
});
}
},
onPressed: () async {
if (widget.changeType) {
} else {
BaseModel baseModel = await ManageFunc.repairDispatch(_reportModel);
if (baseModel.status) {
Get.back();
Get.back();
} else {
BotToast.showText(text: baseModel.message);
}
}
},
// 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 +155,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 +171,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,6 +58,7 @@ Future showNormalSheet(String title, List<Widget> children) async {
Future showItemSheet({
String title,
List<String> items,
List<int> ids,
int selectItem,
Function(int result) onTap,
}) async {
@ -69,14 +70,14 @@ Future showItemSheet({
minWidth: double.infinity,
onPressed: () {
Get.back();
onTap(items.indexOf(e));
onTap(ids[items.indexOf(e)]);
},
child: Text(
e,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 32.sp,
color: e == items[selectItem]
color: items.indexOf(e)==ids.indexOf(selectItem)
? AppStyle.secondaryColor
: AppStyle.primaryTextColor,
),

@ -1,4 +1,5 @@
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';
@ -32,4 +33,17 @@ class ManageFunc {
});
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;
}
}

Loading…
Cancel
Save