diff --git a/lib/customWidget/department_all_person_picker.dart b/lib/customWidget/department_all_person_picker.dart index 5c2863c..5a3787c 100644 --- a/lib/customWidget/department_all_person_picker.dart +++ b/lib/customWidget/department_all_person_picker.dart @@ -68,7 +68,7 @@ class DepartmentAllPersonPicker { static Future show( BuildContext context, { required List personsData, - List? serverData, + required List serverData, bool allowXgfFlag = true, bool multiSelect = false, PersonMultiSelectCallback? onMultiSelected, @@ -113,7 +113,7 @@ class DepartmentAllPersonPicker { class _DepartmentAllPersonPickerSheet extends StatefulWidget { final List personsData; - final List? serverData; + final List serverData; final bool allowXgfFlag; final bool multiSelect; @@ -184,12 +184,24 @@ class _DepartmentAllPersonPickerSheetState extends State<_DepartmentAllPersonPic uniqueMap[key] = item; } } + final Map uniqueMap2 = {}; + + if (widget.serverData.length > 0) { + for (final item in widget.serverData) { + if (item is Map) { + final key = item['id'] ?? item['actUser']; // id去重 + uniqueMap2[key] = item; + } + } } + + final List list = uniqueMap.values.toList(); _personAll = list.map((e) => Person.fromJson(e)).toList(); + final List list2 = uniqueMap2.values.toList(); - _serverAll = (widget.serverData ?? []).map((e) => Person.fromJson(e)).toList(); + _serverAll = list2.map((e) => Person.fromJson(e)).toList(); _personFiltered = List.from(_personAll); _serverFiltered = List.from(_serverAll); diff --git a/lib/pages/home/Tap/special_work/custom/MeasuresListSure.dart b/lib/pages/home/Tap/special_work/custom/MeasuresListSure.dart index 6246336..95a6f47 100644 --- a/lib/pages/home/Tap/special_work/custom/MeasuresListSure.dart +++ b/lib/pages/home/Tap/special_work/custom/MeasuresListSure.dart @@ -296,7 +296,7 @@ class _MeasureslistsureState extends State { vertical: 12, horizontal: 5, ), - child: Text('${widget.item['content']}'.replaceAll('&&', '__')), + child: Text('${widget.item['content']}'.replaceAll('&&', '____')), ), Padding( padding: const EdgeInsets.all(0), diff --git a/lib/pages/home/Tap/special_work/custom/MeasuresListWidget.dart b/lib/pages/home/Tap/special_work/custom/MeasuresListWidget.dart index c38d88c..4482a7f 100644 --- a/lib/pages/home/Tap/special_work/custom/MeasuresListWidget.dart +++ b/lib/pages/home/Tap/special_work/custom/MeasuresListWidget.dart @@ -80,7 +80,7 @@ class _MeasuresListWidgetState extends State { item['signPath'] = '1983773013086048256/202604/special_operation_process_signature_photo/7da0a8e8eeef403f9c1973f0c566cd24.png'; item['signTime'] = DateFormat( - 'yyyy-MM-dd HH:mm', + 'yyyy-MM-dd HH:mm:ss', ).format(DateTime.now()); } }); diff --git a/lib/pages/home/Tap/special_work/dh_work/HotWorkDetailFormWidget.dart b/lib/pages/home/Tap/special_work/dh_work/HotWorkDetailFormWidget.dart index 3962968..c509f03 100644 --- a/lib/pages/home/Tap/special_work/dh_work/HotWorkDetailFormWidget.dart +++ b/lib/pages/home/Tap/special_work/dh_work/HotWorkDetailFormWidget.dart @@ -134,6 +134,14 @@ class _HotWorkDetailFormWidgetState extends State { const Divider(), ], ListItemFactory.createBuildSimpleSection('基本信息'), + if (FormUtils.hasValue(widget.pd, 'checkNo') && !widget.isEditable) ...[ + ItemListWidget.singleLineTitleText( + label: '作业编号:', + isEditable: false, + text: widget.pd['checkNo'] ?? '', + ), + const Divider(), + ], ItemListWidget.singleLineTitleText( label: '申请单位:', isEditable: false, @@ -145,14 +153,6 @@ class _HotWorkDetailFormWidgetState extends State { isEditable: false, text: pd['applyUser'] ?? '', ), - if (FormUtils.hasValue(pd, 'checkNo') && !widget.isEditable) ...[ - const Divider(), - ItemListWidget.singleLineTitleText( - label: '作业编号:', - isEditable: false, - text: pd['checkNo'] ?? '', - ), - ], const Divider(), ItemListWidget.selectableLineTitleTextRightButton( label: '申请日期:', @@ -178,7 +178,7 @@ class _HotWorkDetailFormWidgetState extends State { groupValue: null, onChanged: (bool value) { }, ), - const Divider(height: 1), + const Divider(), // 相关方作业 ItemListWidget.selectableLineTitleTextRightButton( @@ -305,31 +305,6 @@ class _HotWorkDetailFormWidgetState extends State { ), const Divider(), ], - if (_otherMeasuresList.isNotEmpty) ...[ - ListItemFactory.createBuildSimpleSection('其他安全措施'), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: - _otherMeasuresList.map((item) { - return Padding( - padding: const EdgeInsets.symmetric( - vertical: 6.0, - horizontal: 12.0, - ), - child: Align( - alignment: Alignment.centerLeft, - child: Text( - '${item['stepName'] ?? ''}:${item['content'] ?? ''}', - style: const TextStyle(fontSize: 14), - textAlign: TextAlign.left, - ), - ), - ); - }).toList(), - ), - const Divider(), - - ], ], 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 8a05be2..9c68ab2 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 @@ -46,37 +46,18 @@ class DhWaitPage extends SpecialWorkWaitPageBase { ) async { final hotworkId = item['id'] ?? ''; final hotworkCodeId = item['workId'] ?? ''; - final hotworkInfo = - listType == SpecialListType.task ? item['workInfo'] : item; + final hotworkInfo = listType == SpecialListType.task ? (item['workInfo'] ?? {}) : item; - final stepId = '${item['stepId'] ?? ''}'; - final status = '${hotworkInfo['status']}'; - final String statusName = - listType == SpecialListType.task + final status = '${hotworkInfo['status'] ?? ''}'; + final stepName = isEdit + ? (listType == SpecialListType.task ? '${item['stepName'] ?? ''}' - : '${hotworkInfo['currentStep'] ?? ''}'; + : '${hotworkInfo['currentStep'] ?? ''}') + : '查看'; if (listType == SpecialListType.task) { - if (stepId == '2') { + if (status == '0' || status == '2') { if (isEdit) { - await pushPage( - SpecialWorkGasList(data: item, addFlag: stepId == '2'), - context, - ); - } else { - await pushPage( - HotTaskPage( - workId: hotworkId, - stepName: statusName, - workCodeId: hotworkCodeId, - isEdit: false, - type: listType, - ), - context, - ); - } - } else { - if (status == '0') { await pushPage( HotWorkApplyPage( isReEdit: true, @@ -85,64 +66,36 @@ class DhWaitPage extends SpecialWorkWaitPageBase { ), context, ); - } else if (status == '2') { - if (isEdit) { - await pushPage( - HotWorkApplyPage( - isReEdit: true, - workId: hotworkId, - status: status, - ), - context, - ); - } else { - await pushPage( - HotTaskPage( - workId: hotworkId, - stepName: '查看', - workCodeId: hotworkCodeId, - isEdit: false, - type: listType, - ), - context, - ); - } - } else if (stepId == '12') { - if (isEdit) { - await pushPage( - HotDelayPage(data: item, isEdit: true), - context, - ); - } else { - await pushPage( - HotTaskPage( - workId: hotworkId, - stepName: statusName, - workCodeId: hotworkCodeId, - isEdit: false, - type: listType, - ), - context, - ); - } } else { await pushPage( HotTaskPage( workId: hotworkId, - stepName: statusName, + stepName: stepName, workCodeId: hotworkCodeId, - isEdit: isEdit, + 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: statusName, + stepName: stepName, workCodeId: hotworkCodeId, isEdit: isEdit, type: listType, diff --git a/lib/pages/home/Tap/special_work/dh_work/hot_apply_page.dart b/lib/pages/home/Tap/special_work/dh_work/hot_apply_page.dart index f6444fd..764bf4e 100644 --- a/lib/pages/home/Tap/special_work/dh_work/hot_apply_page.dart +++ b/lib/pages/home/Tap/special_work/dh_work/hot_apply_page.dart @@ -119,6 +119,15 @@ class _HotWorkApplyPageState extends SpecialWorkApplyBaseState const Divider(), ], ListItemFactory.createBuildSimpleSection('基本信息'), + // 作业编号(只读,仅在详情模式下显示) + if (FormUtils.hasValue(pd, 'checkNo') && !isEditable) ...[ + const Divider(), + ItemListWidget.singleLineTitleText( + label: '作业编号:', + isEditable: false, + text: initData['checkNo'] ?? '', + ), + ], // 申请单位(只读) ItemListWidget.singleLineTitleText( label: '申请单位:', @@ -132,15 +141,6 @@ class _HotWorkApplyPageState extends SpecialWorkApplyBaseState isEditable: false, text: pd['applyUser'] ?? '', ), - // 作业编号(只读,仅在详情模式下显示) - if (FormUtils.hasValue(pd, 'checkNo') && !isEditable) ...[ - const Divider(), - ItemListWidget.singleLineTitleText( - label: '作业编号:', - isEditable: false, - text: initData['checkNo'] ?? '', - ), - ], const Divider(), // 申请日期 ItemListWidget.selectableLineTitleTextRightButton( @@ -179,7 +179,7 @@ class _HotWorkApplyPageState extends SpecialWorkApplyBaseState verticalPadding: 0, title: '是否项目内作业', isRequired: true, - groupValue: isInnerWork, + groupValue: pd['internalOperationFlag'] == 1, onChanged: (value) { setState(() { isInnerWork = value; diff --git a/lib/pages/home/Tap/special_work/dh_work/hot_delay_page.dart b/lib/pages/home/Tap/special_work/dh_work/hot_delay_page.dart index a628618..4b90e23 100644 --- a/lib/pages/home/Tap/special_work/dh_work/hot_delay_page.dart +++ b/lib/pages/home/Tap/special_work/dh_work/hot_delay_page.dart @@ -211,6 +211,8 @@ class _HotDelayPageState extends State { } void _onAdd() async { + final time = DateFormat('yyyy-MM-dd HH:mm:ss').format(DateTime.now()); + addData['delayHotTime'] = time; await SpecialWorkGasAlert.show( context, title: '添加', diff --git a/lib/pages/home/Tap/special_work/dl_work/breakgroundDetailFormWidget.dart b/lib/pages/home/Tap/special_work/dl_work/breakgroundDetailFormWidget.dart index 79ed83c..a6b6397 100644 --- a/lib/pages/home/Tap/special_work/dl_work/breakgroundDetailFormWidget.dart +++ b/lib/pages/home/Tap/special_work/dl_work/breakgroundDetailFormWidget.dart @@ -127,7 +127,7 @@ class _BreakgroundDetailFormWidgetState extends State((item) { - return Padding( - padding: const EdgeInsets.symmetric( - vertical: 6.0, - horizontal: 12.0, - ), - child: Align( - alignment: Alignment.centerLeft, - child: Text( - '${item['stepName'] ?? ''}:${item['content'] ?? ''}', - style: const TextStyle(fontSize: 14), - textAlign: TextAlign.left, - ), - ), - ); - }).toList(), - ), - ], + ], ), diff --git a/lib/pages/home/Tap/special_work/dl_work/dl_apply_page.dart b/lib/pages/home/Tap/special_work/dl_work/dl_apply_page.dart index 937bfb5..91e0e6e 100644 --- a/lib/pages/home/Tap/special_work/dl_work/dl_apply_page.dart +++ b/lib/pages/home/Tap/special_work/dl_work/dl_apply_page.dart @@ -63,7 +63,7 @@ class _DlApplyPageState extends SpecialWorkApplyBaseState { bool get enableLocation => true; // 使用基类定位组件,但定位跳转需自定义 @override - bool get enableRiskResults => false; // 使用自定义风险辨识结果选择 + bool get enableRiskResults => true; // 使用自定义风险辨识结果选择 @override UploadFileType? get imageUploadType => UploadFileType.specialOperationApplyInvolvedPhoto; @@ -135,6 +135,15 @@ class _DlApplyPageState extends SpecialWorkApplyBaseState { const Divider(), ], ListItemFactory.createBuildSimpleSection('基本信息'), + // 作业编号(只读,仅在详情模式下显示) + if (FormUtils.hasValue(pd, 'checkNo') && !isEditable) ...[ + const Divider(), + ItemListWidget.singleLineTitleText( + label: '作业编号:', + isEditable: false, + text: initData['checkNo'] ?? '', + ), + ], // 申请单位(只读) ItemListWidget.singleLineTitleText( label: '申请单位:', @@ -166,7 +175,7 @@ class _DlApplyPageState extends SpecialWorkApplyBaseState { verticalPadding: 0, title: '是否项目内作业', isRequired: true, - groupValue: isInnerWork, + groupValue: pd['internalOperationFlag'] == 1, onChanged: (value) { setState(() { isInnerWork = value; diff --git a/lib/pages/home/Tap/special_work/dl_work/dl_wait_page.dart b/lib/pages/home/Tap/special_work/dl_work/dl_wait_page.dart index 126c042..cecdc6d 100644 --- a/lib/pages/home/Tap/special_work/dl_work/dl_wait_page.dart +++ b/lib/pages/home/Tap/special_work/dl_work/dl_wait_page.dart @@ -44,41 +44,52 @@ class DlWaitPage extends SpecialWorkWaitPageBase { ) async { final hotworkId = item['id'] ?? ''; final hotworkCodeId = item['workId'] ?? ''; - final hotworkInfo = - listType == SpecialListType.task ? item['workInfo'] : item; + final hotworkInfo = listType == SpecialListType.task ? (item['workInfo'] ?? {}) : item; - final status = '${hotworkInfo['status']}'; - final String statusName = - listType == SpecialListType.task + final status = '${hotworkInfo['status'] ?? ''}'; + final stepName = isEdit + ? (listType == SpecialListType.task ? '${item['stepName'] ?? ''}' - : '${hotworkInfo['currentStep'] ?? ''}'; + : '${hotworkInfo['currentStep'] ?? ''}') + : '查看'; if (listType == SpecialListType.task) { if (status == '0' || status == '2') { - await pushPage( - DlApplyPage(isReEdit: true, work_id: hotworkId, status: status), - context, - ); - if (context.mounted) { - (context as Element).markNeedsBuild(); + if (isEdit) { + await pushPage( + DlApplyPage(isReEdit: true, work_id: hotworkId, status: status), + context, + ); + } else { + await pushPage( + DlTaskPage( + workId: hotworkId, + stepName: stepName, + workCodeId: hotworkCodeId, + isEdit: false, + type: listType, + ), + context, + ); } - } else { - await pushPage( - DlTaskPage( - workId: hotworkId, - stepName: statusName, - workCodeId: hotworkCodeId, - isEdit: isEdit, - type: listType, - ), - context, - ); + return; } + + await pushPage( + DlTaskPage( + workId: hotworkId, + stepName: stepName, + workCodeId: hotworkCodeId, + isEdit: isEdit, + type: listType, + ), + context, + ); } else { await pushPage( DlTaskPage( workId: hotworkId, - stepName: statusName, + stepName: stepName, workCodeId: hotworkCodeId, isEdit: isEdit, type: listType, diff --git a/lib/pages/home/Tap/special_work/dt_work/cutRoadDetailFormWidget.dart b/lib/pages/home/Tap/special_work/dt_work/cutRoadDetailFormWidget.dart index cd9655f..1d41437 100644 --- a/lib/pages/home/Tap/special_work/dt_work/cutRoadDetailFormWidget.dart +++ b/lib/pages/home/Tap/special_work/dt_work/cutRoadDetailFormWidget.dart @@ -127,7 +127,7 @@ class _CutRoadDetailFormWidgetState extends State { ListItemFactory.createBuildSimpleSection('基本信息'), if (FormUtils.hasValue(widget.pd, 'checkNo') && !widget.isEditable) ...[ ItemListWidget.singleLineTitleText( - label: '编号:', + label: '作业编号:', isEditable: false, text: widget.pd['checkNo'] ?? '', ), @@ -163,7 +163,7 @@ class _CutRoadDetailFormWidgetState extends State { groupValue: null, onChanged: (bool value) { }, ), - const Divider(height: 1), + const Divider(), // 相关方作业 ItemListWidget.selectableLineTitleTextRightButton( @@ -250,23 +250,6 @@ class _CutRoadDetailFormWidgetState extends State { controller: null, text: riskShowStr, ), - const Divider(), - - ItemListWidget.selectableLineTitleTextRightButton( - label: '作业实施开始时间:', - isEditable: false, - onTap: () async { - }, - text: pd['workStartTime'] ?? '', - ), - const Divider(), - ItemListWidget.selectableLineTitleTextRightButton( - label: '作业实施结束时间:', - isEditable: false, - onTap: () async { - }, - text: pd['workEndTime'] ?? '', - ), ], @@ -278,30 +261,7 @@ class _CutRoadDetailFormWidgetState extends State { isAllowEdit: false, ), ], - if (_otherMeasuresList.isNotEmpty) ...[ - const Divider(), - ListItemFactory.createBuildSimpleSection('其他安全措施'), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: - _otherMeasuresList.map((item) { - return Padding( - padding: const EdgeInsets.symmetric( - vertical: 6.0, - horizontal: 12.0, - ), - child: Align( - alignment: Alignment.centerLeft, - child: Text( - '${item['stepName'] ?? ''}:${item['content'] ?? ''}', - style: const TextStyle(fontSize: 14), - textAlign: TextAlign.left, - ), - ), - ); - }).toList(), - ), - ], + ], ), diff --git a/lib/pages/home/Tap/special_work/dt_work/dt_apply_page.dart b/lib/pages/home/Tap/special_work/dt_work/dt_apply_page.dart index ebba236..fe5f070 100644 --- a/lib/pages/home/Tap/special_work/dt_work/dt_apply_page.dart +++ b/lib/pages/home/Tap/special_work/dt_work/dt_apply_page.dart @@ -134,6 +134,15 @@ class _DtApplyPageState extends SpecialWorkApplyBaseState { const Divider(), ], ListItemFactory.createBuildSimpleSection('基本信息'), + // 作业编号(只读,仅在详情模式下显示) + if (FormUtils.hasValue(pd, 'checkNo') && !isEditable) ...[ + const Divider(), + ItemListWidget.singleLineTitleText( + label: '作业编号:', + isEditable: false, + text: initData['checkNo'] ?? '', + ), + ], // 申请单位(只读) ItemListWidget.singleLineTitleText( label: '申请单位:', @@ -165,7 +174,7 @@ class _DtApplyPageState extends SpecialWorkApplyBaseState { verticalPadding: 0, title: '是否项目内作业', isRequired: true, - groupValue: isInnerWork, + groupValue: pd['internalOperationFlag'] == 1, onChanged: (value) { setState(() { isInnerWork = value; diff --git a/lib/pages/home/Tap/special_work/dt_work/dt_wait_page.dart b/lib/pages/home/Tap/special_work/dt_work/dt_wait_page.dart index 2c062d5..1e9806b 100644 --- a/lib/pages/home/Tap/special_work/dt_work/dt_wait_page.dart +++ b/lib/pages/home/Tap/special_work/dt_work/dt_wait_page.dart @@ -44,38 +44,52 @@ class DtWaitPage extends SpecialWorkWaitPageBase { ) async { final hotworkId = item['id'] ?? ''; final hotworkCodeId = item['workId'] ?? ''; - final hotworkInfo = - listType == SpecialListType.task ? item['workInfo'] : item; + final hotworkInfo = listType == SpecialListType.task ? (item['workInfo'] ?? {}) : item; - final status = '${hotworkInfo['status']}'; - final String statusName = - listType == SpecialListType.task + final status = '${hotworkInfo['status'] ?? ''}'; + final stepName = isEdit + ? (listType == SpecialListType.task ? '${item['stepName'] ?? ''}' - : '${hotworkInfo['currentStep'] ?? ''}'; + : '${hotworkInfo['currentStep'] ?? ''}') + : '查看'; if (listType == SpecialListType.task) { if (status == '0' || status == '2') { - await pushPage( - DtApplyPage(isReEdit: true, work_id: hotworkId, status: status), - context, - ); - } else { - await pushPage( - DtTaskPage( - workId: hotworkId, - stepName: statusName, - workCodeId: hotworkCodeId, - isEdit: isEdit, - type: listType, - ), - context, - ); + if (isEdit) { + await pushPage( + DtApplyPage(isReEdit: true, work_id: hotworkId, status: status), + context, + ); + } else { + await pushPage( + DtTaskPage( + workId: hotworkId, + stepName: stepName, + workCodeId: hotworkCodeId, + isEdit: false, + type: listType, + ), + context, + ); + } + return; } + + await pushPage( + DtTaskPage( + workId: hotworkId, + stepName: stepName, + workCodeId: hotworkCodeId, + isEdit: isEdit, + type: listType, + ), + context, + ); } else { await pushPage( DtTaskPage( workId: hotworkId, - stepName: statusName, + stepName: stepName, workCodeId: hotworkCodeId, isEdit: isEdit, type: listType, diff --git a/lib/pages/home/Tap/special_work/dz_work/dz_apply_page.dart b/lib/pages/home/Tap/special_work/dz_work/dz_apply_page.dart index 5edc8ee..ed293f1 100644 --- a/lib/pages/home/Tap/special_work/dz_work/dz_apply_page.dart +++ b/lib/pages/home/Tap/special_work/dz_work/dz_apply_page.dart @@ -129,6 +129,15 @@ class _DzApplyPageState extends SpecialWorkApplyBaseState { const Divider(), ], ListItemFactory.createBuildSimpleSection('基本信息'), + // 作业编号(只读,仅在详情模式下显示) + if (FormUtils.hasValue(pd, 'checkNo') && !isEditable) ...[ + const Divider(), + ItemListWidget.singleLineTitleText( + label: '作业编号:', + isEditable: false, + text: initData['checkNo'] ?? '', + ), + ], // 申请单位(只读) ItemListWidget.singleLineTitleText( label: '申请单位:', @@ -156,11 +165,11 @@ class _DzApplyPageState extends SpecialWorkApplyBaseState { if (pd['xgfFlag'] == 1) ...[ const Divider(), ListItemFactory.createYesNoSection( - horizontalPadding: 5, - verticalPadding: 0, + horizontalPadding: 2, + verticalPadding: 7, title: '是否项目内作业', isRequired: true, - groupValue: isInnerWork, + groupValue: pd['internalOperationFlag'] == 1, onChanged: (value) { setState(() { isInnerWork = value; diff --git a/lib/pages/home/Tap/special_work/dz_work/dz_wait_page.dart b/lib/pages/home/Tap/special_work/dz_work/dz_wait_page.dart index 709902c..7bec5ea 100644 --- a/lib/pages/home/Tap/special_work/dz_work/dz_wait_page.dart +++ b/lib/pages/home/Tap/special_work/dz_work/dz_wait_page.dart @@ -44,43 +44,52 @@ class DzWaitPage extends SpecialWorkWaitPageBase { ) async { final hotworkId = item['id'] ?? ''; final hotworkCodeId = item['workId'] ?? ''; - final hotworkInfo = - listType == SpecialListType.task ? item['workInfo'] : item; + final hotworkInfo = listType == SpecialListType.task ? (item['workInfo'] ?? {}) : item; - final status = '${hotworkInfo['status']}'; - final String statusName = - listType == SpecialListType.task + final status = '${hotworkInfo['status'] ?? ''}'; + final stepName = isEdit + ? (listType == SpecialListType.task ? '${item['stepName'] ?? ''}' - : '${hotworkInfo['currentStep'] ?? ''}'; + : '${hotworkInfo['currentStep'] ?? ''}') + : '查看'; if (listType == SpecialListType.task) { - if (status == '0') { - await pushPage( - DzApplyPage(isReEdit: true, work_id: hotworkId, status: status), - context, - ); - } else if (status == '2') { - await pushPage( - DzApplyPage(isReEdit: true, work_id: hotworkId, status: status), - context, - ); - } else { - await pushPage( - DzTaskPage( - workId: hotworkId, - stepName: statusName, - workCodeId: hotworkCodeId, - isEdit: isEdit, - type: listType, - ), - context, - ); + if (status == '0' || status == '2') { + if (isEdit) { + await pushPage( + DzApplyPage(isReEdit: true, work_id: hotworkId, status: status), + context, + ); + } else { + await pushPage( + DzTaskPage( + workId: hotworkId, + stepName: stepName, + workCodeId: hotworkCodeId, + isEdit: false, + type: listType, + ), + context, + ); + } + return; } + + await pushPage( + DzTaskPage( + workId: hotworkId, + stepName: stepName, + workCodeId: hotworkCodeId, + isEdit: isEdit, + type: listType, + ), + context, + ); } else { await pushPage( DzTaskPage( workId: hotworkId, - stepName: statusName, + stepName: stepName, workCodeId: hotworkCodeId, isEdit: isEdit, type: listType, diff --git a/lib/pages/home/Tap/special_work/dz_work/hoistingDetailFormWidget.dart b/lib/pages/home/Tap/special_work/dz_work/hoistingDetailFormWidget.dart index ff415a1..41e0701 100644 --- a/lib/pages/home/Tap/special_work/dz_work/hoistingDetailFormWidget.dart +++ b/lib/pages/home/Tap/special_work/dz_work/hoistingDetailFormWidget.dart @@ -126,7 +126,7 @@ class _HoistingDetailFormWidgetState extends State { ListItemFactory.createBuildSimpleSection('基本信息'), if (FormUtils.hasValue(widget.pd, 'checkNo') && !widget.isEditable) ...[ ItemListWidget.singleLineTitleText( - label: '编号:', + label: '作业编号:', isEditable: false, text: widget.pd['checkNo'] ?? '', ), @@ -162,7 +162,7 @@ class _HoistingDetailFormWidgetState extends State { groupValue: null, onChanged: (bool value) { }, ), - const Divider(height: 1), + const Divider(), // 相关方作业 ItemListWidget.selectableLineTitleTextRightButton( @@ -289,30 +289,7 @@ class _HoistingDetailFormWidgetState extends State { isAllowEdit: false, ), ], - if (_otherMeasuresList.isNotEmpty) ...[ - const Divider(), - ListItemFactory.createBuildSimpleSection('其他安全措施'), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: - _otherMeasuresList.map((item) { - return Padding( - padding: const EdgeInsets.symmetric( - vertical: 6.0, - horizontal: 12.0, - ), - child: Align( - alignment: Alignment.centerLeft, - child: Text( - '${item['stepName'] ?? ''}:${item['content'] ?? ''}', - style: const TextStyle(fontSize: 14), - textAlign: TextAlign.left, - ), - ), - ); - }).toList(), - ), - ], + ], diff --git a/lib/pages/home/Tap/special_work/gc_work/HeighWorkDetailFormWidget.dart b/lib/pages/home/Tap/special_work/gc_work/HeighWorkDetailFormWidget.dart index 755b465..d4b8864 100644 --- a/lib/pages/home/Tap/special_work/gc_work/HeighWorkDetailFormWidget.dart +++ b/lib/pages/home/Tap/special_work/gc_work/HeighWorkDetailFormWidget.dart @@ -123,7 +123,7 @@ class _HeighWorkDetailFormWidgetState extends State { if (FormUtils.hasValue(widget.pd, 'checkNo') && !widget.isEditable) ...[ ItemListWidget.singleLineTitleText( - label: '编号:', + label: '作业编号:', isEditable: false, text: widget.pd['checkNo'] ?? '', ), @@ -159,7 +159,7 @@ class _HeighWorkDetailFormWidgetState extends State { groupValue: null, onChanged: (bool value) {}, ), - const Divider(height: 1), + const Divider(), // 相关方作业 ItemListWidget.selectableLineTitleTextRightButton( @@ -258,30 +258,7 @@ class _HeighWorkDetailFormWidgetState extends State { isAllowEdit: false, ), ], - if (_otherMeasuresList.isNotEmpty) ...[ - const Divider(), - ListItemFactory.createBuildSimpleSection('其他安全措施'), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: - _otherMeasuresList.map((item) { - return Padding( - padding: const EdgeInsets.symmetric( - vertical: 6.0, - horizontal: 12.0, - ), - child: Align( - alignment: Alignment.centerLeft, - child: Text( - '${item['stepName'] ?? ''}:${item['content'] ?? ''}', - style: const TextStyle(fontSize: 14), - textAlign: TextAlign.left, - ), - ), - ); - }).toList(), - ), - ], + ], ), ); diff --git a/lib/pages/home/Tap/special_work/gc_work/gc_apply_page.dart b/lib/pages/home/Tap/special_work/gc_work/gc_apply_page.dart index 7123f55..55ad545 100644 --- a/lib/pages/home/Tap/special_work/gc_work/gc_apply_page.dart +++ b/lib/pages/home/Tap/special_work/gc_work/gc_apply_page.dart @@ -126,6 +126,15 @@ class _GcApplyPageState extends SpecialWorkApplyBaseState { const Divider(), ], ListItemFactory.createBuildSimpleSection('基本信息'), + // 作业编号(只读,仅在详情模式下显示) + if (FormUtils.hasValue(pd, 'checkNo') && !isEditable) ...[ + const Divider(), + ItemListWidget.singleLineTitleText( + label: '作业编号:', + isEditable: false, + text: initData['checkNo'] ?? '', + ), + ], // 申请单位(只读) ItemListWidget.singleLineTitleText( label: '申请单位:', @@ -157,7 +166,7 @@ class _GcApplyPageState extends SpecialWorkApplyBaseState { verticalPadding: 0, title: '是否项目内作业', isRequired: true, - groupValue: isInnerWork, + groupValue: pd['internalOperationFlag'] == 1, onChanged: (value) { setState(() { isInnerWork = value; diff --git a/lib/pages/home/Tap/special_work/gc_work/gc_wait_page.dart b/lib/pages/home/Tap/special_work/gc_work/gc_wait_page.dart index fd67853..38ec64a 100644 --- a/lib/pages/home/Tap/special_work/gc_work/gc_wait_page.dart +++ b/lib/pages/home/Tap/special_work/gc_work/gc_wait_page.dart @@ -44,74 +44,81 @@ class GcWaitPage extends SpecialWorkWaitPageBase { ) async { final hotworkId = item['id'] ?? ''; final hotworkCodeId = item['workId'] ?? ''; - final hotworkInfo = - listType == SpecialListType.task ? item['workInfo'] : item; + final hotworkInfo = listType == SpecialListType.task ? (item['workInfo'] ?? {}) : item; final stepId = '${item['stepId'] ?? ''}'; - final status = '${hotworkInfo['status']}'; - final String statusName = - listType == SpecialListType.task + final status = '${hotworkInfo['status'] ?? ''}'; + final stepName = isEdit + ? (listType == SpecialListType.task ? '${item['stepName'] ?? ''}' - : '${hotworkInfo['currentStep'] ?? ''}'; + : '${hotworkInfo['currentStep'] ?? ''}') + : '查看'; if (listType == SpecialListType.task) { if (stepId == '2') { - } else { - if (status == '0') { + await pushPage( + GcTaskPage( + workId: hotworkId, + stepName: stepName, + workCodeId: hotworkCodeId, + isEdit: false, + type: listType, + ), + context, + ); + return; + } + + if (status == '0' || status == '2') { + if (isEdit) { await pushPage( GcApplyPage(isReEdit: true, work_id: hotworkId, status: status), context, ); - } else if (status == '2') { - if (isEdit) { - await pushPage( - GcApplyPage(isReEdit: true, work_id: hotworkId, status: status), - context, - ); - } else { - await pushPage( - GcTaskPage( - workId: hotworkId, - stepName: '查看', - workCodeId: hotworkCodeId, - isEdit: false, - type: listType, - ), - context, - ); - } - } else if (stepId == '12') { - if (isEdit) { - } else { - await pushPage( - GcTaskPage( - workId: hotworkId, - stepName: statusName, - workCodeId: hotworkCodeId, - isEdit: false, - type: listType, - ), - context, - ); - } } else { await pushPage( GcTaskPage( workId: hotworkId, - stepName: statusName, + stepName: stepName, workCodeId: hotworkCodeId, - isEdit: isEdit, + isEdit: false, type: listType, ), context, ); } + return; } + + if (stepId == '12') { + await pushPage( + GcTaskPage( + workId: hotworkId, + stepName: stepName, + workCodeId: hotworkCodeId, + isEdit: isEdit, + type: listType, + ), + context, + ); + return; + } + + await pushPage( + GcTaskPage( + workId: hotworkId, + stepName: stepName, + workCodeId: hotworkCodeId, + isEdit: isEdit, + type: listType, + ), + context, + ); } else { await pushPage( GcTaskPage( workId: hotworkId, - stepName: statusName, + stepName: stepName, workCodeId: hotworkCodeId, isEdit: isEdit, type: listType, @@ -129,9 +136,16 @@ class GcWaitPage extends SpecialWorkWaitPageBase { Map info, String statusName, ) { - final step10 = Map.from(info['step_10'] ?? {}); - final step4 = Map.from(info['step_4'] ?? {}); - final step6 = Map.from(info['step_6'] ?? {}); + // 获取各个步骤的人员信息(按原逻辑) + String actUserUnit = info['step_21']?['actUserDepartmentName'] ?? ''; + String safeDisclosureUserName = info['step_18']?['actUserName'] ?? ''; + String acceptDisclosureUserName = info['step_19']?['actUserName'] ?? ''; + String guardianUserName = info['step_20']?['actUserName'] ?? ''; + String workUserName = info['step_21']?['actUserName'] ?? ''; + String unitLeaderUserName = info['step_22']?['actUserName'] ?? ''; + String auditDepartmentLeaderUserName = info['step_23']?['actUserName'] ?? ''; + String spDepartmentLeaderUserName = info['step_24']?['actUserName'] ?? ''; + String acceptDepartmentLeaderUserName = info['step_25']?['actUserName'] ?? ''; return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -141,7 +155,7 @@ class GcWaitPage extends SpecialWorkWaitPageBase { children: [ Expanded( child: Text( - '编号: ${workInfo['checkNo'] ?? ''}', + "编号: ${item['checkNo'] ?? ''}", style: const TextStyle( fontSize: 14, fontWeight: FontWeight.bold, @@ -154,8 +168,7 @@ class GcWaitPage extends SpecialWorkWaitPageBase { ], ), Text( - '动火等级: ${info['workLevelName'] ?? ''}', - textAlign: TextAlign.right, + "施工单位: $actUserUnit", style: const TextStyle( fontSize: 14, fontWeight: FontWeight.bold, @@ -168,7 +181,7 @@ class GcWaitPage extends SpecialWorkWaitPageBase { children: [ Expanded( child: Text( - '申请人: ${info['applyUser'] ?? ''}', + "申请人: ${info['applyUser'] ?? ''}", softWrap: true, maxLines: null, overflow: TextOverflow.visible, @@ -177,7 +190,7 @@ class GcWaitPage extends SpecialWorkWaitPageBase { const SizedBox(width: 8), Expanded( child: Text( - '申请部门: ${info['applyDepartment'] ?? ''}', + "申请单位: ${info['applyDepartment'] ?? ''}", textAlign: TextAlign.right, softWrap: true, maxLines: null, @@ -189,42 +202,41 @@ class GcWaitPage extends SpecialWorkWaitPageBase { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - '现场负责人: ${step10['actUserName'] ?? ''}', - softWrap: true, - maxLines: null, - textAlign: TextAlign.right, - overflow: TextOverflow.visible, - ), - Text( - '动火单位负责人: ${step4['actUserName'] ?? ''}', - softWrap: true, - maxLines: null, - overflow: TextOverflow.visible, - ), + Text("作业负责人: $workUserName", + softWrap: true, maxLines: null, overflow: TextOverflow.visible), + Text("所在单位负责人: $unitLeaderUserName", + softWrap: true, maxLines: null, overflow: TextOverflow.visible), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text("审核部门负责人: $auditDepartmentLeaderUserName", + softWrap: true, maxLines: null, overflow: TextOverflow.visible), + Text("审批部门负责人: $spDepartmentLeaderUserName", + softWrap: true, maxLines: null, overflow: TextOverflow.visible), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text("监护人: $guardianUserName", + softWrap: true, maxLines: null, overflow: TextOverflow.visible), + Text("安全交底人: $safeDisclosureUserName", + softWrap: true, maxLines: null, overflow: TextOverflow.visible), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text("接受交底人: $acceptDisclosureUserName", + softWrap: true, maxLines: null, overflow: TextOverflow.visible), + Text("验收部门负责人: $acceptDepartmentLeaderUserName", + softWrap: true, maxLines: null, overflow: TextOverflow.visible), ], ), Text( - '现场管辖单位负责人: ${step6['actUserName'] ?? ''}', - softWrap: true, - maxLines: null, - overflow: TextOverflow.visible, - ), - Text( - '作业内容: ${info['workContent'] ?? ''}', - textAlign: TextAlign.left, - softWrap: true, - maxLines: 3, - overflow: TextOverflow.visible, - ), - Text( - '动火部位: ${info['work_place'] ?? ''}', - softWrap: true, - maxLines: null, - overflow: TextOverflow.visible, - ), - Text( - '作业类型: ${info['operationTypeName'] ?? ''}', + "作业类型: ${info['operationTypeName'] ?? ''}", softWrap: true, maxLines: null, overflow: TextOverflow.visible, @@ -233,7 +245,7 @@ class GcWaitPage extends SpecialWorkWaitPageBase { children: [ Expanded( child: Text( - '审核状态: $statusName', + "审核状态: $statusName", overflow: TextOverflow.ellipsis, softWrap: true, maxLines: null, diff --git a/lib/pages/home/Tap/special_work/lsyd_work/LsydWorkDetailFormWidget.dart b/lib/pages/home/Tap/special_work/lsyd_work/LsydWorkDetailFormWidget.dart index 6d1e978..5841d81 100644 --- a/lib/pages/home/Tap/special_work/lsyd_work/LsydWorkDetailFormWidget.dart +++ b/lib/pages/home/Tap/special_work/lsyd_work/LsydWorkDetailFormWidget.dart @@ -126,6 +126,14 @@ class _LsydWorkDetailFormWidgetState extends State { const Divider(), ], ListItemFactory.createBuildSimpleSection('基本信息'), + if (FormUtils.hasValue(widget.pd, 'checkNo') && !widget.isEditable) ...[ + ItemListWidget.singleLineTitleText( + label: '作业编号:', + isEditable: false, + text: widget.pd['checkNo'] ?? '', + ), + const Divider(), + ], ItemListWidget.singleLineTitleText( label: '申请单位:', isEditable: false, @@ -137,14 +145,6 @@ class _LsydWorkDetailFormWidgetState extends State { isEditable: false, text: pd['applyUser'] ?? '', ), - if (FormUtils.hasValue(pd, 'checkNo') && !widget.isEditable) ...[ - const Divider(), - ItemListWidget.singleLineTitleText( - label: '作业编号:', - isEditable: false, - text: pd['checkNo'] ?? '', - ), - ], const Divider(), ItemListWidget.selectableLineTitleTextRightButton( label: '作业类型:', @@ -163,7 +163,7 @@ class _LsydWorkDetailFormWidgetState extends State { groupValue: null, onChanged: (bool value) { }, ), - const Divider(height: 1), + const Divider(), // 相关方作业 ItemListWidget.selectableLineTitleTextRightButton( @@ -317,30 +317,7 @@ class _LsydWorkDetailFormWidgetState extends State { isAllowEdit: false, ), ], - if (_otherMeasuresList.isNotEmpty) ...[ - const Divider(), - ListItemFactory.createBuildSimpleSection('其他安全措施'), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: - _otherMeasuresList.map((item) { - return Padding( - padding: const EdgeInsets.symmetric( - vertical: 6.0, - horizontal: 12.0, - ), - child: Align( - alignment: Alignment.centerLeft, - child: Text( - '${item['stepName'] ?? ''}:${item['content'] ?? ''}', - style: const TextStyle(fontSize: 14), - textAlign: TextAlign.left, - ), - ), - ); - }).toList(), - ), - ], + ], ), diff --git a/lib/pages/home/Tap/special_work/lsyd_work/lsyd_apply_page.dart b/lib/pages/home/Tap/special_work/lsyd_work/lsyd_apply_page.dart index cb2b5ad..d6cf03e 100644 --- a/lib/pages/home/Tap/special_work/lsyd_work/lsyd_apply_page.dart +++ b/lib/pages/home/Tap/special_work/lsyd_work/lsyd_apply_page.dart @@ -135,6 +135,15 @@ class _LsydApplyPageState extends SpecialWorkApplyBaseState { const Divider(), ], ListItemFactory.createBuildSimpleSection('基本信息'), + // 作业编号(只读,仅在详情模式下显示) + if (FormUtils.hasValue(pd, 'checkNo') && !isEditable) ...[ + const Divider(), + ItemListWidget.singleLineTitleText( + label: '作业编号:', + isEditable: false, + text: initData['checkNo'] ?? '', + ), + ], // 申请单位 ItemListWidget.singleLineTitleText( label: '申请单位:', @@ -166,7 +175,7 @@ class _LsydApplyPageState extends SpecialWorkApplyBaseState { verticalPadding: 0, title: '是否项目内作业', isRequired: true, - groupValue: isInnerWork, + groupValue: pd['internalOperationFlag'] == 1, onChanged: (value) { setState(() { isInnerWork = value; diff --git a/lib/pages/home/Tap/special_work/lsyd_work/lsyd_wait_page.dart b/lib/pages/home/Tap/special_work/lsyd_work/lsyd_wait_page.dart index 68145c6..9554dba 100644 --- a/lib/pages/home/Tap/special_work/lsyd_work/lsyd_wait_page.dart +++ b/lib/pages/home/Tap/special_work/lsyd_work/lsyd_wait_page.dart @@ -46,70 +46,64 @@ class LsydWaitPage extends SpecialWorkWaitPageBase { final hotworkId = item['id'] ?? ''; final hotworkCodeId = item['workId'] ?? ''; final hotworkInfo = - listType == SpecialListType.task ? item['workInfo'] : item; + listType == SpecialListType.task ? (item['workInfo'] ?? {}) : item; final stepId = '${item['stepId'] ?? ''}'; - final status = '${hotworkInfo['status']}'; - final String statusName = - listType == SpecialListType.task - ? '${item['stepName'] ?? ''}' - : '${hotworkInfo['currentStep'] ?? ''}'; + final status = '${hotworkInfo['status'] ?? ''}'; - if (listType == SpecialListType.task) { - if (stepId == '2') { - if (isEdit) { - await pushPage( - SpecialWorkGasList(data: item, addFlag: stepId == '2'), - context, - ); - } else { - await pushPage( - LsydTaskPage( - workId: hotworkId, - stepName: statusName, - workCodeId: hotworkCodeId, - isEdit: false, - type: listType, - ), - context, - ); - } - } else { - if (status == '0') { - await pushPage( - LsydApplyPage(isReEdit: true, work_id: hotworkId, status: status), - context, - ); - } else if (status == '2') { - await pushPage( - LsydApplyPage(isReEdit: true, work_id: hotworkId, status: status), - context, - ); - } else { - await pushPage( - LsydTaskPage( - workId: hotworkId, - stepName: statusName, - workCodeId: hotworkCodeId, - isEdit: isEdit, - type: listType, - ), - context, - ); - } - } - } else { + final String stepName = isEdit + ? (listType == SpecialListType.task + ? '${item['stepName'] ?? ''}' + : '${hotworkInfo['currentStep'] ?? ''}') + : '查看'; + + Future openTaskPage({required bool editable}) async { await pushPage( LsydTaskPage( workId: hotworkId, - stepName: statusName, + stepName: stepName, workCodeId: hotworkCodeId, - isEdit: isEdit, + isEdit: editable, type: listType, ), context, ); } + + if (listType == SpecialListType.task) { + if (stepId == '2') { + if (isEdit) { + await pushPage( + SpecialWorkGasList(data: item, addFlag: true), + context, + ); + } else { + await openTaskPage(editable: false); + } + return; + } + + if (status == '0' || status == '2') { + if (isEdit) { + await pushPage( + LsydApplyPage( + isReEdit: true, + work_id: hotworkId, + status: status, + ), + context, + ); + } else { + await openTaskPage(editable: false); + } + return; + } + + await openTaskPage(editable: isEdit); + return; + } + + await openTaskPage(editable: isEdit); } @override diff --git a/lib/pages/home/Tap/special_work/mbcd_work/mbcdDetailFormWidget.dart b/lib/pages/home/Tap/special_work/mbcd_work/mbcdDetailFormWidget.dart index 059893f..6b1cba1 100644 --- a/lib/pages/home/Tap/special_work/mbcd_work/mbcdDetailFormWidget.dart +++ b/lib/pages/home/Tap/special_work/mbcd_work/mbcdDetailFormWidget.dart @@ -177,7 +177,7 @@ class _MbcdDetailFormWidgetState extends State { ListItemFactory.createBuildSimpleSection('基本信息'), if (FormUtils.hasValue(widget.pd, 'checkNo') && !widget.isEditable) ...[ ItemListWidget.singleLineTitleText( - label: '编号:', + label: '作业编号:', isEditable: false, text: widget.pd['checkNo'] ?? '', ), @@ -213,7 +213,7 @@ class _MbcdDetailFormWidgetState extends State { groupValue: null, onChanged: (bool value) { }, ), - const Divider(height: 1), + const Divider(), // 相关方作业 ItemListWidget.selectableLineTitleTextRightButton( @@ -336,30 +336,7 @@ class _MbcdDetailFormWidgetState extends State { isAllowEdit: false, ), ], - if (_otherMeasuresList.isNotEmpty) ...[ - const Divider(), - ListItemFactory.createBuildSimpleSection('其他安全措施'), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: - _otherMeasuresList.map((item) { - return Padding( - padding: const EdgeInsets.symmetric( - vertical: 6.0, - horizontal: 12.0, - ), - child: Align( - alignment: Alignment.centerLeft, - child: Text( - '${item['stepName'] ?? ''}:${item['content'] ?? ''}', - style: const TextStyle(fontSize: 14), - textAlign: TextAlign.left, - ), - ), - ); - }).toList(), - ), - ], + ], diff --git a/lib/pages/home/Tap/special_work/mbcd_work/mbcd_apply_page.dart b/lib/pages/home/Tap/special_work/mbcd_work/mbcd_apply_page.dart index ec528d6..67d96cd 100644 --- a/lib/pages/home/Tap/special_work/mbcd_work/mbcd_apply_page.dart +++ b/lib/pages/home/Tap/special_work/mbcd_work/mbcd_apply_page.dart @@ -176,6 +176,15 @@ class _MbcdApplyPageState extends SpecialWorkApplyBaseState { const Divider(), ], ListItemFactory.createBuildSimpleSection('基本信息'), + // 作业编号(只读,仅在详情模式下显示) + if (FormUtils.hasValue(pd, 'checkNo') && !isEditable) ...[ + const Divider(), + ItemListWidget.singleLineTitleText( + label: '作业编号:', + isEditable: false, + text: initData['checkNo'] ?? '', + ), + ], // 申请单位 ItemListWidget.singleLineTitleText( label: '申请单位:', @@ -207,7 +216,7 @@ class _MbcdApplyPageState extends SpecialWorkApplyBaseState { verticalPadding: 0, title: '是否项目内作业', isRequired: true, - groupValue: isInnerWork, + groupValue: pd['internalOperationFlag'] == 1, onChanged: (value) { setState(() { isInnerWork = value; diff --git a/lib/pages/home/Tap/special_work/mbcd_work/mbcd_wait_page.dart b/lib/pages/home/Tap/special_work/mbcd_work/mbcd_wait_page.dart index 8ddf7a2..e49b173 100644 --- a/lib/pages/home/Tap/special_work/mbcd_work/mbcd_wait_page.dart +++ b/lib/pages/home/Tap/special_work/mbcd_work/mbcd_wait_page.dart @@ -47,38 +47,52 @@ class MbcdWaitPage extends SpecialWorkWaitPageBase { ) async { final hotworkId = item['id'] ?? ''; final hotworkCodeId = item['workId'] ?? ''; - final hotworkInfo = - listType == SpecialListType.task ? item['workInfo'] : item; + final hotworkInfo = listType == SpecialListType.task ? (item['workInfo'] ?? {}) : item; - final status = '${hotworkInfo['status']}'; - final String statusName = - listType == SpecialListType.task + final status = '${hotworkInfo['status'] ?? ''}'; + final stepName = isEdit + ? (listType == SpecialListType.task ? '${item['stepName'] ?? ''}' - : '${hotworkInfo['currentStep'] ?? ''}'; + : '${hotworkInfo['currentStep'] ?? ''}') + : '查看'; if (listType == SpecialListType.task) { if (status == '0' || status == '2') { - await pushPage( - MbcdApplyPage(isReEdit: true, work_id: hotworkId, status: status), - context, - ); - } else { - await pushPage( - MbcdTaskPage( - workId: hotworkId, - stepName: statusName, - workCodeId: hotworkCodeId, - isEdit: isEdit, - type: listType, - ), - context, - ); + if (isEdit) { + await pushPage( + MbcdApplyPage(isReEdit: true, work_id: hotworkId, status: status), + context, + ); + } else { + await pushPage( + MbcdTaskPage( + workId: hotworkId, + stepName: stepName, + workCodeId: hotworkCodeId, + isEdit: false, + type: listType, + ), + context, + ); + } + return; } + + await pushPage( + MbcdTaskPage( + workId: hotworkId, + stepName: stepName, + workCodeId: hotworkCodeId, + isEdit: isEdit, + type: listType, + ), + context, + ); } else { await pushPage( MbcdTaskPage( workId: hotworkId, - stepName: statusName, + stepName: stepName, workCodeId: hotworkCodeId, isEdit: isEdit, type: listType, @@ -188,24 +202,6 @@ class MbcdWaitPage extends SpecialWorkWaitPageBase { ), ], ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '审核部门负责人: $auditDepartmentLeaderUserName', - softWrap: true, - maxLines: null, - textAlign: TextAlign.right, - overflow: TextOverflow.visible, - ), - Text( - '审批部门负责人: $spDepartmentLeaderUserName', - softWrap: true, - maxLines: null, - overflow: TextOverflow.visible, - ), - ], - ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/pages/home/Tap/special_work/sxkj_work/SxkjWorkDetailFormWidget.dart b/lib/pages/home/Tap/special_work/sxkj_work/SxkjWorkDetailFormWidget.dart index 3a5f49a..16d463c 100644 --- a/lib/pages/home/Tap/special_work/sxkj_work/SxkjWorkDetailFormWidget.dart +++ b/lib/pages/home/Tap/special_work/sxkj_work/SxkjWorkDetailFormWidget.dart @@ -122,6 +122,14 @@ class _SxkjWorkDetailFormWidgetState extends State { const Divider(), ], ListItemFactory.createBuildSimpleSection('基本信息'), + if (FormUtils.hasValue(widget.pd, 'checkNo') && !widget.isEditable) ...[ + ItemListWidget.singleLineTitleText( + label: '作业编号:', + isEditable: false, + text: widget.pd['checkNo'] ?? '', + ), + const Divider(), + ], ItemListWidget.singleLineTitleText( label: '申请单位:', isEditable: false, @@ -133,14 +141,6 @@ class _SxkjWorkDetailFormWidgetState extends State { isEditable: false, text: pd['applyUser'] ?? '', ), - if (FormUtils.hasValue(pd, 'checkNo') && !widget.isEditable) ...[ - const Divider(), - ItemListWidget.singleLineTitleText( - label: '作业编号:', - isEditable: false, - text: pd['checkNo'] ?? '', - ), - ], const Divider(), ItemListWidget.selectableLineTitleTextRightButton( label: '申请日期:', @@ -282,31 +282,6 @@ class _SxkjWorkDetailFormWidgetState extends State { isAllowEdit: false, ), ], - if (_otherMeasuresList.isNotEmpty) ...[ - const Divider(), - ListItemFactory.createBuildSimpleSection('其他安全措施'), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: - _otherMeasuresList.map((item) { - return Padding( - padding: const EdgeInsets.symmetric( - vertical: 6.0, - horizontal: 12.0, - ), - child: Align( - alignment: Alignment.centerLeft, - child: Text( - '${item['stepName'] ?? ''}:${item['content'] ?? ''}', - style: const TextStyle(fontSize: 14), - textAlign: TextAlign.left, - ), - ), - ); - }).toList(), - ), - ], - ], ), 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 a196b9e..1795ba4 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 @@ -175,6 +175,15 @@ class _SxkjApplyPageState extends SpecialWorkApplyBaseState { const Divider(), ], ListItemFactory.createBuildSimpleSection('基本信息'), + // 作业编号(只读,仅在详情模式下显示) + if (FormUtils.hasValue(pd, 'checkNo') && !isEditable) ...[ + const Divider(), + ItemListWidget.singleLineTitleText( + label: '作业编号:', + isEditable: false, + text: initData['checkNo'] ?? '', + ), + ], // 申请单位(只读) ItemListWidget.singleLineTitleText( label: '申请单位:', @@ -226,7 +235,7 @@ class _SxkjApplyPageState extends SpecialWorkApplyBaseState { verticalPadding: 0, title: '是否项目内作业', isRequired: true, - groupValue: isInnerWork, + groupValue: pd['internalOperationFlag'] == 1, onChanged: (value) { setState(() { isInnerWork = value; diff --git a/lib/pages/home/Tap/special_work/sxkj_work/sxkj_wait_page.dart b/lib/pages/home/Tap/special_work/sxkj_work/sxkj_wait_page.dart index e7a6b3b..9fb9c1a 100644 --- a/lib/pages/home/Tap/special_work/sxkj_work/sxkj_wait_page.dart +++ b/lib/pages/home/Tap/special_work/sxkj_work/sxkj_wait_page.dart @@ -45,66 +45,64 @@ class SxkjWaitPage extends SpecialWorkWaitPageBase { ) async { final hotworkId = item['id'] ?? ''; final hotworkCodeId = item['workId'] ?? ''; - final hotworkInfo = - listType == SpecialListType.task ? item['workInfo'] : item; + final hotworkInfo = listType == SpecialListType.task ? item['workInfo'] ?? {} : item; final stepId = '${item['stepId'] ?? ''}'; - final status = '${hotworkInfo['status']}'; - final String statusName = - listType == SpecialListType.task - ? '${item['stepName'] ?? ''}' - : '${hotworkInfo['currentStep'] ?? ''}'; + final status = '${hotworkInfo['status'] ?? ''}'; - if (listType == SpecialListType.task) { - if (stepId == '2') { - if (isEdit) { - await pushPage( - SpecialWorkGasList(data: item, addFlag: stepId == '2'), - context, - ); - } else { - await pushPage( - SxkjTaskPage( - workId: hotworkId, - stepName: statusName, - workCodeId: hotworkCodeId, - isEdit: false, - type: listType, - ), - context, - ); - } - } else { - if (status == '0' || status == '2') { - await pushPage( - SxkjApplyPage(isReEdit: true, workId: hotworkId, status: status), - context, - ); - } else { - await pushPage( - SxkjTaskPage( - workId: hotworkId, - stepName: statusName, - workCodeId: hotworkCodeId, - isEdit: isEdit, - type: listType, - ), - context, - ); - } - } - } else { + final String statusName = isEdit + ? (listType == SpecialListType.task + ? '${item['stepName'] ?? ''}' + : '${hotworkInfo['currentStep'] ?? ''}') + : '查看'; + + Future openTaskPage({required bool editable}) async { await pushPage( SxkjTaskPage( workId: hotworkId, stepName: statusName, workCodeId: hotworkCodeId, - isEdit: isEdit, + isEdit: editable, type: listType, ), context, ); } + + if (listType == SpecialListType.task) { + if (stepId == '2') { + if (isEdit) { + await pushPage( + SpecialWorkGasList(data: item, addFlag: true), + context, + ); + } else { + await openTaskPage(editable: false); + } + return; + } + + if (status == '0' || status == '2') { + if (isEdit) { + await pushPage( + SxkjApplyPage( + isReEdit: true, + workId: hotworkId, + status: status, + ), + context, + ); + } else { + await openTaskPage(editable: false); + } + return; + } + + await openTaskPage(editable: isEdit); + return; + } + + await openTaskPage(editable: isEdit); } @override @@ -115,12 +113,7 @@ class SxkjWaitPage extends SpecialWorkWaitPageBase { Map info, String statusName, ) { - final step21 = Map.from(info['step_21'] ?? {}); - final step18 = Map.from(info['step_18'] ?? {}); - final step19 = Map.from(info['step_19'] ?? {}); - final step20 = Map.from(info['step_20'] ?? {}); - final step22 = Map.from(info['step_22'] ?? {}); - final step25 = Map.from(info['step_25'] ?? {}); + final chooseLimitedSpace = Map.from( info['chooseLimitedSpace'] ?? {}, ); 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 badcf83..e0a019f 100644 --- a/lib/pages/home/Tap/special_work_apply_base_page.dart +++ b/lib/pages/home/Tap/special_work_apply_base_page.dart @@ -363,7 +363,7 @@ abstract class SpecialWorkApplyBaseState /// 根据 initData 生成签字组 void _initGroupsFromInitData(bool isRefresh) { - _clearRelatedPartiesPerson(); + _clearAllPerson(); final List steps = (initData['settingSignSteps'] is List) ? List.from(initData['settingSignSteps']) @@ -586,7 +586,8 @@ abstract class SpecialWorkApplyBaseState void _clearRelatedPartiesPerson() { setState(() { for (Map item in groups) { - if (item['stepId']?.toString() == '2') { + final stepId = item['stepId']?.toString() ?? ''; + if (stepId == '2') { // 气体检测人清空 item['actUser'] = ''; item['actUserName'] = ''; item['actUserDepartment'] = ''; @@ -595,9 +596,30 @@ abstract class SpecialWorkApplyBaseState } safeController.clearAllGroupUser(); }); - - // 特殊处理:气体分析人员(stepId=2)只能从作业负责人和监护人中选择 } + void _clearAllPerson() async { + setState(() { + for (Map item in groups) { + item['actUser'] = ''; + item['actUserName'] = ''; + item['actUserDepartment'] = ''; + item['actUserDepartmentName'] = ''; + } + if (pd['xgfFlag'] == 1) { + safeController.clearAllGroupUser(); + } + pd['workChargeUserId'] = ''; + pd['workChargeUserName'] = ''; + pd['workChargeUserDepartment'] = ''; + pd['workChargeUserDepartmentName'] = ''; + + pd['workGuardianUserId'] = ''; + pd['workGuardianUserName'] = ''; + pd['workGuardianUserDepartment'] = ''; + pd['workGuardianUserDepartmentName'] = ''; + }); + } + /// 选择相关方项目 Future getRelatedPartiesList() async { @@ -794,7 +816,10 @@ abstract class SpecialWorkApplyBaseState /// 通用提交入口 Future submit(String status) async { await beforeSubmit(status); - + if (!FormUtils.hasValue(pd, 'workLevel')) { + ToastUtil.showNormal(context, '请选择作业等级'); + return; + } final preparers = enableSafeProtection ? safeController.buildPreparers() @@ -848,33 +873,35 @@ abstract class SpecialWorkApplyBaseState /// 通用 payload 组装 Future> buildSubmitPayload( - String status, - List signLogs, - ) async { + String status, + List signLogs, + ) async { + + final extraPayload = await buildExtraPayload(); final info = {...pd}; if (FormUtils.hasValue(info, 'taskWorkLevels')) { info.remove('taskWorkLevels'); } - final payload = { 'workLevel': info['workLevel'] ?? '', 'workType': workType.code, 'xgfFlag': info['xgfFlag'] ?? '', 'projectId': info['projectId'] ?? '', 'projectName': info['projectName'] ?? '', + 'corpinfoId': info['projectExecutionLocationCorpId'] ?? '', 'info': info, 'gasFlag': info['gasFlag'] ?? '', 'checkNo': info['checkNo'] ?? '', 'signLogs': signLogs, 'workId': form['workId'] ?? '', }; + payload.addAll(extraPayload); if (pd['internalOperationFlag'] == 1) { payload['xgfId'] = info['xgfId'] ?? ''; } - final extraPayload = await buildExtraPayload(); - payload.addAll(extraPayload); + if (FormUtils.hasValue(payload, 'workId') && widget.status == '2') { payload.remove('checkNo'); @@ -911,9 +938,9 @@ abstract class SpecialWorkApplyBaseState for (final measure in uniquePreparers) { final newItem = Map.from(item); newItem['updateId'] = measure['updateId']; - newItem['updateName'] = measure['userName']; + newItem['updateName'] = measure['updateName']; newItem['actUser'] = measure['updateId']; - newItem['actUserName'] = measure['userName']; + newItem['actUserName'] = measure['updateName']; newItem['actUserDepartment'] = measure['departmentId']; newItem['actUserDepartmentName'] = measure['departmentName']; newGroups.add(newItem); @@ -1187,9 +1214,12 @@ abstract class SpecialWorkApplyBaseState padding: const EdgeInsets.all(12), child: Column( children: [ - buildFormContent(), - const SizedBox(height: 20), - buildFooterButtons(), + if (pd.keys.isNotEmpty) ...[ + buildFormContent(), + const SizedBox(height: 20), + buildFooterButtons(), + ]else + NoDataWidget.show() ], ), ), diff --git a/lib/pages/home/Tap/special_work_task_page_base.dart b/lib/pages/home/Tap/special_work_task_page_base.dart index cfde339..7a308ca 100644 --- a/lib/pages/home/Tap/special_work_task_page_base.dart +++ b/lib/pages/home/Tap/special_work_task_page_base.dart @@ -126,6 +126,9 @@ class _SpecialWorkTaskPageBaseState extends State { /// 安全措施列表 List _measures = []; + /// 已提交的其他安全措施 + List _otherMeasuresList = []; + /// 备注/意见输入 final TextEditingController _contentController = TextEditingController(); @@ -194,7 +197,7 @@ class _SpecialWorkTaskPageBaseState extends State { await NativeOrientation.setPortrait(); if (path != null) { - final now = DateFormat('yyyy-MM-dd HH:mm').format(DateTime.now()); + final now = DateFormat('yyyy-MM-dd HH:mm:ss').format(DateTime.now()); setState(() { signImages = [path]; signTimes = [now]; @@ -239,6 +242,17 @@ class _SpecialWorkTaskPageBaseState extends State { }); } + /// 只获取已填写的其他安全措施列表 + final measuresData = await SpecialWorkApi.specialWorkSignMeasureList({ + 'eqWorkId': pd['workId'] ?? '', + 'eqType' : 2 + }); + if (measuresData['success'] == true) { + setState(() { + _otherMeasuresList = measuresData['data'] ?? []; + }); + } + if (mounted) { setState(() { _groups = groups; @@ -512,6 +526,7 @@ class _SpecialWorkTaskPageBaseState extends State { DepartmentAllPersonPicker.show( context, personsData: personList, + serverData: [], allowXgfFlag: false, onSelectedWithData: (userId, name, data) { setState(() { @@ -911,7 +926,7 @@ class _SpecialWorkTaskPageBaseState extends State { } return Column( children: [ - if (pd['measuresStepFlag'] == 1) ... [ + if (pd['measuresStepFlag'] == 1 && widget.isEdit) ... [ Multitextfieldwithtitlewidght( label: '其他安全措施:', isEditable: true, @@ -925,22 +940,23 @@ class _SpecialWorkTaskPageBaseState extends State { // 签字信息 ...buildStepSignWidgets(signInfo), - if (pd['locateStepFlag'] == 1) _locationWidget(), - if (pd['componentName'] == 'completeDelayTime') _completeDelayTimeWidget(), - if (pd['componentName'] == 'personAnderRecordFile') _personAnderRecordFileWidget(), - if (pd['componentName'] == 'completeDelayTime') ...[ - if (other['isCompleteWork'] == 1) ...[ - if (other['isDelayWork'] != 1) ...[ - if (_groups.isNotEmpty) ...[_buildDeptList(), const Divider()], + if (widget.isEdit) ...[ + if (pd['locateStepFlag'] == 1) _locationWidget(), + if (pd['componentName'] == 'completeDelayTime') _completeDelayTimeWidget(), + if (pd['componentName'] == 'personAnderRecordFile') _personAnderRecordFileWidget(), + if (pd['componentName'] == 'completeDelayTime') ...[ + if (other['isCompleteWork'] == 1) ...[ + if (other['isDelayWork'] != 1) ...[ + if (_groups.isNotEmpty) ...[_buildDeptList(), const Divider()], + ], + _signWidget(), ], + ] else ...[ + if (_groups.isNotEmpty) ...[_buildDeptList(), const Divider()], _signWidget(), ], - ] else ...[ - if (_groups.isNotEmpty) ...[_buildDeptList(), const Divider()], - _signWidget(), - ], - - _bottomButtons(), + _bottomButtons(), + ] ], ); } @@ -1003,7 +1019,73 @@ class _SpecialWorkTaskPageBaseState extends State { if (validEntries.isNotEmpty) { widgets.add(ListItemFactory.createBuildSimpleSection('签字信息')); } + if (FormUtils.hasValue(pd, 'applyUserSignImage')) { + final stepName = '申请部门负责人'; + final imageUrl = ApiService.baseImgPath + pd['applyUserSignImage']; + String signTime = pd['applyTime'] ?? ''; + if (FormUtils.hasValue(pd, 'step_1')) { + final workInfo = pd['step_1'] ?? {}; + signTime = workInfo['signTime'] ?? ''; + } + widgets.add( + Container( + margin: const EdgeInsets.only(top: 10, left: 5, right: 5), + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(6), + border: Border.all(color: Colors.grey.shade300), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisSize: MainAxisSize.min, + children: [ + Align( + alignment: Alignment.centerLeft, + child: Text( + stepName, + style: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + ), + const SizedBox(height: 10), + GestureDetector( + onTap: () async { + presentOpaque(SingleImageViewer(imageUrl: imageUrl), context); + }, + child: Align( + alignment: Alignment.centerRight, + child: ConstrainedBox( + constraints: const BoxConstraints( + maxWidth: 220, + maxHeight: 140, + ), + child: Image.network( + imageUrl, + fit: BoxFit.contain, + errorBuilder: (context, error, stackTrace) { + return const Text('签字图片加载失败'); + }, + ), + ), + ), + ), + const SizedBox(height: 8), + Align( + alignment: Alignment.centerRight, + child: Text( + signTime, + style: const TextStyle(fontSize: 12, color: Colors.black54), + ), + ), + ], + ), + ), + ); + } for (final entry in validEntries) { final raw = entry.value; if (raw is! Map) continue; @@ -1095,6 +1177,38 @@ class _SpecialWorkTaskPageBaseState extends State { return widgets; } + // 其他安全措施回显 + Widget _otherMeasureWidgets() { + if (_otherMeasuresList.isNotEmpty) { + return Column( + children: [ + ListItemFactory.createBuildSimpleSection('其他安全措施'), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: + _otherMeasuresList.map((item) { + return Padding( + padding: const EdgeInsets.symmetric( + vertical: 6.0, + horizontal: 12.0, + ), + child: Align( + alignment: Alignment.centerLeft, + child: Text( + '${item['stepName'] ?? ''}:${item['content'] ?? ''}', + style: const TextStyle(fontSize: 14), + textAlign: TextAlign.left, + ), + ), + ); + }).toList(), + ), + ], + ); + } + return Container(); + } + @override Widget build(BuildContext context) { @@ -1110,7 +1224,7 @@ class _SpecialWorkTaskPageBaseState extends State { children: [ widget.buildDetailForm(pd), const Divider(height: 1), - if (pd['specialStepCode'] == 'measures') ...[ + if (pd['specialStepCode'] == 'measures' && widget.isEdit) ...[ MeasuresListWidget( measuresList: _measures, isAllowEdit: true, @@ -1130,9 +1244,10 @@ class _SpecialWorkTaskPageBaseState extends State { }, ), ], - if (widget.isEdit) ...[ - _operationWidget(), - ] else ...[ + _otherMeasureWidgets(), + _operationWidget(), + + if (!widget.isEdit) ...[ const SizedBox(height: 10), CustomButton( text: '返回',