diff --git a/assets/images/key_tasks_banner.jpg b/assets/images/key_tasks_banner.jpg new file mode 100644 index 0000000..73f9939 Binary files /dev/null and b/assets/images/key_tasks_banner.jpg differ diff --git a/assets/images/key_tasks_ico2.png b/assets/images/key_tasks_ico2.png new file mode 100644 index 0000000..6735aa2 Binary files /dev/null and b/assets/images/key_tasks_ico2.png differ diff --git a/assets/images/key_tasks_ico3.png b/assets/images/key_tasks_ico3.png new file mode 100644 index 0000000..e95383c Binary files /dev/null and b/assets/images/key_tasks_ico3.png differ diff --git a/assets/images/key_tasks_ico6.png b/assets/images/key_tasks_ico6.png new file mode 100644 index 0000000..a7807e3 Binary files /dev/null and b/assets/images/key_tasks_ico6.png differ diff --git a/assets/images/key_tasks_ico7.png b/assets/images/key_tasks_ico7.png new file mode 100644 index 0000000..f2a85f4 Binary files /dev/null and b/assets/images/key_tasks_ico7.png differ diff --git a/lib/http/modules/key_tasks_api.dart b/lib/http/modules/key_tasks_api.dart index 95f9620..3cb7f49 100644 --- a/lib/http/modules/key_tasks_api.dart +++ b/lib/http/modules/key_tasks_api.dart @@ -1,4 +1,5 @@ import 'package:dio/dio.dart'; +import 'package:qhd_prevention/common/route_service.dart'; import 'package:qhd_prevention/http/ApiService.dart'; import 'package:qhd_prevention/http/HttpManager.dart'; import 'package:qhd_prevention/services/SessionService.dart'; @@ -7,12 +8,16 @@ class KeyTasksApi { /// 重点作业确认分页-监管-分公司 - static Future> getKeyTasksConfirmList(Map data) { + static Future> getKeyTasksConfirmList(Map data) async { + final parentPerm = 'dashboard:Key-assignment:Key-Task-Application'; + final targetPerm = ''; + final menuPath = await RouteService.getMenuPath(parentPerm, targetPerm); return HttpManager().request( '${ApiService.basePath}/keyProject', '/keyProject/pageConfirm', method: Method.post, data: { + "menuPath": menuPath, ...data }, ); @@ -57,12 +62,16 @@ class KeyTasksApi { /// 安全环保检查分页 - static Future> getKeyTasksSafetyEnvironmentalInspectionList(Map data) { + static Future> getKeyTasksSafetyEnvironmentalInspectionList(Map data) async { + final parentPerm = 'dashboard:Key-assignment:Confirmed-by-the-inspectee'; + final targetPerm = ''; + final menuPath = await RouteService.getMenuPath(parentPerm, targetPerm); return HttpManager().request( '${ApiService.basePath}/keyProject', '/safetyEnvironmentalInspection/list', method: Method.post, data: { + "menuPath": menuPath, ...data }, ); @@ -131,6 +140,17 @@ class KeyTasksApi { ); } + /// 待整改数量 + static Future> getKeyTasksToDoCount(String id) { + return HttpManager().request( + '${ApiService.basePath}/keyProject', + '/keyProject/count/$id', + method: Method.get, + data: { + // ...data + }, + ); + } } \ No newline at end of file diff --git a/lib/pages/home/doorAndCar/doorCar_tab_page.dart b/lib/pages/home/doorAndCar/doorCar_tab_page.dart index 516da3d..7a5b49c 100644 --- a/lib/pages/home/doorAndCar/doorCar_tab_page.dart +++ b/lib/pages/home/doorAndCar/doorCar_tab_page.dart @@ -12,13 +12,15 @@ typedef ItemTapCallback = void Function(); class AppSectionItem { final String title; final String icon; // asset path - final int badge; + final String menuPerms; // 路由唯一权限标识 + int badge; final bool visible; final ItemTapCallback? onTap; AppSectionItem({ required this.title, required this.icon, + required this.menuPerms, this.badge = 0, this.visible = true, this.onTap, @@ -50,6 +52,7 @@ class _DoorcarTabPageState extends State { AppSectionItem( title: '进港口门申请', icon: 'assets/images/door_ico9.png', + menuPerms:'', badge: 0, onTap: () async { await pushPage(DoorareaTypePage(1), context); @@ -59,6 +62,7 @@ class _DoorcarTabPageState extends State { AppSectionItem( title: '进港口门申请记录', icon: 'assets/images/door_ico10.png', + menuPerms:'', badge: 0, onTap: () async { await pushPage(DoorareaTypePage(2), context); @@ -71,6 +75,7 @@ class _DoorcarTabPageState extends State { AppSectionItem( title: '封闭区域口门申请', icon: 'assets/images/door_ico9.png', + menuPerms:'', badge: 0, onTap: () async { await pushPage(DoorareaTypePage(3), context); @@ -80,6 +85,7 @@ class _DoorcarTabPageState extends State { AppSectionItem( title: '封闭区域口门申请记录', icon: 'assets/images/door_ico10.png', + menuPerms:'', badge: 0, onTap: () async { await pushPage(DoorareaTypePage(4), context); diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index aa0cfd0..5b4a7be 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -9,6 +9,7 @@ import 'package:qhd_prevention/customWidget/custom_alert_dialog.dart'; import 'package:qhd_prevention/customWidget/custom_button.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/Study/study_tab_list_page.dart'; import 'package:qhd_prevention/pages/home/Tap/work_tab_list_page.dart'; import 'package:qhd_prevention/pages/home/doorAndCar/doorCar_tab_page.dart'; @@ -19,6 +20,7 @@ import 'package:qhd_prevention/pages/main_tab.dart'; import 'package:qhd_prevention/pages/mine/onboarding_full_page.dart'; import 'package:qhd_prevention/pages/user/choose_userFirm_page.dart'; import 'package:qhd_prevention/pages/user/firm_list_page.dart'; +import 'package:qhd_prevention/services/SessionService.dart'; import 'package:qhd_prevention/services/auth_service.dart'; import 'package:qhd_prevention/services/scan_service.dart'; import 'package:qhd_prevention/tools/h_colors.dart'; @@ -120,7 +122,7 @@ class HomePageState extends RouteAwareState "现场监管": "dashboard-Site-Supervision", "危险作业": "dashboard-Hazardous-Work", "隐患治理": "dashboard-Hazard-Management", - "重点作业": "dashboard-Hazard-Management", // 无对应,暂时留空 + "重点作业": "dashboard:Key-assignment", "口门门禁": "dashboard-Gate-Access-Control", "入港培训": "dashboard-Study-Training", }; @@ -1103,7 +1105,9 @@ class HomePageState extends RouteAwareState }; final result = await TodoApi.getTodoList(data); final specialWork = await SpecialWorkApi.specialWorkTaskLogTotalCount(); + final keyTasksWork = await KeyTasksApi.getKeyTasksToDoCount(SessionService.instance.accountId??''); int specialWorkNum = 0; + int keyTasksNum = 0; try { if (specialWork['success']) { List specialWorkList = specialWork['data'] ?? []; @@ -1114,11 +1118,21 @@ class HomePageState extends RouteAwareState } } } + if (keyTasksWork['success']) { + int zdzysqCount = int.parse(keyTasksWork['data']['zdzysqCount']??0); + int bjcrqrCount = int.parse(keyTasksWork['data']['bjcrqrCount']??0); + int yhdzgCount = int.parse(keyTasksWork['data']['yhdzgCount']??0); + keyTasksNum = bjcrqrCount+yhdzgCount+zdzysqCount; + } setState(() { for (var section in buttonInfos) { if (section['title'] == '危险作业') { section['unreadCount'] = specialWorkNum; } + if (section['title'] == '重点作业') { + section['unreadCount'] = keyTasksNum; + } + } }); } catch (e) {} 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 c0827cd..2c514c9 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 @@ -481,12 +481,12 @@ class _KeyTasksHiddenDangerDetailState extends State _buildInfoItem( '整改部门', - pd["rectificationRecord"]['rectificationDepartmentIdName'] ?? '', + pd['rectificationDepartmentName'] ?? '', ), Divider(height: 1), _buildInfoItem( '整改人', - pd["rectificationRecord"]['rectificationUserIdName'] ?? '', + pd['rectificationUserName'] ?? '', ), Divider(height: 1), diff --git a/lib/pages/home/keyTasks/keyTasksDetail/keyTasksHiddenDanger/key_tasks_hidden_danger_list.dart b/lib/pages/home/keyTasks/keyTasksDetail/keyTasksHiddenDanger/key_tasks_hidden_danger_list.dart index bf68037..56b8ac0 100644 --- a/lib/pages/home/keyTasks/keyTasksDetail/keyTasksHiddenDanger/key_tasks_hidden_danger_list.dart +++ b/lib/pages/home/keyTasks/keyTasksDetail/keyTasksHiddenDanger/key_tasks_hidden_danger_list.dart @@ -1,6 +1,7 @@ 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'; @@ -48,19 +49,31 @@ class _KeyTasksHiddenDangerListState extends State { _searchController.addListener(_onSearchChanged); + _distinguishData(); + // _getListData(false); + } + + Future _distinguishData() async { switch (widget.appItem) { case 1: buttonTextTwo = '整改'; title = "隐患整改"; - keyTasksHiddenDangerListData['stateList']=[1]; + keyTasksHiddenDangerListData['stateList']=[1,4]; + final parentPerm = 'dashboard:Key-assignment:Hidden-danger-rectification'; + final targetPerm = ''; + final menuPath = await RouteService.getMenuPath(parentPerm, targetPerm); + keyTasksHiddenDangerListData['menuPath']=menuPath; break; case 2: buttonTextTwo = '查看'; title = "隐患记录"; keyTasksHiddenDangerListData['stateList']=[1,2,3,4]; + final parentPerm = 'dashboard:Key-assignment:Hidden-Hazard-Record'; + final targetPerm = ''; + final menuPath = await RouteService.getMenuPath(parentPerm, targetPerm); + keyTasksHiddenDangerListData['menuPath']=menuPath; break; } - _getListData(false); } @@ -304,7 +317,7 @@ class _KeyTasksHiddenDangerListState extends State { // 隐患发现人 - 使用 Expanded 包裹 Expanded( child: Text( - '发现人:${truncateString(pageData['createName'] ?? '')}', + '发现人:${truncateString(pageData['findUserName'] ?? '')}', style: TextStyle(fontSize: 14, color: Colors.black87), maxLines: 1, overflow: TextOverflow.ellipsis, diff --git a/lib/pages/home/keyTasks/keyTasksDetail/key_taskes_danger_page.dart b/lib/pages/home/keyTasks/keyTasksDetail/key_taskes_danger_page.dart index 6cce03e..ebee5cb 100644 --- a/lib/pages/home/keyTasks/keyTasksDetail/key_taskes_danger_page.dart +++ b/lib/pages/home/keyTasks/keyTasksDetail/key_taskes_danger_page.dart @@ -20,6 +20,7 @@ import 'package:qhd_prevention/customWidget/toast_util.dart'; import 'package:qhd_prevention/http/ApiService.dart'; import 'package:qhd_prevention/http/modules/auth_api.dart'; import 'package:qhd_prevention/http/modules/hidden_danger_api.dart'; +import 'package:qhd_prevention/http/modules/key_tasks_api.dart'; import 'package:qhd_prevention/http/modules/safety_check_api.dart'; import 'package:qhd_prevention/pages/my_appbar.dart'; import 'package:qhd_prevention/services/SessionService.dart'; @@ -105,7 +106,7 @@ class _KeyTaskesDangerPageState extends State { "hiddenUserId": "", //整改id(整改图片反的id) "hiddenPartName": "", //隐患部位名称 - 'hiddenFindUserdList':[],//隐患发现人多选 + 'hiddenFindUserList':[],//隐患发现人多选 'hiddenFindUserdName':'',//隐患发现人多选名字 }; @@ -185,16 +186,26 @@ class _KeyTaskesDangerPageState extends State { } Future _getHiddenDetail() async { - // LoadingDialogHelper.show(); - // final result = await HiddenDangerApi.getDangerDetail(widget.initData['id']); - // LoadingDialogHelper.hide(); - // if (result['success']) { - // final data = result['data']; - // setState(() { - // addData = data; - _getHiddenImages(); - // }); - // } + _getHiddenImages(); + LoadingDialogHelper.show(); + final result = await KeyTasksApi.getKeyTasksHiddenDangerDetail(widget.initData['id']); + LoadingDialogHelper.hide(); + if (result['success']) { + final data = result['data']; + setState(() { + addData['rectificationDepartmentId'] = data['rectificationDepartmentId']; + addData['rectificationDepartmentName'] = data['rectificationDepartmentName']; + addData['rectificationUserId'] = data['rectificationUserId']; + addData['rectificationUserName'] = data['rectificationUserName']; + + //发现人 + List result = addData['findUserList']??[]; + addData['hiddenFindUserName'] = result.map((user) => user['findUserName']).join(','); + List idList = result.map((item) => item['findUserId'].toString()).toList(); + addData['hiddenFindUserList'] = idList; + + }); + } } /// 获取隐患照片 @@ -610,7 +621,7 @@ class _KeyTaskesDangerPageState extends State { } // 获取当前已选择的项目 - final dynamic currentSelected = addData['hiddenFindUserdList'] ?? []; + final dynamic currentSelected = addData['hiddenFindUserList'] ?? []; List selectedList = []; if (currentSelected is List) { @@ -657,7 +668,7 @@ class _KeyTaskesDangerPageState extends State { String userName = person['userName']?.toString() ?? ''; return selectedItems.contains(userName); }).toList(); - addData['hiddenFindUserdList'] = result; + addData['hiddenFindUserList'] = result; }); } 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 54f001f..dac375e 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 @@ -38,8 +38,8 @@ class _KeyTasksConfirmDetailPageState extends State { final _standardController = TextEditingController(); - double centerLat = 39.8883; - double centerLng = 119.519; + double centerLat = 0; + double centerLng = 0; late Map pd = {}; @@ -208,6 +208,7 @@ class _KeyTasksConfirmDetailPageState extends State { }, ), + if(centerLat!=0) Container( height: 200, margin: EdgeInsetsGeometry.symmetric(horizontal: 15), @@ -357,7 +358,11 @@ class _KeyTasksConfirmDetailPageState extends State { _buildTableHeaderCell("视频类型"), ]), if (monitorList.isEmpty) - TableRow(children: [Padding(padding: EdgeInsets.all(12), child: Text("暂无数据")), SizedBox()]) + TableRow(children: [ + SizedBox(), + Padding(padding: EdgeInsets.all(12), child: Text("暂无数据",textAlign: TextAlign.center, )), + Padding(padding: EdgeInsets.all(12), child: Text("暂无数据",textAlign: TextAlign.center, )), + ]) else ...monitorList.asMap().entries.map((entry) { final index = entry.key + 1; // 序号从1开始 @@ -412,7 +417,12 @@ class _KeyTasksConfirmDetailPageState extends State { _buildTableHeaderCell("操作"), ]), if (monitorList.isEmpty) - TableRow(children: [Padding(padding: EdgeInsets.all(12), child: Text("暂无数据")), SizedBox()]) + TableRow(children: [ + SizedBox(), + Padding(padding: EdgeInsets.all(12), child: Text("暂无数据",textAlign: TextAlign.center, )), + Padding(padding: EdgeInsets.all(12), child: Text("暂无数据",textAlign: TextAlign.center, )), + SizedBox() + ]) else ...monitorList.asMap().entries.map((entry) { final index = entry.key + 1; // 序号从1开始 diff --git a/lib/pages/home/keyTasks/key_tasks_tab_page.dart b/lib/pages/home/keyTasks/key_tasks_tab_page.dart index 1685772..e6dcdde 100644 --- a/lib/pages/home/keyTasks/key_tasks_tab_page.dart +++ b/lib/pages/home/keyTasks/key_tasks_tab_page.dart @@ -2,11 +2,14 @@ import 'dart:ffi'; import 'package:flutter/material.dart'; +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/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'; +import 'package:qhd_prevention/services/SessionService.dart'; import 'package:qhd_prevention/tools/tools.dart'; @@ -20,7 +23,7 @@ class KeyTasksTabPage extends StatefulWidget { class _DoorcarTabPageState extends State { - final String bannerAsset = 'assets/images/door_banner.png'; + final String bannerAsset = 'assets/images/key_tasks_banner.jpg'; late List defaultSections; @@ -40,7 +43,8 @@ class _DoorcarTabPageState extends State { AppSection(title: '重点作业管理', items: [ AppSectionItem( title: '重点作业申请', - icon: 'assets/images/door_ico9.png', + icon: 'assets/images/key_tasks_ico2.png', + menuPerms:'dashboard:Key-assignment:Key-Task-Application', badge: 0, onTap: () async { await pushPage(KeyTasksConfirmListPage(), context); @@ -49,7 +53,8 @@ class _DoorcarTabPageState extends State { ), AppSectionItem( title: '被检查确认', - icon: 'assets/images/door_ico9.png', + icon: 'assets/images/key_tasks_ico3.png', + menuPerms:'dashboard:Key-assignment:Key-Task-Application', badge: 0, onTap: () async { await pushPage(KeyTasksCheckListPage(), context); @@ -58,7 +63,8 @@ class _DoorcarTabPageState extends State { ), AppSectionItem( title: '隐患整改', - icon: 'assets/images/door_ico9.png', + icon: 'assets/images/key_tasks_ico6.png', + menuPerms:'dashboard:Key-assignment:Hidden-danger-rectification', badge: 0, onTap: () async { await pushPage(KeyTasksHiddenDangerList(1), context); @@ -67,7 +73,8 @@ class _DoorcarTabPageState extends State { ), AppSectionItem( title: '隐患记录', - icon: 'assets/images/door_ico9.png', + icon: 'assets/images/key_tasks_ico7.png', + menuPerms:'dashboard:Key-assignment:Hidden-Hazard-Record', badge: 0, onTap: () async { await pushPage(KeyTasksHiddenDangerList(2), context); @@ -81,106 +88,32 @@ class _DoorcarTabPageState extends State { } Future _getDoorCarCount() async { - // try { - // final result = await DoorAndCarApi.getDoorCarCount(); - // if (result['success'] ) { - // List< dynamic> data = result['data']??[] ; - // - // int stakeholderPersonCount =0; - // int stakeholderCarCount =0; - // int temporaryPersonCount =0; - // int temporaryCarCount =0; - // int companyCarCount =0; - // int closureLongPersonCount =0; - // int closureLongCarCount =0; - // int closureTemporaryPersonCount =0; - // int closureTemporaryCarCount =0; - // for(int i=0;i 2) { - // final closureSection = defaultSections[2]; - // // 长期人员审核 - // closureSection.items[0].badge = closureLongPersonCount; - // // 长期车辆审核 - // closureSection.items[1].badge = closureLongCarCount; - // // 临时访客审核 - // closureSection.items[2].badge = closureTemporaryPersonCount; - // // 临时车辆审核 - // closureSection.items[3].badge = closureTemporaryCarCount; - // } - // }); - // } - // // else { - // // ToastUtil.showNormal(context, result['errMessage'] ?? "加载数据失败"); - // // } - // } catch (e) { - // LoadingDialogHelper.hide(); - // print('加载数据失败:$e'); - // } + try { + String userId= SessionService.instance.accountId??''; + final result = await KeyTasksApi.getKeyTasksToDoCount(userId); + if (result['success'] ) { + dynamic data = result['data']?? {} ; + + setState(() { + // 重点作业管理 + final gateSection = defaultSections[0]; + + // // 重点作业申请 + gateSection.items[0].badge = int.parse(data['zdzysqCount']??0); + // 确认 + gateSection.items[1].badge = int.parse(data['bjcrqrCount']??0); + // 整改 + gateSection.items[2].badge = int.parse(data['yhdzgCount']??0); + + }); + } + // else { + // ToastUtil.showNormal(context, result['errMessage'] ?? "加载数据失败"); + // } + } catch (e) { + LoadingDialogHelper.hide(); + print('加载数据失败:$e'); + } } @override @@ -191,12 +124,28 @@ class _DoorcarTabPageState extends State { const double iconOverlapBanner = 30.0; // 过滤掉没有可见 items 的分组 - final visibleSections = defaultSections - .map((s) => AppSection( - title: s.title, - items: s.items.where((it) => it.visible).toList())) - .where((s) => s.items.isNotEmpty) - .toList(); + // final visibleSections = defaultSections + // .map((s) => AppSection( + // title: s.title, + // items: s.items.where((it) => it.visible).toList())) + // .where((s) => s.items.isNotEmpty) + // .toList(); + final routeService = RouteService(); + + return AnimatedBuilder( + animation: routeService, + builder: (context, _) + { + final rebuiltVisibleSections = defaultSections.map((section) { + final visibleItems = section.items.where((item) { + return item.visible && routeService.hasPerm(item.menuPerms); + }).toList(); + + return AppSection( + title: section.title, + items: visibleItems, + ); + }).where((section) => section.items.isNotEmpty).toList(); return Scaffold( extendBodyBehindAppBar: true, @@ -222,13 +171,15 @@ class _DoorcarTabPageState extends State { right: 10, top: bannerHeight - iconOverlapBanner, height: iconSectionHeight, - child: _buildIconSection(context, visibleSections), + child: _buildIconSection(context, rebuiltVisibleSections), ), ], ), ), ], ), + ); + }, ); }