From 9c10669cf8b5b1846e8fc4e79171cf241417df26 Mon Sep 17 00:00:00 2001 From: xufei <727302827@qq.com> Date: Fri, 29 Aug 2025 10:00:35 +0800 Subject: [PATCH] =?UTF-8?q?2025.8.29=20=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/http/ApiService.dart | 15 ++++- .../check_information_one_item.dart | 9 +-- .../hazard_registration_page.dart | 9 +-- .../app/Danger_paicha/quick_report_page.dart | 2 +- lib/pages/app/application_page.dart | 32 ++++++++++ .../app/checking_information_one_page.dart | 12 +++- lib/pages/app/danner_repair.dart | 4 +- .../app/hidden_danger_acceptance_page.dart | 25 +++----- lib/pages/app/hidden_record_detail_page.dart | 64 +++++++++++++++++++ .../pending_rectification_detail_page.dart | 16 ++--- .../commitment_workshop_detail_page.dart | 2 +- .../company_safety_commitment_detail.dart | 2 +- .../team_safety_commitment_detail.dart | 2 +- lib/pages/home/home_danger_page.dart | 15 ++++- lib/pages/home/home_page.dart | 28 +++++++- lib/pages/home/work/danger_page.dart | 13 +++- lib/pages/mine/mine_page.dart | 28 +++++++- lib/services/auth_service.dart | 5 +- 18 files changed, 237 insertions(+), 46 deletions(-) diff --git a/lib/http/ApiService.dart b/lib/http/ApiService.dart index 95c3ecd..5f34acd 100644 --- a/lib/http/ApiService.dart +++ b/lib/http/ApiService.dart @@ -313,7 +313,7 @@ U6Hzm1ninpWeE+awIDAQAB static Future> getHiddenRoll() { return HttpManager().request( basePath, - '/app/hidden/getHiddenByCorp', + '/app/offduty/isRest', method: Method.post, data: { 'CORPINFO_ID': SessionService.instance.corpinfoId, @@ -322,6 +322,19 @@ U6Hzm1ninpWeE+awIDAQAB ); } + static Future> getIsRest() { + return HttpManager().request( + basePath, + '/app/offduty/isRest', + method: Method.post, + data: { + 'CORPINFO_ID': SessionService.instance.corpinfoId, + 'USER_ID': SessionService.instance.loginUserId, + }, + ); + } + + /// TODO -------------–-------------------- 首页学习园地 -------------–-------------------- /// 我的任务列表 static Future> getStudyList(int page) { diff --git a/lib/pages/app/Danger_paicha/check_information_one_item.dart b/lib/pages/app/Danger_paicha/check_information_one_item.dart index 8267477..b9032da 100644 --- a/lib/pages/app/Danger_paicha/check_information_one_item.dart +++ b/lib/pages/app/Danger_paicha/check_information_one_item.dart @@ -152,7 +152,7 @@ class _CheckInformationOneItemState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: MyAppbar(title: "隐患等级"), + appBar: MyAppbar(title: "隐患登记"), body: Column( children: [ // 详情滚动区域 @@ -510,7 +510,7 @@ class _CheckInformationOneItemState extends State { } Future _riskListCheckAppAdd() async { - LoadingDialogHelper.show(); + if(_yinHuanImages.isEmpty){ ToastUtil.showNormal(context, "请上传隐患图片"); return; @@ -576,6 +576,7 @@ class _CheckInformationOneItemState extends State { } + LoadingDialogHelper.show(); String yinHuanTypeIds=""; String yinHuanTypeNames=""; for(int i=0;i<_yinHuanTypeIds.length;i++){ @@ -645,7 +646,7 @@ class _CheckInformationOneItemState extends State { // yinHuanTypeIds, hazardLeve, buMenId, buMenPDId, // yinHuanTypeNames, hiddenType1, hiddenType2, hiddenType3,); - + LoadingDialogHelper.hide(); if (result['result'] == 'success') { String hiddenId = result['pd']['HIDDEN_ID'] ; @@ -669,7 +670,7 @@ class _CheckInformationOneItemState extends State { ToastUtil.showNormal(context, "提交成功"); Navigator.pop(context); widget.onClose(hiddenId,_standardController.text.trim()); - LoadingDialogHelper.hide(); + }); } } catch (e) { diff --git a/lib/pages/app/Danger_paicha/hazard_registration_page.dart b/lib/pages/app/Danger_paicha/hazard_registration_page.dart index 643a41a..9d70e94 100644 --- a/lib/pages/app/Danger_paicha/hazard_registration_page.dart +++ b/lib/pages/app/Danger_paicha/hazard_registration_page.dart @@ -151,7 +151,7 @@ class _HazardRegistrationPageState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: MyAppbar(title: "隐患等级"), + appBar: MyAppbar(title: "隐患登记"), body: Column( children: [ // 详情滚动区域 @@ -509,7 +509,7 @@ class _HazardRegistrationPageState extends State { } Future _riskListCheckAppAdd() async { - LoadingDialogHelper.show(); + if(_yinHuanImages.isEmpty){ ToastUtil.showNormal(context, "请上传隐患图片"); return; @@ -575,6 +575,7 @@ class _HazardRegistrationPageState extends State { } + LoadingDialogHelper.show(); String yinHuanTypeIds=""; String yinHuanTypeNames=""; for(int i=0;i<_yinHuanTypeIds.length;i++){ @@ -633,7 +634,7 @@ class _HazardRegistrationPageState extends State { - + LoadingDialogHelper.hide(); if (result['result'] == 'success') { String hiddenId = result['pd']['HIDDEN_ID'] ; @@ -652,7 +653,7 @@ class _HazardRegistrationPageState extends State { _addImgFiles(_zhengGaiImages[i],"4",hiddenId); } } - LoadingDialogHelper.hide(); + setState(() { ToastUtil.showNormal(context, "提交成功"); Navigator.pop(context); diff --git a/lib/pages/app/Danger_paicha/quick_report_page.dart b/lib/pages/app/Danger_paicha/quick_report_page.dart index 4e14132..4c57a8a 100644 --- a/lib/pages/app/Danger_paicha/quick_report_page.dart +++ b/lib/pages/app/Danger_paicha/quick_report_page.dart @@ -439,7 +439,7 @@ class _QuickReportPageState extends State { } - if(_hazardLeve.isEmpty){ + if(_hazardLeve==null||_hazardLeve.isEmpty){ ToastUtil.showNormal(context, "请选择隐患级别"); return; } diff --git a/lib/pages/app/application_page.dart b/lib/pages/app/application_page.dart index c8f27e9..46062a9 100644 --- a/lib/pages/app/application_page.dart +++ b/lib/pages/app/application_page.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:qhd_prevention/customWidget/toast_util.dart'; +import 'package:qhd_prevention/http/ApiService.dart'; import 'package:qhd_prevention/pages/app/Danger_paicha/check_record_page.dart'; import 'package:qhd_prevention/pages/app/Danger_paicha/quick_report_page.dart'; import 'package:qhd_prevention/pages/app/danger_wait_list_page.dart'; @@ -57,6 +59,11 @@ class _ApplicationPageState extends State { case AppItem.riskInspection: // 跳转到隐患排查页面 + bool isRest= await _getIsRest(); + if(isRest){ + ToastUtil.showNormal(context, "您已经处于离岗状态中"); + return; + } pushPage(DangerPage(1), context); break; case AppItem.checkRecord: @@ -73,6 +80,11 @@ class _ApplicationPageState extends State { break; case AppItem.supervisionRectification: // 跳转到监管帮扶隐患整改页面 + bool isRest= await _getIsRest(); + if(isRest){ + ToastUtil.showNormal(context, "您已经处于离岗状态中"); + return; + } pushPage(DangerPage(2), context); //Navigator.push(context, MaterialPageRoute(builder: (_) => SupervisionRectificationPage())); break; @@ -284,4 +296,24 @@ class _ApplicationPageState extends State { ), ); } + + Future _getIsRest( )async { + try { + final raw = await ApiService.getIsRest(); + if (raw['result'] == 'success') { + if( raw['ISREST']=="1"){ + return true; + }else{ + return false; + } + }else{ + return false; + } + } catch (e) { + // 出错时可以 Toast 或者在页面上显示错误状态 + print('加载头像数据失败:$e'); + return false; + } + } + } \ No newline at end of file diff --git a/lib/pages/app/checking_information_one_page.dart b/lib/pages/app/checking_information_one_page.dart index 5c50a55..dace362 100644 --- a/lib/pages/app/checking_information_one_page.dart +++ b/lib/pages/app/checking_information_one_page.dart @@ -35,7 +35,14 @@ class CheckingInformationOnePage extends StatefulWidget { class _CheckingInformationOnePageState extends State { final List departments = [ - DepartmentEntry(department: '请选择', responsible: '请选择',index:'',departmentId: '',responsibleId:''), + // "DEPARTMENT_NAME" -> "测试部" + // "DEPARTMENT_ID" -> "0a8f669cd1b742f9be4fc063cb0b1afa" + // "NAME" -> "王轩" + //"USER_ID" -> "542627bb14154fcaaf496e3aa105dd2b" + + DepartmentEntry(department: SessionService.instance.loginUser?["DEPARTMENT_NAME"], responsible: SessionService.instance.loginUser?["NAME"] + ,index:'', + departmentId: SessionService.instance.loginUser?["DEPARTMENT_ID"],responsibleId: SessionService.instance.loginUser?["USER_ID"]), ]; final List otherHidden = []; @@ -60,7 +67,8 @@ class _CheckingInformationOnePageState extends State dataTime=DateFormat('yyyy-MM-dd').format(now); stringTime=DateFormat('HH:mm').format(now); - _getData(); + //获取其他隐患信息列表 + // _getData(); } diff --git a/lib/pages/app/danner_repair.dart b/lib/pages/app/danner_repair.dart index 2599f73..e0058d5 100644 --- a/lib/pages/app/danner_repair.dart +++ b/lib/pages/app/danner_repair.dart @@ -421,7 +421,7 @@ class DannerRepairState extends State { borderRadius: BorderRadius.circular(5), ), child: ListItemFactory.createRowSpaceBetweenItem( - leftText: "整改部门", + leftText: "验收部门", rightText: departments[index].department.isNotEmpty?departments[index].department:"请选择", isRight: true, ), @@ -462,7 +462,7 @@ class DannerRepairState extends State { borderRadius: BorderRadius.circular(5), ), child: ListItemFactory.createRowSpaceBetweenItem( - leftText: "整改负责人", + leftText: "验收部门负责人", rightText: departments[index].responsible.isNotEmpty?departments[index].responsible:"请选择", isRight: true, ), diff --git a/lib/pages/app/hidden_danger_acceptance_page.dart b/lib/pages/app/hidden_danger_acceptance_page.dart index 605f933..acee9e5 100644 --- a/lib/pages/app/hidden_danger_acceptance_page.dart +++ b/lib/pages/app/hidden_danger_acceptance_page.dart @@ -179,10 +179,10 @@ class _HiddenDangerAcceptancePageState extends State return Scaffold( appBar: MyAppbar(title: widget.dangerType.detailTitle), body: pd.isEmpty - ? const Center(child: CircularProgressIndicator()) + ? Container(color: Colors.white,child: Center(child: CircularProgressIndicator(),)) : LayoutBuilder( builder: (context, constraints) { - return SingleChildScrollView( + return Container(color: Colors.white,child:SingleChildScrollView( child: ConstrainedBox( constraints: BoxConstraints( minHeight: constraints.maxHeight, @@ -381,6 +381,7 @@ class _HiddenDangerAcceptancePageState extends State ), ), ), + ), ); }, ), @@ -393,8 +394,6 @@ class _HiddenDangerAcceptancePageState extends State return SizedBox( child: Column( children: [ - - _getRepairState(), // 整改选项 // _accepted ? _getRepairState() : _noAccepet_repair(_accepted), @@ -419,21 +418,15 @@ class _HiddenDangerAcceptancePageState extends State Widget _getRepairState() { - return Container( - - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(5), - ), - child: Column( + return Column( children: [ - ListItemFactory.createBuildSimpleSection("隐患验收"), + ListItemFactory.createBuildSimpleSection("隐患验收",horPadding:0), Divider(height: 1), ListItemFactory.createYesNoSection( - horizontalPadding: 5, + horizontalPadding: 0, title: '是否合格', yesLabel: '是', noLabel: '否', @@ -451,7 +444,7 @@ class _HiddenDangerAcceptancePageState extends State Divider(), Container( height: 130, - padding: EdgeInsets.all(15), + padding: EdgeInsets.only(top: 15,bottom: 15), child: Column( children: [ Row( @@ -499,7 +492,7 @@ class _HiddenDangerAcceptancePageState extends State // ); }, child: Padding( - padding: EdgeInsets.symmetric(horizontal: 15), + padding: EdgeInsets.symmetric(horizontal: 0), child: ListItemFactory.createRowSpaceBetweenItem( leftText: "验收日期", rightText: dataTime.isEmpty?"请选择":dataTime, @@ -527,7 +520,7 @@ class _HiddenDangerAcceptancePageState extends State ], - ), + ); } diff --git a/lib/pages/app/hidden_record_detail_page.dart b/lib/pages/app/hidden_record_detail_page.dart index 58b528d..285f857 100644 --- a/lib/pages/app/hidden_record_detail_page.dart +++ b/lib/pages/app/hidden_record_detail_page.dart @@ -36,6 +36,8 @@ class _HiddenRecordDetailPageState extends State { List files6 = []; List videoList = []; List checkList = []; + List files7 = []; + bool modalShow = false; String videoSrc = ""; @@ -90,6 +92,11 @@ class _HiddenRecordDetailPageState extends State { } files6 = data['yImgs'] ?? []; checkList = data['checkList'] ?? []; + if(checkList.isNotEmpty) { + for (var img in checkList[0]['cImgs']) { + files7.add(img["FILEPATH"]); + } + } }); } @@ -357,6 +364,51 @@ class _HiddenRecordDetailPageState extends State { // ... 其他整改信息字段 ], + + + // 验收信息部分 + if (6==widget.dangerType.index&&checkList.isNotEmpty) ...[ + // const Divider(height: 10,color: Colors.grey,), + SizedBox(height: 10,), + Row( + children: [ + Container(width: 3, height: 15, color: Colors.blue), + const SizedBox(width: 8), + Text( + "验收信息", + style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + ), + ], + ), + + + // const Text('整改信息', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)), + Divider(height: 1), + _buildInfoItem('验收描述', checkList[0]['CHECKDESCR'] ?? ''), + Divider(height: 1), + _buildInfoItem('是否合格',_getText (checkList[0]['STATUS'] )), + Divider(height: 1), + _buildInfoItem('验收部门', checkList[0]['CHECKDEPTNAME'] ?? ''), + Divider(height: 1), + _buildInfoItem('验收部门负责人', checkList[0]['CHECKORNAME'] ?? ''), + Divider(height: 1), + _buildInfoItem('验收时间', checkList[0]['CHECK_TIME'] ?? ''), + Divider(height: 1), + // const Text('整改后图片', style: TextStyle(fontWeight: FontWeight.bold)), + // _buildImageGrid(files2, onTap: (index) => _showImageGallery(files2, index)), + ListItemFactory.createTextImageItem( + text: "验收图片", + imageUrls: files5, + onImageTapped: (index) { + presentOpaque( + SingleImageViewer(imageUrl: ApiService.baseImgPath +files5[index]), + context, + ); + }, + ), + ], + + // 添加底部安全区域间距 SizedBox(height: MediaQuery.of(context).padding.bottom + 20), ], @@ -369,10 +421,22 @@ class _HiddenRecordDetailPageState extends State { ); } + String _getText(String source) { + if(source.isNotEmpty){ + if(source=="1"){ + return "是"; + }else{ + return "否"; + } + }else{ + return ""; + } + } String _getSourceText(String? source) { + switch (source) { case '1': return '隐患快报'; case '2': return '隐患排查清单检查'; diff --git a/lib/pages/app/pending_rectification_detail_page.dart b/lib/pages/app/pending_rectification_detail_page.dart index e0a0d75..b74fc90 100644 --- a/lib/pages/app/pending_rectification_detail_page.dart +++ b/lib/pages/app/pending_rectification_detail_page.dart @@ -209,14 +209,14 @@ class _PendingRectificationDetailPageState extends State ), const SizedBox(width: 15), if (pd['SIGN_PATH'] != null) - Image.network(ApiService.baseImgPath+pd['SIGN_PATH'],width: 230,height: 150,fit: BoxFit.cover,), + Image.network(ApiService.baseImgPath+pd['SIGN_PATH'],width: 230,height: 150,fit: BoxFit.contain,), ], ), diff --git a/lib/pages/home/home_danger_page.dart b/lib/pages/home/home_danger_page.dart index ac33954..23fd3b1 100644 --- a/lib/pages/home/home_danger_page.dart +++ b/lib/pages/home/home_danger_page.dart @@ -1,6 +1,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; import 'package:qhd_prevention/customWidget/danner_repain_item.dart'; import 'package:qhd_prevention/customWidget/department_picker.dart'; import 'package:qhd_prevention/customWidget/search_bar_widget.dart'; @@ -81,6 +82,8 @@ class _HomeDangerPageState extends State } + + Future _getHazardInvestigationList() async { try { @@ -264,7 +267,7 @@ class _HomeDangerPageState extends State '排查周期:${item['PERIODNAME']}', '包含检查项:${item['count']}', '负责人:${item['USER_NAME']}', - '起始时间:${item['START_DATE']}-${item['END_DATE']}', + '起始时间:${changeTimeString(item['START_DATE'])}-${changeTimeString(item['END_DATE'])}', ], showBottomTags: showBottomTags, @@ -285,6 +288,15 @@ class _HomeDangerPageState extends State ); } + String changeTimeString(String dataTime) { + final dateFormat = DateFormat('yyyy-MM-dd'); + // 先将字符串转换为 DateTime 对象 + DateTime dateTime = DateTime.parse(dataTime); + // 然后格式化 DateTime 对象 + String newData = dateFormat.format(dateTime); + return newData; + } + Widget _itemCell(final item) { return Padding( padding: EdgeInsets.only(left: 15, right: 15, bottom: 15), @@ -401,6 +413,7 @@ class _HomeDangerPageState extends State } + // 模拟数据模版 class NotificationItem { final String title; diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index e78d9c3..36f15f5 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -679,8 +679,13 @@ class _HomePageState extends State { required int index, }) { return GestureDetector( - onTap: () { + onTap: () async { if (index == 1) { + bool isRest= await _getIsRest(); + if(isRest){ + ToastUtil.showNormal(context, "您已经处于离岗状态中"); + return; + } pushPage(HomeDangerPage(), context); } else if (index == 2) { pushPage(DangerWaitListPage(DangerType.wait, 2), context); @@ -730,4 +735,25 @@ class _HomePageState extends State { ), ); } + + + Future _getIsRest( )async { + try { + final raw = await ApiService.getIsRest(); + if (raw['result'] == 'success') { + if( raw['ISREST']=="1"){ + return true; + }else{ + return false; + } + }else{ + return false; + } + } catch (e) { + // 出错时可以 Toast 或者在页面上显示错误状态 + print('加载头像数据失败:$e'); + return false; + } + } + } diff --git a/lib/pages/home/work/danger_page.dart b/lib/pages/home/work/danger_page.dart index 9ebb937..c8c3d95 100644 --- a/lib/pages/home/work/danger_page.dart +++ b/lib/pages/home/work/danger_page.dart @@ -1,6 +1,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; import 'package:qhd_prevention/customWidget/danner_repain_item.dart'; import 'package:qhd_prevention/customWidget/department_picker.dart'; import 'package:qhd_prevention/customWidget/search_bar_widget.dart'; @@ -293,7 +294,8 @@ class _DangerPageState extends State '排查周期:${item['PERIODNAME']}', '包含检查项:${item['count']}', '负责人:${item['USER_NAME']}', - '起始时间:${item['START_DATE']}-${item['END_DATE']}', + // '起始时间:${item['START_DATE']}-${item['END_DATE']}', + '起始时间:${changeTimeString(item['START_DATE'])}-${changeTimeString(item['END_DATE'])}', ], showBottomTags: showBottomTags, @@ -314,6 +316,15 @@ class _DangerPageState extends State ); } + String changeTimeString(String dataTime) { + final dateFormat = DateFormat('yyyy-MM-dd'); + // 先将字符串转换为 DateTime 对象 + DateTime dateTime = DateTime.parse(dataTime); + // 然后格式化 DateTime 对象 + String newData = dateFormat.format(dateTime); + return newData; + } + Widget _itemCell(final item) { return Padding( padding: EdgeInsets.only(left: 15, right: 15, bottom: 15), diff --git a/lib/pages/mine/mine_page.dart b/lib/pages/mine/mine_page.dart index 656ab40..fc31c81 100644 --- a/lib/pages/mine/mine_page.dart +++ b/lib/pages/mine/mine_page.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:qhd_prevention/customWidget/toast_util.dart'; import 'package:qhd_prevention/http/ApiService.dart'; import 'package:qhd_prevention/pages/mine/mine_feedback_page.dart'; import 'package:qhd_prevention/pages/mine/webViewPage.dart'; @@ -57,6 +58,25 @@ class _MinePageState extends State { } + Future _getIsRest( )async { + try { + final raw = await ApiService.getIsRest(); + if (raw['result'] == 'success') { + if( raw['ISREST']=="1"){ + return true; + }else{ + return false; + } + }else{ + return false; + } + } catch (e) { + // 出错时可以 Toast 或者在页面上显示错误状态 + print('加载头像数据失败:$e'); + return false; + } + } + @override Widget build(BuildContext context) { @@ -99,7 +119,13 @@ class _MinePageState extends State { SizedBox(height: 10,), GestureDetector( child: _setItemWidget("离岗"), - onTap: () { + onTap: () async { + + bool isRest= await _getIsRest(); + if(isRest){ + ToastUtil.showNormal(context, "您已经处于离岗状态中"); + return; + } pushPage(MineDepartureListPage(), context); }, ), diff --git a/lib/services/auth_service.dart b/lib/services/auth_service.dart index 8846d13..a770dcd 100644 --- a/lib/services/auth_service.dart +++ b/lib/services/auth_service.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:encrypt/encrypt.dart' as encrypt; import 'package:pointycastle/asymmetric/api.dart' show RSAPublicKey; +import 'package:qhd_prevention/customWidget/toast_util.dart'; import 'package:qhd_prevention/tools/tools.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:fluttertoast/fluttertoast.dart'; @@ -30,7 +31,9 @@ class AuthService { final data = await ApiService.loginCheck(encrypted); final result = data['result'] as String? ?? ''; - if (result != 'success') { + if (result != 'success'){ + Fluttertoast.showToast(msg:data['msg']); + // ToastUtil.showNormal(context,data['msg']); return false; }