| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | import 'dart:io'; | 
					
						
							|  |  |  | import 'package:flutter/material.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | import 'package:intl/intl.dart'; | 
					
						
							|  |  |  | import 'package:qhd_prevention/customWidget/department_person_picker.dart'; | 
					
						
							|  |  |  | import 'package:qhd_prevention/customWidget/department_picker.dart'; | 
					
						
							| 
									
										
										
										
											2025-09-06 16:52:08 +08:00
										 |  |  | import 'package:qhd_prevention/customWidget/picker/CupertinoDatePicker.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | import 'package:qhd_prevention/customWidget/toast_util.dart'; | 
					
						
							|  |  |  | import 'package:qhd_prevention/http/ApiService.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 '../../customWidget/ItemWidgetFactory.dart'; | 
					
						
							|  |  |  | import '../../customWidget/custom_button.dart'; | 
					
						
							|  |  |  | import '../../customWidget/date_picker_dialog.dart'; | 
					
						
							|  |  |  | import '../../customWidget/photo_picker_row.dart'; | 
					
						
							|  |  |  | import '../../tools/h_colors.dart'; | 
					
						
							|  |  |  | import '../../tools/tools.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DepartmentEntry { | 
					
						
							|  |  |  |   String department; | 
					
						
							|  |  |  |   String responsible; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |   String index; | 
					
						
							|  |  |  |   String departmentId; | 
					
						
							|  |  |  |   String responsibleId; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |   DepartmentEntry({ | 
					
						
							|  |  |  |     required this.department, | 
					
						
							|  |  |  |     required this.responsible, | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     required this.index, | 
					
						
							|  |  |  |     required this.departmentId, | 
					
						
							|  |  |  |     required this.responsibleId, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // 将对象转换为 Map
 | 
					
						
							|  |  |  |   Map<String, dynamic> toJson() { | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       'DEPARTMENT_ID': departmentId, | 
					
						
							|  |  |  |       'USER_ID': responsibleId, | 
					
						
							|  |  |  |       'DEPARTMENT_NAME': department, | 
					
						
							|  |  |  |       'USER_NAME': responsible, | 
					
						
							|  |  |  |       'index': index, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | /// 隐患整改
 | 
					
						
							|  |  |  | class DannerRepair extends StatefulWidget { | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |    DannerRepair(this.pd, {super.key}); | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |   final Map<String, dynamic> pd; | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |   @override | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |   State<DannerRepair> createState() => DannerRepairState(); | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  | class DannerRepairState extends State<DannerRepair> { | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // 是否有整改方案
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |   bool acceptedPrepare = false; | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // 是否有整改计划
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |   bool acceptedPlan = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   final standardController = TextEditingController(); | 
					
						
							|  |  |  |   final methodController = TextEditingController(); | 
					
						
							|  |  |  |   final fundController = TextEditingController(); | 
					
						
							|  |  |  |   final personController = TextEditingController(); | 
					
						
							|  |  |  |   final workTimeController = TextEditingController(); | 
					
						
							|  |  |  |   final timeController = TextEditingController(); | 
					
						
							|  |  |  |   final workController = TextEditingController(); | 
					
						
							|  |  |  |   final otherController = TextEditingController(); | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |   final TextEditingController miaoShuController = TextEditingController(); | 
					
						
							| 
									
										
										
										
											2025-07-17 16:10:46 +08:00
										 |  |  |   late var _selectData = DateTime.now(); | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |   String dataTime=""; | 
					
						
							|  |  |  |   // 整改后图片
 | 
					
						
							|  |  |  |   List<String> gaiHouImages = []; | 
					
						
							|  |  |  |   //方案图片
 | 
					
						
							|  |  |  |   List<String> fangAnImages = []; | 
					
						
							|  |  |  |   //计划图片
 | 
					
						
							|  |  |  |   List<String> jiHuaImages = []; | 
					
						
							|  |  |  |   int yanShouAdd=1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |   final List<DepartmentEntry> departments = [ | 
					
						
							|  |  |  |     DepartmentEntry(department: '请选择', responsible: '请选择',index:'',departmentId: '',responsibleId:''), | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |   ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void _addDepartment() { | 
					
						
							|  |  |  |     setState(() { | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |       departments.add(DepartmentEntry(department: '请选择', responsible: '请选择',index:'',departmentId: '',responsibleId:'')); | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |     }); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void _removeDepartment(int index) { | 
					
						
							|  |  |  |     if (index == 0) return; // 防止删除第一行
 | 
					
						
							|  |  |  |     setState(() { | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |       departments.removeAt(index); | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |     }); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   void initState() { | 
					
						
							|  |  |  |     // TODO: implement initState
 | 
					
						
							|  |  |  |     super.initState(); | 
					
						
							|  |  |  |     // _yanShouFuZeItem.add(_departmentItem(0));
 | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |   @override | 
					
						
							|  |  |  |   void dispose() { | 
					
						
							|  |  |  |     // 释放资源
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |     standardController.dispose(); | 
					
						
							|  |  |  |     methodController.dispose(); | 
					
						
							|  |  |  |     fundController.dispose(); | 
					
						
							|  |  |  |     personController.dispose(); | 
					
						
							|  |  |  |     workTimeController.dispose(); | 
					
						
							|  |  |  |     timeController.dispose(); | 
					
						
							|  |  |  |     workController.dispose(); | 
					
						
							|  |  |  |     otherController.dispose(); | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |     miaoShuController.dispose(); | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     super.dispose(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   Widget build(BuildContext context) { | 
					
						
							|  |  |  |     return Container( | 
					
						
							|  |  |  |       padding: EdgeInsets.only(bottom: 10), | 
					
						
							|  |  |  |       decoration: BoxDecoration( | 
					
						
							|  |  |  |         color: Colors.white, | 
					
						
							|  |  |  |         borderRadius: BorderRadius.circular(5), | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |       child: Column( | 
					
						
							|  |  |  |         children: [ | 
					
						
							|  |  |  |           ListItemFactory.createBuildSimpleSection("隐患整改"), | 
					
						
							|  |  |  |           Divider(height: 1), | 
					
						
							|  |  |  |           Container( | 
					
						
							| 
									
										
										
										
											2025-09-10 18:06:56 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |             padding: EdgeInsets.all(15), | 
					
						
							|  |  |  |             child: Column( | 
					
						
							|  |  |  |               children: [ | 
					
						
							| 
									
										
										
										
											2025-09-10 18:06:56 +08:00
										 |  |  |                 ListItemFactory.createBuildMultilineInput( | 
					
						
							|  |  |  |                   isRequired:true, | 
					
						
							|  |  |  |                   "隐患描述", | 
					
						
							|  |  |  |                   "请对隐患进行详细描述(必填项)", | 
					
						
							|  |  |  |                   miaoShuController, | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |                 ), | 
					
						
							| 
									
										
										
										
											2025-09-10 18:06:56 +08:00
										 |  |  |                 // Row(
 | 
					
						
							|  |  |  |                 //   children: [
 | 
					
						
							|  |  |  |                 //     Text('* ', style: TextStyle(color: Colors.red)),
 | 
					
						
							|  |  |  |                 //     HhTextStyleUtils.mainTitle("隐患描述", fontSize: 15)],
 | 
					
						
							|  |  |  |                 // ),
 | 
					
						
							|  |  |  |                 // TextField(
 | 
					
						
							|  |  |  |                 //   controller: miaoShuController,
 | 
					
						
							|  |  |  |                 //   keyboardType: TextInputType.multiline,
 | 
					
						
							|  |  |  |                 //   maxLines: null, // 不限制行数,输入多少文字就撑开多少行
 | 
					
						
							|  |  |  |                 //   style: TextStyle(fontSize: 15),
 | 
					
						
							|  |  |  |                 //   decoration: InputDecoration(
 | 
					
						
							|  |  |  |                 //     hintText: '请对隐患进行详细描述(必填项)',
 | 
					
						
							|  |  |  |                 //     border: InputBorder.none,
 | 
					
						
							|  |  |  |                 //   ),
 | 
					
						
							|  |  |  |                 // ),
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |               ], | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |           Divider(height: 1), | 
					
						
							|  |  |  |           GestureDetector( | 
					
						
							| 
									
										
										
										
											2025-09-06 16:52:08 +08:00
										 |  |  |             onTap: () async { | 
					
						
							|  |  |  |               DateTime? picked = await BottomDateTimePicker.showDate( | 
					
						
							|  |  |  |                 mode: BottomPickerMode.date, | 
					
						
							|  |  |  |                 context, | 
					
						
							|  |  |  |                 allowPast:false, | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |               ); | 
					
						
							| 
									
										
										
										
											2025-09-06 16:52:08 +08:00
										 |  |  |               if (picked != null) { | 
					
						
							|  |  |  |                 setState(() { | 
					
						
							|  |  |  |                    _selectData = picked; | 
					
						
							|  |  |  |                    dataTime= DateFormat('yyyy-MM-dd').format(picked); | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |                 //FocusHelper.clearFocus(context);
 | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |               // showDialog(
 | 
					
						
							|  |  |  |               //   context: context,
 | 
					
						
							|  |  |  |               //   builder:
 | 
					
						
							|  |  |  |               //       (_) => HDatePickerDialog(
 | 
					
						
							|  |  |  |               //     initialDate: DateTime.now(),
 | 
					
						
							|  |  |  |               //     onCancel: () => Navigator.of(context).pop(),
 | 
					
						
							|  |  |  |               //     onConfirm: (selected) {
 | 
					
						
							|  |  |  |               //       Navigator.of(context).pop();
 | 
					
						
							|  |  |  |               //       setState(() {
 | 
					
						
							|  |  |  |               //         _selectData = selected;
 | 
					
						
							|  |  |  |               //         dataTime= DateFormat('yyyy-MM-dd').format(selected);
 | 
					
						
							|  |  |  |               //
 | 
					
						
							|  |  |  |               //       });
 | 
					
						
							|  |  |  |               //     },
 | 
					
						
							|  |  |  |               //   ),
 | 
					
						
							|  |  |  |               // );
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |             }, | 
					
						
							|  |  |  |             child: Padding( | 
					
						
							|  |  |  |               padding: EdgeInsets.symmetric(horizontal: 15), | 
					
						
							|  |  |  |               child: ListItemFactory.createRowSpaceBetweenItem( | 
					
						
							| 
									
										
										
										
											2025-09-06 16:52:08 +08:00
										 |  |  |                 isRequired:true, | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |                 leftText: "整改日期", | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |                 rightText: dataTime.isEmpty?"请选择":dataTime, | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |                 isRight: true, | 
					
						
							|  |  |  |               ), | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |           Divider(), | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |           ItemListWidget.itemContainer( | 
					
						
							|  |  |  |             RepairedPhotoSection( | 
					
						
							| 
									
										
										
										
											2025-09-06 16:52:08 +08:00
										 |  |  |               isRequired:true, | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |               title: "整改后照片", | 
					
						
							|  |  |  |               maxCount: 4, | 
					
						
							|  |  |  |               mediaType: MediaType.image, | 
					
						
							|  |  |  |               onChanged: (files) { | 
					
						
							|  |  |  |                 // 上传 files 到服务器
 | 
					
						
							|  |  |  |                 gaiHouImages.clear(); | 
					
						
							|  |  |  |                 for(int i=0;i<files.length;i++){ | 
					
						
							|  |  |  |                   gaiHouImages.add(files[i].path); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |               }, | 
					
						
							|  |  |  |               onAiIdentify: () { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |               }, | 
					
						
							|  |  |  |             ), | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |           ), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           Divider(), | 
					
						
							|  |  |  |           Row( | 
					
						
							|  |  |  |             mainAxisAlignment: MainAxisAlignment.end, | 
					
						
							|  |  |  |             children: [ | 
					
						
							|  |  |  |               CustomButton( | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |                 onPressed: () { | 
					
						
							|  |  |  |                   _addDepartment(); | 
					
						
							|  |  |  |                 }, | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |                 text: "添加", | 
					
						
							|  |  |  |                 backgroundColor: Colors.blue, | 
					
						
							|  |  |  |                 borderRadius: 17, | 
					
						
							|  |  |  |                 height: 34, | 
					
						
							|  |  |  |                 padding: EdgeInsets.symmetric(horizontal: 20), | 
					
						
							|  |  |  |               ), | 
					
						
							|  |  |  |             ], | 
					
						
							|  |  |  |           ), | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           Column( | 
					
						
							|  |  |  |             children: List.generate( | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |               departments.length, | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |                   (index) => _departmentItem( | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |                 departments[index], | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |                 index, | 
					
						
							|  |  |  |                 showLabel: index == 0, | 
					
						
							|  |  |  |               ), | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // for(int m=0;m<_yanShouFuZeItem.length;m++)
 | 
					
						
							|  |  |  |           //   _yanShouFuZeItem[m],
 | 
					
						
							|  |  |  |           // _departmentItem(m),
 | 
					
						
							|  |  |  |           // _departmentItem(2),
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |           Divider(), | 
					
						
							|  |  |  |           ListItemFactory.createYesNoSection( | 
					
						
							|  |  |  |             title: "是否有整改方案", | 
					
						
							|  |  |  |             yesLabel: "是", | 
					
						
							|  |  |  |             noLabel: "否", | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |             groupValue: acceptedPrepare, | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |             onChanged: (val) { | 
					
						
							|  |  |  |               setState(() { | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |                 acceptedPrepare = val; | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |               }); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |           ), | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |           acceptedPrepare ? _acceptPrepare() : SizedBox(height: 1), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           Divider(), | 
					
						
							|  |  |  |           // 图片上传
 | 
					
						
							|  |  |  |           // const SizedBox(height: 16),
 | 
					
						
							|  |  |  |           if(acceptedPrepare) | 
					
						
							|  |  |  |           RepairedPhotoSection( | 
					
						
							| 
									
										
										
										
											2025-09-03 18:03:04 +08:00
										 |  |  |             horizontalPadding: 15, | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |             title: "方案图片", | 
					
						
							|  |  |  |             maxCount: 4, | 
					
						
							|  |  |  |             mediaType: MediaType.image, | 
					
						
							|  |  |  |             onChanged: (files) { | 
					
						
							|  |  |  |               // 上传 files 到服务器
 | 
					
						
							|  |  |  |               fangAnImages.clear(); | 
					
						
							|  |  |  |               for(int i=0;i<files.length;i++){ | 
					
						
							|  |  |  |                 fangAnImages.add(files[i].path); | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             onAiIdentify: () { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |           Divider(), | 
					
						
							|  |  |  |           ListItemFactory.createYesNoSection( | 
					
						
							|  |  |  |             title: "是否有整改计划", | 
					
						
							|  |  |  |             yesLabel: "是", | 
					
						
							|  |  |  |             noLabel: "否", | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |             groupValue: acceptedPlan, | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |             onChanged: (val) { | 
					
						
							|  |  |  |               setState(() { | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |                 acceptedPlan = val; | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |               }); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |           ), | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |           acceptedPlan ? _acceptPlan() : SizedBox(height: 1), | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         ], | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   /// 整改方案
 | 
					
						
							|  |  |  |   Widget _acceptPrepare() { | 
					
						
							|  |  |  |     final fields = [ | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |       _buildReadOnlyRow("排查日期", widget.pd["CREATTIME"]), | 
					
						
							| 
									
										
										
										
											2025-09-05 09:27:46 +08:00
										 |  |  |       if(FormUtils.hasValue(widget.pd, "LIST_NAME")) | 
					
						
							|  |  |  |       _buildReadOnlyRow("隐患清单", widget.pd["LIST_NAME"]), | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |       ListItemFactory.createBuildMultilineInput("治理标准", "请输入治理标准", standardController), | 
					
						
							|  |  |  |       ListItemFactory.createBuildMultilineInput("治理方法", "请输入治理方法", methodController), | 
					
						
							|  |  |  |       ListItemFactory.createBuildMultilineInput("经费落实", "请输入经费落实", fundController), | 
					
						
							|  |  |  |       ListItemFactory.createBuildMultilineInput("负责人员", "请输入负责人员", personController), | 
					
						
							|  |  |  |       ListItemFactory.createBuildMultilineInput("工时安排", "请输入工时安排", workTimeController), | 
					
						
							|  |  |  |       ListItemFactory.createBuildMultilineInput("时限要求", "请输入时限要求", timeController), | 
					
						
							|  |  |  |       ListItemFactory.createBuildMultilineInput("工作要求", "请输入工作要求", workController), | 
					
						
							|  |  |  |       ListItemFactory.createBuildMultilineInput("其他事项", "请输入其他事项", otherController), | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return ListView.separated( | 
					
						
							|  |  |  |       shrinkWrap: true, | 
					
						
							|  |  |  |       physics: const NeverScrollableScrollPhysics(), | 
					
						
							|  |  |  |       itemCount: fields.length, | 
					
						
							|  |  |  |       separatorBuilder: | 
					
						
							|  |  |  |           (_, __) => const Divider(height: 1, color: Colors.black12), | 
					
						
							|  |  |  |       itemBuilder: | 
					
						
							|  |  |  |           (_, index) => Padding( | 
					
						
							|  |  |  |         padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), | 
					
						
							|  |  |  |         child: fields[index], | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Widget _buildReadOnlyRow(String left, String right) { | 
					
						
							|  |  |  |     return ListItemFactory.createRowSpaceBetweenItem( | 
					
						
							|  |  |  |       leftText: left, | 
					
						
							|  |  |  |       rightText: right, | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /// 验收部门和负责人选择的item
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |   Widget _departmentItem( | 
					
						
							|  |  |  |       DepartmentEntry entry, | 
					
						
							|  |  |  |       int index, { | 
					
						
							|  |  |  |         required bool showLabel, | 
					
						
							|  |  |  |       }) { | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |     return Padding( | 
					
						
							|  |  |  |       padding: const EdgeInsets.all(10), | 
					
						
							|  |  |  |       child: Stack( | 
					
						
							|  |  |  |         clipBehavior: Clip.none, | 
					
						
							|  |  |  |         children: [ | 
					
						
							|  |  |  |           Container( | 
					
						
							|  |  |  |             decoration: BoxDecoration( | 
					
						
							|  |  |  |               border: Border.all(color: Colors.black12, width: 1), | 
					
						
							|  |  |  |             ), | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |             child: _noAccepet_repair(false,index), | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |           ), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // 当 num > 1 时,左上角显示删除按钮
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |           if (index > 0) | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |             Positioned( | 
					
						
							|  |  |  |               top: -20, | 
					
						
							|  |  |  |               left: -20, | 
					
						
							|  |  |  |               child: IconButton( | 
					
						
							|  |  |  |                 padding: EdgeInsets.zero, | 
					
						
							|  |  |  |                 constraints: const BoxConstraints(), | 
					
						
							|  |  |  |                 icon: const Icon(Icons.cancel, color: Colors.red, size: 25), | 
					
						
							|  |  |  |                 onPressed: () { | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |                   _removeDepartment(index); | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |                   // 这里处理删除逻辑,比如:
 | 
					
						
							|  |  |  |                   // setState(() => _items.removeAt(num));
 | 
					
						
							|  |  |  |                 }, | 
					
						
							|  |  |  |               ), | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // 存储各单位的人员列表
 | 
					
						
							|  |  |  |   List<Map<String, dynamic>> _personCache = []; | 
					
						
							|  |  |  |   // #region 不整改
 | 
					
						
							|  |  |  |   Widget _noAccepet_repair(bool _accept,int index, ) { | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |     return Column( | 
					
						
							|  |  |  |       children: [ | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |         GestureDetector( | 
					
						
							|  |  |  |         onTap: () { | 
					
						
							|  |  |  |           showModalBottomSheet( | 
					
						
							|  |  |  |             context: context, | 
					
						
							|  |  |  |             isScrollControlled: true, | 
					
						
							|  |  |  |             barrierColor: Colors.black54, | 
					
						
							|  |  |  |             backgroundColor: Colors.transparent, | 
					
						
							|  |  |  |             builder: (ctx) => DepartmentPicker(onSelected: (id, name) async { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |               setState(() { | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |                 // buMenId=id;
 | 
					
						
							|  |  |  |                 // buMenName=name;
 | 
					
						
							|  |  |  |                 //
 | 
					
						
							|  |  |  |                 // // 清空已选人员
 | 
					
						
							|  |  |  |                 // renYuanId="";
 | 
					
						
							|  |  |  |                 // renYuanName="";
 | 
					
						
							|  |  |  |                 departments[index].department=name; | 
					
						
							|  |  |  |                 departments[index].departmentId=id; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 departments[index].responsible=""; | 
					
						
							|  |  |  |                 departments[index].responsibleId=""; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |               }); | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |               // 拉取该单位的人员列表并缓存
 | 
					
						
							|  |  |  |               final result = await ApiService.getListTreePersonList(id); | 
					
						
							|  |  |  |               _personCache=List<Map<String, dynamic>>.from( | 
					
						
							|  |  |  |                 result['userList'] as List, | 
					
						
							|  |  |  |               ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             }), | 
					
						
							|  |  |  |           ); | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         child: Container( | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |           padding: EdgeInsets.symmetric(horizontal: 10), | 
					
						
							|  |  |  |           decoration: BoxDecoration( | 
					
						
							|  |  |  |             color: Colors.white, | 
					
						
							|  |  |  |             borderRadius: BorderRadius.circular(5), | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |           child: ListItemFactory.createRowSpaceBetweenItem( | 
					
						
							| 
									
										
										
										
											2025-09-08 14:17:00 +08:00
										 |  |  |             isRequired:true, | 
					
						
							| 
									
										
										
										
											2025-08-29 10:00:35 +08:00
										 |  |  |             leftText: "验收部门", | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |             rightText: departments[index].department.isNotEmpty?departments[index].department:"请选择", | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |             isRight: true, | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |         ), | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |         ), | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         Divider( | 
					
						
							|  |  |  |           height: 10, | 
					
						
							|  |  |  |           color: _accept ? h_backGroundColor() : Colors.transparent, | 
					
						
							|  |  |  |         ), | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         GestureDetector( | 
					
						
							|  |  |  |           onTap: () { | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |             if ( departments[index].departmentId.isEmpty) { | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |               ToastUtil.showNormal(context, '请先选择部门'); | 
					
						
							|  |  |  |               return; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             DepartmentPersonPicker.show( | 
					
						
							|  |  |  |               context, | 
					
						
							|  |  |  |               personsData: _personCache, | 
					
						
							|  |  |  |               onSelected: (userId, name) { | 
					
						
							|  |  |  |                 setState(() { | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |                   // renYuanId = userId;
 | 
					
						
							|  |  |  |                   // renYuanName = name;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                   departments[index].responsible=name; | 
					
						
							|  |  |  |                   departments[index].responsibleId=userId; | 
					
						
							|  |  |  |                   departments[index].index=(index-1).toString(); | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |                 }); | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |               }, | 
					
						
							|  |  |  |             ); | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |         child:Container( | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |           padding: EdgeInsets.symmetric(horizontal: 10), | 
					
						
							|  |  |  |           decoration: BoxDecoration( | 
					
						
							|  |  |  |             color: Colors.white, | 
					
						
							|  |  |  |             borderRadius: BorderRadius.circular(5), | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |           child: ListItemFactory.createRowSpaceBetweenItem( | 
					
						
							| 
									
										
										
										
											2025-09-08 14:17:00 +08:00
										 |  |  |             isRequired:true, | 
					
						
							| 
									
										
										
										
											2025-08-29 10:00:35 +08:00
										 |  |  |             leftText: "验收部门负责人", | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |             rightText: departments[index].responsible.isNotEmpty?departments[index].responsible:"请选择", | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |             isRight: true, | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |         ), | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |         ), | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |       ], | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /// 整改计划
 | 
					
						
							|  |  |  |   Widget _acceptPlan() { | 
					
						
							|  |  |  |     return Padding( | 
					
						
							| 
									
										
										
										
											2025-09-10 13:48:52 +08:00
										 |  |  |       padding: EdgeInsets.symmetric(horizontal: 15), | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |       child: MediaPickerRow( | 
					
						
							|  |  |  |         maxCount: 4, | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |         onChanged: (List<File> files) { | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |           // images 列表更新
 | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  |           // 上传 files 到服务器
 | 
					
						
							|  |  |  |           jiHuaImages.clear(); | 
					
						
							|  |  |  |           for(int i=0;i<files.length;i++){ | 
					
						
							|  |  |  |             jiHuaImages.add(files[i].path); | 
					
						
							|  |  |  |           } | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         }, | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |