对接:派单

hmxc
张萌 4 years ago
parent bec70947a3
commit 7a2bc773f9

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

@ -8,12 +8,12 @@ class DispatchReportModel {
String remark; String remark;
DispatchReportModel.zero() { DispatchReportModel.zero() {
dispatchListId = 0; dispatchListId = -1;
workOrderTyoe = 0; workOrderTyoe = -1;
workOrderTyoe = 0; workOrderTypeDetail = -1;
workOrderTimeLimit = 0; workOrderTimeLimit = -1;
type = 0; type = -1;
operato = 0; operato = -1;
remark = ''; remark = '';
} }
DispatchReportModel( 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_order_type_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/work_time_limit_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/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:aku_community_manager/utils/network/manage_func.dart';
import 'package:flutter/material.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:aku_ui/common_widgets/aku_material_button.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// Project imports: // Project imports:
@ -63,51 +65,6 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
super.dispose(); 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() { Widget fixTypeWidget() {
UserProvider userProvider = UserProvider userProvider =
Provider.of<UserProvider>(context, listen: false); Provider.of<UserProvider>(context, listen: false);
@ -136,10 +93,10 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
header: MaterialHeader(), header: MaterialHeader(),
onRefresh: () async { onRefresh: () async {
_detailModel = await ManageFunc.repairDetail(widget.model.id); _detailModel = await ManageFunc.repairDetail(widget.model.id);
_reportModel.dispatchListId = widget.model.id;
_reportModel.workOrderTyoe = 1;
_onload = false; _onload = false;
setState(() { setState(() {});
});
}, },
child: _onload child: _onload
? _empty() ? _empty()
@ -170,7 +127,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
_reportModel.workOrderTyoe != null && _reportModel.workOrderTyoe != null &&
_reportModel.workOrderTimeLimit != null _reportModel.workOrderTimeLimit != null
? () { ? () {
// Get.to(FixerDepartmentPage(model: widget.model)); Get.to(FixerDepartmentPage(model: _reportModel));
} }
: null, : null,
child: Text( child: Text(
@ -342,9 +299,11 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
children: [ children: [
_buildTypeTile( _buildTypeTile(
'派单类型', '派单类型',
_dispatchModels==null _dispatchModels == null
? null ? null
: _dispatchModels[_reportModel.type]?.showName, : _dispatchModels[_dispatchModels.indexWhere(
(element) => element.showValue == _reportModel.type)]
.showName,
canTap, canTap,
helpContent: '请选择服务类型', helpContent: '请选择服务类型',
onTap: () async { onTap: () async {
@ -354,20 +313,26 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
showItemSheet( showItemSheet(
title: '派单类型', title: '派单类型',
items: _dispatchModels.map((e) => e.showName).toList(), items: _dispatchModels.map((e) => e.showName).toList(),
ids: _dispatchModels.map((e) => e.showValue).toList(),
selectItem: _reportModel.type, selectItem: _reportModel.type,
onTap: (result) { onTap: (result) {
_reportModel.type = result; _reportModel.type = result;
}, },
).then((_) { ).then((_) {
if (_reportModel.type == -1) {
_dispatchModels = null;
}
setState(() {}); setState(() {});
}); });
}, },
), ),
_buildTypeTile( _buildTypeTile(
'工单时限', '工单时限',
_timeLimitModels==null _timeLimitModels == null
? null ? null
: _timeLimitModels[_reportModel.workOrderTimeLimit]?.name, : _timeLimitModels[_timeLimitModels.indexWhere((element) =>
element.id == _reportModel.workOrderTimeLimit)]
?.name,
canTap, canTap,
helpContent: '请选择工单时限', helpContent: '请选择工单时限',
onTap: () async { onTap: () async {
@ -377,20 +342,26 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
showItemSheet( showItemSheet(
title: '工单时限', title: '工单时限',
items: _timeLimitModels.map((e) => e.name).toList(), items: _timeLimitModels.map((e) => e.name).toList(),
ids: _timeLimitModels.map((e) => e.id).toList(),
selectItem: _reportModel.workOrderTimeLimit, selectItem: _reportModel.workOrderTimeLimit,
onTap: (result) { onTap: (result) {
_reportModel.workOrderTimeLimit = result; _reportModel.workOrderTimeLimit = result;
}, },
).then((_) { ).then((_) {
if (_reportModel.workOrderTimeLimit == -1) {
_timeLimitModels = null;
}
setState(() {}); setState(() {});
}); });
}, },
), ),
_buildTypeTile( _buildTypeTile(
'工单子类', '工单子类',
_workTypeModels==null _workTypeModels == null
? null ? null
: _workTypeModels[_reportModel.workOrderTyoe].name, : _workTypeModels[_workTypeModels.indexWhere((element) =>
element.id == _reportModel.workOrderTypeDetail)]
.name,
canTap, canTap,
helpContent: '请选择工单子类', helpContent: '请选择工单子类',
onTap: () async { onTap: () async {
@ -400,11 +371,15 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
showItemSheet( showItemSheet(
title: '工单子类', title: '工单子类',
items: _workTypeModels.map((e) => e.name).toList(), items: _workTypeModels.map((e) => e.name).toList(),
selectItem: _reportModel.workOrderTyoe, ids: _workTypeModels.map((e) => e.id).toList(),
selectItem: _reportModel.workOrderTypeDetail,
onTap: (result) { onTap: (result) {
_reportModel.workOrderTyoe = result; _reportModel.workOrderTypeDetail = result;
}, },
).then((_) { ).then((_) {
if (_reportModel.workOrderTypeDetail == -1) {
_workTypeModels = null;
}
setState(() {}); setState(() {});
}); });
}, },

@ -1,8 +1,11 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/const/api.dart'; 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/models/manager/fixer_item_model.dart';
import 'package:aku_community_manager/utils/network/base_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:aku_community_manager/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
@ -13,14 +16,13 @@ import 'package:get/get.dart';
// Project imports: // Project imports:
import 'package:aku_community_manager/const/resource.dart'; 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/style/app_style.dart';
import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/tools/widget_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/common/aku_scaffold.dart';
class FixerDepartmentPage extends StatefulWidget { class FixerDepartmentPage extends StatefulWidget {
final FixModel model; final DispatchReportModel model;
final bool changeType; final bool changeType;
FixerDepartmentPage({Key key, @required this.model, this.changeType = false}) FixerDepartmentPage({Key key, @required this.model, this.changeType = false})
: super(key: key); : super(key: key);
@ -30,6 +32,7 @@ class FixerDepartmentPage extends StatefulWidget {
} }
class _FixerDepartmentPageState extends State<FixerDepartmentPage> { class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
DispatchReportModel _reportModel;
List<RepairmanVos> _pickedFixers = []; List<RepairmanVos> _pickedFixers = [];
List<FixerItemModel> _fixerItems = []; List<FixerItemModel> _fixerItems = [];
@ -45,6 +48,7 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
_fixerItems = (model.data as List) _fixerItems = (model.data as List)
.map((e) => FixerItemModel.fromJson(e)) .map((e) => FixerItemModel.fromJson(e))
.toList(); .toList();
_reportModel = widget.model;
setState(() {}); setState(() {});
}, },
child: ListView.builder( child: ListView.builder(
@ -57,29 +61,41 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
), ),
bottom: AkuMaterialButton( bottom: AkuMaterialButton(
height: 96.w, height: 96.w,
onPressed: _pickedFixers.isEmpty onPressed: () async {
? null if (widget.changeType) {
: () { } else {
if (widget.changeType) { BaseModel baseModel = await ManageFunc.repairDispatch(_reportModel);
Get.back(); if (baseModel.status) {
_pickedFixers.forEach((element) { Get.back();
widget.model.detail.fixStatuses.add( Get.back();
FixStatus( } else {
title: '改派给${element.name}', date: DateTime.now()), BotToast.showText(text: baseModel.message);
); }
}); }
} else { },
Get.back(); // onPressed: _pickedFixers.isEmpty
Get.back(); // ? null
widget.model.type = FIX_ENUM.WAIT_PICKUP; // : () {
_pickedFixers.forEach((element) { // if (widget.changeType) {
widget.model.detail.fixStatuses.add( // Get.back();
FixStatus( // _pickedFixers.forEach((element) {
title: '分配给${element.name}', date: DateTime.now()), // 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, color: AppStyle.primaryColor,
nullColor: AppStyle.primaryColor.withOpacity(0.5), nullColor: AppStyle.primaryColor.withOpacity(0.5),
child: Text( child: Text(
@ -139,13 +155,14 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
AkuMaterialButton( AkuMaterialButton(
height: 96.w, height: 96.w,
onPressed: () { onPressed: () {
if (_pickedFixers // if (_pickedFixers
.indexWhere((element) => element.id == e.id) == // .indexWhere((element) => element.id == e.id) ==
-1) { // -1) {
_pickedFixers.add(e); // _pickedFixers.add(e);
} else { // } else {
_pickedFixers.remove(e); // _pickedFixers.remove(e);
} // }
_reportModel.operato = e.id;
setState(() {}); setState(() {});
}, },
child: Row( child: Row(
@ -154,12 +171,17 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
Checkbox( Checkbox(
checkColor: AppStyle.primaryTextColor, checkColor: AppStyle.primaryTextColor,
activeColor: AppStyle.primaryColor, activeColor: AppStyle.primaryColor,
value: _pickedFixers.indexOf(e) != -1, value: _reportModel.operato == e.id,
onChanged: (state) { onChanged: (state) {
if (_pickedFixers.indexOf(e) == -1) { // if (_pickedFixers.indexOf(e) == -1) {
_pickedFixers.add(e); // _pickedFixers.add(e);
// } else {
// _pickedFixers.remove(e);
// }
if (_reportModel.operato == e.id) {
_reportModel.operato = -1;
} else { } else {
_pickedFixers.remove(e); _reportModel.operato = e.id;
} }
setState(() {}); setState(() {});
}, },

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

@ -1,4 +1,5 @@
import 'package:aku_community_manager/const/api.dart'; 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/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/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart'; import 'package:aku_community_manager/utils/network/net_util.dart';
@ -32,4 +33,17 @@ class ManageFunc {
}); });
return baseModel.data as List; 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