| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  | import 'dart:ui'; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | import 'package:flutter/material.dart'; | 
					
						
							| 
									
										
										
										
											2025-08-29 10:00:35 +08:00
										 |  |  |  | import 'package:intl/intl.dart'; | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  | 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'; | 
					
						
							|  |  |  |  | import 'package:qhd_prevention/customWidget/toast_util.dart'; | 
					
						
							|  |  |  |  | import 'package:qhd_prevention/http/ApiService.dart'; | 
					
						
							|  |  |  |  | import 'package:qhd_prevention/pages/home/scan_page.dart'; | 
					
						
							|  |  |  |  | import 'package:qhd_prevention/pages/home/work/risk_list_page.dart'; | 
					
						
							|  |  |  |  | import 'package:qhd_prevention/pages/my_appbar.dart'; | 
					
						
							|  |  |  |  | import 'package:qhd_prevention/tools/SmallWidget.dart'; | 
					
						
							|  |  |  |  | import 'package:qhd_prevention/tools/tools.dart'; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | class HomeDangerPage extends StatefulWidget { | 
					
						
							|  |  |  |  |   const HomeDangerPage( {super.key}); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   @override | 
					
						
							|  |  |  |  |   _HomeDangerPageState createState() => _HomeDangerPageState(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | class _HomeDangerPageState extends State<HomeDangerPage> | 
					
						
							|  |  |  |  |     with SingleTickerProviderStateMixin { | 
					
						
							|  |  |  |  |   late TabController _tabController; | 
					
						
							|  |  |  |  |   int _selectedTab = 0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   final TextEditingController _searchController = TextEditingController(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   String appBarTitle=""; | 
					
						
							|  |  |  |  |   String id=""; | 
					
						
							|  |  |  |  |   String searchKey=""; | 
					
						
							|  |  |  |  |   String searchName=""; | 
					
						
							|  |  |  |  |   bool showBottomTags=true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   List<dynamic> listOne = []; | 
					
						
							|  |  |  |  |   List<dynamic> listTwo = []; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   List<dynamic> listDates = []; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   @override | 
					
						
							|  |  |  |  |   void initState() { | 
					
						
							|  |  |  |  |     super.initState(); | 
					
						
							|  |  |  |  |     _tabController = TabController(length: 2, vsync: this); | 
					
						
							|  |  |  |  |     _tabController.addListener(() { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |       if (_tabController.indexIsChanging) { | 
					
						
							|  |  |  |  |         setState(() => _selectedTab = _tabController.index); | 
					
						
							|  |  |  |  |         print('切换到标签:${_tabController.index}'); | 
					
						
							|  |  |  |  |         listDates.clear(); | 
					
						
							|  |  |  |  |         setState(() { | 
					
						
							|  |  |  |  |           if(_selectedTab==0){ | 
					
						
							| 
									
										
										
										
											2025-09-03 18:03:04 +08:00
										 |  |  |  |             getListData(); | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |             showBottomTags=true; | 
					
						
							|  |  |  |  |           }else{ | 
					
						
							| 
									
										
										
										
											2025-09-03 18:03:04 +08:00
										 |  |  |  |             getListData(); | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |             showBottomTags=false; | 
					
						
							|  |  |  |  |           } | 
					
						
							|  |  |  |  |         }); | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |     }); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     id=SessionService.instance.loginUser?["DEPARTMENT_ID"]??""; | 
					
						
							|  |  |  |  |     getListData(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   void getListData(){ | 
					
						
							|  |  |  |  |     listDates.clear(); | 
					
						
							|  |  |  |  |     listOne.clear(); | 
					
						
							|  |  |  |  |     listTwo.clear(); | 
					
						
							|  |  |  |  |         appBarTitle="待排查"; | 
					
						
							| 
									
										
										
										
											2025-09-03 18:03:04 +08:00
										 |  |  |  |         if(_selectedTab==0){ | 
					
						
							|  |  |  |  |           _getHazardInvestigationList(); | 
					
						
							|  |  |  |  |         }else{ | 
					
						
							|  |  |  |  |           _getStandardInvestigationList(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |     // case 3://首页-待排查
 | 
					
						
							|  |  |  |  |     //   appBarTitle="待排查";
 | 
					
						
							|  |  |  |  |     //   // _getStandardInvestigationRecordList(_page,keyWord,"","","","","","",addList);
 | 
					
						
							|  |  |  |  |     //   break;
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-29 10:00:35 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |   Future<void> _getHazardInvestigationList() async { | 
					
						
							|  |  |  |  |     try { | 
					
						
							| 
									
										
										
										
											2025-09-06 16:52:08 +08:00
										 |  |  |  |       LoadingDialogHelper.show(); | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |       final result = await ApiService.getHazardInvestigationList(id,searchKey); | 
					
						
							| 
									
										
										
										
											2025-09-06 16:52:08 +08:00
										 |  |  |  |       LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |       if (result['result'] == 'success') { | 
					
						
							|  |  |  |  |         final List<dynamic> newList = result['varList'] ?? []; | 
					
						
							|  |  |  |  |         setState(() { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |           for(int i=0;i<newList.length;i++){ | 
					
						
							| 
									
										
										
										
											2025-09-19 13:33:13 +08:00
										 |  |  |  |             Map item = newList[i]; | 
					
						
							|  |  |  |  |             if (item['PERIOD'] == "checkPeriod0000") { | 
					
						
							|  |  |  |  |               // 特殊处理 checkPeriod0000 的情况
 | 
					
						
							|  |  |  |  |               if (!item['investigated']) { | 
					
						
							|  |  |  |  |                 listOne.add(item); | 
					
						
							|  |  |  |  |               } | 
					
						
							|  |  |  |  |             } else { | 
					
						
							|  |  |  |  |               if(newList[i]["checkCount"]==0){ | 
					
						
							|  |  |  |  |                 listOne.add(newList[i]); | 
					
						
							|  |  |  |  |                 // }else{
 | 
					
						
							|  |  |  |  |                 //   listTwo.add(newList[i]);
 | 
					
						
							|  |  |  |  |               } | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |           } | 
					
						
							|  |  |  |  |           listDates.addAll(listOne); | 
					
						
							|  |  |  |  |         }); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |       }else{ | 
					
						
							|  |  |  |  |         ToastUtil.showNormal(context, "加载数据失败"); | 
					
						
							|  |  |  |  |         // _showMessage('加载数据失败');
 | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |     } catch (e) { | 
					
						
							| 
									
										
										
										
											2025-09-06 16:52:08 +08:00
										 |  |  |  |       LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |       // 出错时可以 Toast 或者在页面上显示错误状态
 | 
					
						
							|  |  |  |  |       print('加载数据失败:$e'); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   Future<void> _getStandardInvestigationList() async { | 
					
						
							|  |  |  |  |     try { | 
					
						
							| 
									
										
										
										
											2025-09-06 16:52:08 +08:00
										 |  |  |  |       LoadingDialogHelper.show(); | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |       final result = await ApiService.getStandardInvestigationList(id,searchKey); | 
					
						
							| 
									
										
										
										
											2025-09-06 16:52:08 +08:00
										 |  |  |  |       LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |       if (result['result'] == 'success') { | 
					
						
							|  |  |  |  |         final List<dynamic> newList = result['varList'] ?? []; | 
					
						
							|  |  |  |  |         setState(() { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |           for(int i=0;i<newList.length;i++){ | 
					
						
							|  |  |  |  |             if(newList[i]["checkCount"]==0){ | 
					
						
							|  |  |  |  |             //   listOne.add(newList[i]);
 | 
					
						
							|  |  |  |  |             // }else{
 | 
					
						
							|  |  |  |  |               listTwo.add(newList[i]); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |           } | 
					
						
							| 
									
										
										
										
											2025-09-03 18:03:04 +08:00
										 |  |  |  |           listDates.addAll(listTwo); | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |         }); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |       }else{ | 
					
						
							|  |  |  |  |         ToastUtil.showNormal(context, "加载数据失败"); | 
					
						
							|  |  |  |  |         // _showMessage('加载数据失败');
 | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |     } catch (e) { | 
					
						
							| 
									
										
										
										
											2025-09-06 16:52:08 +08:00
										 |  |  |  |       LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |       // 出错时可以 Toast 或者在页面上显示错误状态
 | 
					
						
							|  |  |  |  |       print('加载数据失败:$e'); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   @override | 
					
						
							|  |  |  |  |   void dispose() { | 
					
						
							|  |  |  |  |     _tabController.dispose(); | 
					
						
							|  |  |  |  |     super.dispose(); | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   Future<void> _handleItemTap( item, int index) async { | 
					
						
							|  |  |  |  |     print("点击了是: ${index}"); | 
					
						
							|  |  |  |  |     SessionService.instance.setListItemNameJson(item['NAME']); | 
					
						
							|  |  |  |  |     switch(_selectedTab ){ | 
					
						
							|  |  |  |  |       case 0://隐患排查
 | 
					
						
							|  |  |  |  |         // pushPage(RiskListPage(1,item["LISTMANAGER_ID"]), context);
 | 
					
						
							|  |  |  |  |         final result = await Navigator.push( | 
					
						
							|  |  |  |  |           context, | 
					
						
							| 
									
										
										
										
											2025-09-12 21:04:05 +08:00
										 |  |  |  |           MaterialPageRoute(builder: (_) => RiskListPage(1,item["LISTMANAGER_ID"],FormUtils.hasValue(item, "IDENTIFICATIONPARTS_ID")?item["IDENTIFICATIONPARTS_ID"]:"")), | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |         ); | 
					
						
							|  |  |  |  |         break; | 
					
						
							|  |  |  |  |       case 1://标准排查
 | 
					
						
							|  |  |  |  |         // pushPage(RiskListPage(2,item["CUSTOM_ID"]), context);
 | 
					
						
							|  |  |  |  |         final result = await Navigator.push( | 
					
						
							|  |  |  |  |           context, | 
					
						
							| 
									
										
										
										
											2025-09-12 21:04:05 +08:00
										 |  |  |  |           MaterialPageRoute(builder: (_) => RiskListPage(2,item["CUSTOM_ID"],FormUtils.hasValue(item, "IDENTIFICATIONPARTS_ID")?item["IDENTIFICATIONPARTS_ID"]:"")), | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |         ); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         break; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     getListData(); | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   // 显示分类选择器
 | 
					
						
							|  |  |  |  |   void showCategoryPicker() { | 
					
						
							|  |  |  |  |     showModalBottomSheet( | 
					
						
							|  |  |  |  |       context: context, | 
					
						
							|  |  |  |  |       isScrollControlled: true, | 
					
						
							|  |  |  |  |       barrierColor: Colors.black54, | 
					
						
							|  |  |  |  |       backgroundColor: Colors.transparent, | 
					
						
							|  |  |  |  |       builder: | 
					
						
							|  |  |  |  |           (ctx) => DepartmentPicker(onSelected: (id, name) { | 
					
						
							|  |  |  |  |         setState(() { | 
					
						
							|  |  |  |  |           searchKey=id; | 
					
						
							|  |  |  |  |           searchName=name; | 
					
						
							|  |  |  |  |           _searchController.text=name; | 
					
						
							|  |  |  |  |         }); | 
					
						
							|  |  |  |  |         getListData(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |       }), | 
					
						
							|  |  |  |  |     ); | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   @override | 
					
						
							|  |  |  |  |   Widget build(BuildContext context) { | 
					
						
							|  |  |  |  |     return Scaffold( | 
					
						
							|  |  |  |  |       appBar: MyAppbar( | 
					
						
							| 
									
										
										
										
											2025-09-03 18:03:04 +08:00
										 |  |  |  |         title: appBarTitle, | 
					
						
							|  |  |  |  |         // actions: [
 | 
					
						
							|  |  |  |  |         //   TextButton(
 | 
					
						
							|  |  |  |  |         //     onPressed: () {
 | 
					
						
							|  |  |  |  |         //       // pushPage(ScanPage(), context);
 | 
					
						
							|  |  |  |  |         //       _goScan();
 | 
					
						
							|  |  |  |  |         //     },
 | 
					
						
							|  |  |  |  |         //     child: Text(
 | 
					
						
							|  |  |  |  |         //       "清单扫描",
 | 
					
						
							|  |  |  |  |         //       style: TextStyle(color: Colors.white, fontSize: 16),
 | 
					
						
							|  |  |  |  |         //     ),
 | 
					
						
							|  |  |  |  |         //   ),
 | 
					
						
							|  |  |  |  |         // ],
 | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |       ), | 
					
						
							|  |  |  |  |       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, | 
					
						
							| 
									
										
										
										
											2025-09-03 18:03:04 +08:00
										 |  |  |  |               tabs: const [Tab(text: '隐患排查'), Tab(text: '标准排查')], | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |             ), | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             Container( | 
					
						
							|  |  |  |  |               color: Colors.white, | 
					
						
							|  |  |  |  |               child: Padding( | 
					
						
							|  |  |  |  |                 padding: const EdgeInsets.all(10), | 
					
						
							|  |  |  |  |                 child: SearchBarWidget( | 
					
						
							|  |  |  |  |                   showResetButton: true, | 
					
						
							|  |  |  |  |                   onInputTap: () { | 
					
						
							|  |  |  |  |                     showCategoryPicker(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                   }, | 
					
						
							|  |  |  |  |                   hintText: "", | 
					
						
							|  |  |  |  |                   isClickableOnly: true, | 
					
						
							|  |  |  |  |                   onSearch: (text) { | 
					
						
							|  |  |  |  |                     print('----------'); | 
					
						
							|  |  |  |  |                     // searchKey=text;
 | 
					
						
							|  |  |  |  |                     // getListData();
 | 
					
						
							|  |  |  |  |                   }, | 
					
						
							| 
									
										
										
										
											2025-09-03 18:03:04 +08:00
										 |  |  |  |                   onReset:  () { | 
					
						
							|  |  |  |  |                     setState(() { | 
					
						
							|  |  |  |  |                       searchKey=""; | 
					
						
							|  |  |  |  |                       searchName=""; | 
					
						
							|  |  |  |  |                     }); | 
					
						
							|  |  |  |  |                     getListData(); | 
					
						
							|  |  |  |  |                   }, | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |                   controller: _searchController, | 
					
						
							|  |  |  |  |                 ), | 
					
						
							|  |  |  |  |               ), | 
					
						
							|  |  |  |  |             ), | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             // List
 | 
					
						
							|  |  |  |  |             Expanded( | 
					
						
							|  |  |  |  |               child:  listDates.isEmpty | 
					
						
							|  |  |  |  |                   ? NoDataWidget.show() | 
					
						
							|  |  |  |  |                   : ListView.separated( | 
					
						
							|  |  |  |  |                 padding: EdgeInsets.only(top: 15), | 
					
						
							|  |  |  |  |                 itemCount: listDates.length, | 
					
						
							|  |  |  |  |                 separatorBuilder: (_, __) => const SizedBox(), | 
					
						
							|  |  |  |  |                 itemBuilder: (context, index) { | 
					
						
							|  |  |  |  |                   final item = listDates[index]; | 
					
						
							|  |  |  |  |                   return GestureDetector( | 
					
						
							|  |  |  |  |                     onTap: () => _handleItemTap(item, index), | 
					
						
							|  |  |  |  |                     child: DannerRepainItem( | 
					
						
							| 
									
										
										
										
											2025-09-06 16:52:08 +08:00
										 |  |  |  |                       showTitleIcon: (SessionService.instance.username==item['USER_NAME']), | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |                       title: item['NAME'], | 
					
						
							|  |  |  |  |                       details: [ | 
					
						
							|  |  |  |  |                         '清单类型:${item['TYPENAME']}', | 
					
						
							|  |  |  |  |                         '排查周期:${item['PERIODNAME']}', | 
					
						
							|  |  |  |  |                         '包含检查项:${item['count']}', | 
					
						
							|  |  |  |  |                         '负责人:${item['USER_NAME']}', | 
					
						
							| 
									
										
										
										
											2025-08-29 10:00:35 +08:00
										 |  |  |  |                         '起始时间:${changeTimeString(item['START_DATE'])}-${changeTimeString(item['END_DATE'])}', | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |                       ], | 
					
						
							|  |  |  |  |                       showBottomTags: showBottomTags, | 
					
						
							|  |  |  |  |                       bottomTags: [ | 
					
						
							|  |  |  |  |                         riskTagText(1, "重大风险:${item['ACOUNT']}"), | 
					
						
							|  |  |  |  |                         riskTagText(2, "较大:${item['BCOUNT']}"), | 
					
						
							|  |  |  |  |                         riskTagText(3, "一般:${item['CCOUNT']}"), | 
					
						
							|  |  |  |  |                         riskTagText(4, "低:${item['DCOUNT']}"), | 
					
						
							|  |  |  |  |                       ], | 
					
						
							|  |  |  |  |                     ), | 
					
						
							|  |  |  |  |                   ); | 
					
						
							|  |  |  |  |                 }, | 
					
						
							|  |  |  |  |               ), | 
					
						
							|  |  |  |  |             ), | 
					
						
							|  |  |  |  |           ], | 
					
						
							|  |  |  |  |         ), | 
					
						
							|  |  |  |  |       ), | 
					
						
							|  |  |  |  |     ); | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-29 10:00:35 +08:00
										 |  |  |  |   String changeTimeString(String dataTime) { | 
					
						
							|  |  |  |  |     final dateFormat = DateFormat('yyyy-MM-dd'); | 
					
						
							|  |  |  |  |     // 先将字符串转换为 DateTime 对象
 | 
					
						
							|  |  |  |  |     DateTime dateTime = DateTime.parse(dataTime); | 
					
						
							|  |  |  |  |     // 然后格式化 DateTime 对象
 | 
					
						
							|  |  |  |  |     String newData = dateFormat.format(dateTime); | 
					
						
							|  |  |  |  |     return newData; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  |   Widget _itemCell(final item) { | 
					
						
							|  |  |  |  |     return Padding( | 
					
						
							|  |  |  |  |       padding: EdgeInsets.only(left: 15, right: 15, bottom: 15), | 
					
						
							|  |  |  |  |       child: Container( | 
					
						
							|  |  |  |  |         decoration: const BoxDecoration( | 
					
						
							|  |  |  |  |           color: Colors.white, | 
					
						
							|  |  |  |  |           borderRadius: BorderRadius.all(Radius.circular(5)), | 
					
						
							|  |  |  |  |         ), | 
					
						
							|  |  |  |  |         child: Column( | 
					
						
							|  |  |  |  |           children: [ | 
					
						
							|  |  |  |  |             Padding( | 
					
						
							|  |  |  |  |               padding: EdgeInsets.symmetric(vertical: 10, horizontal: 15), | 
					
						
							|  |  |  |  |               child: Row( | 
					
						
							|  |  |  |  |                 mainAxisAlignment: MainAxisAlignment.spaceBetween, | 
					
						
							|  |  |  |  |                 children: [ | 
					
						
							|  |  |  |  |                   Row( | 
					
						
							|  |  |  |  |                     children: [ | 
					
						
							|  |  |  |  |                       Icon( | 
					
						
							|  |  |  |  |                         Icons.star_rate_sharp, | 
					
						
							|  |  |  |  |                         color: Colors.green, | 
					
						
							|  |  |  |  |                         size: 18, | 
					
						
							|  |  |  |  |                       ), | 
					
						
							|  |  |  |  |                       SizedBox(width: 5), | 
					
						
							|  |  |  |  |                       Text("测试--------", style: TextStyle(fontSize: 14)), | 
					
						
							|  |  |  |  |                     ], | 
					
						
							|  |  |  |  |                   ), | 
					
						
							|  |  |  |  |                   Icon( | 
					
						
							|  |  |  |  |                     Icons.arrow_forward_ios_rounded, | 
					
						
							|  |  |  |  |                     color: Colors.grey, | 
					
						
							|  |  |  |  |                     size: 15, | 
					
						
							|  |  |  |  |                   ), | 
					
						
							|  |  |  |  |                 ], | 
					
						
							|  |  |  |  |               ), | 
					
						
							|  |  |  |  |             ), | 
					
						
							|  |  |  |  |             Divider(height: 1), | 
					
						
							|  |  |  |  |             Padding( | 
					
						
							|  |  |  |  |               padding: EdgeInsets.symmetric(vertical: 10, horizontal: 15), | 
					
						
							|  |  |  |  |               child: Column( | 
					
						
							|  |  |  |  |                 spacing: 5, | 
					
						
							|  |  |  |  |                 children: [ | 
					
						
							|  |  |  |  |                   Row( | 
					
						
							|  |  |  |  |                     mainAxisAlignment: MainAxisAlignment.spaceBetween, | 
					
						
							|  |  |  |  |                     children: [ | 
					
						
							|  |  |  |  |                       HhTextStyleUtils.secondaryTitle("清单类型:测试"), | 
					
						
							|  |  |  |  |                       HhTextStyleUtils.secondaryTitle("排查周期:测试"), | 
					
						
							|  |  |  |  |                     ], | 
					
						
							|  |  |  |  |                   ), | 
					
						
							|  |  |  |  |                   Row( | 
					
						
							|  |  |  |  |                     mainAxisAlignment: MainAxisAlignment.spaceBetween, | 
					
						
							|  |  |  |  |                     children: [ | 
					
						
							|  |  |  |  |                       HhTextStyleUtils.secondaryTitle("包含检查项:3"), | 
					
						
							|  |  |  |  |                       HhTextStyleUtils.secondaryTitle("负责人:是测试"), | 
					
						
							|  |  |  |  |                     ], | 
					
						
							|  |  |  |  |                   ), | 
					
						
							|  |  |  |  |                   Row( | 
					
						
							|  |  |  |  |                     mainAxisAlignment: MainAxisAlignment.spaceBetween, | 
					
						
							|  |  |  |  |                     children: [ | 
					
						
							|  |  |  |  |                       HhTextStyleUtils.secondaryTitle( | 
					
						
							|  |  |  |  |                         "起始时间:2025-6-20 - 2026-3-31", | 
					
						
							|  |  |  |  |                       ), | 
					
						
							|  |  |  |  |                       SizedBox(), | 
					
						
							|  |  |  |  |                     ], | 
					
						
							|  |  |  |  |                   ), | 
					
						
							|  |  |  |  |                 ], | 
					
						
							|  |  |  |  |               ), | 
					
						
							|  |  |  |  |             ), | 
					
						
							|  |  |  |  |             Padding( | 
					
						
							|  |  |  |  |               padding: EdgeInsets.only(top: 0, bottom: 15, left: 15, right: 15), | 
					
						
							|  |  |  |  |               child: Row( | 
					
						
							|  |  |  |  |                 spacing: 5, | 
					
						
							|  |  |  |  |                 children: [ | 
					
						
							|  |  |  |  |                   riskTagText(1, "重大风险:0"), | 
					
						
							|  |  |  |  |                   riskTagText(2, "较大:3"), | 
					
						
							|  |  |  |  |                   riskTagText(3, "一般:1"), | 
					
						
							|  |  |  |  |                   riskTagText(4, "低:0"), | 
					
						
							|  |  |  |  |                 ], | 
					
						
							|  |  |  |  |               ), | 
					
						
							|  |  |  |  |             ), | 
					
						
							|  |  |  |  |           ], | 
					
						
							|  |  |  |  |         ), | 
					
						
							|  |  |  |  |       ), | 
					
						
							|  |  |  |  |     ); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-08-07 17:37:21 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   Future<void> _goScan() async { | 
					
						
							|  |  |  |  |     final result = await Navigator.push( | 
					
						
							|  |  |  |  |       context, | 
					
						
							| 
									
										
										
										
											2025-09-01 17:25:55 +08:00
										 |  |  |  |       MaterialPageRoute(builder: (_) => ScanPage(totalList: [])), | 
					
						
							| 
									
										
										
										
											2025-08-07 17:37:21 +08:00
										 |  |  |  |     ); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     dynamic item; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     for(int i=0;i<listDates.length;i++){ | 
					
						
							|  |  |  |  |       final listItem= listDates[i]; | 
					
						
							|  |  |  |  |       String code=""; | 
					
						
							|  |  |  |  |       switch(_selectedTab){ | 
					
						
							|  |  |  |  |         case 0://隐患排查
 | 
					
						
							|  |  |  |  |           code= listItem["LISTMANAGER_ID"]; | 
					
						
							|  |  |  |  |           break; | 
					
						
							|  |  |  |  |         case 1://标准排查
 | 
					
						
							|  |  |  |  |           code= listItem["CUSTOM_ID"]; | 
					
						
							|  |  |  |  |           break; | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |       if(code==result){ | 
					
						
							|  |  |  |  |         item=listItem; | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     _handleItemTap(item,0); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-29 10:00:35 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |  | // 模拟数据模版
 | 
					
						
							|  |  |  |  | class NotificationItem { | 
					
						
							|  |  |  |  |   final String title; | 
					
						
							|  |  |  |  |   final String time; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   NotificationItem(this.title, this.time); | 
					
						
							|  |  |  |  | } |