diff --git a/.tgitconfig b/.tgitconfig new file mode 100644 index 0000000..e69de29 diff --git a/lib/pages/app/Danger_paicha/quick_report_page.dart b/lib/pages/app/Danger_paicha/quick_report_page.dart index 0e18443..ee9fbe8 100644 --- a/lib/pages/app/Danger_paicha/quick_report_page.dart +++ b/lib/pages/app/Danger_paicha/quick_report_page.dart @@ -486,6 +486,8 @@ class _QuickReportPageState extends State { } + LoadingDialogHelper.show(context); + String yinHuanTypeIds=""; String yinHuanTypeNames=""; for(int i=0;i<_yinHuanTypeIds.length;i++){ @@ -546,11 +548,15 @@ class _QuickReportPageState extends State { } } setState(() { + LoadingDialogHelper.hide(context); ToastUtil.showNormal(context, "提交成功"); Navigator.pop(context); }); + }else{ + LoadingDialogHelper.hide(context); } } catch (e) { + LoadingDialogHelper.hide(context); print('Error fetching data: $e'); } } diff --git a/lib/pages/app/checking_information_one_page.dart b/lib/pages/app/checking_information_one_page.dart index 79e038e..6f5188e 100644 --- a/lib/pages/app/checking_information_one_page.dart +++ b/lib/pages/app/checking_information_one_page.dart @@ -675,6 +675,8 @@ class _CheckingInformationOnePageState extends State Future _customCheckRecordFinish( ) async { try { + LoadingDialogHelper.show(context); + bool departmentsAllInput=true; bool departmentsSameMan=false; for(int i=0;i }); } else { + LoadingDialogHelper.hide(context); ToastUtil.showNormal(context, "加载数据失败"); // _showMessage('加载数据失败'); } } catch (e) { + LoadingDialogHelper.hide(context); // 出错时可以 Toast 或者在页面上显示错误状态 print('加载数据失败:$e'); } diff --git a/lib/pages/app/hidden_danger_acceptance_page.dart b/lib/pages/app/hidden_danger_acceptance_page.dart index 3fa8c2b..0fbcfdb 100644 --- a/lib/pages/app/hidden_danger_acceptance_page.dart +++ b/lib/pages/app/hidden_danger_acceptance_page.dart @@ -568,7 +568,7 @@ class _HiddenDangerAcceptancePageState extends State } - + LoadingDialogHelper.show(context); final data = await ApiService.addHazardAcceptance( type, miaoshu, dataTime,widget.item['HIDDEN_ID']); if (data['result'] == 'success') { @@ -590,9 +590,12 @@ class _HiddenDangerAcceptancePageState extends State widget.onClose('关闭详情'); // 触发回调 }); + }else{ + LoadingDialogHelper.hide(context); } } catch (e) { + LoadingDialogHelper.hide(context); print('Error fetching data: $e'); } } diff --git a/lib/pages/app/pending_rectification_detail_page.dart b/lib/pages/app/pending_rectification_detail_page.dart index 50684cb..37a664f 100644 --- a/lib/pages/app/pending_rectification_detail_page.dart +++ b/lib/pages/app/pending_rectification_detail_page.dart @@ -549,6 +549,8 @@ class _PendingRectificationDetailPageState extends State jiHuaImages =[]; // 是否有整改计划 @@ -562,7 +564,9 @@ class _PendingRectificationDetailPageState extends State departments = dannerRepairKey.currentState!.departments; bool departmentsAllInput=true; @@ -581,11 +585,17 @@ class _PendingRectificationDetailPageState extends State _rectificationSubmission() async { try { - + LoadingDialogHelper.show(context); final result = await ApiService.rectificationSubmission(pd["HIDDEN_ID"],buMenId,renYuanId); if (result['result'] == 'success') { setState(() { @@ -646,9 +658,11 @@ class _PendingRectificationDetailPageState extends State createState() => _SafetyMeetingListPageState(); +} + +class _SafetyMeetingListPageState extends State + with SingleTickerProviderStateMixin{ + + + final TextEditingController searchController = TextEditingController(); + late List _list = []; + late TabController _tabController= TabController(length: 2, vsync: this); + int _selectedTab = 0; + int pageNum = 1; + + // 模拟数据 + final List> _notifications = List.generate(10, (i) { + bool read = i % 3 == 0; + return { + 'title': '测试数据标题标题 ${i + 1}', + 'time': '2025-06-${10 + i} 12:3${i}', + 'read': read, + }; + }); + + @override + void initState() { + super.initState(); + // _tabController = TabController(length: 2, vsync: this); + _tabController.addListener(() { + // if (!_tabController.indexIsChanging) { + // setState(() => _selectedTab = _tabController.index); + // } + + if (_tabController.indexIsChanging) { + setState(() => _selectedTab = _tabController.index); + print('切换到标签:${_tabController.index}'); + reRefreshData(); + } + + }); + + _getNotifList(""); + } + + void reRefreshData(){ + pageNum=1; + _list.clear(); + searchController.text=""; + if(0==_selectedTab){ + _getNotifList(""); + }else{ + _getNotifEnterprise(""); + } + } + + Future _getNotifList(String keyWord) async { + // LoadingDialogHelper.show(context); + try { + final result = await ApiService.getNotifList("-1", pageNum.toString(),keyWord); + if (result['result'] == 'success') { + final List newList = result['varList'] ?? []; + setState(() { + _list.addAll(newList); + }); + } + } catch (e) { + print('加载出错: $e'); + } finally { + LoadingDialogHelper.hide(context); + } + } + + Future _getNotifEnterprise(String keyWord) async { + // LoadingDialogHelper.show(context); + try { + final result = await ApiService.getNotifEnterprise("-1", pageNum.toString(),keyWord); + if (result['result'] == 'success') { + final List newList = result['varList'] ?? []; + setState(() { + _list.addAll(newList); + }); + } + } catch (e) { + print('加载出错: $e'); + } finally { + LoadingDialogHelper.hide(context); + } + } + + Future _deleteNotif(String id) async { + // LoadingDialogHelper.show(context); + try { + final result = await ApiService.deleteNotif(id); + if (result['result'] == 'success') { + setState(() { + reRefreshData(); + + }); + } + } catch (e) { + print('加载出错: $e'); + } finally { + LoadingDialogHelper.hide(context); + } + } + + + + @override + void dispose() { + _tabController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppbar(title: "安全例会"), + body: + GestureDetector( + onTap: () { + FocusScope.of(context).unfocus(); // 收起键盘 + }, + behavior: HitTestBehavior.opaque, + child: Scaffold( + body: SafeArea( + child: Column( + children: [ + // Tab bar + TabBar( + controller: _tabController, + labelStyle: TextStyle(fontSize: 16), + indicator: UnderlineTabIndicator( + borderSide: BorderSide(width: 3.0, color: Colors.blue), + insets: EdgeInsets.symmetric(horizontal: 100.0), + ), + labelColor: Colors.blue, + unselectedLabelColor: Colors.grey, + tabs: const [Tab(text: '待反馈'), Tab(text: '已反馈')], + ), + + // Search bar + // List + Expanded( + child: + _list.isEmpty + ? NoDataWidget.show() + : ListView.builder( + itemCount: _list.length, + itemBuilder: (context, index) { + return _itemCell(_list[index]); + }, + ), + ), + ], + ), + ), + ), + ), + ); + } + + Widget _itemCell(final item) { + return Column( + children: [ + ListTile( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => NotifDetailPage( + item,_selectedTab, + onClose: (result) { + print('详情页面已关闭,返回结果: $result'); + reRefreshData(); + }, + ), + ), + ); + + // pushPage(NotifDetailPage(item,_selectedTab), context); + }, + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 10, + ), + title: Padding( + padding: const EdgeInsets.only(bottom: 20), // 减小底部间距 + child: Text(item['SYNOPSIS'], style: const TextStyle(fontSize: 14)), + ), + + subtitle: Text(item['CREATTIME'], style: TextStyle(fontSize: 13)), + + trailing: Container( + constraints: const BoxConstraints(minHeight: 100), // 确保最小高度 + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, // 关键修改:使用最小尺寸 + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if (0 != _selectedTab) + Text( + item['TYPE'] == 1 ? '已读' : '未读', + style: TextStyle( + fontSize: 12, // 稍微减小字体大小 + color: item['TYPE'] == 1 ? Colors.grey : Colors.red, + ), + ), + SizedBox(height: 15), + + if (0 != _selectedTab && item['TYPE'] == 1) + SizedBox( + height: 24, // 固定按钮高度 + child: TextButton( + onPressed: () async{ + // 显示确认对话框 + bool? confirm = await showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text("确认删除"), + content: Text("确定要删除这条通知吗?"), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context, false), + // onPressed: () => Navigator.pop(context, false), + child: Text("取消"), + ), + TextButton( + onPressed: () => Navigator.pop(context, true), + // onPressed: () => Navigator.pop(context, true), + child: Text("确定", style: TextStyle(color: Colors.red)), + ), + ], + ), + ); + if (confirm == true) { + _deleteNotif(item['NOTICECORPUSERID_ID']); + } + + }, + style: TextButton.styleFrom( + padding: const EdgeInsets.symmetric(horizontal: 12), + backgroundColor: Colors.red, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + ), + child: Text( '删除', style: TextStyle(fontSize: 13, color: Colors.white),), + + ), + ), + ], + ), + ), + ), + Divider(height: 1, color: Colors.black12), + ], + ); + } +} + + + diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 41ae43b..c51fbb9 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -15,6 +15,7 @@ import 'package:qhd_prevention/pages/app/danger_wait_list_page.dart'; import 'package:qhd_prevention/pages/home/work/laws_regulations_page.dart'; import 'package:qhd_prevention/pages/home/workSet_page.dart'; +import 'Safetymeeting/safety_meeting_list_page.dart'; import 'hidden_roll_widget.dart'; import '../../http/ApiService.dart'; import '../../tools/tools.dart'; @@ -337,6 +338,9 @@ class _HomePageState extends State { case 7: pushPage(StudyGardenPage(), context); break; + case 10: + pushPage(SafetyMeetingListPage(), context); + break; case 11: pushPage(HomeNfcListPage(), context); break; diff --git a/lib/pages/home/work/danger_project_page.dart b/lib/pages/home/work/danger_project_page.dart index 1d06ec7..dee6c8d 100644 --- a/lib/pages/home/work/danger_project_page.dart +++ b/lib/pages/home/work/danger_project_page.dart @@ -90,17 +90,35 @@ class _DangerProjectPageState extends State { final List newList = result['varList'] ?? []; final List newListTwo = result['records'] ?? []; setState(() { + listDates.addAll(newList); - if(newListTwo.isNotEmpty){ + if(newListTwo.isNotEmpty&&newListTwo[0]["LISTCHECKITEM_ID"]!=null){ if( newListTwo[0]["LISTCHECKITEM_ID"]==listDates[0]["LISTCHECKITEM_ID"]){ listDatesSelect.addAll(newListTwo); } } - listDates.addAll(newList); - // listDatesTwo.addAll(newListTwo); + + // listDatesTwo.addAll(newListTwo);option1 for(int i=0;i)["ids"] =""; + if(listDatesSelect.isNotEmpty){ + switch(listDatesSelect[i]["ISNORMAL"] ){ + case 0: + (listDates[i] as Map)["REFERENCE_BASIS"] = "option1"; + break; + case 1: + (listDates[i] as Map)["REFERENCE_BASIS"] = "option2"; + break; + case 2: + (listDates[i] as Map)["REFERENCE_BASIS"] = "option3"; + break; + } + (listDates[i] as Map)["ids"] = listDatesSelect[i]["HIDDEN_ID"]; + SessionService.instance.setUnqualifiedInspectionItemIDJson(listDatesSelect[i]["HIDDEN_ID"]); + }else { + (listDates[i] as Map)["ids"] = ""; + (listDates[i] as Map)["REFERENCE_BASIS"] = ""; + } } @@ -125,17 +143,36 @@ class _DangerProjectPageState extends State { final List newList = result['varList'] ?? []; final List newListTwo = result['records'] ?? []; setState(() { + listDates.addAll(newList); - if(newListTwo.isNotEmpty){ + if(newListTwo.isNotEmpty&&newListTwo[0]["CUSTOM_ID"]!=null){ if( newListTwo[0]["CUSTOM_ID"]==listDates[0]["CUSTOM_ID"]){ listDatesSelect.addAll(newListTwo); } } - listDates.addAll(newList); + // listDatesTwo.addAll(newListTwo); for(int i=0;i)["ids"] =""; + if(listDatesSelect.isNotEmpty){ + switch(listDatesSelect[i]["ISNORMAL"] ){ + case 0: + (listDates[i] as Map)["REFERENCE_BASIS"] = "option1"; + break; + case 1: + (listDates[i] as Map)["REFERENCE_BASIS"] = "option2"; + break; + case 2: + (listDates[i] as Map)["REFERENCE_BASIS"] = "option3"; + break; + + } + (listDates[i] as Map)["ids"] = listDatesSelect[i]["HIDDEN_ID"]; + SessionService.instance.setUnqualifiedInspectionItemIDJson(listDatesSelect[i]["HIDDEN_ID"]); + }else { + (listDates[i] as Map)["ids"] = ""; + (listDates[i] as Map)["REFERENCE_BASIS"] = ""; + } }