diff --git a/lib/tools/aku_map.dart b/lib/tools/aku_map.dart index 60c9fff..ecabf6f 100644 --- a/lib/tools/aku_map.dart +++ b/lib/tools/aku_map.dart @@ -74,4 +74,6 @@ class AkuMap { 8: '作废', 9: '取消' }; + + static Map dispatchType = {1: '无偿服务', 2: '有偿服务'}; } diff --git a/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart b/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart index f3df6cf..7df0c94 100644 --- a/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart +++ b/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart @@ -123,7 +123,7 @@ class _BusinessAndFixDetailPageState extends State { builder: (context) { final userProvider = Provider.of(context, listen: false); - if (userProvider.infoModel.canOperation) { + if (userProvider.infoModel.canOperation&&widget.model.status<2) { return AkuMaterialButton( color: AppStyle.primaryColor, nullColor: AppStyle.minorColor, @@ -141,7 +141,7 @@ class _BusinessAndFixDetailPageState extends State { ), ), ); - } else if (widget.model.status == 3) { + } else if (widget.model.status == 2) { if (userProvider.infoModel.canOperation) { return AkuMaterialButton( color: AppStyle.primaryColor, @@ -180,7 +180,7 @@ class _BusinessAndFixDetailPageState extends State { ), ); } - } else if ((widget.model.status >= 4 && widget.model.status <= 4) && + } else if ((widget.model.status==3) && userProvider.infoModel.canPickUpTicket) return Container( height: 96.w, @@ -227,7 +227,7 @@ class _BusinessAndFixDetailPageState extends State { color: AppStyle.primaryColor, onPressed: () { Get.to(FixWorkFinishPage( - fixModel :widget.model, + fixModel: widget.model, model: _detailModel, dispatchType: _detailModel.dispatchType.dispatchType == 1)); @@ -307,11 +307,13 @@ class _BusinessAndFixDetailPageState extends State { children: [ _buildTypeTile( '派单类型', - _dispatchModels == null - ? null - : _dispatchModels[_dispatchModels.indexWhere( - (element) => element.showValue == _reportModel.type)] - .showName, + canTap + ? _dispatchModels == null + ? null + : _dispatchModels[_dispatchModels.indexWhere( + (element) => element.showValue == _reportModel.type)] + .showName + : AkuMap.dispatchType[_detailModel.dispatchType.dispatchType], canTap, helpContent: '请选择服务类型', onTap: () async { @@ -336,11 +338,13 @@ class _BusinessAndFixDetailPageState extends State { ), _buildTypeTile( '工单时限', - _timeLimitModels == null - ? null - : _timeLimitModels[_timeLimitModels.indexWhere((element) => - element.id == _reportModel.workOrderTimeLimit)] - ?.name, + canTap + ? _timeLimitModels == null + ? null + : _timeLimitModels[_timeLimitModels.indexWhere((element) => + element.id == _reportModel.workOrderTimeLimit)] + ?.name + : _detailModel.dispatchType.workOrderLimitName, canTap, helpContent: '请选择工单时限', onTap: () async { @@ -365,11 +369,13 @@ class _BusinessAndFixDetailPageState extends State { ), _buildTypeTile( '工单子类', - _workTypeModels == null - ? null - : _workTypeModels[_workTypeModels.indexWhere((element) => - element.id == _reportModel.workOrderTypeDetail)] - .name, + canTap + ? _workTypeModels == null + ? null + : _workTypeModels[_workTypeModels.indexWhere((element) => + element.id == _reportModel.workOrderTypeDetail)] + .name + : _detailModel.dispatchType.workOrderSubclassName, canTap, helpContent: '请选择工单子类', onTap: () async { diff --git a/lib/ui/sub_pages/business_and_fix/fixer_department_page.dart b/lib/ui/sub_pages/business_and_fix/fixer_department_page.dart index 53c2000..051a9dd 100644 --- a/lib/ui/sub_pages/business_and_fix/fixer_department_page.dart +++ b/lib/ui/sub_pages/business_and_fix/fixer_department_page.dart @@ -36,6 +36,22 @@ class _FixerDepartmentPageState extends State { List _pickedFixers = []; List _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( @@ -61,25 +77,28 @@ class _FixerDepartmentPageState extends State { ), bottom: AkuMaterialButton( height: 96.w, - onPressed: () async { - if (widget.changeType) { - BaseModel baseModel = await ManageFunc.repairReassignment( - _reportModel.dispatchListId, _reportModel.operato); - if (baseModel.status) { - Get.back(); - } else { - BotToast.showText(text: baseModel.message); - } - } else { - BaseModel baseModel = await ManageFunc.repairDispatch(_reportModel); - if (baseModel.status) { - Get.back(); - Get.back(); - } else { - BotToast.showText(text: baseModel.message); - } - } - }, + onPressed: canDispatch + ? () async { + if (widget.changeType) { + BaseModel baseModel = await ManageFunc.repairReassignment( + _reportModel.dispatchListId, _reportModel.operato); + if (baseModel.status) { + Get.back(); + } else { + BotToast.showText(text: baseModel.message); + } + } else { + BaseModel baseModel = + await ManageFunc.repairDispatch(_reportModel); + if (baseModel.status) { + Get.back(); + Get.back(); + } else { + BotToast.showText(text: baseModel.message); + } + } + } + : null, // onPressed: _pickedFixers.isEmpty // ? null // : () {