Merge remote-tracking branch 'origin/master'

# Conflicts:
#	lib/pages/home/home_page.dart
master
hs 2026-05-22 09:02:40 +08:00
commit 092a5701dd
8 changed files with 199 additions and 174 deletions

View File

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:dio/dio.dart'; 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/ApiService.dart';
import 'package:qhd_prevention/http/HttpManager.dart'; import 'package:qhd_prevention/http/HttpManager.dart';
@ -131,15 +132,22 @@ class HiddenDangerApi {
} }
/// ///
static Future<Map<String, dynamic>> getRectificationList(int page,String search) { static Future<Map<String, dynamic>> getRectificationList(int page,String search ,int pageSize ) async {
final parentPerm = 'dashboard:Hazard:Management:Hidden-danger-rectification';
final targetPerm = '';
final menuPath = await RouteService.getMenuPath(parentPerm, targetPerm);
return HttpManager().request( return HttpManager().request(
'${ApiService.basePath}/hidden', '${ApiService.basePath}/hidden',
'/hidden/rectifyList', '/hidden/rectifyList',
method: Method.post, method: Method.post,
data: { data: {
"pageIndex": page, "pageIndex": page,
"pageSize":pageSize,
"hiddenDesc": search, "hiddenDesc": search,
"hiddenLevels": ["hiddenLevel1004", "hiddenLevel1002"],
"menuPath": menuPath,
}, },
); );
} }
@ -229,15 +237,20 @@ class HiddenDangerApi {
} }
/// ///
static Future<Map<String, dynamic>> getGeneralHazardList(int page,String search,searchData, String corpId) { static Future<Map<String, dynamic>> getGeneralHazardList(int page,String search,searchData, String corpId) async {
final parentPerm = 'dashboard:Hazard:Management:Hidden-hazard-record';
final targetPerm = '';
final menuPath = await RouteService.getMenuPath(parentPerm, targetPerm);
return HttpManager().request( return HttpManager().request(
'${ApiService.basePath}/hidden', '${ApiService.basePath}/hidden',
'/hidden/generalHiddenList', '/hidden/list',
method: Method.post, method: Method.post,
data: { data: {
'hiddenLevels': ["hiddenLevel1001", "hiddenLevel1004", "hiddenLevel1002"],
"pageIndex": page, "pageIndex": page,
"hiddenDesc": search, "hiddenDesc": search,
"corpId": corpId, 'menuPath':menuPath,
// "corpId": corpId,
"hiddenFindTime": searchData['beginTIme'], "hiddenFindTime": searchData['beginTIme'],
"hiddenFindTimeLe": searchData['endTime'], "hiddenFindTimeLe": searchData['endTime'],

View File

@ -606,7 +606,7 @@ class _HiddenDangerAcceptanceState extends State<HiddenDangerAcceptance> {
if (widget.appItem == 2) { if (widget.appItem == 2) {
result = await HiddenDangerApi.getIgnoreList(_page, searchKey); result = await HiddenDangerApi.getIgnoreList(_page, searchKey);
} else if (widget.appItem == 3) { } else if (widget.appItem == 3) {
result = await HiddenDangerApi.getRectificationList(_page, searchKey); result = await HiddenDangerApi.getRectificationList(_page, searchKey,20);
} else if (widget.appItem == 4) { } else if (widget.appItem == 4) {
result = await HiddenDangerApi.getSpecialHandlingList( result = await HiddenDangerApi.getSpecialHandlingList(
_page, _page,
@ -698,36 +698,40 @@ class _HiddenDangerAcceptanceState extends State<HiddenDangerAcceptance> {
String _getState(final item) { String _getState(final item) {
int type = item["state"]; int type = item["state"];
if(100==type){ if (100 == type) {
return "待确认"; return "待确认";
}else if(200==type){ } else if (200 == type) {
return "整改"; return "整改";
}else if(201==type){ } else if (201 == type) {
return "确认打回"; return "确认打回";
}else if(202==type){ } else if (202 == type) {
return "待处理特殊隐患"; return "待处理特殊隐患";
}else if(300==type){ } else if (300 == type) {
return "待验收"; return "已整改";
}else if(301==type){ } else if (301 == type) {
return "已验收"; return "已验收";
}else if(302==type){ } else if (302 == type) {
return "验收打回"; return "验收打回";
}else if(303==type){ } else if (303 == type) {
return "验收打回"; return "验收打回";
}else if(400==type){ } else if (400 == type) {
return "处理特殊隐患"; return "归档";
}else if(99==type){ } else if (99 == type) {
return "强制关闭(人员变动)"; return "强制关闭(人员变动)";
}else if(98==type){ } else if (98 == type) {
return "安全环保检查/清单排查暂存"; return "安全环保检查/清单排查暂存";
}else if(102==type){ } else if (102 == type) {
return "安全环保检查,隐患待指派"; return "安全环保检查,隐患带指派";
}else if(97==type){ } else if (97 == type) {
return "已过期";
}else if(101==type){
return "忽略隐患";
}else{
return "已过期"; return "已过期";
} else if (101 == type) {
return "已忽略";
} else if (110 == type) {
return "待核实";
}else if (120 == type) {
return "待核定";
}else {
return "";
} }
} }

View File

@ -241,51 +241,73 @@ class _HiddenDangerDeawerState extends State<HiddenDangerDeawer> {
const SizedBox(height: 10), const SizedBox(height: 10),
GestureDetector( Container(
onTap: () async { padding: EdgeInsets.symmetric(horizontal: 0),
decoration: BoxDecoration(
if(_HazardPersonlist.isEmpty){ borderRadius: BorderRadius.circular(4),
await _getHazardPersonlist(); border: Border.all(color: Colors.grey.shade400),
} color: Colors.white,
String choice = await BottomPickerTwo.show<String>( ),
context, child: ItemListWidget.singleLineTitleText(
items: _HazardPersonlist, label: '隐患确认人',
itemName: "name", isEditable: true,
itemBuilder: (item) => Text(item["name"], textAlign: TextAlign.center), isRequired:false,
initialIndex: 0, isTextFont:false,
); hintText: '',
if (choice != null) { text: allData['trueUserName'] ?? '',
for(int i=0;i<_HazardPersonlist.length;i++){ onChanged: (value) {
if(choice==_HazardPersonlist[i]["name"]){
_hazardLeve = _HazardPersonlist[i];
}
}
setState(() { setState(() {
allData['trueUserId']=_hazardLeve["userId"]; allData['trueUserName'] = value;
allData['trueUserName']=_hazardLeve["name"];
// addData['confirmDeptId']=_hazardLeve["deptId"];
// addData['confirmDeptName']=_hazardLeve["deptName"];
}); });
} },
},
child:Container(
padding: EdgeInsets.symmetric(horizontal: 0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
border: Border.all(color: Colors.grey.shade400),
color: Colors.white,
),
child: ListItemFactory.createRowSpaceBetweenItem(
isRequired:false,
leftText: "隐患确认人",
rightText: allData['trueUserName'].isNotEmpty?allData['trueUserName']:"请选择",
isRight: true,
),
), ),
), ),
// GestureDetector(
// onTap: () async {
//
// if(_HazardPersonlist.isEmpty){
// await _getHazardPersonlist();
// }
// String choice = await BottomPickerTwo.show<String>(
// context,
// items: _HazardPersonlist,
// itemName: "name",
// itemBuilder: (item) => Text(item["name"], textAlign: TextAlign.center),
// initialIndex: 0,
// );
// if (choice != null) {
// for(int i=0;i<_HazardPersonlist.length;i++){
// if(choice==_HazardPersonlist[i]["name"]){
// _hazardLeve = _HazardPersonlist[i];
// }
// }
//
// setState(() {
// allData['trueUserId']=_hazardLeve["userId"];
// allData['trueUserName']=_hazardLeve["name"];
//
// // addData['confirmDeptId']=_hazardLeve["deptId"];
// // addData['confirmDeptName']=_hazardLeve["deptName"];
//
// });
// }
// },
// child:Container(
// padding: EdgeInsets.symmetric(horizontal: 0),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(4),
// border: Border.all(color: Colors.grey.shade400),
// color: Colors.white,
// ),
// child: ListItemFactory.createRowSpaceBetweenItem(
// isRequired:false,
// leftText: "隐患确认人",
// rightText: allData['trueUserName'].isNotEmpty?allData['trueUserName']:"请选择",
// isRight: true,
// ),
// ),
// ),
const SizedBox(height: 10), const SizedBox(height: 10),

View File

@ -673,7 +673,7 @@ class _HiddenDangerRecordTwoState extends State<HiddenDangerRecordTwo> {
if (100 == type) { if (100 == type) {
return "待确认"; return "待确认";
} else if (200 == type) { } else if (200 == type) {
return "整改"; return "整改";
} else if (201 == type) { } else if (201 == type) {
return "确认打回"; return "确认打回";
} else if (202 == type) { } else if (202 == type) {
@ -687,7 +687,7 @@ class _HiddenDangerRecordTwoState extends State<HiddenDangerRecordTwo> {
} else if (303 == type) { } else if (303 == type) {
return "验收打回"; return "验收打回";
} else if (400 == type) { } else if (400 == type) {
return "处理特殊隐患"; return "归档";
} else if (99 == type) { } else if (99 == type) {
return "强制关闭(人员变动)"; return "强制关闭(人员变动)";
} else if (98 == type) { } else if (98 == type) {
@ -697,9 +697,13 @@ class _HiddenDangerRecordTwoState extends State<HiddenDangerRecordTwo> {
} else if (97 == type) { } else if (97 == type) {
return "已过期"; return "已过期";
} else if (101 == type) { } else if (101 == type) {
return "忽略隐患"; return "已忽略";
} else { } else if (110 == type) {
return "已过期"; return "待核实";
}else if (120 == type) {
return "待核定";
}else {
return "";
} }
} }

View File

@ -3,6 +3,7 @@ import 'dart:ffi';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:qhd_prevention/common/route_service.dart'; import 'package:qhd_prevention/common/route_service.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/key_tasks_api.dart';
import 'package:qhd_prevention/pages/home/doorAndCar/doorCar_tab_page.dart'; import 'package:qhd_prevention/pages/home/doorAndCar/doorCar_tab_page.dart';
import 'package:qhd_prevention/pages/home/hiddenDanger/hidden_danger_acceptance.dart'; import 'package:qhd_prevention/pages/home/hiddenDanger/hidden_danger_acceptance.dart';
@ -46,7 +47,7 @@ class _HiddenDangerTabPageState extends State<HiddenDangerTabPage> {
AppSectionItem( AppSectionItem(
title: '隐患整改', title: '隐患整改',
icon: 'assets/images/key_tasks_ico6.png', icon: 'assets/images/key_tasks_ico6.png',
menuPerms:'dashboard:Key-assignment:Hidden-danger-rectification', menuPerms:'dashboard:Hazard:Management:Hidden-danger-rectification',
badge: 0, badge: 0,
onTap: () async { onTap: () async {
await pushPage(HiddenDangerAcceptance(DangerType.wait, 3), context); await pushPage(HiddenDangerAcceptance(DangerType.wait, 3), context);
@ -56,7 +57,7 @@ class _HiddenDangerTabPageState extends State<HiddenDangerTabPage> {
AppSectionItem( AppSectionItem(
title: '隐患记录', title: '隐患记录',
icon: 'assets/images/key_tasks_ico7.png', icon: 'assets/images/key_tasks_ico7.png',
menuPerms:'dashboard:Key-assignment:Hidden-Hazard-Record', menuPerms:'dashboard:Hazard:Management:Hidden-hazard-record',
badge: 0, badge: 0,
onTap: () async { onTap: () async {
await pushPage(HiddenDangerRecordTwo(DangerType.ristRecord, 7, ''), context); await pushPage(HiddenDangerRecordTwo(DangerType.ristRecord, 7, ''), context);
@ -70,32 +71,32 @@ class _HiddenDangerTabPageState extends State<HiddenDangerTabPage> {
} }
Future<void> _getDoorCarCount() async { Future<void> _getDoorCarCount() async {
// try { try {
// String userId= SessionService.instance.accountId??'';
// final result = await KeyTasksApi.getKeyTasksToDoCount(userId); final result = await HiddenDangerApi.getRectificationList(1, '',101);
// if (result['success'] ) { if (result['success'] ) {
// dynamic data = result['data']?? {} ; List<dynamic> data = result['data']?? [] ;
//
// setState(() { setState(() {
// // //
// final gateSection = defaultSections[0]; final gateSection = defaultSections[0];
//
// // //
// gateSection.items[0].badge = int.parse(data['zdzysqCount']??0); gateSection.items[0].badge = data.length;
// // // //
// gateSection.items[1].badge = int.parse(data['bjcrqrCount']??0); // gateSection.items[1].badge = int.parse(data['bjcrqrCount']??0);
// // // //
// gateSection.items[2].badge = int.parse(data['yhdzgCount']??0); // gateSection.items[2].badge = int.parse(data['yhdzgCount']??0);
//
// }); });
// } }
// // else { // else {
// // ToastUtil.showNormal(context, result['errMessage'] ?? "加载数据失败"); // ToastUtil.showNormal(context, result['errMessage'] ?? "加载数据失败");
// // } // }
// } catch (e) { } catch (e) {
// LoadingDialogHelper.hide(); LoadingDialogHelper.hide();
// print('加载数据失败:$e'); print('加载数据失败:$e');
// } }
} }
@override @override

View File

@ -3186,7 +3186,7 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
if (100 == type) { if (100 == type) {
return "待确认"; return "待确认";
} else if (200 == type) { } else if (200 == type) {
return "整改"; return "整改";
} else if (201 == type) { } else if (201 == type) {
return "确认打回"; return "确认打回";
} else if (202 == type) { } else if (202 == type) {
@ -3200,19 +3200,23 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
} else if (303 == type) { } else if (303 == type) {
return "验收打回"; return "验收打回";
} else if (400 == type) { } else if (400 == type) {
return "处理特殊隐患"; return "归档";
} else if (99 == type) { } else if (99 == type) {
return "强制关闭(人员变动)"; return "强制关闭(人员变动)";
} else if (98 == type) { } else if (98 == type) {
return "安全环保检查/清单排查暂存"; return "安全环保检查/清单排查暂存";
} else if (102 == type) { } else if (102 == type) {
return "安全环保检查,隐患指派"; return "安全环保检查,隐患指派";
} else if (97 == type) { } else if (97 == type) {
return "已过期"; return "已过期";
} else if (101 == type) { } else if (101 == type) {
return "忽略隐患"; return "已忽略";
} else { } else if (110 == type) {
return "已过期"; return "待核实";
}else if (120 == type) {
return "待核定";
}else {
return "";
} }
} }

View File

@ -1497,36 +1497,40 @@ class _HiddenRecordDetailPastrecordsPageState extends State<HiddenRecordDetailPa
String _getState(final item) { String _getState(final item) {
int type = item["state"]; int type = item["state"];
if(100==type){ if (100 == type) {
return "待确认"; return "待确认";
}else if(200==type){ } else if (200 == type) {
return "整改"; return "整改";
}else if(201==type){ } else if (201 == type) {
return "确认打回"; return "确认打回";
}else if(202==type){ } else if (202 == type) {
return "待处理特殊隐患"; return "待处理特殊隐患";
}else if(300==type){ } else if (300 == type) {
return "待验收"; return "已整改";
}else if(301==type){ } else if (301 == type) {
return "已验收"; return "已验收";
}else if(302==type){ } else if (302 == type) {
return "验收打回"; return "验收打回";
}else if(303==type){ } else if (303 == type) {
return "验收打回"; return "验收打回";
}else if(400==type){ } else if (400 == type) {
return "处理特殊隐患"; return "归档";
}else if(99==type){ } else if (99 == type) {
return "强制关闭(人员变动)"; return "强制关闭(人员变动)";
}else if(98==type){ } else if (98 == type) {
return "安全环保检查/清单排查暂存"; return "安全环保检查/清单排查暂存";
}else if(102==type){ } else if (102 == type) {
return "安全环保检查,隐患待指派"; return "安全环保检查,隐患带指派";
}else if(97==type){ } else if (97 == type) {
return "已过期";
}else if(101==type){
return "忽略隐患";
}else{
return "已过期"; return "已过期";
} else if (101 == type) {
return "已忽略";
} else if (110 == type) {
return "待核实";
}else if (120 == type) {
return "待核定";
}else {
return "";
} }
} }

View File

@ -1112,46 +1112,15 @@ class HomePageState extends RouteAwareState<HomePage>
"pageIndex": '1', "pageIndex": '1',
"pageSize": '999', "pageSize": '999',
}; };
Future<Map> safeRequest( final result = await TodoApi.getTodoList(data);
Future request, final specialWork = await SpecialWorkApi.specialWorkTaskLogTotalCount();
Map fallback, final keyTasksWork = await KeyTasksApi.getKeyTasksToDoCount(SessionService.instance.accountId??'');
String apiName, final hiddenDangerWork = await HiddenDangerApi.getRectificationList(1, '',101);
) async {
try {
final response = await request;
if (response is Map) return response;
} catch (e) {
debugPrint('$apiName request failed: $e');
}
return fallback;
}
final responses = await Future.wait([
safeRequest(TodoApi.getTodoList(data), {
"success": false,
"data": [],
"totalCount": 0,
}, 'TodoApi.getTodoList'),
safeRequest(
SpecialWorkApi.specialWorkTaskLogTotalCount(),
{"success": false, "data": []},
'SpecialWorkApi.specialWorkTaskLogTotalCount',
),
safeRequest(
KeyTasksApi.getKeyTasksToDoCount(
SessionService.instance.accountId ?? '',
),
{"success": false, "data": {}},
'KeyTasksApi.getKeyTasksToDoCount',
),
]);
final result = responses[0];
final specialWork = responses[1];
final keyTasksWork = responses[2];
int specialWorkNum = 0; int specialWorkNum = 0;
int keyTasksNum = 0; int keyTasksNum = 0;
int hiddenDangerNum = 0;
try { try {
if (FormUtils.hasValue(specialWork, 'success') && specialWork['success']) { if (specialWork['success']) {
List<dynamic> specialWorkList = specialWork['data'] ?? []; List<dynamic> specialWorkList = specialWork['data'] ?? [];
for (var item in specialWorkList) { for (var item in specialWorkList) {
if (item is Map) { if (item is Map) {
@ -1160,14 +1129,16 @@ class HomePageState extends RouteAwareState<HomePage>
} }
} }
} }
if (FormUtils.hasValue(keyTasksWork, 'success') && keyTasksWork['success']) { if (keyTasksWork['success']) {
final keyTasksData = keyTasksWork['data']; int zdzysqCount = int.parse(keyTasksWork['data']['zdzysqCount']??0);
if (keyTasksData is Map) { int bjcrqrCount = int.parse(keyTasksWork['data']['bjcrqrCount']??0);
int zdzysqCount = int.tryParse('${keyTasksData['zdzysqCount']}') ?? 0; int yhdzgCount = int.parse(keyTasksWork['data']['yhdzgCount']??0);
int bjcrqrCount = int.tryParse('${keyTasksData['bjcrqrCount']}') ?? 0; keyTasksNum = bjcrqrCount+yhdzgCount+zdzysqCount;
int yhdzgCount = int.tryParse('${keyTasksData['yhdzgCount']}') ?? 0; }
keyTasksNum = bjcrqrCount + yhdzgCount + zdzysqCount;
} if (hiddenDangerWork['success']) {
List<dynamic> data = hiddenDangerWork['data']?? [] ;
hiddenDangerNum = data.length;
} }
setState(() { setState(() {
for (var section in buttonInfos) { for (var section in buttonInfos) {
@ -1177,16 +1148,18 @@ class HomePageState extends RouteAwareState<HomePage>
if (section['title'] == '重点作业') { if (section['title'] == '重点作业') {
section['unreadCount'] = keyTasksNum; section['unreadCount'] = keyTasksNum;
} }
if (section['title'] == '隐患治理') {
section['unreadCount'] = hiddenDangerNum;
}
} }
}); });
} catch (e) { } catch (e) {}
debugPrint('_getToDoWorkList parse failed: $e');
}
if (result['success']) { if (result['success']) {
setState(() { setState(() {
workStats['total'] = result['totalCount']; workStats['total'] = result['totalCount'];
checkLists = result['data']; checkLists = result['data'];
// checkLists = result['data']; // checkLists = result['data'];
int m = checkLists.length;
}); });
} }
} }