| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | import 'package:flutter/material.dart'; | 
					
						
							|  |  |  | import 'package:http/http.dart' as http; | 
					
						
							|  |  |  | import 'package:qhd_prevention/customWidget/big_video_viewer.dart'; | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  | import 'package:qhd_prevention/pages/home/tap/item_list_widget.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | import 'package:qhd_prevention/pages/my_appbar.dart'; | 
					
						
							|  |  |  | import 'dart:convert'; | 
					
						
							|  |  |  | import 'package:video_player/video_player.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import '../../customWidget/ItemWidgetFactory.dart'; | 
					
						
							|  |  |  | import '../../customWidget/custom_button.dart'; | 
					
						
							|  |  |  | import '../../customWidget/department_person_picker.dart'; | 
					
						
							|  |  |  | import '../../customWidget/department_picker.dart'; | 
					
						
							|  |  |  | import '../../customWidget/full_screen_video_page.dart'; | 
					
						
							|  |  |  | import '../../customWidget/single_image_viewer.dart'; | 
					
						
							|  |  |  | import '../../customWidget/toast_util.dart'; | 
					
						
							|  |  |  | import '../../customWidget/video_player_widget.dart'; | 
					
						
							|  |  |  | import '../../http/ApiService.dart'; | 
					
						
							|  |  |  | import '../../tools/h_colors.dart'; | 
					
						
							|  |  |  | import '../../tools/tools.dart'; | 
					
						
							|  |  |  | import 'danner_repair.dart'; | 
					
						
							|  |  |  | import 'danger_wait_list_page.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class PendingRectificationDetailPage extends StatefulWidget { | 
					
						
							|  |  |  |   const PendingRectificationDetailPage(this.dangerType, this.item, {super.key,required this.onClose}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   final Function(String) onClose; // 回调函数
 | 
					
						
							|  |  |  |   final DangerType dangerType; | 
					
						
							|  |  |  |   final item; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   _PendingRectificationDetailPageState createState() => _PendingRectificationDetailPageState(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class _PendingRectificationDetailPageState extends State<PendingRectificationDetailPage> { | 
					
						
							|  |  |  |   late Map<String, dynamic> pd = {}; | 
					
						
							|  |  |  |   late Map<String, dynamic> hs = {}; | 
					
						
							|  |  |  |   List<String> files = []; | 
					
						
							|  |  |  |   List<String> files2 = []; | 
					
						
							|  |  |  |   List<dynamic> files4 = []; | 
					
						
							|  |  |  |   List<dynamic> files5 = []; | 
					
						
							|  |  |  |   List<dynamic> files6 = []; | 
					
						
							|  |  |  |   List<dynamic> videoList = []; | 
					
						
							|  |  |  |   List<dynamic> checkList = []; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   bool modalShow = false; | 
					
						
							|  |  |  |   String videoSrc = ""; | 
					
						
							|  |  |  |   VideoPlayerController? _videoController; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // 是否整改
 | 
					
						
							|  |  |  |   bool _accepted = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   String buMenId=""; | 
					
						
							|  |  |  |   String buMenName=""; | 
					
						
							|  |  |  |   String renYuanId=""; | 
					
						
							|  |  |  |   String renYuanName=""; | 
					
						
							|  |  |  |   // 存储各单位的人员列表
 | 
					
						
							|  |  |  |   late List<Map<String, dynamic>> _personCache = []; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   late DannerRepair dannerRepair; | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |   // 在父组件中
 | 
					
						
							|  |  |  |   final GlobalKey<DannerRepairState> dannerRepairKey = GlobalKey(); | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   void initState() { | 
					
						
							|  |  |  |     super.initState(); | 
					
						
							|  |  |  |     if("2"==widget.item['HIDDEN_RISKSTANDARD']){ | 
					
						
							|  |  |  |       getDataTwo(); | 
					
						
							|  |  |  |     }else { | 
					
						
							|  |  |  |       getData(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   void dispose() { | 
					
						
							|  |  |  |     _videoController?.dispose(); | 
					
						
							|  |  |  |     super.dispose(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Future<void> getData() async { | 
					
						
							|  |  |  |     try { | 
					
						
							|  |  |  |       final data = await ApiService.getDangerDetail(widget.item['HIDDEN_ID']); | 
					
						
							|  |  |  |       if (data['result'] == 'success') { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           setState(() { | 
					
						
							|  |  |  |             pd = data['pd']; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |              buMenId=pd["RECTIFICATIONDEPT"]; | 
					
						
							|  |  |  |              buMenName=pd["RECTIFICATIONDEPTNAME"]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |              renYuanId=pd["RECTIFICATIONOR"]; | 
					
						
							|  |  |  |              renYuanName=pd["RECTIFICATIONORNAME"]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             hs = data['hs'] ?? {}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // 处理图片和视频
 | 
					
						
							| 
									
										
										
										
											2025-08-29 09:52:48 +08:00
										 |  |  |             videoList = data['hiddenVideo'] ?? []; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |             for (var img in data['hImgs']) { | 
					
						
							| 
									
										
										
										
											2025-08-29 09:52:48 +08:00
										 |  |  |               if (img["FILEPATH"].toString().endsWith('.mp4')) { | 
					
						
							|  |  |  |                 videoList.add(img); | 
					
						
							|  |  |  |               }else{ | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |                 files.add(img["FILEPATH"]); | 
					
						
							| 
									
										
										
										
											2025-08-29 09:52:48 +08:00
										 |  |  |               } | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // List<dynamic> filesZheng = data['rImgs'] ?? [];
 | 
					
						
							|  |  |  |             for (var img in data['rImgs']) { | 
					
						
							|  |  |  |               files2.add(img["FILEPATH"]); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             // files2=data['rImgs'] ?? [];
 | 
					
						
							|  |  |  |             files4 = data['sImgs'] ?? []; | 
					
						
							|  |  |  |             files5 = data['pImgs'] ?? []; | 
					
						
							|  |  |  |             files6 = data['yImgs'] ?? []; | 
					
						
							|  |  |  |             checkList = data['checkList'] ?? []; | 
					
						
							| 
									
										
										
										
											2025-09-08 17:53:44 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |           }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // 拉取该单位的人员列表并缓存
 | 
					
						
							|  |  |  |           final result = await ApiService.getListTreePersonList(buMenId); | 
					
						
							|  |  |  |           setState(() { | 
					
						
							|  |  |  |             _personCache=List<Map<String, dynamic>>.from( | 
					
						
							|  |  |  |               result['userList'] as List, | 
					
						
							|  |  |  |             ); | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |           }); | 
					
						
							| 
									
										
										
										
											2025-09-08 17:53:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } catch (e) { | 
					
						
							|  |  |  |       print('Error fetching data: $e'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Future<void> getDataTwo() async { | 
					
						
							|  |  |  |     try { | 
					
						
							|  |  |  |       final data = await ApiService.getDangerDetailTwo(widget.item['HIDDEN_ID']); | 
					
						
							|  |  |  |       if (data['result'] == 'success') { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         setState(() { | 
					
						
							|  |  |  |           pd = data['pd']; | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |           buMenId=pd["RECTIFICATIONDEPT"]; | 
					
						
							|  |  |  |           buMenName=pd["RECTIFICATIONDEPTNAME"]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           renYuanId=pd["RECTIFICATIONOR"]; | 
					
						
							|  |  |  |           renYuanName=pd["RECTIFICATIONORNAME"]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |           hs = data['hs'] ?? {}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // 处理图片和视频
 | 
					
						
							|  |  |  |           for (var img in data['hImgs']) { | 
					
						
							|  |  |  |             if (img['FILEPATH'].toString().endsWith('.mp4')) { | 
					
						
							|  |  |  |               videoList.add(img); | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |               files.add(img["FILEPATH"]); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // List<dynamic> filesZheng = data['rImgs'] ?? [];
 | 
					
						
							|  |  |  |           for (var img in data['rImgs']) { | 
					
						
							|  |  |  |             files2.add(img["FILEPATH"]); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           // files2=data['rImgs'] ?? [];
 | 
					
						
							|  |  |  |           files4 = data['sImgs'] ?? []; | 
					
						
							|  |  |  |           files5 = data['pImgs'] ?? []; | 
					
						
							|  |  |  |           files6 = data['yImgs'] ?? []; | 
					
						
							|  |  |  |           checkList = data['checkList'] ?? []; | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2025-09-08 17:53:44 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // 拉取该单位的人员列表并缓存
 | 
					
						
							|  |  |  |         final result = await ApiService.getListTreePersonList(buMenId); | 
					
						
							|  |  |  |         setState(() { | 
					
						
							|  |  |  |           _personCache=List<Map<String, dynamic>>.from( | 
					
						
							|  |  |  |             result['userList'] as List, | 
					
						
							|  |  |  |           ); | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } catch (e) { | 
					
						
							|  |  |  |       print('Error fetching data: $e'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Widget _buildInfoItem(String title, String value) { | 
					
						
							|  |  |  |     return Padding( | 
					
						
							|  |  |  |       padding: const EdgeInsets.symmetric(vertical: 8), | 
					
						
							|  |  |  |       child: Row( | 
					
						
							|  |  |  |         crossAxisAlignment: CrossAxisAlignment.start, | 
					
						
							|  |  |  |         children: [ | 
					
						
							|  |  |  |           SizedBox( | 
					
						
							|  |  |  |             width: 120, | 
					
						
							|  |  |  |             child: Text( | 
					
						
							|  |  |  |               title, | 
					
						
							|  |  |  |               style: const TextStyle(fontWeight: FontWeight.bold), | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |           Expanded(child: Text(value,textAlign: TextAlign.right,)),  | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   Widget build(BuildContext context) { | 
					
						
							|  |  |  |     return Scaffold( | 
					
						
							|  |  |  |       appBar: MyAppbar(title: widget.dangerType.detailTitle), | 
					
						
							|  |  |  |       body: pd.isEmpty | 
					
						
							|  |  |  |           ? const Center(child: CircularProgressIndicator()) | 
					
						
							|  |  |  |           : LayoutBuilder( | 
					
						
							|  |  |  |         builder: (context, constraints) { | 
					
						
							|  |  |  |           return SingleChildScrollView( | 
					
						
							|  |  |  |             child: ConstrainedBox( | 
					
						
							|  |  |  |               constraints: BoxConstraints( | 
					
						
							|  |  |  |                 minHeight: constraints.maxHeight, | 
					
						
							|  |  |  |               ), | 
					
						
							|  |  |  |               child: Padding( | 
					
						
							|  |  |  |                 padding: const EdgeInsets.all(16), | 
					
						
							|  |  |  |                 child: Column( | 
					
						
							|  |  |  |                   crossAxisAlignment: CrossAxisAlignment.start, | 
					
						
							|  |  |  |                   children: [ | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |                     ItemListWidget.itemContainer( | 
					
						
							|  |  |  |                       Column( | 
					
						
							|  |  |  |                         crossAxisAlignment: CrossAxisAlignment.start, | 
					
						
							|  |  |  |                         children: [ | 
					
						
							| 
									
										
										
										
											2025-09-10 18:06:56 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |                           _buildInfoItem('隐患描述', pd['HIDDENDESCR'] ?? ''), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                           Divider(height: 1), | 
					
						
							|  |  |  |                           // 隐患来源
 | 
					
						
							|  |  |  |                           _buildInfoItem('隐患来源', _getSourceText(pd['SOURCE'])), | 
					
						
							|  |  |  |                           Divider(height: 1), | 
					
						
							|  |  |  |                           // 条件渲染部分
 | 
					
						
							|  |  |  |                           if (pd['SOURCE'] == '2') ...[ | 
					
						
							| 
									
										
										
										
											2025-09-02 14:42:47 +08:00
										 |  |  |                             _buildInfoItem('风险点(单元)', pd['RISK_UNIT'] ?? ''), | 
					
						
							|  |  |  |                             Divider(height: 1), | 
					
						
							|  |  |  |                             _buildInfoItem('辨识部位', pd['IDENTIFICATION'] ?? ''), | 
					
						
							|  |  |  |                             Divider(height: 1), | 
					
						
							|  |  |  |                             _buildInfoItem('存在风险', pd['RISK_DESCR'] ?? ''), | 
					
						
							|  |  |  |                             Divider(height: 1), | 
					
						
							|  |  |  |                             _buildInfoItem('风险分级', pd['LEVEL'] ?? ''), | 
					
						
							|  |  |  |                             Divider(height: 1), | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |                             _buildInfoItem('检查内容', pd['CHECK_CONTENT'] ?? ''), | 
					
						
							|  |  |  |                             Divider(height: 1), | 
					
						
							|  |  |  |                           ], | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                           _buildInfoItem('隐患部位', pd['HIDDENPART'] ?? ''), | 
					
						
							|  |  |  |                           Divider(height: 1), | 
					
						
							|  |  |  |                           _buildInfoItem('发现人', pd['CREATORNAME'] ?? ''), | 
					
						
							|  |  |  |                           Divider(height: 1), | 
					
						
							|  |  |  |                           _buildInfoItem('发现时间', pd['CREATTIME'] ?? ''), | 
					
						
							|  |  |  |                           Divider(height: 1), | 
					
						
							| 
									
										
										
										
											2025-09-18 15:32:04 +08:00
										 |  |  |                           _buildInfoItem('隐患级别', pd['HIDDENLEVELNAME'] ?? ''), | 
					
						
							|  |  |  |                           Divider(height: 1), | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |                           if (pd['HIDDEN_CATEGORY']?.isNotEmpty == true) | 
					
						
							|  |  |  |                             _buildInfoItem('隐患类别', pd['HIDDEN_CATEGORY_NAME'] ?? ''), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                           _buildInfoItem('隐患类型', pd['HIDDENTYPE_NAME'] ?? ''), | 
					
						
							|  |  |  |                           Divider(height: 1), | 
					
						
							|  |  |  |                           _buildInfoItem('整改类型', _getRectificationType(pd['RECTIFICATIONTYPE'])), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                           if (pd['RECTIFICATIONTYPE'] == '2') | 
					
						
							|  |  |  |                             _buildInfoItem('整改期限', pd['RECTIFICATIONDEADLINE'] ?? ''), | 
					
						
							|  |  |  |                           Divider(height: 1), | 
					
						
							|  |  |  |                           // 隐患照片
 | 
					
						
							|  |  |  |                           // const Text('隐患照片', style: TextStyle(fontWeight: FontWeight.bold)),
 | 
					
						
							|  |  |  |                           // _buildImageGrid(files, onTap: (index) => _showImageGallery(files, index)),
 | 
					
						
							|  |  |  |                           ListItemFactory.createTextImageItem( | 
					
						
							|  |  |  |                             text: "隐患照片", | 
					
						
							|  |  |  |                             imageUrls: files, | 
					
						
							|  |  |  |                             onImageTapped: (index) { | 
					
						
							|  |  |  |                               presentOpaque( | 
					
						
							|  |  |  |                                 SingleImageViewer(imageUrl:ApiService.baseImgPath + files[index]), | 
					
						
							|  |  |  |                                 context, | 
					
						
							|  |  |  |                               ); | 
					
						
							|  |  |  |                             }, | 
					
						
							|  |  |  |                           ), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                           // 隐患视频
 | 
					
						
							|  |  |  |                           if (videoList.isNotEmpty) ...[ | 
					
						
							|  |  |  |                             const SizedBox(height: 16), | 
					
						
							|  |  |  |                             const Text('隐患视频', style: TextStyle(fontWeight: FontWeight.bold)), | 
					
						
							|  |  |  |                             GestureDetector( | 
					
						
							|  |  |  |                               onTap: () { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                                 showDialog( | 
					
						
							|  |  |  |                                   context: context, | 
					
						
							|  |  |  |                                   barrierColor: Colors.black54, | 
					
						
							|  |  |  |                                   builder: (_) => VideoPlayerPopup(videoUrl: ApiService.baseImgPath + videoList[0]['FILEPATH']), | 
					
						
							|  |  |  |                                 ); | 
					
						
							|  |  |  |                                 // present(
 | 
					
						
							|  |  |  |                                 //   BigVideoViewer(videoUrl:ApiService.baseImgPath + videoList[0]['FILEPATH']),
 | 
					
						
							|  |  |  |                                 //   context,
 | 
					
						
							|  |  |  |                                 // );
 | 
					
						
							|  |  |  |                               }, | 
					
						
							|  |  |  |                               // => _playVideo(ApiService.baseImgPath + videoList[0]['FILEPATH']),
 | 
					
						
							|  |  |  |                               child: Image.asset( | 
					
						
							|  |  |  |                                 'assets/image/videostart.png', // 替换为你的视频占位图
 | 
					
						
							|  |  |  |                                 color: Colors.blue, | 
					
						
							|  |  |  |                                 width: 120, | 
					
						
							|  |  |  |                                 height: 120, | 
					
						
							|  |  |  |                               ), | 
					
						
							|  |  |  |                             ), | 
					
						
							|  |  |  |                           ], | 
					
						
							|  |  |  |                         ], | 
					
						
							|  |  |  |                       ) | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |                     ), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     SizedBox(height: 10,), | 
					
						
							|  |  |  |                     // 整改信息部分
 | 
					
						
							|  |  |  |                     // if (pd['STATE'] != null && int.parse(pd['STATE']) >= 2 && int.parse(pd['STATE']) <= 4) ...[
 | 
					
						
							|  |  |  |                     //   // const Divider(height: 10,color: Colors.grey,),
 | 
					
						
							|  |  |  |                     //   const Text('整改信息', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
 | 
					
						
							|  |  |  |                     //   Divider(height: 1),
 | 
					
						
							|  |  |  |                     //   _buildInfoItem('整改描述', pd['RECTIFYDESCR'] ?? ''),
 | 
					
						
							|  |  |  |                     //   Divider(height: 1),
 | 
					
						
							|  |  |  |                     //   _buildInfoItem('整改部门', pd['RECTIFICATIONDEPTNAME'] ?? ''),
 | 
					
						
							|  |  |  |                     //   Divider(height: 1),
 | 
					
						
							|  |  |  |                     //   _buildInfoItem('整改人', pd['RECTIFICATIONORNAME'] ?? ''),
 | 
					
						
							|  |  |  |                     //   Divider(height: 1),
 | 
					
						
							|  |  |  |                     //   _buildInfoItem('整改时间', pd['RECTIFICATIONTIME'] ?? ''),
 | 
					
						
							|  |  |  |                     //   Divider(height: 1),
 | 
					
						
							|  |  |  |                     //   // const Text('整改后图片', style: TextStyle(fontWeight: FontWeight.bold)),
 | 
					
						
							|  |  |  |                     //   // _buildImageGrid(files2, onTap: (index) => _showImageGallery(files2, index)),
 | 
					
						
							|  |  |  |                     //   ListItemFactory.createTextImageItem(
 | 
					
						
							|  |  |  |                     //     text: "整改后图片",
 | 
					
						
							|  |  |  |                     //     imageUrls: files2,
 | 
					
						
							|  |  |  |                     //     onImageTapped: (index) {
 | 
					
						
							|  |  |  |                     //       present(
 | 
					
						
							|  |  |  |                     //         SingleImageViewer(imageUrl: ApiService.baseImgPath +files2[index]),
 | 
					
						
							|  |  |  |                     //         context,
 | 
					
						
							|  |  |  |                     //       );
 | 
					
						
							|  |  |  |                     //     },
 | 
					
						
							|  |  |  |                     //   ),
 | 
					
						
							|  |  |  |                     //
 | 
					
						
							|  |  |  |                     //   // ... 其他整改信息字段
 | 
					
						
							|  |  |  |                     // ],
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     // 添加底部安全区域间距
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     // 隐患整改
 | 
					
						
							|  |  |  |                     _danner_type_wait(), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     SizedBox(height: MediaQuery.of(context).padding.bottom + 20), | 
					
						
							|  |  |  |                   ], | 
					
						
							|  |  |  |                 ), | 
					
						
							|  |  |  |               ), | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |           ); | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /// 隐患整改
 | 
					
						
							|  |  |  |   Widget _danner_type_wait() { | 
					
						
							|  |  |  |     return SizedBox( | 
					
						
							|  |  |  |       child: Column( | 
					
						
							|  |  |  |         children: [ | 
					
						
							|  |  |  |           ListItemFactory.createYesNoSection( | 
					
						
							|  |  |  |             horizontalPadding: 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             title: '是否正常整改', | 
					
						
							|  |  |  |             yesLabel: '是', | 
					
						
							|  |  |  |             noLabel: '否', | 
					
						
							|  |  |  |             groupValue: _accepted, | 
					
						
							|  |  |  |             onChanged: (val) { | 
					
						
							|  |  |  |               setState(() { | 
					
						
							|  |  |  |                 _accepted = val; | 
					
						
							|  |  |  |               }); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // 整改选项
 | 
					
						
							|  |  |  |           _accepted ? _getRepairState() : _noAccepet_repair(_accepted), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           const SizedBox(height: 20), | 
					
						
							|  |  |  |           CustomButton( | 
					
						
							|  |  |  |             text: "提交", | 
					
						
							|  |  |  |             backgroundColor: Colors.blue, | 
					
						
							|  |  |  |             onPressed: () { | 
					
						
							|  |  |  |               // ToastUtil
 | 
					
						
							|  |  |  |               //接口请求
 | 
					
						
							|  |  |  |               // _submitToServer();
 | 
					
						
							|  |  |  |               _accepted ? _normalRectificationSubmission() : _rectificationSubmission(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Widget _getRepairState() { | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |     dannerRepair= DannerRepair(pd,key: dannerRepairKey, ); | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |      return dannerRepair; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // #region 不整改
 | 
					
						
							|  |  |  |   Widget _noAccepet_repair(bool _accept) { | 
					
						
							|  |  |  |     return Column( | 
					
						
							|  |  |  |       children: [ | 
					
						
							|  |  |  |         GestureDetector( | 
					
						
							|  |  |  |           onTap: () { | 
					
						
							|  |  |  |             showModalBottomSheet( | 
					
						
							|  |  |  |               context: context, | 
					
						
							|  |  |  |               isScrollControlled: true, | 
					
						
							|  |  |  |               barrierColor: Colors.black54, | 
					
						
							|  |  |  |               backgroundColor: Colors.transparent, | 
					
						
							|  |  |  |               builder: (ctx) => DepartmentPicker(onSelected: (id, name) async { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 setState(() { | 
					
						
							|  |  |  |                    buMenId=id; | 
					
						
							|  |  |  |                    buMenName=name; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                   // 清空已选人员
 | 
					
						
							|  |  |  |                    renYuanId=""; | 
					
						
							|  |  |  |                    renYuanName=""; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |                 // 拉取该单位的人员列表并缓存
 | 
					
						
							|  |  |  |                 final result = await ApiService.getListTreePersonList(id); | 
					
						
							| 
									
										
										
										
											2025-09-08 17:53:44 +08:00
										 |  |  |                setState(() { | 
					
						
							|  |  |  |                  _personCache=List<Map<String, dynamic>>.from( | 
					
						
							|  |  |  |                    result['userList'] as List, | 
					
						
							|  |  |  |                  ); | 
					
						
							|  |  |  |                }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |               }), | 
					
						
							|  |  |  |             ); | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |           child: Container( | 
					
						
							|  |  |  |           padding: EdgeInsets.symmetric(horizontal: 10), | 
					
						
							|  |  |  |           decoration: BoxDecoration( | 
					
						
							|  |  |  |             color: Colors.white, | 
					
						
							|  |  |  |             borderRadius: BorderRadius.circular(5), | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |           child: ListItemFactory.createRowSpaceBetweenItem( | 
					
						
							|  |  |  |             leftText: "整改部门", | 
					
						
							|  |  |  |             rightText: buMenName, | 
					
						
							|  |  |  |             isRight: true, | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |         Divider( | 
					
						
							|  |  |  |           height: 10, | 
					
						
							|  |  |  |           color: _accept ? h_backGroundColor() : Colors.transparent, | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |         GestureDetector( | 
					
						
							|  |  |  |           onTap: () { | 
					
						
							| 
									
										
										
										
											2025-09-08 17:53:44 +08:00
										 |  |  |             if ( buMenId.isEmpty) { | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |               ToastUtil.showNormal(context, '请先选择部门'); | 
					
						
							|  |  |  |               return; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             DepartmentPersonPicker.show( | 
					
						
							|  |  |  |               context, | 
					
						
							|  |  |  |               personsData: _personCache, | 
					
						
							|  |  |  |               onSelected: (userId, name) { | 
					
						
							|  |  |  |                 setState(() { | 
					
						
							|  |  |  |                   renYuanId = userId; | 
					
						
							|  |  |  |                   renYuanName = name; | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |               }, | 
					
						
							|  |  |  |             ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |           child: Container( | 
					
						
							|  |  |  |           padding: EdgeInsets.symmetric(horizontal: 10), | 
					
						
							|  |  |  |           decoration: BoxDecoration( | 
					
						
							|  |  |  |             color: Colors.white, | 
					
						
							|  |  |  |             borderRadius: BorderRadius.circular(5), | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |           child: ListItemFactory.createRowSpaceBetweenItem( | 
					
						
							|  |  |  |             leftText: "整改负责人", | 
					
						
							|  |  |  |             rightText: renYuanName, | 
					
						
							|  |  |  |             isRight: true, | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |       ], | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Future<void> _normalRectificationSubmission() async { | 
					
						
							| 
									
										
										
										
											2025-08-15 17:11:26 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       String dataTime= dannerRepairKey.currentState!.dataTime; | 
					
						
							|  |  |  |       if(dataTime.isEmpty){ | 
					
						
							|  |  |  |         ToastUtil.showNormal(context, "请选择整改时间"); | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       String miaoShu= dannerRepairKey.currentState!.miaoShuController.text.trim(); | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |       if(miaoShu.isEmpty){ | 
					
						
							|  |  |  |         ToastUtil.showNormal(context, "请填整改描述"); | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |      List<String> gaiHouImages = dannerRepairKey.currentState!.gaiHouImages; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |      if(gaiHouImages.isEmpty){ | 
					
						
							|  |  |  |        ToastUtil.showNormal(context, "请上传整改后照片"); | 
					
						
							|  |  |  |        return; | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |      String acceptedPrepareType="0"; | 
					
						
							|  |  |  |      String standard=""; | 
					
						
							|  |  |  |      String method=""; | 
					
						
							|  |  |  |      String fund=""; | 
					
						
							|  |  |  |      String person=""; | 
					
						
							|  |  |  |      String workTime=""; | 
					
						
							|  |  |  |      String time=""; | 
					
						
							|  |  |  |      String work=""; | 
					
						
							|  |  |  |      String other=""; | 
					
						
							|  |  |  |      List<String> fangAnImages =[]; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |      // 是否有整改方案
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |      bool acceptedPrepare= dannerRepairKey.currentState!.acceptedPrepare; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |      if(acceptedPrepare){ | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |         acceptedPrepareType="1"; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |         standard= dannerRepairKey.currentState!.standardController.text; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |        if(standard.isEmpty){ | 
					
						
							|  |  |  |          ToastUtil.showNormal(context, "请输入治理标准要求"); | 
					
						
							|  |  |  |          return; | 
					
						
							|  |  |  |        } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |         method= dannerRepairKey.currentState!.methodController.text; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |        if(method.isEmpty){ | 
					
						
							|  |  |  |          ToastUtil.showNormal(context, "请输入治理方法"); | 
					
						
							|  |  |  |          return; | 
					
						
							|  |  |  |        } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |         fund= dannerRepairKey.currentState!.fundController.text; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |        if(fund.isEmpty){ | 
					
						
							|  |  |  |          ToastUtil.showNormal(context, "请输入经费和物资的落实"); | 
					
						
							|  |  |  |          return; | 
					
						
							|  |  |  |        } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |         person= dannerRepairKey.currentState!.personController.text; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |        if(person.isEmpty){ | 
					
						
							|  |  |  |          ToastUtil.showNormal(context, "请输入负责治理人员"); | 
					
						
							|  |  |  |          return; | 
					
						
							|  |  |  |        } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |         workTime= dannerRepairKey.currentState!.workTimeController.text; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |        if(workTime.isEmpty){ | 
					
						
							|  |  |  |          ToastUtil.showNormal(context, "请输入工时安排"); | 
					
						
							|  |  |  |          return; | 
					
						
							|  |  |  |        } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |         time= dannerRepairKey.currentState!.timeController.text; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |        if(time.isEmpty){ | 
					
						
							|  |  |  |          ToastUtil.showNormal(context, "请输入时限要求"); | 
					
						
							|  |  |  |          return; | 
					
						
							|  |  |  |        } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |         work= dannerRepairKey.currentState!.workController.text; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |        if(work.isEmpty){ | 
					
						
							|  |  |  |          ToastUtil.showNormal(context, "请输入工作要求"); | 
					
						
							|  |  |  |          return; | 
					
						
							|  |  |  |        } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |         other= dannerRepairKey.currentState!.otherController.text; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |        if(other.isEmpty){ | 
					
						
							|  |  |  |          ToastUtil.showNormal(context, "请输入工作要求"); | 
					
						
							|  |  |  |          return; | 
					
						
							|  |  |  |        } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |         fangAnImages = dannerRepairKey.currentState!.fangAnImages; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |        if(fangAnImages.isEmpty){ | 
					
						
							|  |  |  |          ToastUtil.showNormal(context, "请上传方案照片"); | 
					
						
							|  |  |  |          return; | 
					
						
							|  |  |  |        } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:51:48 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |      String acceptedPlanType="0"; | 
					
						
							|  |  |  |      List<String> jiHuaImages =[]; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |      // 是否有整改计划
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |      bool acceptedPlan= dannerRepairKey.currentState!.acceptedPlan; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |      if(acceptedPlan){ | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |        acceptedPlanType="1"; | 
					
						
							|  |  |  |        jiHuaImages = dannerRepairKey.currentState!.jiHuaImages; | 
					
						
							|  |  |  |        if(jiHuaImages.isEmpty){ | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |          ToastUtil.showNormal(context, "请上传计划照片"); | 
					
						
							|  |  |  |          return; | 
					
						
							|  |  |  |        } | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-08 16:18:07 +08:00
										 |  |  |      LoadingDialogHelper.show(); | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |      List<DepartmentEntry> departments = dannerRepairKey.currentState!.departments; | 
					
						
							|  |  |  |      bool departmentsAllInput=true; | 
					
						
							|  |  |  |      bool departmentsSameMan=false; | 
					
						
							|  |  |  |      for(int i=0;i<departments.length;i++){ | 
					
						
							|  |  |  |        if( departments[i].responsibleId.isEmpty){ | 
					
						
							|  |  |  |          departmentsAllInput=false; | 
					
						
							|  |  |  |        }else{ | 
					
						
							|  |  |  |          for(int m=i+1;m<departments.length;m++){ | 
					
						
							|  |  |  |            if(departments[i].responsibleId==departments[m].responsibleId){ | 
					
						
							|  |  |  |              departmentsSameMan=true; | 
					
						
							|  |  |  |            } | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  |        } | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      if(!departmentsAllInput){ | 
					
						
							| 
									
										
										
										
											2025-08-08 11:05:06 +08:00
										 |  |  |          LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |        ToastUtil.showNormal(context, "请添加验收部门负责人"); | 
					
						
							|  |  |  |        return; | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      if(departmentsSameMan){ | 
					
						
							| 
									
										
										
										
											2025-08-08 11:05:06 +08:00
										 |  |  |          LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |        ToastUtil.showNormal(context, "不能选择重复的验收部门负责人"); | 
					
						
							|  |  |  |        return; | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       String caertTime=  pd["CREATTIME"]; | 
					
						
							|  |  |  |       String listName=  "";//pd["LIST_NAME"];
 | 
					
						
							|  |  |  |       String id=  pd["HIDDEN_ID"]; | 
					
						
							|  |  |  |       // 转换为 JSON 字符串
 | 
					
						
							|  |  |  |       String json = _convertDepartmentsToJson(departments); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      for(int i=0;i<gaiHouImages.length;i++){ | 
					
						
							|  |  |  |        _addImgFiles(gaiHouImages[i],"4",id) ; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      for(int i=0;i<fangAnImages.length;i++){ | 
					
						
							|  |  |  |        _addImgFiles(fangAnImages[i],"8",id) ; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |      } | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |      for(int i=0;i<jiHuaImages.length;i++){ | 
					
						
							|  |  |  |        _addImgFiles(jiHuaImages[i],"22",id) ; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |      } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-15 17:11:26 +08:00
										 |  |  |       try { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 20:08:10 +08:00
										 |  |  |         final Map<String, dynamic> result; | 
					
						
							|  |  |  |         // if ("4"==widget.item['SOURCE' ]||"5"==widget.item['SOURCE' ]) {
 | 
					
						
							|  |  |  |         //   result = await ApiService.normalRectificationSubmission(
 | 
					
						
							|  |  |  |         //       dataTime, miaoShu, acceptedPrepareType, acceptedPlanType,
 | 
					
						
							|  |  |  |         //       id, caertTime, listName,
 | 
					
						
							|  |  |  |         //       standard, method, fund, person,
 | 
					
						
							|  |  |  |         //       workTime, time, work, other, json);
 | 
					
						
							|  |  |  |         // } else if ("1"==widget.item['HIDDEN_RISKSTANDARD']) {
 | 
					
						
							|  |  |  |         //   result = await ApiService.normalRectificationSubmission(
 | 
					
						
							|  |  |  |         //       dataTime, miaoShu, acceptedPrepareType, acceptedPlanType,
 | 
					
						
							|  |  |  |         //       id, caertTime, listName,
 | 
					
						
							|  |  |  |         //       standard, method, fund, person,
 | 
					
						
							|  |  |  |         //       workTime, time, work, other, json);
 | 
					
						
							|  |  |  |         // } else
 | 
					
						
							|  |  |  |           if ("2"==widget.item['HIDDEN_RISKSTANDARD']) { | 
					
						
							|  |  |  |              result = await ApiService.normalRectificationSubmissionTwo( | 
					
						
							|  |  |  |                 dataTime, miaoShu, acceptedPrepareType, acceptedPlanType, | 
					
						
							|  |  |  |                 id, caertTime, listName, | 
					
						
							|  |  |  |                 standard, method, fund, person, | 
					
						
							|  |  |  |                 workTime, time, work, other, json); | 
					
						
							|  |  |  |         }else{ | 
					
						
							|  |  |  |             result = await ApiService.normalRectificationSubmission( | 
					
						
							|  |  |  |                 dataTime, miaoShu, acceptedPrepareType, acceptedPlanType, | 
					
						
							|  |  |  |                 id, caertTime, listName, | 
					
						
							|  |  |  |                 standard, method, fund, person, | 
					
						
							|  |  |  |                 workTime, time, work, other, json); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |       if (result['result'] == 'success') { | 
					
						
							|  |  |  |         setState(() { | 
					
						
							| 
									
										
										
										
											2025-08-08 16:18:07 +08:00
										 |  |  |           LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |           ToastUtil.showNormal(context, "提交成功"); | 
					
						
							|  |  |  |           Navigator.of(context).pop(); | 
					
						
							|  |  |  |           widget.onClose('关闭详情'); // 触发回调
 | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       }else{ | 
					
						
							| 
									
										
										
										
											2025-08-08 11:05:06 +08:00
										 |  |  |         LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |         ToastUtil.showNormal(context, "加载数据失败"); | 
					
						
							| 
									
										
										
										
											2025-09-09 20:08:10 +08:00
										 |  |  |         // final result = await ApiService.normalRectificationSubmissionTwo(
 | 
					
						
							|  |  |  |         //     dataTime, miaoShu, acceptedPrepareType, acceptedPlanType,
 | 
					
						
							|  |  |  |         //     id, caertTime, listName,
 | 
					
						
							|  |  |  |         //     standard, method, fund, person,
 | 
					
						
							|  |  |  |         //     workTime, time, work, other, json);
 | 
					
						
							|  |  |  |         // // LoadingDialogHelper.hide();
 | 
					
						
							|  |  |  |         // if (result['result'] == 'success') {
 | 
					
						
							|  |  |  |         //   setState(() {
 | 
					
						
							|  |  |  |         //
 | 
					
						
							|  |  |  |         //     ToastUtil.showNormal(context, "提交成功");
 | 
					
						
							|  |  |  |         //     Navigator.of(context).pop();
 | 
					
						
							|  |  |  |         //     widget.onClose('关闭详情'); // 触发回调
 | 
					
						
							|  |  |  |         //   });
 | 
					
						
							|  |  |  |         //
 | 
					
						
							|  |  |  |         // }else{
 | 
					
						
							|  |  |  |         //   // LoadingDialogHelper.hide();
 | 
					
						
							|  |  |  |         //   ToastUtil.showNormal(context, "加载数据失败");
 | 
					
						
							|  |  |  |         // }
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |       } | 
					
						
							|  |  |  |     } catch (e) { | 
					
						
							| 
									
										
										
										
											2025-08-08 11:05:06 +08:00
										 |  |  |       LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-08-15 17:11:26 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |       // 出错时可以 Toast 或者在页面上显示错误状态
 | 
					
						
							|  |  |  |       print('加载数据失败:$e'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Future<void> _rectificationSubmission() async { | 
					
						
							|  |  |  |     try { | 
					
						
							| 
									
										
										
										
											2025-08-08 11:05:06 +08:00
										 |  |  |         LoadingDialogHelper.show(); | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |       final result = await ApiService.rectificationSubmission(pd["HIDDEN_ID"],buMenId,renYuanId); | 
					
						
							|  |  |  |       if (result['result'] == 'success') { | 
					
						
							|  |  |  |         setState(() { | 
					
						
							| 
									
										
										
										
											2025-08-08 16:18:07 +08:00
										 |  |  |           LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |           ToastUtil.showNormal(context, "提交成功"); | 
					
						
							|  |  |  |           Navigator.of(context).pop(); | 
					
						
							|  |  |  |           widget.onClose('关闭详情'); // 触发回调
 | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       }else{ | 
					
						
							| 
									
										
										
										
											2025-08-08 11:05:06 +08:00
										 |  |  |         LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |         ToastUtil.showNormal(context, "加载数据失败"); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } catch (e) { | 
					
						
							| 
									
										
										
										
											2025-08-08 11:05:06 +08:00
										 |  |  |       LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-08-15 17:11:26 +08:00
										 |  |  |       final result = await ApiService.rectificationSubmissionTwo(pd["HIDDEN_ID"],buMenId,renYuanId); | 
					
						
							|  |  |  |       if (result['result'] == 'success') { | 
					
						
							|  |  |  |         setState(() { | 
					
						
							|  |  |  |           LoadingDialogHelper.hide(); | 
					
						
							|  |  |  |           ToastUtil.showNormal(context, "提交成功"); | 
					
						
							|  |  |  |           Navigator.of(context).pop(); | 
					
						
							|  |  |  |           widget.onClose('关闭详情'); // 触发回调
 | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       }else{ | 
					
						
							|  |  |  |         LoadingDialogHelper.hide(); | 
					
						
							|  |  |  |         ToastUtil.showNormal(context, "加载数据失败"); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |       // 出错时可以 Toast 或者在页面上显示错误状态
 | 
					
						
							|  |  |  |       print('加载数据失败:$e'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |   String _convertDepartmentsToJson(List<DepartmentEntry> departments) { | 
					
						
							|  |  |  |     // 1. 将列表中的每个对象转换为 Map
 | 
					
						
							|  |  |  |     List<Map<String, dynamic>> jsonList = departments | 
					
						
							|  |  |  |         .map((dept) => dept.toJson()) | 
					
						
							|  |  |  |         .toList(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // 2. 使用 jsonEncode 转换为 JSON 字符串
 | 
					
						
							|  |  |  |     return jsonEncode(jsonList); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Future<String> _addImgFiles(String imagePath,String type,String id) async { | 
					
						
							|  |  |  |     try { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       final raw = await ApiService.addImgFiles( imagePath, type, id); | 
					
						
							|  |  |  |       if (raw['result'] == 'success') { | 
					
						
							|  |  |  |         return raw['imgPath']; | 
					
						
							|  |  |  |       }else{ | 
					
						
							|  |  |  |         // _showMessage('反馈提交失败');
 | 
					
						
							|  |  |  |         return ""; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } catch (e) { | 
					
						
							|  |  |  |       // 出错时可以 Toast 或者在页面上显示错误状态
 | 
					
						
							|  |  |  |       print('加载首页数据失败:$e'); | 
					
						
							|  |  |  |       return ""; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   String _getSourceText(String? source) { | 
					
						
							|  |  |  |     switch (source) { | 
					
						
							|  |  |  |       case '1': return '隐患快报'; | 
					
						
							| 
									
										
										
										
											2025-09-19 18:01:23 +08:00
										 |  |  |       case '2': return '隐患排查'; | 
					
						
							|  |  |  |       case '3': return '标准排查'; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |       case '4': return '专项检查'; | 
					
						
							|  |  |  |       case '5': return '安全检查'; | 
					
						
							| 
									
										
										
										
											2025-08-29 09:52:48 +08:00
										 |  |  |       case '6': return 'NFC设备巡检'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |       default: return ''; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   String _getRectificationType(String? type) { | 
					
						
							|  |  |  |     switch (type) { | 
					
						
							|  |  |  |       case '1': return '立即整改'; | 
					
						
							|  |  |  |       case '2': return '限期整改'; | 
					
						
							|  |  |  |       default: return ''; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 |