2025.7.30 正在写检查记录
parent
0238689f1a
commit
0e760563d9
|
@ -9,7 +9,7 @@ class ApiService {
|
||||||
// static const String basePath = "http://192.168.0.25:28199/";
|
// 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 basePath = "http://192.168.20.240:8500/integrated_whb";
|
||||||
// static const String baseFacePath = "http://192.168.0.25:38199/";
|
// static const String baseFacePath = "http://192.168.0.25:38199/";
|
||||||
// 人脸识别服务
|
// ///人脸识别服务
|
||||||
// static const String baseFacePath = "https://qaaqwh.qhdsafety.com/whb_stu_face/";
|
// static const String baseFacePath = "https://qaaqwh.qhdsafety.com/whb_stu_face/";
|
||||||
|
|
||||||
// static const String basePath = "https://qaaqwh.qhdsafety.com/integrated_whb/";
|
// 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¤tPage=$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¤tPage=$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,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:qhd_prevention/customWidget/search_bar_widget.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/check_record_list_page.dart';
|
||||||
import 'package:qhd_prevention/pages/app/Danger_paicha/custom_record_drawer.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/pages/my_appbar.dart';
|
||||||
|
import 'package:qhd_prevention/tools/h_colors.dart';
|
||||||
import 'package:qhd_prevention/tools/tools.dart';
|
import 'package:qhd_prevention/tools/tools.dart';
|
||||||
|
|
||||||
import '../../../Model/list_model.dart';
|
import '../../../Model/list_model.dart';
|
||||||
|
@ -10,24 +13,65 @@ import '../../../customWidget/danner_repain_item.dart';
|
||||||
import '../../home/scan_page.dart';
|
import '../../home/scan_page.dart';
|
||||||
|
|
||||||
class CheckRecordPage extends StatefulWidget {
|
class CheckRecordPage extends StatefulWidget {
|
||||||
const CheckRecordPage({super.key});
|
const CheckRecordPage(this.type, {super.key});
|
||||||
|
|
||||||
|
final int type;
|
||||||
@override
|
@override
|
||||||
State<CheckRecordPage> createState() => _CheckRecordPageState();
|
State<CheckRecordPage> createState() => _CheckRecordPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CheckRecordPageState extends State<CheckRecordPage> {
|
class _CheckRecordPageState extends State<CheckRecordPage> {
|
||||||
final TextEditingController _searchController = TextEditingController();
|
final TextEditingController _searchController = TextEditingController();
|
||||||
final List<RecordCheckModel> _notifications = List.generate(10, (i) {
|
|
||||||
bool read = i % 3 == 0;
|
String appBarTitle="";
|
||||||
String title = '测试数据标题标题 ${i + 1}';
|
String id="";
|
||||||
String time = '2025-06-${10 + i} 12:3${i}';
|
int _page = 1;
|
||||||
return RecordCheckModel(title, time);
|
String searchKey="";
|
||||||
});
|
int _totalPage=1;
|
||||||
|
List<dynamic> _list = [];
|
||||||
|
bool _isLoading = false;
|
||||||
|
bool _hasMore = true;
|
||||||
|
|
||||||
|
List<dynamic> listType = [];
|
||||||
|
List<dynamic> listInspectionCycle = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void _handleItemTap(RecordCheckModel model) {
|
void _handleItemTap(RecordCheckModel model) {
|
||||||
|
//item点击事件
|
||||||
pushPage(CheckRecordListPage(), context);
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// 取屏幕宽度
|
// 取屏幕宽度
|
||||||
|
@ -38,7 +82,7 @@ class _CheckRecordPageState extends State<CheckRecordPage> {
|
||||||
key: _scaffoldKey, // ② 绑定 key
|
key: _scaffoldKey, // ② 绑定 key
|
||||||
|
|
||||||
appBar: MyAppbar(
|
appBar: MyAppbar(
|
||||||
title: "清单检查记录",
|
title: appBarTitle,
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
@ -51,57 +95,246 @@ class _CheckRecordPageState extends State<CheckRecordPage> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
endDrawer: Drawer(
|
endDrawer: Drawer(
|
||||||
// 用 Container 限制宽度为屏幕的 3/5
|
// 用 Container 限制宽度为屏幕的 3/5
|
||||||
child: Container(
|
child: Container(
|
||||||
width: screenWidth * 3 / 5,
|
width: screenWidth * 3 / 5,
|
||||||
color: Colors.white,
|
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(
|
body: SafeArea(
|
||||||
padding: EdgeInsets.all(15),
|
child: NotificationListener<ScrollNotification>(
|
||||||
color: Colors.white,
|
onNotification: _onScroll,
|
||||||
|
child:_vcDetailWidget()
|
||||||
|
)
|
||||||
|
),
|
||||||
|
// backgroundColor: Colors.white,
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _vcDetailWidget() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
child: SearchBarWidget(
|
child: SearchBarWidget(
|
||||||
controller: _searchController,
|
controller: _searchController,
|
||||||
|
autoFocus: true,
|
||||||
onSearch: (keyboard) {
|
onSearch: (keyboard) {
|
||||||
// 输入请求接口
|
// 输入请求接口
|
||||||
|
_page=1;
|
||||||
|
searchKey=keyboard;
|
||||||
|
getListData(false,keyboard);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
),
|
||||||
|
|
||||||
child: ListView.separated(
|
Container(
|
||||||
padding: EdgeInsets.only(top: 15),
|
height: 5,
|
||||||
itemCount: _notifications.length,
|
color: h_backGroundColor(),
|
||||||
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,
|
|
||||||
|
|
||||||
),
|
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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,160 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
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.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/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 '../../../tools/h_colors.dart';
|
||||||
import '/customWidget/custom_button.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 {
|
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
|
@override
|
||||||
_CustomRecordDrawerState createState() => _CustomRecordDrawerState();
|
_CustomRecordDrawerState createState() => _CustomRecordDrawerState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
||||||
// 四个选项的单选 index
|
|
||||||
int _selectedOption = -1;
|
// 存储各单位的人员列表
|
||||||
|
List<Map<String, dynamic>> _personCache = [];
|
||||||
|
|
||||||
|
|
||||||
// 已选择的分类 id
|
// 已选择的分类 id
|
||||||
String? _selectedCategoryId;
|
String departmentId="";
|
||||||
// 检查人
|
String departmentName="";
|
||||||
String? _selectedPerson;
|
|
||||||
|
String responsibleId="";
|
||||||
|
String responsibleName="";
|
||||||
|
|
||||||
// 清单类型
|
// 清单类型
|
||||||
String? _selectedQDType;
|
String _selectedQDType="";
|
||||||
|
String _selectedQDTypeId="";
|
||||||
// 排查周期
|
// 排查周期
|
||||||
String? _selectedZQTime;
|
String _selectedZQTime="";
|
||||||
|
String _selectedZQTimeId="";
|
||||||
|
|
||||||
// 新增:开始/结束时间
|
// 新增:开始/结束时间
|
||||||
DateTime? _startDate;
|
DateTime? _startDate;
|
||||||
DateTime? _endDate;
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -38,48 +166,87 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
barrierColor: Colors.black54,
|
barrierColor: Colors.black54,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
builder: (ctx) => DepartmentPicker(onSelected: (id, name) {
|
builder: (ctx) => DepartmentPicker(onSelected: (id, name) async {
|
||||||
setState(() {
|
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) {
|
} else if (type == 2) {
|
||||||
final choice = await BottomPicker.show<String>(
|
|
||||||
context,
|
if ( departmentId.isEmpty) {
|
||||||
items: ['未知'],
|
ToastUtil.showNormal(context, '请先选择部门');
|
||||||
itemBuilder: (item) => Text(item, textAlign: TextAlign.center),
|
return;
|
||||||
initialIndex: 0,
|
}
|
||||||
);
|
DepartmentPersonPicker.show(
|
||||||
if (choice != null) {
|
context,
|
||||||
// 用户点击确定并选择了 choice
|
personsData: _personCache,
|
||||||
setState(() {
|
onSelected: (userId, name) {
|
||||||
_selectedPerson = choice;
|
setState(() {
|
||||||
});
|
// renYuanId = userId;
|
||||||
}
|
// renYuanName = name;
|
||||||
|
|
||||||
|
responsibleId=userId;
|
||||||
|
responsibleName=name;
|
||||||
|
// setResult();
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}else if (type == 3) {
|
}else if (type == 3) {
|
||||||
final choice = await BottomPicker.show<String>(
|
final choice = await BottomPickerTwo.show<String>(
|
||||||
context,
|
context,
|
||||||
items: ['日常', '综合', '专业', '季节性','节假日'],
|
items: widget.listType,
|
||||||
itemBuilder: (item) => Text(item, textAlign: TextAlign.center),
|
itemBuilder: (item) => Text(item["NAME"], textAlign: TextAlign.center),
|
||||||
initialIndex: 0,
|
initialIndex: 0,
|
||||||
);
|
);
|
||||||
if (choice != null) {
|
if (choice != null) {
|
||||||
|
for(int i=0;i<widget.listType.length;i++){
|
||||||
|
if(choice==widget.listType[i]["NAME"]){
|
||||||
|
_selectedQDTypeId = widget.listType[i]["BIANMA"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedQDType = choice;
|
_selectedQDType = choice;
|
||||||
|
// setResult();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else if (type == 4) {
|
}else if (type == 4) {
|
||||||
final choice = await BottomPicker.show<String>(
|
final choice = await BottomPickerTwo.show<String>(
|
||||||
context,
|
context,
|
||||||
items: ['每日', '每周', '每旬', '每月', '每季', '半年', '每年'],
|
items: widget.listInspectionCycle,
|
||||||
itemBuilder: (item) => Text(item, textAlign: TextAlign.center),
|
itemBuilder: (item) => Text(item["NAME"], textAlign: TextAlign.center),
|
||||||
initialIndex: 0,
|
initialIndex: 0,
|
||||||
);
|
);
|
||||||
if (choice != null) {
|
if (choice != null) {
|
||||||
|
for(int i=0;i<widget.listInspectionCycle.length;i++){
|
||||||
|
if(choice==widget.listInspectionCycle[i]["NAME"]){
|
||||||
|
_selectedZQTimeId = widget.listInspectionCycle[i]["BIANMA"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedZQTime = choice;
|
_selectedZQTime = choice;
|
||||||
|
// setResult();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,11 +263,19 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
||||||
);
|
);
|
||||||
if (picked != null) {
|
if (picked != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
||||||
_startDate = picked;
|
_startDate = picked;
|
||||||
|
final dateFormat = DateFormat('yyyy-MM-dd');
|
||||||
|
startTime=dateFormat.format(picked);
|
||||||
|
|
||||||
// 保证开始 <= 结束
|
// 保证开始 <= 结束
|
||||||
if (_endDate != null && _endDate!.isBefore(picked)) {
|
if (_endDate != null && _endDate!.isBefore(picked)) {
|
||||||
_endDate = null;
|
_endDate = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// setResult();
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,6 +295,12 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
||||||
if (picked != null) {
|
if (picked != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_endDate = picked;
|
_endDate = picked;
|
||||||
|
|
||||||
|
final dateFormat = DateFormat('yyyy-MM-dd');
|
||||||
|
endTime=dateFormat.format(picked);
|
||||||
|
|
||||||
|
// setResult();
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,25 +351,25 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
||||||
// 分类筛选
|
// 分类筛选
|
||||||
_buildDropdownBox(
|
_buildDropdownBox(
|
||||||
"检查部门",
|
"检查部门",
|
||||||
display: _selectedCategoryId ?? '请选择',
|
display: departmentName.isNotEmpty ?departmentName: '请选择',
|
||||||
onTap: () => showCategoryPicker(1),
|
onTap: () => showCategoryPicker(1),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
_buildDropdownBox(
|
_buildDropdownBox(
|
||||||
"检查人",
|
"检查人",
|
||||||
display: _selectedPerson ?? '请选择',
|
display: responsibleName .isNotEmpty ?responsibleName: '请选择',
|
||||||
onTap: () => showCategoryPicker(2),
|
onTap: () => showCategoryPicker(2),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
_buildDropdownBox(
|
_buildDropdownBox(
|
||||||
"清单类型",
|
"清单类型",
|
||||||
display: _selectedQDType ?? '请选择',
|
display: _selectedQDType .isNotEmpty ?_selectedQDType: '请选择',
|
||||||
onTap: () => showCategoryPicker(3),
|
onTap: () => showCategoryPicker(3),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
_buildDropdownBox(
|
_buildDropdownBox(
|
||||||
"排查周期",
|
"排查周期",
|
||||||
display: _selectedZQTime ?? '请选择',
|
display: _selectedZQTime .isNotEmpty ?_selectedZQTime: '请选择',
|
||||||
onTap: () => showCategoryPicker(4),
|
onTap: () => showCategoryPicker(4),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
|
@ -232,10 +413,26 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
||||||
textStyle: const TextStyle(color: Colors.black45),
|
textStyle: const TextStyle(color: Colors.black45),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedOption = -1;
|
|
||||||
_selectedCategoryId = null;
|
// 已选择的分类 id
|
||||||
_startDate = null;
|
departmentId="";
|
||||||
_endDate = null;
|
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,
|
backgroundColor: Colors.blue,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// TODO: 提交筛选条件,包括 _startDate、_endDate
|
// 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:"",
|
||||||
|
); // 触发回调
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ApplicationPage extends StatelessWidget {
|
||||||
break;
|
break;
|
||||||
case AppItem.checkRecord:
|
case AppItem.checkRecord:
|
||||||
// 跳转到检查记录页面
|
// 跳转到检查记录页面
|
||||||
pushPage(CheckRecordPage(), context);
|
pushPage(CheckRecordPage(1), context);
|
||||||
break;
|
break;
|
||||||
case AppItem.specialRectification:
|
case AppItem.specialRectification:
|
||||||
// 跳转到专项检查隐患整改页面
|
// 跳转到专项检查隐患整改页面
|
||||||
|
@ -59,6 +59,7 @@ class ApplicationPage extends StatelessWidget {
|
||||||
case AppItem.supervisionRecord:
|
case AppItem.supervisionRecord:
|
||||||
// 跳转到监管帮扶隐患记录页面
|
// 跳转到监管帮扶隐患记录页面
|
||||||
//Navigator.push(context, MaterialPageRoute(builder: (_) => SupervisionRecordPage()));
|
//Navigator.push(context, MaterialPageRoute(builder: (_) => SupervisionRecordPage()));
|
||||||
|
pushPage(CheckRecordPage(2), context);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AppItem.riskRecord:
|
case AppItem.riskRecord:
|
||||||
|
@ -82,7 +83,7 @@ class ApplicationPage extends StatelessWidget {
|
||||||
pushPage(DangerWaitListPage(DangerType.acceptanced,5), context);
|
pushPage(DangerWaitListPage(DangerType.acceptanced,5), context);
|
||||||
break;
|
break;
|
||||||
case AppItem.aiAlarm:
|
case AppItem.aiAlarm:
|
||||||
// 跳转到隐患排查页面
|
// ai
|
||||||
pushPage(AiAlarmPage(), context);
|
pushPage(AiAlarmPage(), context);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +111,7 @@ class ApplicationPage extends StatelessWidget {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'title': '监管帮扶',
|
'title': '标准排查',
|
||||||
'list': [
|
'list': [
|
||||||
{'item': AppItem.supervisionRectification, 'icon': 'assets/icon-apps/icon-zl-6.png', 'title': '标准排查', 'num': 2},
|
{'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},
|
{'item': AppItem.supervisionRecord, 'icon': 'assets/icon-apps/icon-zl-2.png', 'title': '检查记录', 'num': 0},
|
||||||
|
|
|
@ -10,6 +10,7 @@ import '../../http/ApiService.dart';
|
||||||
import 'application_page.dart';
|
import 'application_page.dart';
|
||||||
import '/customWidget/search_bar_widget.dart';
|
import '/customWidget/search_bar_widget.dart';
|
||||||
import '../home/work/danger_wait_deawer.dart';
|
import '../home/work/danger_wait_deawer.dart';
|
||||||
|
import 'hidden_danger_acceptance_page.dart';
|
||||||
import 'hidden_record_detail_page.dart';
|
import 'hidden_record_detail_page.dart';
|
||||||
|
|
||||||
enum DangerType {
|
enum DangerType {
|
||||||
|
@ -217,6 +218,7 @@ class _DangerWaitListPageState extends State<DangerWaitListPage> {
|
||||||
widget.dangerType,item,
|
widget.dangerType,item,
|
||||||
onClose: (result) {
|
onClose: (result) {
|
||||||
print('详情页面已关闭,返回结果: $result');
|
print('详情页面已关闭,返回结果: $result');
|
||||||
|
_page=1;
|
||||||
getListData(widget.appItem,false,"");
|
getListData(widget.appItem,false,"");
|
||||||
SessionService.instance.setDangerWaitInfo("");
|
SessionService.instance.setDangerWaitInfo("");
|
||||||
// reRefreshData();
|
// reRefreshData();
|
||||||
|
@ -231,7 +233,23 @@ class _DangerWaitListPageState extends State<DangerWaitListPage> {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 4://隐患验收
|
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;
|
break;
|
||||||
case 5://已验收隐患
|
case 5://已验收隐患
|
||||||
pushPage(HiddenRecordDetailPage(widget.dangerType,item), context);
|
pushPage(HiddenRecordDetailPage(widget.dangerType,item), context);
|
||||||
|
|
|
@ -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 '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:qhd_prevention/customWidget/big_video_viewer.dart';
|
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 'package:qhd_prevention/pages/my_appbar.dart';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:video_player/video_player.dart';
|
import 'package:video_player/video_player.dart';
|
||||||
|
@ -30,8 +31,8 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
|
||||||
late Map<String, dynamic> hs = {};
|
late Map<String, dynamic> hs = {};
|
||||||
List<String> files = [];
|
List<String> files = [];
|
||||||
List<String> files2 = [];
|
List<String> files2 = [];
|
||||||
List<dynamic> files4 = [];
|
List<String> files4 = [];
|
||||||
List<dynamic> files5 = [];
|
List<String> files5 = [];
|
||||||
List<dynamic> files6 = [];
|
List<dynamic> files6 = [];
|
||||||
List<dynamic> videoList = [];
|
List<dynamic> videoList = [];
|
||||||
List<dynamic> checkList = [];
|
List<dynamic> checkList = [];
|
||||||
|
@ -79,8 +80,14 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
|
||||||
files2.add(img["FILEPATH"]);
|
files2.add(img["FILEPATH"]);
|
||||||
}
|
}
|
||||||
// files2=data['rImgs'] ?? [];
|
// files2=data['rImgs'] ?? [];
|
||||||
files4 = data['sImgs'] ?? [];
|
// files4 = data['sImgs'] ?? [];
|
||||||
files5 = data['pImgs'] ?? [];
|
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'] ?? [];
|
files6 = data['yImgs'] ?? [];
|
||||||
checkList = data['checkList'] ?? [];
|
checkList = data['checkList'] ?? [];
|
||||||
});
|
});
|
||||||
|
@ -114,8 +121,14 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
|
||||||
files2.add(img["FILEPATH"]);
|
files2.add(img["FILEPATH"]);
|
||||||
}
|
}
|
||||||
// files2=data['rImgs'] ?? [];
|
// files2=data['rImgs'] ?? [];
|
||||||
files4 = data['sImgs'] ?? [];
|
// files4 = data['sImgs'] ?? [];
|
||||||
files5 = data['pImgs'] ?? [];
|
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'] ?? [];
|
files6 = data['yImgs'] ?? [];
|
||||||
checkList = data['checkList'] ?? [];
|
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) ...[
|
if (pd['STATE'] != null && int.parse(pd['STATE']) >= 2 && int.parse(pd['STATE']) <= 4) ...[
|
||||||
// const Divider(height: 10,color: Colors.grey,),
|
// 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),
|
Divider(height: 1),
|
||||||
_buildInfoItem('整改描述', pd['RECTIFYDESCR'] ?? ''),
|
_buildInfoItem('整改描述', pd['RECTIFYDESCR'] ?? ''),
|
||||||
Divider(height: 1),
|
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,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
// ... 其他整改信息字段
|
// ... 其他整改信息字段
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,7 @@ class SessionService {
|
||||||
String? riskJson;
|
String? riskJson;
|
||||||
String? departmentJsonStr;
|
String? departmentJsonStr;
|
||||||
String? departmentHiddenTypeJsonStr;
|
String? departmentHiddenTypeJsonStr;
|
||||||
|
String? customRecordDangerJson;
|
||||||
|
|
||||||
/// 如果以下任何一项为空,则跳转到登录页
|
/// 如果以下任何一项为空,则跳转到登录页
|
||||||
void loginSession(BuildContext context) {
|
void loginSession(BuildContext context) {
|
||||||
|
@ -220,7 +221,7 @@ class SessionService {
|
||||||
|
|
||||||
void setDepartmentJsonStr(String json) => departmentJsonStr = json;
|
void setDepartmentJsonStr(String json) => departmentJsonStr = json;
|
||||||
|
|
||||||
|
void setCustomRecordDangerJson(String json) => customRecordDangerJson = json;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue