diff --git a/lib/customWidget/ItemWidgetFactory.dart b/lib/customWidget/ItemWidgetFactory.dart index 03d1733..bb83668 100644 --- a/lib/customWidget/ItemWidgetFactory.dart +++ b/lib/customWidget/ItemWidgetFactory.dart @@ -6,6 +6,8 @@ import '../tools/tools.dart'; /// 自定义组件 class ListItemFactory { + static const Color detailtextColor = Colors.black54; + /// 类型1:横向spaceBetween布局两个文本加按钮 static Widget createRowSpaceBetweenItem({ required String leftText, @@ -333,7 +335,7 @@ class ListItemFactory { ), ], ), - if (!isEdit) Text(text, style: TextStyle()), + if (!isEdit) Text(text, style: TextStyle(color: detailtextColor)), ], ), ), diff --git a/lib/pages/home/Tap/special_work/dh_work/dh_wait_page.dart b/lib/pages/home/Tap/special_work/dh_work/dh_wait_page.dart index 9c68ab2..824b8b3 100644 --- a/lib/pages/home/Tap/special_work/dh_work/dh_wait_page.dart +++ b/lib/pages/home/Tap/special_work/dh_work/dh_wait_page.dart @@ -44,65 +44,120 @@ class DhWaitPage extends SpecialWorkWaitPageBase { Map item, bool isEdit, ) async { - final hotworkId = item['id'] ?? ''; - final hotworkCodeId = item['workId'] ?? ''; - final hotworkInfo = listType == SpecialListType.task ? (item['workInfo'] ?? {}) : item; + final hotworkId = '${item['id'] ?? ''}'; + final hotworkCodeId = '${item['workId'] ?? ''}'; + final Map hotworkInfo = + listType == SpecialListType.task + ? (item['workInfo'] as Map? ?? {}) + : item; + + final stepId = '${item['stepId'] ?? ''}'; final status = '${hotworkInfo['status'] ?? ''}'; - final stepName = isEdit - ? (listType == SpecialListType.task + final statusName = listType == SpecialListType.task ? '${item['stepName'] ?? ''}' - : '${hotworkInfo['currentStep'] ?? ''}') - : '查看'; + : '${hotworkInfo['currentStep'] ?? ''}'; - if (listType == SpecialListType.task) { - if (status == '0' || status == '2') { - if (isEdit) { - await pushPage( - HotWorkApplyPage( - isReEdit: true, - workId: hotworkId, - status: status, - ), - context, - ); - } else { - await pushPage( - HotTaskPage( - workId: hotworkId, - stepName: stepName, - workCodeId: hotworkCodeId, - isEdit: false, - type: listType, - ), - context, - ); - } - return; - } - - await pushPage( - HotTaskPage( - workId: hotworkId, - stepName: stepName, - workCodeId: hotworkCodeId, - isEdit: isEdit, - type: listType, - ), - context, - ); - } else { - await pushPage( - HotTaskPage( - workId: hotworkId, - stepName: stepName, - workCodeId: hotworkCodeId, - isEdit: isEdit, - type: listType, - ), - context, + // 非 task 类型,统一进详情页 + if (listType != SpecialListType.task) { + await _openTaskPage( + context: context, + workId: hotworkId, + workCodeId: hotworkCodeId, + stepName: statusName, + isEdit: isEdit, ); + return; } + + + // task 类型:先处理特殊步骤 + if (stepId == '2') { + if (isEdit) { + await pushPage( + SpecialWorkGasList(data: item, addFlag: true), + context, + ); + } else { + await _openTaskPage( + context: context, + workId: hotworkId, + workCodeId: hotworkCodeId, + stepName: statusName, + isEdit: false, + ); + } + return; + } + + // task 类型:状态为 0 / 2,走申请重编辑或查看 + if (status == '0' || status == '2') { + if (isEdit) { + await pushPage( + HotWorkApplyPage( + isReEdit: true, + workId: hotworkId, + status: status, + ), + context, + ); + } else { + await _openTaskPage( + context: context, + workId: hotworkId, + workCodeId: hotworkCodeId, + stepName: '查看', + isEdit: false, + ); + } + return; + } + + // task 类型:延期步骤 + if (stepId == '12') { + if (isEdit) { + await pushPage( + HotDelayPage(data: item, isEdit: true), + context, + ); + } else { + await _openTaskPage( + context: context, + workId: hotworkId, + workCodeId: hotworkCodeId, + stepName: statusName, + isEdit: false, + ); + } + return; + } + + // 其他情况,统一进任务页 + await _openTaskPage( + context: context, + workId: hotworkId, + workCodeId: hotworkCodeId, + stepName: statusName, + isEdit: isEdit, + ); + } + Future _openTaskPage({ + required BuildContext context, + required String workId, + required String workCodeId, + required String stepName, + required bool isEdit, + }) async { + await pushPage( + HotTaskPage( + workId: workId, + stepName: stepName, + workCodeId: workCodeId, + isEdit: isEdit, + type: listType, + ), + context, + ); } @override diff --git a/lib/pages/home/Tap/special_work/sxkj_work/sxkj_apply_page.dart b/lib/pages/home/Tap/special_work/sxkj_work/sxkj_apply_page.dart index 1795ba4..76a6020 100644 --- a/lib/pages/home/Tap/special_work/sxkj_work/sxkj_apply_page.dart +++ b/lib/pages/home/Tap/special_work/sxkj_work/sxkj_apply_page.dart @@ -75,15 +75,12 @@ class _SxkjApplyPageState extends SpecialWorkApplyBaseState { @override Future loadExtraData() async { - final parentPerm = - 'dashboard:hazardous:work:confined-space-operations:Confined-Space-Work-Ledger'; - final targetPerm = ''; - final menuPath = await RouteService.getMenuPath(parentPerm, targetPerm); + final data = { "eqWorkType": SpecialWorkTypeEnum.confinedspaceWork.code, "pageSize": 999, "pageIndex": 1, - "menuPath": menuPath, + "eqCorpinfoId": pd['projectExecutionLocationCorpId'], }; final limitedSpaceRes = await SpecialWorkApi.specialWorkLimitedSpaceList(data); if (limitedSpaceRes['success'] == true) { @@ -426,7 +423,7 @@ class _SxkjApplyPageState extends SpecialWorkApplyBaseState { /// 从台账选择有限空间 Future _chooseFromLedger() async { if (limitedSpaceList.isEmpty) { - ToastUtil.showNormal(context, '暂无可选台账'); + ToastUtil.showNormal(context, '暂无可选台账,请选择正确的相关方项目'); return; } final result = await BottomPicker.show( @@ -504,7 +501,7 @@ class _SxkjApplyPageState extends SpecialWorkApplyBaseState { pd['workGuardianUserDepartmentName'] = data['departmentName']; allowChoosePerson['2'] = data; } - super.getFlowInit(true); + super.clearRelatedPartiesPerson(); }); }, ); diff --git a/lib/pages/home/Tap/special_work_apply_base_page.dart b/lib/pages/home/Tap/special_work_apply_base_page.dart index e0a019f..3d469a0 100644 --- a/lib/pages/home/Tap/special_work_apply_base_page.dart +++ b/lib/pages/home/Tap/special_work_apply_base_page.dart @@ -236,7 +236,6 @@ abstract class SpecialWorkApplyBaseState await getFlowInit(false); } - await loadExtraData(); await afterInitDataLoaded(); if (enableSafeProtection) { @@ -572,10 +571,10 @@ abstract class SpecialWorkApplyBaseState // 同步更新允许列表,用于安全措施确认人、气体分析人 if (stepId == '20') { allowChoosePerson['1'] = data; - _clearRelatedPartiesPerson(); + clearRelatedPartiesPerson(); } else if (stepId == '21') { allowChoosePerson['2'] = data; - _clearRelatedPartiesPerson(); + clearRelatedPartiesPerson(); } }); }, @@ -583,7 +582,7 @@ abstract class SpecialWorkApplyBaseState } // 清空气体检测人和安全措施确认人 - void _clearRelatedPartiesPerson() { + void clearRelatedPartiesPerson() { setState(() { for (Map item in groups) { final stepId = item['stepId']?.toString() ?? ''; @@ -642,6 +641,7 @@ abstract class SpecialWorkApplyBaseState pd['projectExecutionLocationCorpName'] = json['projectExecutionLocationCorpName']; }); + loadExtraData(); _getRelatedPartiesUserList(); }, onSelected: (id, name, pdId) {},