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 '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';
@ -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(
'${ApiService.basePath}/hidden',
'/hidden/rectifyList',
method: Method.post,
data: {
"pageIndex": page,
"pageSize":pageSize,
"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(
'${ApiService.basePath}/hidden',
'/hidden/generalHiddenList',
'/hidden/list',
method: Method.post,
data: {
'hiddenLevels': ["hiddenLevel1001", "hiddenLevel1004", "hiddenLevel1002"],
"pageIndex": page,
"hiddenDesc": search,
"corpId": corpId,
'menuPath':menuPath,
// "corpId": corpId,
"hiddenFindTime": searchData['beginTIme'],
"hiddenFindTimeLe": searchData['endTime'],

View File

@ -606,7 +606,7 @@ class _HiddenDangerAcceptanceState extends State<HiddenDangerAcceptance> {
if (widget.appItem == 2) {
result = await HiddenDangerApi.getIgnoreList(_page, searchKey);
} else if (widget.appItem == 3) {
result = await HiddenDangerApi.getRectificationList(_page, searchKey);
result = await HiddenDangerApi.getRectificationList(_page, searchKey,20);
} else if (widget.appItem == 4) {
result = await HiddenDangerApi.getSpecialHandlingList(
_page,
@ -698,36 +698,40 @@ class _HiddenDangerAcceptanceState extends State<HiddenDangerAcceptance> {
String _getState(final item) {
int type = item["state"];
if(100==type){
if (100 == type) {
return "待确认";
}else if(200==type){
return "整改";
}else if(201==type){
} else if (200 == type) {
return "整改";
} else if (201 == type) {
return "确认打回";
}else if(202==type){
} else if (202 == type) {
return "待处理特殊隐患";
}else if(300==type){
return "待验收";
}else if(301==type){
} else if (300 == type) {
return "已整改";
} else if (301 == type) {
return "已验收";
}else if(302==type){
} else if (302 == type) {
return "验收打回";
}else if(303==type){
} else if (303 == type) {
return "验收打回";
}else if(400==type){
return "处理特殊隐患";
}else if(99==type){
} else if (400 == type) {
return "归档";
} else if (99 == type) {
return "强制关闭(人员变动)";
}else if(98==type){
} else if (98 == type) {
return "安全环保检查/清单排查暂存";
}else if(102==type){
return "安全环保检查,隐患待指派";
}else if(97==type){
return "已过期";
}else if(101==type){
return "忽略隐患";
}else{
} else if (102 == type) {
return "安全环保检查,隐患带指派";
} else if (97 == type) {
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),
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(
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(
child: ItemListWidget.singleLineTitleText(
label: '隐患确认人',
isEditable: true,
isRequired:false,
leftText: "隐患确认人",
rightText: allData['trueUserName'].isNotEmpty?allData['trueUserName']:"请选择",
isRight: true,
),
isTextFont:false,
hintText: '',
text: allData['trueUserName'] ?? '',
onChanged: (value) {
setState(() {
allData['trueUserName'] = value;
});
},
),
),
// 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),

View File

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

View File

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

View File

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

View File

@ -1497,36 +1497,40 @@ class _HiddenRecordDetailPastrecordsPageState extends State<HiddenRecordDetailPa
String _getState(final item) {
int type = item["state"];
if(100==type){
if (100 == type) {
return "待确认";
}else if(200==type){
return "整改";
}else if(201==type){
} else if (200 == type) {
return "整改";
} else if (201 == type) {
return "确认打回";
}else if(202==type){
} else if (202 == type) {
return "待处理特殊隐患";
}else if(300==type){
return "待验收";
}else if(301==type){
} else if (300 == type) {
return "已整改";
} else if (301 == type) {
return "已验收";
}else if(302==type){
} else if (302 == type) {
return "验收打回";
}else if(303==type){
} else if (303 == type) {
return "验收打回";
}else if(400==type){
return "处理特殊隐患";
}else if(99==type){
} else if (400 == type) {
return "归档";
} else if (99 == type) {
return "强制关闭(人员变动)";
}else if(98==type){
} else if (98 == type) {
return "安全环保检查/清单排查暂存";
}else if(102==type){
return "安全环保检查,隐患待指派";
}else if(97==type){
return "已过期";
}else if(101==type){
return "忽略隐患";
}else{
} else if (102 == type) {
return "安全环保检查,隐患带指派";
} else if (97 == type) {
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',
"pageSize": '999',
};
Future<Map> safeRequest(
Future request,
Map fallback,
String apiName,
) 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];
final result = await TodoApi.getTodoList(data);
final specialWork = await SpecialWorkApi.specialWorkTaskLogTotalCount();
final keyTasksWork = await KeyTasksApi.getKeyTasksToDoCount(SessionService.instance.accountId??'');
final hiddenDangerWork = await HiddenDangerApi.getRectificationList(1, '',101);
int specialWorkNum = 0;
int keyTasksNum = 0;
int hiddenDangerNum = 0;
try {
if (FormUtils.hasValue(specialWork, 'success') && specialWork['success']) {
if (specialWork['success']) {
List<dynamic> specialWorkList = specialWork['data'] ?? [];
for (var item in specialWorkList) {
if (item is Map) {
@ -1160,14 +1129,16 @@ class HomePageState extends RouteAwareState<HomePage>
}
}
}
if (FormUtils.hasValue(keyTasksWork, 'success') && keyTasksWork['success']) {
final keyTasksData = keyTasksWork['data'];
if (keyTasksData is Map) {
int zdzysqCount = int.tryParse('${keyTasksData['zdzysqCount']}') ?? 0;
int bjcrqrCount = int.tryParse('${keyTasksData['bjcrqrCount']}') ?? 0;
int yhdzgCount = int.tryParse('${keyTasksData['yhdzgCount']}') ?? 0;
keyTasksNum = bjcrqrCount + yhdzgCount + zdzysqCount;
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;
}
if (hiddenDangerWork['success']) {
List<dynamic> data = hiddenDangerWork['data']?? [] ;
hiddenDangerNum = data.length;
}
setState(() {
for (var section in buttonInfos) {
@ -1177,16 +1148,18 @@ class HomePageState extends RouteAwareState<HomePage>
if (section['title'] == '重点作业') {
section['unreadCount'] = keyTasksNum;
}
if (section['title'] == '隐患治理') {
section['unreadCount'] = hiddenDangerNum;
}
}
});
} catch (e) {
debugPrint('_getToDoWorkList parse failed: $e');
}
} catch (e) {}
if (result['success']) {
setState(() {
workStats['total'] = result['totalCount'];
checkLists = result['data'];
// checkLists = result['data'];
int m = checkLists.length;
});
}
}