From a1fdfef4b6f3982ad34edd849584fc039990731f Mon Sep 17 00:00:00 2001 From: hs <873121290@qq.com> Date: Fri, 24 Apr 2026 11:42:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=B1=E9=99=A9=E4=BD=9C=E4=B8=9Abug?= =?UTF-8?q?=E4=BF=AE=E6=94=B95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../special_work/custom/MeasuresListSure.dart | 2 +- .../dh_work/special_work_gas_list.dart | 2 +- .../special_work/dl_work/dl_apply_page.dart | 14 +++---- .../special_work/dt_work/dt_apply_page.dart | 14 +++---- .../special_work/dz_work/dz_apply_page.dart | 14 +++---- .../special_work/gc_work/gc_apply_page.dart | 14 +++---- .../lsyd_work/lsyd_apply_page.dart | 14 +++---- .../lsyd_work/lsyd_gas_add_page.dart | 2 +- .../mbcd_work/mbcd_apply_page.dart | 14 +++---- .../sxkj_work/sxkj_apply_page.dart | 36 +++++++--------- .../sxkj_work/sxkj_gas_add_page.dart | 2 +- .../sxkj_work/tz/sxkj_tz_apply_page.dart | 2 +- .../Tap/special_work_apply_base_page.dart | 41 ++++++++++++------- .../home/Tap/special_work_task_page_base.dart | 10 ++--- 14 files changed, 93 insertions(+), 88 deletions(-) diff --git a/lib/pages/home/Tap/special_work/custom/MeasuresListSure.dart b/lib/pages/home/Tap/special_work/custom/MeasuresListSure.dart index 5965746..6246336 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'] ?? ''), + child: Text('${widget.item['content']}'.replaceAll('&&', '__')), ), Padding( padding: const EdgeInsets.all(0), diff --git a/lib/pages/home/Tap/special_work/dh_work/special_work_gas_list.dart b/lib/pages/home/Tap/special_work/dh_work/special_work_gas_list.dart index 9733fdb..6d7e33c 100644 --- a/lib/pages/home/Tap/special_work/dh_work/special_work_gas_list.dart +++ b/lib/pages/home/Tap/special_work/dh_work/special_work_gas_list.dart @@ -240,7 +240,7 @@ class _SpecialWorkGasListState extends State { ToastUtil.showNormal(context, '添加成功'); _getListData(); } else { - ToastUtil.showNormal(context, res['errMessage'] ?? '提交失败'); + ToastUtil.showNormal(context, res['errMessage'] ?? '作业提交失败'); } } catch (e) { ToastUtil.showNormal(context, '添加失败'); 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 49f4397..937bfb5 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 @@ -36,7 +36,7 @@ class DlApplyPage extends SpecialWorkApplyBasePage { class _DlApplyPageState extends SpecialWorkApplyBaseState { // 安全措施确认人来源(作业负责人和监护人) - late List allowChoosePersonList = [{}, {}]; + late Map allowChoosePerson = {}; @override SpecialWorkTypeEnum get workType => SpecialWorkTypeEnum.cutRoadWork; @@ -74,20 +74,20 @@ class _DlApplyPageState extends SpecialWorkApplyBaseState { @override Future afterInitDataLoaded() async { // 初始化允许选择的人员列表(作业负责人和监护人) - allowChoosePersonList = [ - { + allowChoosePerson = { + '1' : { "actUser": pd['workGuardianUser'] ?? pd['workGuardianUserId'] ?? '', "actUserDepartment": pd['workGuardianUserDepartment'] ?? '', "actUserDepartmentName": pd['workGuardianUserDepartmentName'] ?? '', "actUserName": pd['workGuardianUserName'] ?? '', }, - { + '2' : { "actUserDepartment": pd['workChargeUserDepartment'] ?? '', "actUserDepartmentName": pd['workChargeUserDepartmentName'] ?? '', "actUser": pd['workChargeUser'] ?? pd['workChargeUserId'] ?? '', "actUserName": pd['workChargeUserName'] ?? '', }, - ]; + }; // 重新编辑时恢复图片选择状态 if (widget.isReEdit && FormUtils.hasValue(pd, 'workScopeAndMethodImage')) { @@ -311,7 +311,7 @@ class _DlApplyPageState extends SpecialWorkApplyBaseState { // 安全防护措施模块 SafeProtectionModule( controller: safeController, - personList: allowChoosePersonList, + personList: allowChoosePerson.values.toList(), isEditable: isEditable, ), ], @@ -332,7 +332,7 @@ class _DlApplyPageState extends SpecialWorkApplyBaseState { if (item['stepId']?.toString() == '2') { List firmList = []; List xgfList = []; - for (final item in allowChoosePersonList) { + for (final item in allowChoosePerson.values.toList()) { // 区分出两个数组、企业和相关方 if (item['userType'] == 2) { firmList.add(item); 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 b2f3486..ebba236 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 @@ -34,7 +34,7 @@ class DtApplyPage extends SpecialWorkApplyBasePage { class _DtApplyPageState extends SpecialWorkApplyBaseState { // 安全措施确认人来源(作业负责人和监护人) - late List allowChoosePersonList = [{}, {}]; + late Map allowChoosePerson = {}; @override SpecialWorkTypeEnum get workType => SpecialWorkTypeEnum.breakgroundWork; @@ -73,20 +73,20 @@ class _DtApplyPageState extends SpecialWorkApplyBaseState { @override Future afterInitDataLoaded() async { // 初始化允许选择的人员列表(作业负责人和监护人) - allowChoosePersonList = [ - { + allowChoosePerson = { + '1' : { "actUser": pd['workGuardianUser'] ?? pd['workGuardianUserId'] ?? '', "actUserDepartment": pd['workGuardianUserDepartment'] ?? '', "actUserDepartmentName": pd['workGuardianUserDepartmentName'] ?? '', "actUserName": pd['workGuardianUserName'] ?? '', }, - { + '2' : { "actUserDepartment": pd['workChargeUserDepartment'] ?? '', "actUserDepartmentName": pd['workChargeUserDepartmentName'] ?? '', "actUser": pd['workChargeUser'] ?? pd['workChargeUserId'] ?? '', "actUserName": pd['workChargeUserName'] ?? '', }, - ]; + }; // 重新编辑时恢复图片选择状态 if (widget.isReEdit && FormUtils.hasValue(pd, 'workScopeAndMethodImage')) { @@ -297,7 +297,7 @@ class _DtApplyPageState extends SpecialWorkApplyBaseState { // 安全防护措施模块 SafeProtectionModule( controller: safeController, - personList: allowChoosePersonList, + personList: allowChoosePerson.values.toList(), isEditable: isEditable, ), ], @@ -318,7 +318,7 @@ class _DtApplyPageState extends SpecialWorkApplyBaseState { if (item['stepId']?.toString() == '2') { List firmList = []; List xgfList = []; - for (final item in allowChoosePersonList) { + for (final item in allowChoosePerson.values.toList()) { // 区分出两个数组、企业和相关方 if (item['userType'] == 2) { firmList.add(item); 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 4149176..5edc8ee 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 @@ -33,7 +33,7 @@ class DzApplyPage extends SpecialWorkApplyBasePage { class _DzApplyPageState extends SpecialWorkApplyBaseState { // 安全措施确认人来源(作业负责人和监护人) - late List allowChoosePersonList = [{}, {}]; + late Map allowChoosePerson = {}; @override SpecialWorkTypeEnum get workType => SpecialWorkTypeEnum.hoistingWork; @@ -73,20 +73,20 @@ class _DzApplyPageState extends SpecialWorkApplyBaseState { @override Future afterInitDataLoaded() async { // 初始化允许选择的人员列表(作业负责人和监护人) - allowChoosePersonList = [ - { + allowChoosePerson = { + '1' : { "actUser": pd['workGuardianUser'] ?? pd['workGuardianUserId'] ?? '', "actUserDepartment": pd['workGuardianUserDepartment'] ?? '', "actUserDepartmentName": pd['workGuardianUserDepartmentName'] ?? '', "actUserName": pd['workGuardianUserName'] ?? '', }, - { + '2' : { "actUserDepartment": pd['workChargeUserDepartment'] ?? '', "actUserDepartmentName": pd['workChargeUserDepartmentName'] ?? '', "actUser": pd['workChargeUser'] ?? pd['workChargeUserId'] ?? '', "actUserName": pd['workChargeUserName'] ?? '', }, - ]; + }; } @override @@ -308,7 +308,7 @@ class _DzApplyPageState extends SpecialWorkApplyBaseState { // 安全防护措施模块 SafeProtectionModule( controller: safeController, - personList: allowChoosePersonList, + personList: allowChoosePerson.values.toList(), isEditable: isEditable, ), ], @@ -329,7 +329,7 @@ class _DzApplyPageState extends SpecialWorkApplyBaseState { if (item['stepId']?.toString() == '2') { List firmList = []; List xgfList = []; - for (final item in allowChoosePersonList) { + for (final item in allowChoosePerson.values.toList()) { // 区分出两个数组、企业和相关方 if (item['userType'] == 2) { firmList.add(item); 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 ae96469..7123f55 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 @@ -33,7 +33,7 @@ class GcApplyPage extends SpecialWorkApplyBasePage { class _GcApplyPageState extends SpecialWorkApplyBaseState { // 安全措施确认人来源(作业负责人和监护人) - late List allowChoosePersonList = [{}, {}]; + late Map allowChoosePerson = {}; @override SpecialWorkTypeEnum get workType => SpecialWorkTypeEnum.highWork; @@ -70,20 +70,20 @@ class _GcApplyPageState extends SpecialWorkApplyBaseState { @override Future afterInitDataLoaded() async { // 初始化允许选择的人员列表(作业负责人和监护人) - allowChoosePersonList = [ - { + allowChoosePerson = { + '1' : { "actUser": pd['workGuardianUser'] ?? pd['workGuardianUserId'] ?? '', "actUserDepartment": pd['workGuardianUserDepartment'] ?? '', "actUserDepartmentName": pd['workGuardianUserDepartmentName'] ?? '', "actUserName": pd['workGuardianUserName'] ?? '', }, - { + '2' : { "actUserDepartment": pd['workChargeUserDepartment'] ?? '', "actUserDepartmentName": pd['workChargeUserDepartmentName'] ?? '', "actUser": pd['workChargeUser'] ?? pd['workChargeUserId'] ?? '', "actUserName": pd['workChargeUserName'] ?? '', }, - ]; + }; } @override @@ -283,7 +283,7 @@ class _GcApplyPageState extends SpecialWorkApplyBaseState { // 安全防护措施模块 SafeProtectionModule( controller: safeController, - personList: allowChoosePersonList, + personList: allowChoosePerson.values.toList(), isEditable: isEditable, ), ], @@ -302,7 +302,7 @@ class _GcApplyPageState extends SpecialWorkApplyBaseState { if (item['stepId']?.toString() == '2') { List firmList = []; List xgfList = []; - for (final item in allowChoosePersonList) { + for (final item in allowChoosePerson.values.toList()) { // 区分出两个数组、企业和相关方 if (item['userType'] == 2) { firmList.add(item); 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 b6ab720..cb2b5ad 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 @@ -33,7 +33,7 @@ class LsydApplyPage extends SpecialWorkApplyBasePage { class _LsydApplyPageState extends SpecialWorkApplyBaseState { // 安全措施确认人来源(作业负责人和监护人) - late List allowChoosePersonList = [{}, {}]; + late Map allowChoosePerson = {}; // 临时用电特有:台账列表(原代码中有但实际未使用,保留以备扩展) List limitedSpaceList = []; @@ -79,20 +79,20 @@ class _LsydApplyPageState extends SpecialWorkApplyBaseState { @override Future afterInitDataLoaded() async { // 初始化允许选择的人员列表(作业负责人和监护人) - allowChoosePersonList = [ - { + allowChoosePerson = { + '1' : { "actUser": pd['workGuardianUser'] ?? pd['workGuardianUserId'] ?? '', "actUserDepartment": pd['workGuardianUserDepartment'] ?? '', "actUserDepartmentName": pd['workGuardianUserDepartmentName'] ?? '', "actUserName": pd['workGuardianUserName'] ?? '', }, - { + '2' : { "actUserDepartment": pd['workChargeUserDepartment'] ?? '', "actUserDepartmentName": pd['workChargeUserDepartmentName'] ?? '', "actUser": pd['workChargeUser'] ?? pd['workChargeUserId'] ?? '', "actUserName": pd['workChargeUserName'] ?? '', }, - ]; + }; } @override @@ -335,7 +335,7 @@ class _LsydApplyPageState extends SpecialWorkApplyBaseState { // 安全防护措施模块 SafeProtectionModule( controller: safeController, - personList: allowChoosePersonList, + personList: allowChoosePerson.values.toList(), isEditable: isEditable, ), ], @@ -354,7 +354,7 @@ class _LsydApplyPageState extends SpecialWorkApplyBaseState { if (item['stepId']?.toString() == '2') { List firmList = []; List xgfList = []; - for (final item in allowChoosePersonList) { + for (final item in allowChoosePerson.values.toList()) { // 区分出两个数组、企业和相关方 if (item['userType'] == 2) { firmList.add(item); diff --git a/lib/pages/home/Tap/special_work/lsyd_work/lsyd_gas_add_page.dart b/lib/pages/home/Tap/special_work/lsyd_work/lsyd_gas_add_page.dart index 6193e3b..9a48a1e 100644 --- a/lib/pages/home/Tap/special_work/lsyd_work/lsyd_gas_add_page.dart +++ b/lib/pages/home/Tap/special_work/lsyd_work/lsyd_gas_add_page.dart @@ -97,7 +97,7 @@ class _LsydGasAddPageState extends State { ToastUtil.showNormal(context, '添加成功'); Navigator.pop(context); } else { - ToastUtil.showNormal(context, res['errMessage'] ?? '提交失败'); + ToastUtil.showNormal(context, res['errMessage'] ?? '作业提交失败'); } } catch (e) { ToastUtil.showNormal(context, '添加失败'); 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 b4a457a..ec528d6 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 @@ -37,7 +37,7 @@ class MbcdApplyPage extends SpecialWorkApplyBasePage { class _MbcdApplyPageState extends SpecialWorkApplyBaseState { // 安全措施确认人来源 - late List allowChoosePersonList = [{}, {}]; + late Map allowChoosePerson = {}; // 盲板抽堵参数动态列表 late List boardList = [ @@ -89,20 +89,20 @@ class _MbcdApplyPageState extends SpecialWorkApplyBaseState { @override Future afterInitDataLoaded() async { // 初始化允许人员列表 - allowChoosePersonList = [ - { + allowChoosePerson = { + '1' : { "actUser": pd['workGuardianUser'] ?? pd['workGuardianUserId'] ?? '', "actUserDepartment": pd['workGuardianUserDepartment'] ?? '', "actUserDepartmentName": pd['workGuardianUserDepartmentName'] ?? '', "actUserName": pd['workGuardianUserName'] ?? '', }, - { + '2' : { "actUserDepartment": pd['workChargeUserDepartment'] ?? '', "actUserDepartmentName": pd['workChargeUserDepartmentName'] ?? '', "actUser": pd['workChargeUser'] ?? pd['workChargeUserId'] ?? '', "actUserName": pd['workChargeUserName'] ?? '', }, - ]; + }; // 重新编辑时恢复盲板参数和图片状态 if (widget.isReEdit) { @@ -352,7 +352,7 @@ class _MbcdApplyPageState extends SpecialWorkApplyBaseState { // 安全防护措施模块 SafeProtectionModule( controller: safeController, - personList: allowChoosePersonList, + personList: allowChoosePerson.values.toList(), isEditable: isEditable, ), ], @@ -371,7 +371,7 @@ class _MbcdApplyPageState extends SpecialWorkApplyBaseState { if (item['stepId']?.toString() == '2') { List firmList = []; List xgfList = []; - for (final item in allowChoosePersonList) { + for (final item in allowChoosePerson.values.toList()) { // 区分出两个数组、企业和相关方 if (item['userType'] == 2) { firmList.add(item); 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 fa7872e..a196b9e 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 @@ -49,7 +49,7 @@ class _SxkjApplyPageState extends SpecialWorkApplyBaseState { List limitedSpaceList = []; /// 气体分析人和安全措施确认人在作业监护人和作业负责人之中选择 - late List allowChoosePersonList = [{}, {}]; + late Map allowChoosePerson = {}; @override SpecialWorkTypeEnum get workType => SpecialWorkTypeEnum.confinedspaceWork; @@ -94,38 +94,38 @@ class _SxkjApplyPageState extends SpecialWorkApplyBaseState { @override Future afterInitDataLoaded() async { // 初始化允许选择的人员列表(作业负责人和监护人) - allowChoosePersonList = [ - { + allowChoosePerson = { + '1' : { "actUser": pd['workGuardianUser'] ?? pd['workGuardianUserId'] ?? '', "actUserDepartment": pd['workGuardianUserDepartment'] ?? '', "actUserDepartmentName": pd['workGuardianUserDepartmentName'] ?? '', "actUserName": pd['workGuardianUserName'] ?? '', }, - { + '2' : { "actUserDepartment": pd['workChargeUserDepartment'] ?? '', "actUserDepartmentName": pd['workChargeUserDepartmentName'] ?? '', "actUser": pd['workChargeUser'] ?? pd['workChargeUserId'] ?? '', "actUserName": pd['workChargeUserName'] ?? '', }, - ]; + }; // 如果是重新编辑,从详情中恢复负责人/监护人选择 if (widget.isReEdit) { setState(() { - allowChoosePersonList = [ - { + allowChoosePerson = { + '1': { "actUser": pd['workGuardianUser'] ?? pd['workGuardianUserId'] ?? '', "actUserDepartment": pd['workGuardianUserDepartment'] ?? '', "actUserDepartmentName": pd['workGuardianUserDepartmentName'] ?? '', "actUserName": pd['workGuardianUserName'] ?? '', }, - { + '2': { "actUserDepartment": pd['workChargeUserDepartment'] ?? '', "actUserDepartmentName": pd['workChargeUserDepartmentName'] ?? '', "actUser": pd['workChargeUser'] ?? pd['workChargeUserId'] ?? '', "actUserName": pd['workChargeUserName'] ?? '', }, - ]; + }; }); } @@ -364,7 +364,7 @@ class _SxkjApplyPageState extends SpecialWorkApplyBaseState { // 安全防护措施模块(基类 controller 已初始化) SafeProtectionModule( controller: safeController, - personList: allowChoosePersonList, + personList: allowChoosePerson.values.toList(), isEditable: isEditable, ), ], @@ -385,7 +385,7 @@ class _SxkjApplyPageState extends SpecialWorkApplyBaseState { if (item['stepId']?.toString() == '2') { List firmList = []; List xgfList = []; - for (final item in allowChoosePersonList) { + for (final item in allowChoosePerson.values.toList()) { // 区分出两个数组、企业和相关方 if (item['userType'] == 2) { firmList.add(item); @@ -486,21 +486,15 @@ class _SxkjApplyPageState extends SpecialWorkApplyBaseState { pd['workChargeUserName'] = name; pd['workChargeUserDepartment'] = data['departmentId']; pd['workChargeUserDepartmentName'] = data['departmentName']; - if (allowChoosePersonList.length > 1) { - allowChoosePersonList[1] = data; - }else{ - allowChoosePersonList.add(data); - } + allowChoosePerson['1'] = data; + } else { pd['workGuardianUserId'] = userId; pd['workGuardianUserName'] = name; pd['workGuardianUserDepartment'] = data['departmentId']; pd['workGuardianUserDepartmentName'] = data['departmentName']; - if (allowChoosePersonList.length > 0) { - allowChoosePersonList[0] = data; - }else{ - allowChoosePersonList.add(data); - } } + allowChoosePerson['2'] = data; + } super.getFlowInit(true); }); }, diff --git a/lib/pages/home/Tap/special_work/sxkj_work/sxkj_gas_add_page.dart b/lib/pages/home/Tap/special_work/sxkj_work/sxkj_gas_add_page.dart index 366d0b5..2460b70 100644 --- a/lib/pages/home/Tap/special_work/sxkj_work/sxkj_gas_add_page.dart +++ b/lib/pages/home/Tap/special_work/sxkj_work/sxkj_gas_add_page.dart @@ -97,7 +97,7 @@ class _SxkjGasAddPageState extends State { ToastUtil.showNormal(context, '添加成功'); Navigator.pop(context); } else { - ToastUtil.showNormal(context, res['errMessage'] ?? '提交失败'); + ToastUtil.showNormal(context, res['errMessage'] ?? '作业提交失败'); } } catch (e) { ToastUtil.showNormal(context, '添加失败'); diff --git a/lib/pages/home/Tap/special_work/sxkj_work/tz/sxkj_tz_apply_page.dart b/lib/pages/home/Tap/special_work/sxkj_work/tz/sxkj_tz_apply_page.dart index fa8ca04..4b03db3 100644 --- a/lib/pages/home/Tap/special_work/sxkj_work/tz/sxkj_tz_apply_page.dart +++ b/lib/pages/home/Tap/special_work/sxkj_work/tz/sxkj_tz_apply_page.dart @@ -194,7 +194,7 @@ class _SxkjTzApplyPageState extends State { Navigator.of(context).pop(); } else { LoadingDialogHelper.hide(); - ToastUtil.showNormal(context, res['errMessage'] ?? "提交失败"); + ToastUtil.showNormal(context, res['errMessage'] ?? "作业提交失败"); } } } 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 6115906..badcf83 100644 --- a/lib/pages/home/Tap/special_work_apply_base_page.dart +++ b/lib/pages/home/Tap/special_work_apply_base_page.dart @@ -74,7 +74,7 @@ abstract class SpecialWorkApplyBaseState List allPersonList = []; /// 常见的“两个可选人员”缓存:比如负责人/监护人、气体分析/措施确认人 - List allowChoosePersonList = [{}, {}]; + Map allowChoosePerson = {}; /// 相关方人员列表 List relatedPartiesPersonList = []; @@ -297,7 +297,7 @@ abstract class SpecialWorkApplyBaseState // 已选安全措施人员匹配 Future _matchSafeMeasurePerson() async { - allowChoosePersonList = []; + allowChoosePerson = {}; if (pd['xgfFlag'] == 1 && pd['xgfId'] != null && pd['xgfId'] != '') { final result = await BasicInfoApi.getDeptUsers( '', @@ -307,24 +307,40 @@ abstract class SpecialWorkApplyBaseState for (SafeMeasureOption measure in safeMeasures) { for (Map item in relatedPartiesPersonList) { if (measure.updateId == item['id']) { - allowChoosePersonList.add(item); + if (pd['workGuardianUser'] == item['id']) { + allowChoosePerson['1'] = item; + }else{ + allowChoosePerson['2'] = item; + } } } } } for (SafeMeasureOption measure in safeMeasures) { for (Map item in allPersonList) { - print('measure.updateId: ${measure.updateId}-${item['id']}'); if (measure.updateId == item['id']) { - allowChoosePersonList.add(item); - continue; + if (pd['workGuardianUser'] == item['id']) { + allowChoosePerson['1'] = item; + }else{ + allowChoosePerson['2'] = item; + } } } } + if (allowChoosePerson.keys.length == 1) { // 作业负责人和作业监护人说明选的是一个人 + allowChoosePerson['1'] = allowChoosePerson.values.first; + allowChoosePerson['2'] = allowChoosePerson.values.first; + } + safeController.setAllMeasures(safeMeasures); + setState(() { + }); } /// 初始化流程数据 Future getFlowInit(bool isRefresh) async { + if (!FormUtils.hasValue(pd, 'workLevel')) { + return; + } LoadingDialogHelper.show(); try { final res = await SpecialWorkApi.specialWorkFlowInit({ @@ -555,15 +571,10 @@ abstract class SpecialWorkApplyBaseState groups[index]['actUserDepartmentName'] = data['departmentName']; // 同步更新允许列表,用于安全措施确认人、气体分析人 if (stepId == '20') { - allowChoosePersonList[0] = data; - if (allowChoosePersonList.length > 1) { - allowChoosePersonList[1] = data; - }else{ - allowChoosePersonList.add(data); - } + allowChoosePerson['1'] = data; _clearRelatedPartiesPerson(); } else if (stepId == '21') { - allowChoosePersonList[1] = data; + allowChoosePerson['2'] = data; _clearRelatedPartiesPerson(); } }); @@ -829,7 +840,7 @@ abstract class SpecialWorkApplyBaseState ToastUtil.showNormal(context, result['errMessage'] ?? '保存失败'); } } catch (e) { - ToastUtil.showNormal(context, '提交失败:$e'); + ToastUtil.showNormal(context, '作业提交失败:$e'); } finally { LoadingDialogHelper.dismiss(); } @@ -1228,7 +1239,7 @@ abstract class SpecialWorkApplyBaseState /// 你可以在子类里直接复用这个字段重置方法 void resetInnerRelatedState() { isInnerWork = false; - allowChoosePersonList = [{}, {}]; + allowChoosePerson = {}; } /// 如果某个页面需要手动清空人员缓存,可以用这个 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 699ddad..cfde339 100644 --- a/lib/pages/home/Tap/special_work_task_page_base.dart +++ b/lib/pages/home/Tap/special_work_task_page_base.dart @@ -257,7 +257,7 @@ class _SpecialWorkTaskPageBaseState extends State { bool isDelayTime = true; if (pd['componentName'] == 'completeDelayTime' && other['isCompleteWork'] == 1) { - if (!FormUtils.hasValue(other, 'hotTime')) { + if (other['isDelayWork'] == 1 && !FormUtils.hasValue(other, 'hotTime')) { ToastUtil.showNormal(context, '请选择动火日期'); return; } @@ -388,7 +388,7 @@ class _SpecialWorkTaskPageBaseState extends State { final signResult = await _checkSignature(); if (!signResult) { LoadingDialogHelper.hide(); - ToastUtil.showNormal(context, '提交失败'); + ToastUtil.showNormal(context, '作业提交失败'); return; } @@ -399,11 +399,11 @@ class _SpecialWorkTaskPageBaseState extends State { ToastUtil.showNormal(context, '提交成功'); widget.onSubmitSuccess(context); } else { - ToastUtil.showNormal(context, res['errMessage'] ?? '提交失败'); + ToastUtil.showNormal(context, res['errMessage'] ?? '作业提交失败'); } } catch (e) { LoadingDialogHelper.hide(); - ToastUtil.showNormal(context, '提交失败'); + ToastUtil.showNormal(context, '作业提交失败'); } } @@ -791,7 +791,7 @@ class _SpecialWorkTaskPageBaseState extends State { isEditable: true, onTap: () async { final DateTime? picked = await BottomDateTimePicker.showDate( - mode: BottomPickerMode.date, + mode: BottomPickerMode.dateTimeWithSeconds, context, allowPast: false, );