2025.7.30 正在写检查记录

main
xufei 2025-07-30 10:47:52 +08:00
parent 0238689f1a
commit 0e760563d9
8 changed files with 1380 additions and 91 deletions

View File

@ -9,7 +9,7 @@ class ApiService {
// static const String basePath = "http://192.168.0.25:28199/";
// static const String basePath = "http://192.168.20.240:8500/integrated_whb";
// static const String baseFacePath = "http://192.168.0.25:38199/";
//
// ///
// static const String baseFacePath = "https://qaaqwh.qhdsafety.com/whb_stu_face/";
// static const String basePath = "https://qaaqwh.qhdsafety.com/integrated_whb/";
@ -1472,6 +1472,101 @@ U6Hzm1ninpWeE+awIDAQAB
);
}
///
static Future<Map<String, dynamic>> addHazardAcceptance(String type,String miaoshu,String dataTime,String id) {
return HttpManager().request(
basePath,
'/app/hidden/riskListCheckInspection',
method: Method.post,
data: {
"ISQUALIFIED": type,
"CHECKDESCR": miaoshu,
"CHECK_TIME": dataTime,
"HIDDEN_ID": id,
"CHECKOR": SessionService.instance.loginUserId,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getHazardInspectionRecordList(
int currentPage,String keyWord,String id,String dept,
String starDate,String endDate,String periodId,String userName,String typeId,) {
return HttpManager().request(
basePath,
'/app/listmanager/recordList?showCount=-1&currentPage=$currentPage',
method: Method.post,
data: {
"DEPARTMENT_ID": id,
"DEPT_ID": dept,
"STARTTIME": starDate,
"ENDTIME": endDate,
"PERIOD": periodId,
"USERNAME": userName,
"TYPE": typeId,
"tm": DateTime.now().millisecondsSinceEpoch.toString(),
"KEYWORDS": keyWord, //
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getStandardInvestigationRecordList(
int currentPage,String keyWord,String id,String dept,
String starDate,String endDate,String periodId,String userName,String typeId,) {
return HttpManager().request(
basePath,
'/app/hiddenDangerCheckStandardCustom/recordList?showCount=-1&currentPage=$currentPage',
method: Method.post,
data: {
"DEPARTMENT_ID": id,
"DEPT_ID": dept,
"STARTTIME": starDate,
"ENDTIME": endDate,
"PERIOD": periodId,
"USERNAME": userName,
"TYPE": typeId,
"tm": DateTime.now().millisecondsSinceEpoch.toString(),
"KEYWORDS": keyWord, //
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getListType() {
return HttpManager().request(
basePath,
'/dictionaries/getLevels?tm=${DateTime.now().millisecondsSinceEpoch.toString()}',
method: Method.post,
data: {
"DICTIONARIES_ID": '4a3d0d99b0ea4e268c11dd0b18866917',
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getListInspectionCycle() {
return HttpManager().request(
basePath,
'/dictionaries/getLevels?tm=${DateTime.now().millisecondsSinceEpoch.toString()}',
method: Method.post,
data: {
"DICTIONARIES_ID": 'f60cf0e8315b4993b6d6049dd29f2ba5',
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
}

View File

@ -1,8 +1,11 @@
import 'package:flutter/material.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/pages/app/Danger_paicha/check_record_list_page.dart';
import 'package:qhd_prevention/pages/app/Danger_paicha/custom_record_drawer.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
import 'package:qhd_prevention/tools/h_colors.dart';
import 'package:qhd_prevention/tools/tools.dart';
import '../../../Model/list_model.dart';
@ -10,24 +13,65 @@ import '../../../customWidget/danner_repain_item.dart';
import '../../home/scan_page.dart';
class CheckRecordPage extends StatefulWidget {
const CheckRecordPage({super.key});
const CheckRecordPage(this.type, {super.key});
final int type;
@override
State<CheckRecordPage> createState() => _CheckRecordPageState();
}
class _CheckRecordPageState extends State<CheckRecordPage> {
final TextEditingController _searchController = TextEditingController();
final List<RecordCheckModel> _notifications = List.generate(10, (i) {
bool read = i % 3 == 0;
String title = '测试数据标题标题 ${i + 1}';
String time = '2025-06-${10 + i} 12:3${i}';
return RecordCheckModel(title, time);
});
String appBarTitle="";
String id="";
int _page = 1;
String searchKey="";
int _totalPage=1;
List<dynamic> _list = [];
bool _isLoading = false;
bool _hasMore = true;
List<dynamic> listType = [];
List<dynamic> listInspectionCycle = [];
void _handleItemTap(RecordCheckModel model) {
//item
pushPage(CheckRecordListPage(), context);
}
@override
void initState() {
// TODO: implement initState
super.initState();
id=SessionService.instance.loginUser?["DEPARTMENT_ID"]??"";
print("======>$id");
getListData(false,"");
_getListType();
_getListInspectionCycle();
SessionService.instance.setCustomRecordDangerJson("");
}
void getListData(bool addList,String keyWord){
switch(widget.type ){
case 1://
appBarTitle="检查记录";
_getHazardInspectionRecordList(_page,keyWord,"","","","","","",addList);
break;
case 2://
appBarTitle="标准排查清单";
_getStandardInvestigationRecordList(_page,keyWord,"","","","","","",addList);
break;
}
}
@override
Widget build(BuildContext context) {
//
@ -38,7 +82,7 @@ class _CheckRecordPageState extends State<CheckRecordPage> {
key: _scaffoldKey, // key
appBar: MyAppbar(
title: "清单检查记录",
title: appBarTitle,
actions: [
TextButton(
onPressed: () {
@ -51,57 +95,246 @@ class _CheckRecordPageState extends State<CheckRecordPage> {
),
],
),
endDrawer: Drawer(
// Container 3/5
child: Container(
width: screenWidth * 3 / 5,
color: Colors.white,
child: const CustomRecordDrawer(),
child: CustomRecordDrawer(
listType,listInspectionCycle,
onClose: (String departmentId,String responsibleName,String selectedQDTypeId,String selectedZQTimeId
,String startDate,String endDate) {
_page=1;
switch(widget.type ){
case 1://
_getHazardInspectionRecordList(_page,searchKey,departmentId,startDate,endDate,selectedZQTimeId,responsibleName,selectedQDTypeId,false);
break;
case 2://
// _getStandardInvestigationRecordList(_page,searchKey,departmentId,startDate,endDate,selectedZQTimeId,responsibleName,selectedQDTypeId,false);
break;
}
},
),
),
),
body: SafeArea(child: Column(
children: [
Container(
padding: EdgeInsets.all(15),
color: Colors.white,
body: SafeArea(
child: NotificationListener<ScrollNotification>(
onNotification: _onScroll,
child:_vcDetailWidget()
)
),
// backgroundColor: Colors.white,
);
}
Widget _vcDetailWidget() {
return Column(
children: [
Container(
color: Colors.white,
child: Padding(
padding: EdgeInsets.all(10),
child: SearchBarWidget(
controller: _searchController,
autoFocus: true,
onSearch: (keyboard) {
//
_page=1;
searchKey=keyboard;
getListData(false,keyboard);
},
),
),
Expanded(
),
child: ListView.separated(
padding: EdgeInsets.only(top: 15),
itemCount: _notifications.length,
separatorBuilder: (_, __) => const SizedBox(),
itemBuilder: (context, index) {
RecordCheckModel item = _notifications[index];
return GestureDetector(
onTap: () => _handleItemTap(item),
child: DannerRepainItem(
showTitleIcon: false,
title: '测试--------new',
details: [
'清单类型:测试',
'排查周期:测试',
'包含检查项3',
'',
'起始时间2025-6-20------',
'测试',"ccccc",'sssss'
],
showBottomTags: false,
Container(
height: 5,
color: h_backGroundColor(),
),
),
);
},
),
)
Expanded(
],
)),
child:_list.isEmpty
? NoDataWidget.show()
: ListView.separated(
padding: EdgeInsets.only(top: 15),
itemCount: _list.length,
separatorBuilder: (_, __) => const SizedBox(),
itemBuilder: (context, index) {
final item = _list[index];
return GestureDetector(
onTap: () => _handleItemTap(item),
child: DannerRepainItem(
showTitleIcon: true,
title: '清单名称:${item['NAME']}',
details: [
'清单类型:${item['TYPENAME']}',
'排查周期:${item['PERIODNAME']}',
'部门:${item['DEPARTMENT_NAME']}',
'',
'岗位:${item['POST_NAME']}',
'人员:${item['USER_NAME']}',
"检查次数:${item['count']}",
'超期未检查次数:${item['overTimeCount']}'
],
showBottomTags: false,
),
);
},
),
)
],
);
}
bool _onScroll(ScrollNotification n) {
if (n.metrics.pixels > n.metrics.maxScrollExtent - 100 &&
_hasMore && !_isLoading) {
_page++;
getListData(true,"");
}
return false;
}
Future<void> _getHazardInspectionRecordList( int currentPage,String keyWord,String dept,
String starDate,String endDate,String periodId,String userName,String typeId,bool loadMore) async {
try {
if (_isLoading) return;
_isLoading = true;
final result = await ApiService.getHazardInspectionRecordList(
currentPage, keyWord, id, dept,
starDate, endDate, periodId, userName, typeId);
if (result['result'] == 'success') {
_totalPage =result["page"]['totalPage'] ?? 1;
final List<dynamic> newList = result['varList'] ?? [];
// 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) {
// Toast
print('加载数据失败:$e');
} finally {
// if (!loadMore) LoadingDialogHelper.hide(context);
_isLoading = false;
}
}
Future<void> _getStandardInvestigationRecordList( int currentPage,String keyWord,String dept,
String starDate,String endDate,String periodId,String userName,String typeId,bool loadMore) async {
try {
if (_isLoading) return;
_isLoading = true;
final result = await ApiService.getStandardInvestigationRecordList(
currentPage, keyWord, id, dept,
starDate, endDate, periodId, userName, typeId);
if (result['result'] == 'success') {
_totalPage =result["page"]['totalPage'] ?? 1;
final List<dynamic> newList = result['varList'] ?? [];
// 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) {
// Toast
print('加载数据失败:$e');
} finally {
// if (!loadMore) LoadingDialogHelper.hide(context);
_isLoading = false;
}
}
Future<void> _getListType() async {
try {
final result = await ApiService.getListType();
if (result['result'] == 'success') {
setState(() {
listType= result['list'];
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
Future<void> _getListInspectionCycle() async {
try {
final result = await ApiService.getListInspectionCycle();
if (result['result'] == 'success') {
setState(() {
listInspectionCycle= result['list'];
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
}

View File

@ -1,32 +1,160 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart' show DateFormat;
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
import 'package:qhd_prevention/customWidget/bottom_picker.dart';
import 'package:qhd_prevention/customWidget/bottom_picker_two.dart';
import 'package:qhd_prevention/customWidget/department_person_picker.dart';
import 'package:qhd_prevention/customWidget/department_picker.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'package:qhd_prevention/http/ApiService.dart';
import 'package:qhd_prevention/tools/tools.dart';
import '../../../tools/h_colors.dart';
import '/customWidget/custom_button.dart';
class CustomRecordBean {
// id
final String departmentId;
final String departmentName;
final String responsibleId;
final String responsibleName;
//
final String? selectedQDType;
final String? selectedQDTypeId;
//
final String? selectedZQTime;
final String? selectedZQTimeId;
// /
final String startTime;
final String endTime;
CustomRecordBean({
required this.departmentId,
required this.departmentName,
required this.responsibleId,
required this.responsibleName,
required this.selectedQDType,
required this.selectedQDTypeId,
required this.selectedZQTime,
required this.selectedZQTimeId,
required this.startTime,
required this.endTime,
});
factory CustomRecordBean.fromJson(
String departmentId,String departmentName, String responsibleId, String responsibleName,
String selectedQDType, String selectedQDTypeId, String selectedZQTime,String selectedZQTimeId,
String startTime,String endTime,
) {
return CustomRecordBean(
departmentId:departmentId,
departmentName:departmentName,
responsibleId:responsibleId,
responsibleName:responsibleName,
selectedQDType:selectedQDType,
selectedQDTypeId:selectedQDTypeId,
selectedZQTime:selectedZQTime,
selectedZQTimeId:selectedZQTimeId,
startTime:startTime,
endTime:endTime,
);
}
Map<String, dynamic> toJson() {
return {"departmentId":departmentId,"departmentName":departmentName, "responsibleId":responsibleId,"responsibleName":responsibleName,
"selectedQDType":selectedQDType,"selectedQDTypeId":selectedQDTypeId,"selectedZQTime":selectedZQTime,"selectedZQTimeId":selectedZQTimeId,
"startTime":startTime,"endTime":endTime,};
}
}
///
class CustomRecordDrawer extends StatefulWidget {
const CustomRecordDrawer({super.key});
const CustomRecordDrawer(this.listType,this.listInspectionCycle, {super.key,required this.onClose});
final List<dynamic> listType ;
final List<dynamic> listInspectionCycle ;
final Function(String,String,String,String,String,String,) onClose;
@override
_CustomRecordDrawerState createState() => _CustomRecordDrawerState();
}
class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
// index
int _selectedOption = -1;
//
List<Map<String, dynamic>> _personCache = [];
// id
String? _selectedCategoryId;
//
String? _selectedPerson;
String departmentId="";
String departmentName="";
String responsibleId="";
String responsibleName="";
//
String? _selectedQDType;
String _selectedQDType="";
String _selectedQDTypeId="";
//
String? _selectedZQTime;
String _selectedZQTime="";
String _selectedZQTimeId="";
// /
DateTime? _startDate;
DateTime? _endDate;
String startTime="";
String endTime="";
@override
void initState() {
// TODO: implement initState
super.initState();
setState(() {
try {
String? dangerJson = SessionService.instance.customRecordDangerJson;
if(null!=dangerJson&&dangerJson.isNotEmpty) {
Map<String, dynamic> dangerWaitBean = json.decode(dangerJson);
departmentId= dangerWaitBean["departmentId"];
departmentName= dangerWaitBean["departmentName"];
responsibleId= dangerWaitBean["responsibleId"];
responsibleName= dangerWaitBean["responsibleName"];
_selectedQDType= dangerWaitBean["selectedQDType"];
_selectedQDTypeId= dangerWaitBean["selectedQDTypeId"];
_selectedZQTime= dangerWaitBean["selectedZQTime"];
_selectedZQTimeId= dangerWaitBean["selectedZQTimeId"];
startTime= dangerWaitBean["startTime"];
endTime= dangerWaitBean["endTime"];
}
} catch (e) {
print("解析失败: $e");
}
});
}
@override
Widget build(BuildContext context) {
@ -38,48 +166,87 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
isScrollControlled: true,
barrierColor: Colors.black54,
backgroundColor: Colors.transparent,
builder: (ctx) => DepartmentPicker(onSelected: (id, name) {
builder: (ctx) => DepartmentPicker(onSelected: (id, name) async {
setState(() {
_selectedCategoryId = id;
departmentId=id;
departmentName=name;
responsibleId="";
responsibleName="";
// setResult();
});
//
final result = await ApiService.getListTreePersonList(id);
_personCache=List<Map<String, dynamic>>.from(
result['userList'] as List,
);
}),
);
} else if (type == 2) {
final choice = await BottomPicker.show<String>(
context,
items: ['未知'],
itemBuilder: (item) => Text(item, textAlign: TextAlign.center),
initialIndex: 0,
);
if (choice != null) {
// choice
setState(() {
_selectedPerson = choice;
});
}
if ( departmentId.isEmpty) {
ToastUtil.showNormal(context, '请先选择部门');
return;
}
DepartmentPersonPicker.show(
context,
personsData: _personCache,
onSelected: (userId, name) {
setState(() {
// renYuanId = userId;
// renYuanName = name;
responsibleId=userId;
responsibleName=name;
// setResult();
});
},
);
}else if (type == 3) {
final choice = await BottomPicker.show<String>(
final choice = await BottomPickerTwo.show<String>(
context,
items: ['日常', '综合', '专业', '季节性','节假日'],
itemBuilder: (item) => Text(item, textAlign: TextAlign.center),
items: widget.listType,
itemBuilder: (item) => Text(item["NAME"], textAlign: TextAlign.center),
initialIndex: 0,
);
if (choice != null) {
for(int i=0;i<widget.listType.length;i++){
if(choice==widget.listType[i]["NAME"]){
_selectedQDTypeId = widget.listType[i]["BIANMA"];
}
}
setState(() {
_selectedQDType = choice;
// setResult();
});
}
}else if (type == 4) {
final choice = await BottomPicker.show<String>(
final choice = await BottomPickerTwo.show<String>(
context,
items: ['每日', '每周', '每旬', '每月', '每季', '半年', '每年'],
itemBuilder: (item) => Text(item, textAlign: TextAlign.center),
items: widget.listInspectionCycle,
itemBuilder: (item) => Text(item["NAME"], textAlign: TextAlign.center),
initialIndex: 0,
);
if (choice != null) {
for(int i=0;i<widget.listInspectionCycle.length;i++){
if(choice==widget.listInspectionCycle[i]["NAME"]){
_selectedZQTimeId = widget.listInspectionCycle[i]["BIANMA"];
}
}
setState(() {
_selectedZQTime = choice;
// setResult();
});
}
}
@ -96,11 +263,19 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
);
if (picked != null) {
setState(() {
_startDate = picked;
final dateFormat = DateFormat('yyyy-MM-dd');
startTime=dateFormat.format(picked);
// <=
if (_endDate != null && _endDate!.isBefore(picked)) {
_endDate = null;
}
// setResult();
});
}
}
@ -120,6 +295,12 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
if (picked != null) {
setState(() {
_endDate = picked;
final dateFormat = DateFormat('yyyy-MM-dd');
endTime=dateFormat.format(picked);
// setResult();
});
}
}
@ -170,25 +351,25 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
//
_buildDropdownBox(
"检查部门",
display: _selectedCategoryId ?? '请选择',
display: departmentName.isNotEmpty ?departmentName: '请选择',
onTap: () => showCategoryPicker(1),
),
const SizedBox(height: 12),
_buildDropdownBox(
"检查人",
display: _selectedPerson ?? '请选择',
display: responsibleName .isNotEmpty ?responsibleName: '请选择',
onTap: () => showCategoryPicker(2),
),
const SizedBox(height: 12),
_buildDropdownBox(
"清单类型",
display: _selectedQDType ?? '请选择',
display: _selectedQDType .isNotEmpty ?_selectedQDType: '请选择',
onTap: () => showCategoryPicker(3),
),
const SizedBox(height: 12),
_buildDropdownBox(
"排查周期",
display: _selectedZQTime ?? '请选择',
display: _selectedZQTime .isNotEmpty ?_selectedZQTime: '请选择',
onTap: () => showCategoryPicker(4),
),
const SizedBox(height: 24),
@ -232,10 +413,26 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
textStyle: const TextStyle(color: Colors.black45),
onPressed: () {
setState(() {
_selectedOption = -1;
_selectedCategoryId = null;
_startDate = null;
_endDate = null;
// id
departmentId="";
departmentName="";
responsibleId="";
responsibleName="";
//
_selectedQDType="";
_selectedQDTypeId="";
//
_selectedZQTime="";
_selectedZQTimeId="";
// /
_startDate=null;
_endDate=null;
startTime="";
endTime="";
});
},
),
@ -248,6 +445,8 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
backgroundColor: Colors.blue,
onPressed: () {
// TODO: _startDate_endDate
Navigator.pop(context);
setResult();//
},
),
),
@ -286,4 +485,24 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
),
);
}
void setResult(){
CustomRecordBean waitBean= CustomRecordBean.fromJson(
departmentId ?? "", departmentName?? "", responsibleId?? "",responsibleName?? "",
_selectedQDType?? "", _selectedQDTypeId?? "",_selectedZQTime?? "", _selectedZQTimeId?? "",
startTime, endTime);
String jsonString = jsonEncode(waitBean.toJson());
SessionService.instance.setCustomRecordDangerJson(jsonString);
widget.onClose(
departmentId ?? "", responsibleName ?? "",
_selectedQDTypeId ?? "", _selectedZQTimeId ?? "",
_startDate!=null?startTime:"",
_endDate!=null?endTime:"",
); //
}
}

View File

@ -42,7 +42,7 @@ class ApplicationPage extends StatelessWidget {
break;
case AppItem.checkRecord:
//
pushPage(CheckRecordPage(), context);
pushPage(CheckRecordPage(1), context);
break;
case AppItem.specialRectification:
//
@ -59,6 +59,7 @@ class ApplicationPage extends StatelessWidget {
case AppItem.supervisionRecord:
//
//Navigator.push(context, MaterialPageRoute(builder: (_) => SupervisionRecordPage()));
pushPage(CheckRecordPage(2), context);
break;
case AppItem.riskRecord:
@ -82,7 +83,7 @@ class ApplicationPage extends StatelessWidget {
pushPage(DangerWaitListPage(DangerType.acceptanced,5), context);
break;
case AppItem.aiAlarm:
//
// ai
pushPage(AiAlarmPage(), context);
break;
}
@ -110,7 +111,7 @@ class ApplicationPage extends StatelessWidget {
],
},
{
'title': '监管帮扶',
'title': '标准排查',
'list': [
{'item': AppItem.supervisionRectification, 'icon': 'assets/icon-apps/icon-zl-6.png', 'title': '标准排查', 'num': 2},
{'item': AppItem.supervisionRecord, 'icon': 'assets/icon-apps/icon-zl-2.png', 'title': '检查记录', 'num': 0},

View File

@ -10,6 +10,7 @@ import '../../http/ApiService.dart';
import 'application_page.dart';
import '/customWidget/search_bar_widget.dart';
import '../home/work/danger_wait_deawer.dart';
import 'hidden_danger_acceptance_page.dart';
import 'hidden_record_detail_page.dart';
enum DangerType {
@ -217,6 +218,7 @@ class _DangerWaitListPageState extends State<DangerWaitListPage> {
widget.dangerType,item,
onClose: (result) {
print('详情页面已关闭,返回结果: $result');
_page=1;
getListData(widget.appItem,false,"");
SessionService.instance.setDangerWaitInfo("");
// reRefreshData();
@ -231,7 +233,23 @@ class _DangerWaitListPageState extends State<DangerWaitListPage> {
break;
case 4://
pushPage(HiddenRecordDetailPage(widget.dangerType,item), context);
// pushPage(HiddenRecordDetailPage(widget.dangerType,item), context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => HiddenDangerAcceptancePage(
widget.dangerType,item,
onClose: (result) {
print('详情页面已关闭,返回结果: $result');
_page=1;
getListData(widget.appItem,false,"");
SessionService.instance.setDangerWaitInfo("");
// reRefreshData();
},
),
),
);
break;
case 5://
pushPage(HiddenRecordDetailPage(widget.dangerType,item), context);

View File

@ -0,0 +1,639 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:intl/intl.dart';
import 'package:qhd_prevention/customWidget/big_video_viewer.dart';
import 'package:qhd_prevention/customWidget/custom_button.dart';
import 'package:qhd_prevention/customWidget/date_picker_dialog.dart';
import 'package:qhd_prevention/customWidget/photo_picker_row.dart';
import 'package:qhd_prevention/customWidget/picker/CupertinoDatePicker.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'package:qhd_prevention/pages/home/tap/item_list_widget.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
import 'dart:convert';
import 'package:video_player/video_player.dart';
import '../../customWidget/ItemWidgetFactory.dart';
import '../../customWidget/full_screen_video_page.dart';
import '../../customWidget/single_image_viewer.dart';
import '../../customWidget/video_player_widget.dart';
import '../../http/ApiService.dart';
import '../../tools/tools.dart';
import 'danger_wait_list_page.dart';
class HiddenDangerAcceptancePage extends StatefulWidget {
const HiddenDangerAcceptancePage(this.dangerType, this.item, {super.key,required this.onClose});
final Function(String) onClose; //
final DangerType dangerType;
final item;
@override
_HiddenDangerAcceptancePageState createState() => _HiddenDangerAcceptancePageState();
}
class _HiddenDangerAcceptancePageState extends State<HiddenDangerAcceptancePage> {
late Map<String, dynamic> pd = {};
late Map<String, dynamic> hs = {};
List<String> files = [];
List<String> files2 = [];
List<String> files4 = [];
List<String> files5 = [];
List<dynamic> files6 = [];
List<dynamic> videoList = [];
List<dynamic> checkList = [];
bool modalShow = false;
String videoSrc = "";
VideoPlayerController? _videoController;
final TextEditingController miaoShuController = TextEditingController();
//
List<String> gaiHouImages = [];
String dataTime="";
//
bool _accepted = true;
@override
void initState() {
super.initState();
if("2"==widget.item['HIDDEN_RISKSTANDARD']){
getDataTwo();
}else {
getData();
}
}
@override
void dispose() {
_videoController?.dispose();
miaoShuController.dispose();
super.dispose();
}
Future<void> getData() async {
try {
final data = await ApiService.getDangerDetail(widget.item['HIDDEN_ID']);
if (data['result'] == 'success') {
setState(() {
pd = data['pd'];
hs = data['hs'] ?? {};
//
for (var img in data['hImgs']) {
if (img['FILEPATH'].toString().endsWith('.mp4')) {
videoList.add(img);
} else {
files.add(img["FILEPATH"]);
}
}
// List<dynamic> filesZheng = data['rImgs'] ?? [];
for (var img in data['rImgs']) {
files2.add(img["FILEPATH"]);
}
// files2=data['rImgs'] ?? [];
// files4 = data['sImgs'] ?? [];
for (var img in data['sImgs']) {
files4.add(img["FILEPATH"]);
}
// files5 = data['pImgs'] ?? [];
for (var img in data['pImgs']) {
files5.add(img["FILEPATH"]);
}
files6 = data['yImgs'] ?? [];
checkList = data['checkList'] ?? [];
});
}
} catch (e) {
print('Error fetching data: $e');
}
}
Future<void> getDataTwo() async {
try {
final data = await ApiService.getDangerDetailTwo(widget.item['HIDDEN_ID']);
if (data['result'] == 'success') {
setState(() {
pd = data['pd'];
hs = data['hs'] ?? {};
//
for (var img in data['hImgs']) {
if (img['FILEPATH'].toString().endsWith('.mp4')) {
videoList.add(img);
} else {
files.add(img["FILEPATH"]);
}
}
// List<dynamic> filesZheng = data['rImgs'] ?? [];
for (var img in data['rImgs']) {
files2.add(img["FILEPATH"]);
}
// files2=data['rImgs'] ?? [];
// files4 = data['sImgs'] ?? [];
for (var img in data['sImgs']) {
files4.add(img["FILEPATH"]);
}
// files5 = data['pImgs'] ?? [];
for (var img in data['pImgs']) {
files5.add(img["FILEPATH"]);
}
files6 = data['yImgs'] ?? [];
checkList = data['checkList'] ?? [];
});
}
} catch (e) {
print('Error fetching data: $e');
}
}
Widget _buildInfoItem(String title, String value) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 120,
child: Text(
title,
style: const TextStyle(fontWeight: FontWeight.bold),
),
),
Expanded(child: Text(value,textAlign: TextAlign.right,)),
],
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppbar(title: widget.dangerType.detailTitle),
body: pd.isEmpty
? const Center(child: CircularProgressIndicator())
: LayoutBuilder(
builder: (context, constraints) {
return SingleChildScrollView(
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: constraints.maxHeight,
),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildInfoItem('隐患描述', pd['HIDDENDESCR'] ?? ''),
Divider(height: 1),
//
_buildInfoItem('隐患来源', _getSourceText(pd['SOURCE'])),
Divider(height: 1),
//
if (pd['SOURCE'] == '2') ...[
_buildInfoItem('风险点(单元)', pd['RISK_UNIT'] ?? ''),
Divider(height: 1),
_buildInfoItem('辨识部位', pd['IDENTIFICATION'] ?? ''),
Divider(height: 1),
_buildInfoItem('存在风险', pd['RISK_DESCR'] ?? ''),
Divider(height: 1),
_buildInfoItem('风险分级', pd['LEVEL'] ?? ''),
Divider(height: 1),
_buildInfoItem('检查内容', pd['CHECK_CONTENT'] ?? ''),
Divider(height: 1),
],
_buildInfoItem('隐患部位', pd['HIDDENPART'] ?? ''),
Divider(height: 1),
_buildInfoItem('发现人', pd['CREATORNAME'] ?? ''),
Divider(height: 1),
_buildInfoItem('发现时间', pd['CREATTIME'] ?? ''),
Divider(height: 1),
if (pd['HIDDEN_CATEGORY']?.isNotEmpty == true)
_buildInfoItem('隐患类别', pd['HIDDEN_CATEGORY_NAME'] ?? ''),
_buildInfoItem('隐患类型', pd['HIDDENTYPE_NAME'] ?? ''),
Divider(height: 1),
_buildInfoItem('整改类型', _getRectificationType(pd['RECTIFICATIONTYPE'])),
if (pd['RECTIFICATIONTYPE'] == '2')
_buildInfoItem('整改期限', pd['RECTIFICATIONDEADLINE'] ?? ''),
Divider(height: 1),
//
// const Text('隐患照片', style: TextStyle(fontWeight: FontWeight.bold)),
// _buildImageGrid(files, onTap: (index) => _showImageGallery(files, index)),
ListItemFactory.createTextImageItem(
text: "隐患照片",
imageUrls: files,
onImageTapped: (index) {
presentOpaque(
SingleImageViewer(imageUrl:ApiService.baseImgPath + files[index]),
context,
);
},
),
//
if (videoList.isNotEmpty) ...[
const SizedBox(height: 16),
const Text('隐患视频', style: TextStyle(fontWeight: FontWeight.bold)),
GestureDetector(
onTap: () {
showDialog(
context: context,
barrierColor: Colors.black54,
builder: (_) => VideoPlayerPopup(videoUrl: ApiService.baseImgPath + videoList[0]['FILEPATH']),
);
// present(
// BigVideoViewer(videoUrl:ApiService.baseImgPath + videoList[0]['FILEPATH']),
// context,
// );
},
// => _playVideo(ApiService.baseImgPath + videoList[0]['FILEPATH']),
child: Image.asset(
'assets/image/videostart.png', //
color: Colors.blue,
width: 120,
height: 120,
),
),
],
SizedBox(height: 10,),
//
if (pd['STATE'] != null && int.parse(pd['STATE']) >= 2 && int.parse(pd['STATE']) <= 4) ...[
// const Divider(height: 10,color: Colors.grey,),
Row(
children: [
Container(width: 3, height: 15, color: Colors.blue),
const SizedBox(width: 8),
Text(
"整改信息",
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
],
),
// const Text('整改信息', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
Divider(height: 1),
_buildInfoItem('整改描述', pd['RECTIFYDESCR'] ?? ''),
Divider(height: 1),
_buildInfoItem('整改部门', pd['RECTIFICATIONDEPTNAME'] ?? ''),
Divider(height: 1),
_buildInfoItem('整改人', pd['RECTIFICATIONORNAME'] ?? ''),
Divider(height: 1),
_buildInfoItem('整改时间', pd['RECTIFICATIONTIME'] ?? ''),
Divider(height: 1),
// const Text('整改后图片', style: TextStyle(fontWeight: FontWeight.bold)),
// _buildImageGrid(files2, onTap: (index) => _showImageGallery(files2, index)),
ListItemFactory.createTextImageItem(
text: "整改后图片",
imageUrls: files2,
onImageTapped: (index) {
presentOpaque(
SingleImageViewer(imageUrl: ApiService.baseImgPath +files2[index]),
context,
);
},
),
Divider(height: 1),
_buildInfoItem('整改部门', pd['HAVESCHEME']=="0" ? '':''),
Divider(height: 1),
if(pd['HAVESCHEME']=="1")
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildInfoItem('排查日期', hs['SCREENINGDATE'] ?? ''),
Divider(height: 1),
_buildInfoItem('隐患清单', hs['LISTNAME'] ?? ''),
Divider(height: 1),
_buildInfoItem('治理标准要求', hs['GOVERNSTANDARDS'] ?? ''),
Divider(height: 1),
_buildInfoItem('治理方法', hs['GOVERNMETHOD'] ?? ''),
Divider(height: 1),
_buildInfoItem('经费和物资的落实', hs['EXPENDITURE'] ?? ''),
Divider(height: 1),
_buildInfoItem('负责治理人员', hs['PRINCIPAL'] ?? ''),
Divider(height: 1),
_buildInfoItem('工时安排', hs['PROGRAMMING'] ?? ''),
Divider(height: 1),
_buildInfoItem('时限要求', hs['TIMELIMITFOR'] ?? ''),
Divider(height: 1),
_buildInfoItem('工作要求', hs['JOBREQUIREMENT'] ?? ''),
Divider(height: 1),
_buildInfoItem('其他事项', hs['OTHERBUSINESS'] ?? ''),
Divider(height: 1),
ListItemFactory.createTextImageItem(
text: "方案图片",
imageUrls: files4,
onImageTapped: (index) {
presentOpaque(
SingleImageViewer(imageUrl: ApiService.baseImgPath +files2[index]),
context,
);
},
),
],
),
Divider(height: 1),
_buildInfoItem('整改计划', pd['HAVEPLAN']=="0" ? '':''),
Divider(height: 1),
if(pd['HAVEPLAN']=="1")
ListItemFactory.createTextImageItem(
text: "计划图片",
imageUrls: files2,
onImageTapped: (index) {
presentOpaque(
SingleImageViewer(imageUrl: ApiService.baseImgPath +files2[index]),
context,
);
},
),
//
_danner_type_wait(),
// ...
],
//
SizedBox(height: MediaQuery.of(context).padding.bottom + 20),
],
),
),
),
);
},
),
);
}
///
Widget _danner_type_wait() {
return SizedBox(
child: Column(
children: [
_getRepairState(),
//
// _accepted ? _getRepairState() : _noAccepet_repair(_accepted),
const SizedBox(height: 20),
CustomButton(
text: "提交",
backgroundColor: Colors.blue,
onPressed: () {
// ToastUtil
//
// _submitToServer();
// _accepted ? _normalRectificationSubmission() : _rectificationSubmission();
_addHazardAcceptance();
},
),
],
),
);
}
Widget _getRepairState() {
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5),
),
child: Column(
children: [
ListItemFactory.createBuildSimpleSection("隐患验收"),
Divider(height: 1),
ListItemFactory.createYesNoSection(
horizontalPadding: 5,
title: '是否合格',
yesLabel: '',
noLabel: '',
groupValue: _accepted,
onChanged: (val) {
setState(() {
_accepted = val;
});
},
),
// _accepted ? _getRepairState() : _noAccepet_repair(_accepted),
if(_accepted)
Column(children: [
Divider(),
Container(
height: 130,
padding: EdgeInsets.all(15),
child: Column(
children: [
Row(
children: [HhTextStyleUtils.mainTitle("验收描述", fontSize: 15)],
),
TextField(
controller: miaoShuController,
keyboardType: TextInputType.multiline,
maxLines: null, //
style: TextStyle(fontSize: 15),
decoration: InputDecoration(
hintText: '请对隐患进行详细描述(必填项)',
border: InputBorder.none,
),
),
],
),
),
Divider(height: 1),
GestureDetector(
onTap: () async {
DateTime? picked = await BottomDateTimePicker.showDate(context);
if (picked != null) {
setState(() {
dataTime = DateFormat('yyyy-MM-dd HH:mm').format(picked);
});
}
// 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);
//
// });
// },
// ),
// );
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 15),
child: ListItemFactory.createRowSpaceBetweenItem(
leftText: "验收日期",
rightText: dataTime.isEmpty?"请选择":dataTime,
isRight: true,
),
),
),
Divider(),
RepairedPhotoSection(
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: () {
},
),
],),
],
),
);
}
// #region
Widget _noAccepet_repair(bool _accept) {
return Column(
);
}
Future<void> _addHazardAcceptance() async {
try {
String type="1";
String miaoshu="";
if(_accepted){
type="1";
miaoshu=miaoShuController.text.trim();
if(miaoshu.isEmpty){
ToastUtil.showNormal(context, "请填验收描述");
return;
}
if(dataTime.isEmpty){
ToastUtil.showNormal(context, "请选择验收时间");
return;
}
if(gaiHouImages.isEmpty){
ToastUtil.showNormal(context, "请上传验收照片");
return;
}
} else{
type="0";
}
final data = await ApiService.addHazardAcceptance( type, miaoshu, dataTime,widget.item['HIDDEN_ID']);
if (data['result'] == 'success') {
String hiddenCheckId="";
try{
data['check']['HIDDENCHECK_ID'];
}catch(e){
hiddenCheckId="";
}
for(int i=0;i<gaiHouImages.length;i++){
_addImgFiles(gaiHouImages[i],"5",hiddenCheckId) ;
}
setState(() {
ToastUtil.showNormal(context, "提交成功");
Navigator.of(context).pop();
widget.onClose('关闭详情'); //
});
}
} catch (e) {
print('Error fetching data: $e');
}
}
Future<String> _addImgFiles(String imagePath,String type,String id) async {
try {
final raw = await ApiService.addImgFiles( imagePath, type, id);
if (raw['result'] == 'success') {
return raw['imgPath'];
}else{
// _showMessage('反馈提交失败');
return "";
}
} catch (e) {
// Toast
print('加载首页数据失败:$e');
return "";
}
}
String _getSourceText(String? source) {
switch (source) {
case '1': return '隐患快报';
case '2': return '隐患排查清单检查';
case '3': return '标准排查清单检查';
case '4': return '专项检查';
case '5': return '安全检查';
default: return '';
}
}
String _getRectificationType(String? type) {
switch (type) {
case '1': return '立即整改';
case '2': return '限期整改';
default: return '';
}
}
}

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:qhd_prevention/customWidget/big_video_viewer.dart';
import 'package:qhd_prevention/pages/home/tap/item_list_widget.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
import 'dart:convert';
import 'package:video_player/video_player.dart';
@ -30,8 +31,8 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
late Map<String, dynamic> hs = {};
List<String> files = [];
List<String> files2 = [];
List<dynamic> files4 = [];
List<dynamic> files5 = [];
List<String> files4 = [];
List<String> files5 = [];
List<dynamic> files6 = [];
List<dynamic> videoList = [];
List<dynamic> checkList = [];
@ -79,8 +80,14 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
files2.add(img["FILEPATH"]);
}
// files2=data['rImgs'] ?? [];
files4 = data['sImgs'] ?? [];
files5 = data['pImgs'] ?? [];
// files4 = data['sImgs'] ?? [];
for (var img in data['sImgs']) {
files4.add(img["FILEPATH"]);
}
// files5 = data['pImgs'] ?? [];
for (var img in data['pImgs']) {
files5.add(img["FILEPATH"]);
}
files6 = data['yImgs'] ?? [];
checkList = data['checkList'] ?? [];
});
@ -114,8 +121,14 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
files2.add(img["FILEPATH"]);
}
// files2=data['rImgs'] ?? [];
files4 = data['sImgs'] ?? [];
files5 = data['pImgs'] ?? [];
// files4 = data['sImgs'] ?? [];
for (var img in data['sImgs']) {
files4.add(img["FILEPATH"]);
}
// files5 = data['pImgs'] ?? [];
for (var img in data['pImgs']) {
files5.add(img["FILEPATH"]);
}
files6 = data['yImgs'] ?? [];
checkList = data['checkList'] ?? [];
});
@ -248,7 +261,19 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
//
if (pd['STATE'] != null && int.parse(pd['STATE']) >= 2 && int.parse(pd['STATE']) <= 4) ...[
// const Divider(height: 10,color: Colors.grey,),
const Text('整改信息', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
Row(
children: [
Container(width: 3, height: 15, color: Colors.blue),
const SizedBox(width: 8),
Text(
"整改信息",
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
],
),
// const Text('整改信息', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
Divider(height: 1),
_buildInfoItem('整改描述', pd['RECTIFYDESCR'] ?? ''),
Divider(height: 1),
@ -271,6 +296,64 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
},
),
Divider(height: 1),
_buildInfoItem('整改部门', pd['HAVESCHEME']=="0" ? '':''),
Divider(height: 1),
if(pd['HAVESCHEME']=="1")
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildInfoItem('排查日期', hs['SCREENINGDATE'] ?? ''),
Divider(height: 1),
_buildInfoItem('隐患清单', hs['LISTNAME'] ?? ''),
Divider(height: 1),
_buildInfoItem('治理标准要求', hs['GOVERNSTANDARDS'] ?? ''),
Divider(height: 1),
_buildInfoItem('治理方法', hs['GOVERNMETHOD'] ?? ''),
Divider(height: 1),
_buildInfoItem('经费和物资的落实', hs['EXPENDITURE'] ?? ''),
Divider(height: 1),
_buildInfoItem('负责治理人员', hs['PRINCIPAL'] ?? ''),
Divider(height: 1),
_buildInfoItem('工时安排', hs['PROGRAMMING'] ?? ''),
Divider(height: 1),
_buildInfoItem('时限要求', hs['TIMELIMITFOR'] ?? ''),
Divider(height: 1),
_buildInfoItem('工作要求', hs['JOBREQUIREMENT'] ?? ''),
Divider(height: 1),
_buildInfoItem('其他事项', hs['OTHERBUSINESS'] ?? ''),
Divider(height: 1),
ListItemFactory.createTextImageItem(
text: "方案图片",
imageUrls: files4,
onImageTapped: (index) {
presentOpaque(
SingleImageViewer(imageUrl: ApiService.baseImgPath +files2[index]),
context,
);
},
),
],
),
Divider(height: 1),
_buildInfoItem('整改计划', pd['HAVEPLAN']=="0" ? '':''),
Divider(height: 1),
if(pd['HAVEPLAN']=="1")
ListItemFactory.createTextImageItem(
text: "计划图片",
imageUrls: files2,
onImageTapped: (index) {
presentOpaque(
SingleImageViewer(imageUrl: ApiService.baseImgPath +files2[index]),
context,
);
},
),
// ...
],

View File

@ -181,6 +181,7 @@ class SessionService {
String? riskJson;
String? departmentJsonStr;
String? departmentHiddenTypeJsonStr;
String? customRecordDangerJson;
///
void loginSession(BuildContext context) {
@ -220,7 +221,7 @@ class SessionService {
void setDepartmentJsonStr(String json) => departmentJsonStr = json;
void setCustomRecordDangerJson(String json) => customRecordDangerJson = json;
}