From 9beb49cd60ecb82998483284e9425864014bedc0 Mon Sep 17 00:00:00 2001 From: xufei <727302827@qq.com> Date: Tue, 16 Jun 2026 09:58:47 +0800 Subject: [PATCH] =?UTF-8?q?2026.6.16=20=20=E9=87=8D=E7=82=B9=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=96=B0=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/home/home_page.dart | 2 +- .../key_tasks_hidden_danger_detail.dart | 99 ++- .../key_tasks_confirm_detail_page.dart | 3 + .../key_tasks_punishment_filter_page.dart | 475 ++++++++++++++ .../key_tasks_punishment_list.dart | 585 ++++++++++++++++++ .../keyTasks/key_tasks_confirm_list_page.dart | 42 ++ .../home/keyTasks/key_tasks_tab_page.dart | 12 + 7 files changed, 1214 insertions(+), 4 deletions(-) create mode 100644 lib/pages/home/keyTasks/keyTasksDetail/punishmentKeyTasks/key_tasks_punishment_filter_page.dart create mode 100644 lib/pages/home/keyTasks/keyTasksDetail/punishmentKeyTasks/key_tasks_punishment_list.dart diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 27c1c67..bd3d870 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -1002,7 +1002,7 @@ class HomePageState extends RouteAwareState case "隐患治理": case "隐患管理": case "风险管控应用": - // await pushPage(ApplicationPageTwo(), context); + await pushPage(HiddenDangerTabPage(), context); break; case "消防检查": // await pushPage(FireManagementTabPage(), context); diff --git a/lib/pages/home/keyTasks/keyTasksDetail/keyTasksHiddenDanger/key_tasks_hidden_danger_detail.dart b/lib/pages/home/keyTasks/keyTasksDetail/keyTasksHiddenDanger/key_tasks_hidden_danger_detail.dart index 9e905e6..0ac85e2 100644 --- a/lib/pages/home/keyTasks/keyTasksDetail/keyTasksHiddenDanger/key_tasks_hidden_danger_detail.dart +++ b/lib/pages/home/keyTasks/keyTasksDetail/keyTasksHiddenDanger/key_tasks_hidden_danger_detail.dart @@ -48,7 +48,7 @@ class KeyTasksHiddenDangerDetail extends StatefulWidget { this.inspectCodeId, }) : super(key: key); - final item; // 1 隐患整改 2 隐患记录 + final item; // 1 隐患整改 2 隐患记录 3 处罚反馈 final String itemId; final String hiddenId; final String foreignKey; @@ -129,6 +129,9 @@ class _KeyTasksHiddenDangerDetailState extends State case 2: //隐患记录 title='隐患记录'; break; + case 3: //处罚反馈 + title='处罚反馈'; + break; } @@ -765,6 +768,93 @@ class _KeyTasksHiddenDangerDetailState extends State ), ], + //处罚反馈 + if (widget.item==3)...[ + SizedBox(height: 10), + Card( + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + top: 10, + left: 10, + right: 10, + ), + child: Row( + children: [ + Container( + width: 3, + height: 15, + color: Colors.blue, + ), + const SizedBox(width: 8), + Text( + "处罚反馈", + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + + ItemListWidget.itemContainer( + RepairedPhotoSection( + isRequired:true, + title: "罚款缴纳单", + maxCount: 4, + mediaType: MediaType.image, + onChanged: (files) { + // 上传 files 到服务器 + gaiHouImages.clear(); + for(int i=0;i //操作按钮 - if (widget.item==1)...[ + if (widget.item==1||widget.item==3)...[ SizedBox(height: 10,), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -910,8 +1000,11 @@ class _KeyTasksHiddenDangerDetailState extends State child: CustomButton( height: 35, onPressed: () { - _setHiddenDangerRectification(); + if(widget.item==3){ + }else{ + _setHiddenDangerRectification(); + } // _setHiddenDangerAcceptance(); }, textStyle: const TextStyle(color: Colors.white), diff --git a/lib/pages/home/keyTasks/keyTasksDetail/key_tasks_confirm_detail_page.dart b/lib/pages/home/keyTasks/keyTasksDetail/key_tasks_confirm_detail_page.dart index dac375e..2462604 100644 --- a/lib/pages/home/keyTasks/keyTasksDetail/key_tasks_confirm_detail_page.dart +++ b/lib/pages/home/keyTasks/keyTasksDetail/key_tasks_confirm_detail_page.dart @@ -636,6 +636,9 @@ class _KeyTasksConfirmDetailPageState extends State { case 6: typeText='已完工'; break; + case 7: + typeText='已驳回'; + break; } return typeText; } diff --git a/lib/pages/home/keyTasks/keyTasksDetail/punishmentKeyTasks/key_tasks_punishment_filter_page.dart b/lib/pages/home/keyTasks/keyTasksDetail/punishmentKeyTasks/key_tasks_punishment_filter_page.dart new file mode 100644 index 0000000..0fbe241 --- /dev/null +++ b/lib/pages/home/keyTasks/keyTasksDetail/punishmentKeyTasks/key_tasks_punishment_filter_page.dart @@ -0,0 +1,475 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:qhd_prevention/customWidget/MultiDictValuesPicker.dart'; +import 'package:qhd_prevention/customWidget/bottom_picker.dart'; +import 'package:qhd_prevention/customWidget/custom_button.dart'; +import 'package:qhd_prevention/customWidget/date_picker_dialog.dart'; +import 'package:qhd_prevention/customWidget/department_person_picker.dart'; +import 'package:qhd_prevention/customWidget/department_picker.dart'; +import 'package:qhd_prevention/customWidget/department_picker_three.dart'; +import 'package:qhd_prevention/customWidget/item_list_widget.dart'; +import 'package:qhd_prevention/customWidget/picker/CupertinoDatePicker.dart'; +import 'package:qhd_prevention/customWidget/toast_util.dart'; +import 'package:qhd_prevention/http/modules/basic_info_api.dart'; +import 'package:qhd_prevention/pages/my_appbar.dart'; +import 'package:qhd_prevention/tools/tools.dart'; + +class KeyTasksPunishmentFilterPage extends StatefulWidget { + const KeyTasksPunishmentFilterPage({ + super.key, + required this.searchData, + + }); + + final Map searchData; + + @override + State createState() => _KeyTasksPunishmentFilterPageState(); +} + +class _KeyTasksPunishmentFilterPageState extends State { + + // controllers / state + + /// 隐患描述 + TextEditingController _inspectionSiteController = TextEditingController(); + /// 被处罚单位 + TextEditingController _initiatorInspectionController = TextEditingController(); + /// 重点作业名称 + TextEditingController _inspectorController = TextEditingController(); + /// 处罚原因 + TextEditingController _punishmentReasonController = TextEditingController(); + + // 存储各单位的人员列表 + final Map>> _personCache = {}; + + DateTime? _startDate; + DateTime? _endDate; + Map searchData = {}; + + final DateFormat _dateFmt = DateFormat('yyyy-MM-dd'); + + + @override + void initState() { + // TODO: implement initState + super.initState(); + _fetchData(); + } + + Future _fetchData() async { + setState(() { + searchData=widget.searchData; + _inspectionSiteController.text = searchData['hiddenDesc']; + _initiatorInspectionController.text = searchData['hiddenFindUserName']; + _inspectorController.text = searchData['projectName']; + _punishmentReasonController.text = searchData['projectName']; + + }); + } + + + // ========== 页面构建 ========== + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: const MyAppbar(title: '筛选'), + backgroundColor: Colors.white, + body: SafeArea( + child: Column( + children: [ + Expanded( + child: ListView( + children: [ + Container( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + buildTextFieldRow( + labelText: '隐患描述', + controller: _inspectionSiteController, + hintText: '请输入隐患描述', + onChanged: (value) { + searchData['hiddenDesc'] = value; + }, + ), + + + const SizedBox(height: 10), + buildTextFieldRow( + labelText: '被处罚单位', + controller: _initiatorInspectionController, + hintText: '请输入被处罚单位', + onChanged: (value) { + searchData['hiddenFindUserName'] = value; + }, + ), + + const SizedBox(height: 10), + buildTextFieldRow( + labelText: '处罚原因', + controller: _punishmentReasonController, + hintText: '请输入处罚原因', + onChanged: (value) { + searchData['projectName'] = value; + }, + ), + + const SizedBox(height: 10), + buildTextFieldRow( + labelText: '重点作业名称', + controller: _inspectorController, + hintText: '请输入重点作业名称', + onChanged: (value) { + searchData['projectName'] = value; + }, + ), + + + ], + ), + ), + ], + ), + ), + ItemListWidget.itemContainer( + Row( + children: [ + CustomButton( + text: '重置', + padding: const EdgeInsets.symmetric( + vertical: 8, + horizontal: 30, + ), + buttonStyle: ButtonStyleType.secondary, + onPressed: _resetAll, + ), + const SizedBox(width: 12), + Expanded( + child: CustomButton(text: '确定', onPressed: _confirm), + ), + ], + ), + ), + ], + ), + ), + ); + } + + + + + + @override + void dispose() { + _inspectionSiteController.dispose(); + _initiatorInspectionController.dispose(); + _inspectorController.dispose(); + _punishmentReasonController.dispose(); + super.dispose(); + } + + Widget buildTextFieldRow({ + required String labelText, + required TextEditingController controller, + required String hintText, + ValueChanged? onChanged, + }) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + labelText, + style: const TextStyle( + fontSize: 15, + fontWeight: FontWeight.w500, + color: Colors.black, + ), + ), + const SizedBox(height: 8), + Container( + height: 45, + decoration: BoxDecoration( + border: Border.all(color: Colors.grey), + borderRadius: BorderRadius.circular(5), + ), + padding: const EdgeInsets.symmetric(horizontal: 8), + alignment: Alignment.centerLeft, + child: TextFormField( + controller: controller, + decoration: InputDecoration( + hintText: hintText, + hintStyle: const TextStyle(color: Colors.grey), + border: InputBorder.none, + isDense: true, + ), + maxLines: 1, + onChanged: onChanged, + ), + ), + ], + ); + } + + Widget buildChooseRow({ + required String labelText, + required String hintText, + required String valueText, + required VoidCallback onTap, + bool showArrow = true, + }) { + final bool hasValue = valueText.trim().isNotEmpty; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + labelText, + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.w500, + color: Colors.black, + ), + ), + const SizedBox(height: 8), + Container( + height: 45, + decoration: BoxDecoration( + border: Border.all(color: Colors.grey), + borderRadius: BorderRadius.circular(5), + ), + child: InkWell( + onTap: onTap, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Row( + children: [ + Expanded( + child: Text( + hasValue ? valueText : hintText, + style: TextStyle( + color: hasValue ? Colors.black87 : Colors.black54, + fontSize: 15, + ), + overflow: TextOverflow.ellipsis, + ), + ), + if (showArrow) + const Icon(Icons.arrow_drop_down, color: Colors.black54), + ], + ), + ), + ), + ), + ], + ); + } + + // Future _chooseDepartment({required String typeStr}) async { + // showModalBottomSheet( + // context: context, + // isScrollControlled: true, + // barrierColor: Colors.black54, + // backgroundColor: Colors.transparent, + // builder: + // (_) => DepartmentPicker( + // onSelected: (id, name) async { + // setState(() { + // searchData['inspectionDepartmentId']=id; + // searchData['inspectionDepartmentName']=name; + // // personUnderInspection['departmentId'] = id; + // // personUnderInspection['userName'] = name; + // // if (typeStr == '检查部门') { + // // _inspectionDeptName = name; + // // } else if (typeStr == '被检查单位') { + // // _inspectedDepartmentName = name; + // // } + // }); + // // 拉该单位人员并缓存 + // await _getPersonListForUnitId(typeStr); + // }, + // ), + // ).then((_) { + // // 可选:FocusHelper.clearFocus(context); + // }); + // } + + Future _getPersonListForUnitId(String typeStr) async { + String unitId = searchData['inspectionDepartmentId'] ?? ''; + // 拉取该单位的人员列表并缓存 + final result = await BasicInfoApi.getDeptUsers(unitId); + dynamic raw = result['data']; + List> list = []; + if (raw is List) { + list = + raw.map>((e) { + if (e is Map) return e; + if (e is Map) return Map.from(e); + return {}; + }).toList(); + } else { + list = []; + } + setState(() { + _personCache[typeStr] = list; + }); + //FocusHelper.clearFocus(context); + } + + + Future _getApproverList() async { + try { + + List newList = [ + {'dataId':'1','dataName':'视频识别报警',}, + {'dataId':'2','dataName':'安全环保检查(监管端)',}, + {'dataId':'3','dataName':'安全环保检查(企业端)',}, + ]; + showModalBottomSheet( + context: context, + isScrollControlled: true, + barrierColor: Colors.black54, + backgroundColor: Colors.transparent, + builder: + (ctx) => DepartmentPickerThree( + listdata: newList, + onSelected: (id, name,pdId) async { + setState(() { + searchData['source']=id; + searchData['sourceName']=name; + }); + + }, + ), + ); + + } catch (e) { + // 出错时可以 Toast 或者在页面上显示错误状态 + print('加载首页数据失败:$e'); + // return ""; + LoadingDialogHelper.hide(); + } + } + + /// 弹出人员选择,需先选择单位 + // void choosePersonHandle(String typeStr) async { + // final personList = _personCache[typeStr]; + // if (!FormUtils.hasValue(_personCache, typeStr)) { + // ToastUtil.showNormal(context, '请先选择单位'); + // return; + // } + // + // DepartmentPersonPicker.show( + // context, + // personsData: personList!, + // onSelectedWithIndex: (userId, name, index) { + // setState(() { + // if (typeStr == '检查人') { + // _inspectionUserName = name; + // } else { + // _inspectedUserName = name; + // } + // }); + // //FocusHelper.clearFocus(context); + // }, + // ).then((_) {}); + // } + + Future _pickDate({required bool isStart}) async { + DateTime? picked = await BottomDateTimePicker.showDate( + context, + minTimeStr: !isStart ? searchData['startTime'] : null, + mode: BottomPickerMode.dateTime, + ); + if (picked != null) { + setState(() { + final dateFormat = DateFormat('yyyy-MM-dd HH:mm'); + if (isStart) { + _startDate = picked; + searchData['startTime'] = dateFormat.format(picked); + } else { + _endDate = picked; + searchData['endTime'] = dateFormat.format(picked); + } + // 保证开始 <= 结束 + if (_endDate != null && _endDate!.isBefore(picked)) { + _endDate = null; + } + }); + } + } + + // // 选择检查状态 + // Future _pickCheckStatus() async { + // List> items = SafeCheckListItem.getStepList(); + // final choice = await BottomPicker.show( + // context, + // items: items.map((item) => item['name'].toString()).toList(), + // itemBuilder: (item) => Text(item, textAlign: TextAlign.center), + // initialIndex: 0, + // ); + // if (choice != null) { + // setState(() { + // Map item = items[items.indexWhere((item) => item['name'] == choice)]; + // _checkStatus = item['id']; + // }); + // } + // } + + + // Future _pickYearDate() async { + // DateTime? picked = await BottomDateTimePicker.showDate( + // context, + // minTimeStr: null, + // mode: BottomPickerMode.year, + // ); + // if (picked != null) { + // setState(() { + // final dateFormat = DateFormat('yyyy'); + // searchData['year'] = dateFormat.format(picked); + // }); + // } + // } + + // ========== 重置 / 确定 ========== + void _resetAll() { + setState(() { + _inspectionSiteController.clear(); + _initiatorInspectionController.clear(); + _inspectorController.clear(); + _punishmentReasonController.clear(); + + // searchData['hiddenDesc']=''; + // searchData['source']=''; + // searchData['sourceName']=''; + // searchData['startTime']=''; + // searchData['endTime']=''; + // searchData['projectName']=''; + // searchData['hiddenFindUserName']=''; + // searchData['orderBy']=''; + // searchData['orderDirection']=''; + // searchData['groupBy']=''; + + }); + final Map pd = { + ...searchData, + }; + Navigator.of(context).pop(pd); + } + + void _confirm() { + final Map pd = { + ...searchData, + }; + // for (Map subject in subjectList) { + // if (subject['bianma'] == pd['inspectionSubject']) { + // pd['inspectionSubject'] = subject['name']; + // } + // } + Navigator.of(context).pop(pd); + } + + +} diff --git a/lib/pages/home/keyTasks/keyTasksDetail/punishmentKeyTasks/key_tasks_punishment_list.dart b/lib/pages/home/keyTasks/keyTasksDetail/punishmentKeyTasks/key_tasks_punishment_list.dart new file mode 100644 index 0000000..e2046e6 --- /dev/null +++ b/lib/pages/home/keyTasks/keyTasksDetail/punishmentKeyTasks/key_tasks_punishment_list.dart @@ -0,0 +1,585 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:qhd_prevention/CustomWidget/range_filter_bar.dart'; +import 'package:qhd_prevention/common/route_service.dart'; + +import 'package:qhd_prevention/customWidget/custom_button.dart'; +import 'package:qhd_prevention/customWidget/search_bar_widget.dart'; +import 'package:qhd_prevention/customWidget/toast_util.dart'; +import 'package:qhd_prevention/http/ApiService.dart'; +import 'package:qhd_prevention/http/modules/key_tasks_api.dart'; + +import 'package:qhd_prevention/pages/home/keyTasks/keyTasksDetail/keyTasksHiddenDanger/key_tasks_hidden_danger_detail.dart'; +import 'package:qhd_prevention/pages/home/keyTasks/keyTasksDetail/keyTasksHiddenDanger/key_tasks_hidden_filter_page.dart'; +import 'package:qhd_prevention/pages/home/keyTasks/keyTasksDetail/punishmentKeyTasks/key_tasks_punishment_filter_page.dart'; +import 'package:qhd_prevention/pages/my_appbar.dart'; +import 'package:qhd_prevention/services/SessionService.dart'; +import 'package:qhd_prevention/tools/h_colors.dart'; +import 'package:qhd_prevention/tools/tools.dart'; +import 'dart:async'; + + + +class KeyTasksPunishmentList extends StatefulWidget { + const KeyTasksPunishmentList( {super.key}); + + + @override + State createState() => _KeyTasksPunishmentListState(); +} + +class _KeyTasksPunishmentListState extends State { + int _page = 1; + // String searchKey = ""; + int _totalPage = 1; + + bool _isLoading = false; + bool _hasMore = true; + Timer? _debounceTimer; + String buttonTextOne = '查看'; + String buttonTextTwo = '确认'; + String title = "隐患记录"; + + final TextEditingController _searchController = TextEditingController(); + + bool isJGD = false; + + late List _list = []; + + @override + void initState() { + super.initState(); + // 初始均为空 + + _searchController.addListener(_onSearchChanged); + + String userId= SessionService.instance.accountId??''; + keyTasksPunishmentData['acceptUserId']=userId; + _distinguishData(); + + } + + Future _distinguishData() async { + + buttonTextTwo = '反馈'; + title = "处罚反馈"; + keyTasksPunishmentData['stateList']=[1,2,3,4]; + final parentPerm = 'dashboard:Key-assignment:Hidden-hazard-record'; + final targetPerm = ''; + final menuPath = await RouteService.getMenuPath(parentPerm, targetPerm); + keyTasksPunishmentData['menuPath']=menuPath; + + _getListData(false); + } + + @override + void dispose() { + _debounceTimer?.cancel(); + _searchController.removeListener(_onSearchChanged); + _searchController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + // 取屏幕宽度 + final double screenWidth = MediaQuery.of(context).size.width; + + return Scaffold( + appBar: MyAppbar(title:title), + + body: SafeArea( + child: NotificationListener( + onNotification: _onScroll, + child: _vcDetailWidget(), + ), + ), + backgroundColor: Colors.white, + ); + } + + Widget _vcDetailWidget() { + return Column( + children: [ + + RangeFilterBar( + initial: RangeOption.none, + mode: RangeFilterBarMode.dayWeekMonth, + onRangeChanged: (range) { + switch (range) { + case RangeOption.oneDay: + keyTasksPunishmentData['startTime'] = DateFormat('yyyy-MM-dd HH:mm:ss') + .format(DateTime.now().subtract(const Duration(days: 1))); + break; + case RangeOption.oneWeek: + keyTasksPunishmentData['startTime'] = DateFormat('yyyy-MM-dd HH:mm:ss') + .format(DateTime.now().subtract(const Duration(days: 7))); + break; + case RangeOption.oneMonth: + keyTasksPunishmentData['startTime'] = DateFormat('yyyy-MM-dd HH:mm:ss') + .format(DateTime.now().subtract(const Duration(days: 30))); + break; + case RangeOption.threeMonths: + break; + case RangeOption.none: + break; + } + _performSearch(); + }, + onFilterPressed: () async { + // 弹出筛选对话框或跳转到筛选页面 + // String searchData=''; + final searchData= await pushPage( + KeyTasksPunishmentFilterPage( + searchData: keyTasksPunishmentData, + ), + context, + ); + if(searchData!=null){ + keyTasksPunishmentData=searchData; + _performSearch(); + } + + }, + ), + + Container(height: 5, color: h_backGroundColor()), + Expanded( + child: + _list.isEmpty + ? NoDataWidget.show() + : ListView.builder( + itemCount: _list.length, + itemBuilder: (context, index) { + final item = _list[index]; + return _fxitemCell(item); + }, + ), + ), + ], + ); + } + + Widget _fxitemCell(pageData) { + // 使用GestureDetector包裹整个列表项以添加点击事件 + return GestureDetector( + onTap: () {}, + + child: Container( + margin: EdgeInsets.all(6), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.3), + spreadRadius: 2, + blurRadius: 5, + offset: Offset(0, 3), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // 标题 + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, // 添加这一行 + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.only(left: 10, top: 15, right: 8), + child: Text( + '隐患描述: ${pageData['hiddenDesc'] ?? ''}', + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + color: Colors.black87, + ), + maxLines: 1, // 只显示一行 + overflow: TextOverflow.ellipsis, // 超出部分显示省略号 + ), + ), + ), + + // 状态标签 + // Container( + // padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6), + // decoration: BoxDecoration( + // color: _getLevelColor(pageData), + // borderRadius: BorderRadius.only( + // bottomLeft: Radius.circular(12), + // topRight: Radius.circular(12), // 改为右上角 + // ), + // ), + // child: Text( + // pageData['hiddenLevelName'] ?? '', + // style: TextStyle( + // color: Colors.white, + // fontSize: 12, + // fontWeight: FontWeight.bold, + // ), + // ), + // ), + ], + ), + + SizedBox(height: 16), + + + Padding( + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // 隐患状态 + Expanded( + child: Text( + '被处罚单位: ${pageData['']??''}', + style: TextStyle(fontSize: 14, color: Colors.black87), + ), + ), + ], + ), + ), + + SizedBox(height: 8), + + Padding( + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // 隐患发现人 - 使用 Expanded 包裹 + Expanded( + child: Text( + '被处罚人:${pageData['findUserName'] ?? ''}', + style: TextStyle(fontSize: 14, color: Colors.black87), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + + // Expanded( + // child: Text( + // '发现时间:${_changeTime(pageData['createTime'] ?? '')}', + // + // style: TextStyle(fontSize: 14, color: Colors.black87), + // // maxLines: 1, + // // overflow: TextOverflow.ellipsis, + // ), + // ), + ], + ), + ), + + SizedBox(height: 8), + Padding( + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // 整改人 + Expanded( + child: + Text('处罚原因: ${pageData['projectName'] ?? ''}', + style: TextStyle(fontSize: 14, color: Colors.black87), + ), + ), + ], + ), + ), + + SizedBox(height: 8), + Padding( + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // 整改人 + Expanded( + child: + Text('下发人: ${pageData['projectName'] ?? ''}', + style: TextStyle(fontSize: 14, color: Colors.black87), + ), + ), + ], + ), + ), + + SizedBox(height: 8), + Padding( + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // 整改人 + Expanded( + child: + Text('处罚反馈状态: ${pageData['projectName'] ?? ''}', + style: TextStyle(fontSize: 14, color: Colors.black87), + ), + ), + ], + ), + ), + + SizedBox(height: 8), + Padding( + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // 整改人 + Expanded( + child: + Text( + '重点作业名称: ${pageData['projectName'] ?? ''}', + style: TextStyle(fontSize: 14, color: Colors.black87), + ), + ), + // Expanded( + // child: + // Text( + // '', + // style: TextStyle( + // fontSize: 14, + // color: Colors.black87, + // ), + // ), + // ), + ], + ), + ), + + + SizedBox(height: 8), + + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + //查看 + + Expanded( + child: CustomButton( + height: 35, + onPressed: () async { + // print('查看: ${pageData['title']}'); + await pushPage( + KeyTasksHiddenDangerDetail( + 2, + pageData['id'], + pageData['hiddenId'], + pageData['foreignKey'], + false, + ), + context, + ); + _page = 1; + _getListData(false); + }, + backgroundColor: h_backGroundColor(), + textStyle: const TextStyle(color: Colors.black), + buttonStyle: ButtonStyleType.secondary, + text: buttonTextOne, + ), + ), + + + SizedBox(width: 10), // 使用width而不是height + Expanded( + child: CustomButton( + height: 35, + onPressed: () async { + await pushPage( + KeyTasksHiddenDangerDetail( + 3, + pageData['id'], + pageData['hiddenId'], + pageData['foreignKey'], + false, + ), + context, + ); + _page = 1; + _getListData(false); + }, + backgroundColor: h_AppBarColor(), + textStyle: const TextStyle(color: Colors.white), + buttonStyle: ButtonStyleType.primary, + text: buttonTextTwo, + ), + ), + + ], + ), + + SizedBox(height: 10), + ], + ), + ), + ); + } + + void _performSearch() { + // 执行搜索逻辑 + // if (keyword.isNotEmpty) { + // print('执行搜索: $keyword'); + // 调用API或其他搜索操作 + // 输入请求接口 + _page = 1; + // searchKey = keyword; + _getListData(false); + // } + } + + bool _onScroll(ScrollNotification n) { + if (n.metrics.pixels > n.metrics.maxScrollExtent - 100 && + _hasMore && + !_isLoading) { + _page++; + _getListData(true); + } + return false; + } + + void _onSearchChanged() { + final query = _searchController.text.toLowerCase().trim(); + setState(() { + print("=====>" + query); + // filtered = query.isEmpty ? original : _filterCategories(original, query); + }); + } + + + Future _getListData(bool loadMore) async { + // try { + // if (_isLoading) return; + // _isLoading = true; + // + // keyTasksPunishmentData['pageIndex']=_page; + // // keyTasksPunishmentData['hiddenDesc']=searchKey; + // + // LoadingDialogHelper.show(); + // final Map result = await KeyTasksApi.setKeyTasksHiddenDangerList(keyTasksPunishmentData); + // LoadingDialogHelper.hide(); + // + // if (result['success']) { + // _totalPage = result['pageSize'] ?? 1; + // final List newList = result['data'] ?? []; + // // setState(() { + // // _list.addAll(newList); + // // }); + // + // setState(() { + // if (loadMore) { + // _list.addAll(newList); + // } else { + // _list = newList; + // } + // _hasMore = _page < _totalPage; + // // if (_hasMore) _page++; + // }); + // } else { + // ToastUtil.showNormal(context, "加载数据失败"); + // // _showMessage('加载数据失败'); + // } + // } catch (e) { + // LoadingDialogHelper.hide(); + // // 出错时可以 Toast 或者在页面上显示错误状态 + // print('加载数据失败:$e'); + // } finally { + // // if (!loadMore) LoadingDialogHelper.hide(); + // _isLoading = false; + // } + } + + String _getSourceDangers(final item) { + //隐患来源,1-视频识别报警,2-安全环保检查(监管端) 3-安全环保检查(企业端) + int type = item["source"] ?? 0; + if (1 == type) { + return "隐患来源:视频识别报警"; + } else if (2 == type) { + return "隐患来源:安全环保检查(监管端)"; + } else if (3 == type) { + return "隐患来源:安全环保检查(企业端)"; + } else { + return "隐患来源:"; + } + } + + // 隐患等级颜色 + Color _getLevelColor(final item) { + String type = item["hiddenLevelName"] ?? ''; + if ("重大隐患" == type) { + return Colors.red; + } else if ("较大隐患" == type) { + return Color(0xFFFF6A4D); + } else if ("一般隐患" == type) { + return Colors.orange; + } else if ("轻微隐患" == type) { + return h_AppBarColor(); + } else { + return Colors.green; + } + } + + String _getState(final item) { + //1,未整改,2:已整改,3:已验收,4:验收打回 + int type = item["state"]; + if(1==type){ + return "未整改"; + }else if(2==type){ + return "已整改"; + }else if(3==type){ + return "已验收"; + }else if(4==type){ + return "验收打回"; + }else{ + return ""; + } + } + + String _changeTime(String time) { + try { + // 解析 ISO 8601 格式的时间字符串 + DateTime dateTime = DateTime.parse(time); + // 格式化为年月日 + return DateFormat('yyyy-MM-dd').format(dateTime); + } catch (e) { + // 如果解析失败,返回原字符串或默认值 + return ' '; + } + } + + String truncateString(String input) { + if (input.length > 10) { + return '${input.substring(0, 10)}...'; + } + return input; + } + + + Map keyTasksPunishmentData={ + "hiddenDesc": "", + "stateList": [], + "pageSize": 20, + "pageIndex": 1, + + "source": "", + 'sourceName': "", + "startTime": "", + "endTime": "", + "projectName": "", + "hiddenFindUserName": "", + "orderBy": "", + "orderDirection": "", + "groupBy": "", + + }; + + +} diff --git a/lib/pages/home/keyTasks/key_tasks_confirm_list_page.dart b/lib/pages/home/keyTasks/key_tasks_confirm_list_page.dart index 3a83336..90aefea 100644 --- a/lib/pages/home/keyTasks/key_tasks_confirm_list_page.dart +++ b/lib/pages/home/keyTasks/key_tasks_confirm_list_page.dart @@ -218,6 +218,45 @@ class _KeyTasksConfirmListPageState extends State { text: item["applyStatus"]==1?'开工申请':'完工申请'),), ], + if(item["applyStatus"]==1)...[ + const SizedBox(width: 8), + Expanded(child: CustomButton( + height: 35, + onPressed: () async { + final ok = await CustomAlertDialog.showConfirm( + context, + title: '删除', + content: '确定要删除吗?', + cancelText: '取消', + ); + if (ok) { + _upKeyTasksData(item); + } + }, + backgroundColor: h_AppBarColor(), + textStyle: const TextStyle(color: Colors.red), + buttonStyle:ButtonStyleType.secondary, + text: '删除'),), + ], + + if(item["applyStatus"]==7)...[ + const SizedBox(width: 8), + Expanded(child: CustomButton( + height: 35, + onPressed: () async { + final ok = await CustomAlertDialog.showConfirm( + context, + title: '驳回原因', + content: '驳回原因。。。。。。。。。', + ); + + }, + backgroundColor: h_AppBarColor(), + textStyle: const TextStyle(color: Colors.red), + buttonStyle:ButtonStyleType.secondary, + text: '驳回原因'),), + ] + ],), @@ -309,6 +348,9 @@ class _KeyTasksConfirmListPageState extends State { case 6: typeText='已完工'; break; + case 7: + typeText='已驳回'; + break; } return typeText; } diff --git a/lib/pages/home/keyTasks/key_tasks_tab_page.dart b/lib/pages/home/keyTasks/key_tasks_tab_page.dart index 9603094..b332dfb 100644 --- a/lib/pages/home/keyTasks/key_tasks_tab_page.dart +++ b/lib/pages/home/keyTasks/key_tasks_tab_page.dart @@ -6,6 +6,7 @@ import 'package:qhd_prevention/common/route_service.dart'; import 'package:qhd_prevention/http/modules/key_tasks_api.dart'; import 'package:qhd_prevention/pages/home/doorAndCar/doorCar_tab_page.dart'; import 'package:qhd_prevention/pages/home/keyTasks/keyTasksDetail/keyTasksHiddenDanger/key_tasks_hidden_danger_list.dart'; +import 'package:qhd_prevention/pages/home/keyTasks/keyTasksDetail/punishmentKeyTasks/key_tasks_punishment_list.dart'; import 'package:qhd_prevention/pages/home/keyTasks/key_tasks_check_list_page.dart'; import 'package:qhd_prevention/pages/home/keyTasks/key_tasks_confirm_list_page.dart'; import 'package:qhd_prevention/pages/my_appbar.dart'; @@ -82,6 +83,17 @@ class _DoorcarTabPageState extends State { }, ), + AppSectionItem( + title: '处罚反馈', + icon: 'assets/images/door_ico10.png', + menuPerms:'dashboard:Key-assignment:Hidden-Hazard-Record', + badge: 0, + onTap: () async { + await pushPage(KeyTasksPunishmentList(), context); + _getDoorCarCount(); + }, + ), + ]), ];