2025.7.31

main
xufei 2025-07-31 21:15:00 +08:00
parent 4accf55b81
commit fc40593ab3
18 changed files with 1196 additions and 391 deletions

1
.gitignore vendored
View File

@ -44,3 +44,4 @@ app.*.map.json
/android/app/profile
/android/app/release
/android/key.properties
/android/app/build.gradle.kts

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -355,3 +355,6 @@ class _RepairedPhotoSectionState extends State<RepairedPhotoSection> {
);
}
}

View File

@ -1693,7 +1693,7 @@ U6Hzm1ninpWeE+awIDAQAB
static Future<Map<String, dynamic>> getInspectRecordsDetail(String id) {
return HttpManager().request(
basePath,
'/app/checkrecord/goEdit',
'/app/customCheckRecord/goEdit',
method: Method.post,
data: {
"CHECKRECORD_ID": id,
@ -1703,7 +1703,164 @@ U6Hzm1ninpWeE+awIDAQAB
);
}
/// 2
static Future<Map<String, dynamic>> getInspectRecordsDetailTwo(String id) {
return HttpManager().request(
basePath,
'/app/customHidden/getCheckHidden',
method: Method.post,
data: {
"CHECKRECORD_ID": id,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getDetailImageList(String id) {
return HttpManager().request(
basePath,
'/app/imgfiles/listImgs',
method: Method.post,
data: {
"FOREIGN_KEY": id,
"TYPE": 14,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getStandardInvestigationList(String id,String keyWord) {
return HttpManager().request(
basePath,
'/app/hiddenDangerCheckStandardCustom/checkList',
method: Method.post,
data: {
"USER_NAME": SessionService.instance.username,
"CHECK_DEPARTMENT_ID": id,
"SUB_DEPARTMENT_IDS": keyWord, //
"IS_MAIN":SessionService.instance. loginUser?["ISMAIN"]??"0",
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
"ISSUPERVISE": SessionService.instance. loginUser?["ISSUPERVISE"]??"0",
},
);
}
///
static Future<Map<String, dynamic>> getHazardInvestigationList(String id,String keyWord) {
return HttpManager().request(
basePath,
'/app/listmanager/checkListV2',
method: Method.post,
data: {
"USER_NAME": SessionService.instance.username,
"CHECK_DEPARTMENT_ID": id,
"SUB_DEPARTMENT_IDS": keyWord, //
"IS_MAIN":SessionService.instance. loginUser?["ISMAIN"]??"0",
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
"ISSUPERVISE": SessionService.instance. loginUser?["ISSUPERVISE"]??"0",
},
);
}
///
static Future<Map<String, dynamic>> getInspectionItemList(String id) {
return HttpManager().request(
basePath,
'/app/hiddenDangerCheckStandardCustom/getCheckItem',
method: Method.post,
data: {
"CUSTOM_ID": id,
"USER_NAME": SessionService.instance.username,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID":SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getRiskPointsList(String id) {
return HttpManager().request(
basePath,
'/app/listmanager/getRisk',
method: Method.post,
data: {
"LISTMANAGER_ID": id,
"USER_NAME": SessionService.instance.username,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID":SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> isInElectronicFence(String id) {
return HttpManager().request(
basePath,
'/app/listmanager/isInElectronicFence',
method: Method.post,
data: {
"ELECTRONIC_FENCE_ID": id,
"USER_NAME": SessionService.instance.username,
"PLS_ID":"",
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID":SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getInvestigationItems(final item) {
return HttpManager().request(
basePath,
'/app/hiddenDangerCheckStandardCustom/goCheck',
method: Method.post,
data: {
"CUSTOM_ID": item["CUSTOM_ID"],
"CHECK_ITEM": item["CHECK_ITEM"],
"USER_NAME": SessionService.instance.username,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID":SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getAlreadyUpImages(String id) {
return HttpManager().request(
basePath,
'/app/imgfiles/listImgs',
method: Method.post,
data: {
"FOREIGN_KEY": id,
"TYPE": 14,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID":SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> onImageRemoved(String id) {
return HttpManager().request(
basePath,
'/app/imgfiles/delete',
method: Method.post,
data: {
"IMGFILES_ID": id,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID":SessionService.instance.loginUserId,
},
);
}
}

View File

@ -130,10 +130,10 @@ class HttpManager {
: <String, dynamic>{};
final result = json['result'] as String?;
final msg = json['msg'] as String? ?? json['message'] as String? ?? '';
if (result != 'success') {
// success
throw ApiException(result ?? 'unknown', msg);
}
// if (result != 'success') {
// // success
// throw ApiException(result ?? 'unknown', msg);
// }
return json;
}
}

View File

@ -2,8 +2,14 @@ import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
import 'package:qhd_prevention/customWidget/single_image_viewer.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'package:qhd_prevention/http/ApiService.dart';
import 'package:qhd_prevention/pages/app/danger_wait_list_page.dart';
import 'package:qhd_prevention/pages/app/detail_images_page.dart';
import 'package:qhd_prevention/pages/app/hidden_record_detail_page.dart';
import 'package:qhd_prevention/tools/tools.dart';
@ -23,28 +29,25 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
// {"RISKPOINT_ID": "3", "CHECK_CONTENT": "电气线路检查", "ISNORMAL": "2"},
// ];
List<Map<String, dynamic>> otherHiddenList = [
{"HIDDEN_ID": "3001", "HIDDENDESCR": "应急通道堵塞"},
{"HIDDEN_ID": "3002", "HIDDENDESCR": "安全标识缺失"},
];
// List<Map<String, dynamic>> otherHiddenList = [
// {"HIDDEN_ID": "3001", "HIDDENDESCR": "应急通道堵塞"},
// {"HIDDEN_ID": "3002", "HIDDENDESCR": "安全标识缺失"},
// ];
Map<String, dynamic> pd = {
"LIST_NAME": "",
"SCREENTYPENAME": "",
"USERS": "",
"CHECK_TIME": "",
"DEPARTMENT_NAME": "",
"POST_NAME": "",
"PERIODNAME": "",
"TYPENAME": "",
"START_DATE": "",
"END_DATE": "",
};
// Map<String, dynamic> pd = {
// "LIST_NAME": "月度安全检查清单",
// "SCREENTYPENAME": "常规排查",
// "USERS": "张三",
// "CHECK_TIME": "2023-06-15 10:30",
// "DEPARTMENT_NAME": "安全部",
// "POST_NAME": "安全主管",
// "PERIODNAME": "每月一次",
// "TYPENAME": "临时",
// "START_DATE": "2023-06-01",
// "END_DATE": "2023-06-30",
// };
List<String> files = [
"https://example.com/sign1.jpg",
"https://example.com/sign2.jpg",
];
//
// final LatLng _center = const LatLng(39.8883, 119.519);
@ -55,9 +58,10 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
bool _showImageViewer = false;
dynamic pd;
List<dynamic> imageList =[];
// dynamic pd;
List<String> imageList =[];
List<dynamic> varList =[];
List<dynamic> hiddenList =[];
@override
void initState() {
@ -71,6 +75,7 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
_getInspectRecordsDetail();
_getInspectRecordsDetailTwo();
}
Future<void> _getInspectRecordsDetail() async {
@ -83,7 +88,7 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
pd= result['pd'];
varList = result['varList'] ?? [];
for(int i=0;i<qianmingList.length;i++){
imageList.add(qianmingList[i]);
imageList.add(qianmingList[i]["FILEPATH"] as String);
}
});
@ -98,6 +103,28 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
}
}
Future<void> _getInspectRecordsDetailTwo() async {
try {
final result = await ApiService.getInspectRecordsDetailTwo(widget.id);
if (result['result'] == 'success') {
final List<dynamic> newList = result['hiddenList'] ?? [];
setState(() {
hiddenList.addAll(newList);
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
@override
Widget build(BuildContext context) {
@ -197,19 +224,19 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
VoidCallback? onTap;
switch (item["ISNORMAL"]) {
case "0":
case 0:
status = "合格";
color = Colors.blue;
if (item["IMGCOUNT"] > 0) {
onTap = () => _goToImgs(item["RECORDITEM_ID"]);
}
break;
case "1":
case 1:
status = "不合格";
color = Colors.blue;
onTap = () => _goToDetail(item["HIDDEN_ID"]);
break;
case "2":
case 2:
status = "不涉及";
color = Colors.blue;
break;
@ -252,7 +279,7 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
_buildTableHeaderCell("操作"),
],
),
...otherHiddenList.map((item) => TableRow(
...hiddenList.map((item) => TableRow(
children: [
Padding(
padding: EdgeInsets.all(8),
@ -312,14 +339,14 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
),
child: Column(
children: [
_buildInfoRow("清单名称", pd["LIST_NAME"]),
_buildInfoRow("排查清单类型", pd["SCREENTYPENAME"]),
_buildInfoRow("检查人", pd["USERS"]),
_buildInfoRow("检查时间", pd["CHECK_TIME"]),
_buildInfoRow("所属部门", pd["DEPARTMENT_NAME"]),
_buildInfoRow("所属岗位", pd["POST_NAME"]),
_buildInfoRow("排查周期", pd["PERIODNAME"]),
_buildInfoRow("清单类型", pd["TYPENAME"]),
_buildInfoRow("清单名称", pd["LIST_NAME"]?? ''),
_buildInfoRow("排查清单类型", pd["SCREENTYPENAME"]?? ''),
_buildInfoRow("检查人", pd["USERS"]?? ''),
_buildInfoRow("检查时间", pd["CHECK_TIME"]?? ''),
_buildInfoRow("所属部门", pd["DEPARTMENT_NAME"]?? ''),
_buildInfoRow("所属岗位", pd["POST_NAME"]?? ''),
_buildInfoRow("排查周期", pd["PERIODNAME"]?? ''),
_buildInfoRow("清单类型", pd["TYPENAME"]?? ''),
if (pd["TYPENAME"] == "临时")
_buildInfoRow("排查日期", "${pd["START_DATE"]} - ${pd["END_DATE"]}"),
],
@ -346,96 +373,48 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
Widget _buildSignPhotos() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("签字照片", style: TextStyle(fontWeight: FontWeight.bold)),
SizedBox(height: 10),
Container(
height: 120,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: files.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
setState(() {
_currentImageIndex = index;
_showImageViewer = true;
});
},
child: Container(
width: 150,
margin: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
image: DecorationImage(
image: NetworkImage(files[index]),
fit: BoxFit.cover,
),
),
),
);
},
),
),
],
child: ListItemFactory.createTextImageItem(
text: "签字照片",
imageUrls: imageList,
onImageTapped: (index) {
presentOpaque(
SingleImageViewer(imageUrl:ApiService.baseImgPath + imageList[index]),
context,
);
},
),
);
}
void _goToDetail(String hiddenId) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Scaffold(
appBar: AppBar(title: Text("隐患详情")),
body: Center(child: Text("隐患ID: $hiddenId")),
),
),
);
dynamic item={"HIDDEN_RISKSTANDARD":"2","HIDDEN_ID":hiddenId};
pushPage(HiddenRecordDetailPage(DangerType.detailsHiddenInvestigationRecord,item), context);
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => Scaffold(
// appBar: AppBar(title: Text("隐患详情")),
// body: Center(child: Text("隐患ID: $hiddenId")),
// ),
// ),
// );
}
void _goToImgs(String recordItemId) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Scaffold(
appBar: AppBar(title: Text("图片详情")),
body: Center(child: Text("记录项ID: $recordItemId")),
),
),
);
pushPage(DetailImagesPage(recordItemId), context);
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => Scaffold(
// appBar: AppBar(title: Text("图片详情")),
// body: Center(child: Text("记录项ID: $recordItemId")),
// ),
// ),
// );
}
Widget _buildImageViewer() {
return Stack(
children: [
PhotoViewGallery.builder(
itemCount: files.length,
builder: (context, index) {
return PhotoViewGalleryPageOptions(
imageProvider: NetworkImage(files[index]),
minScale: PhotoViewComputedScale.contained,
maxScale: PhotoViewComputedScale.covered * 2,
);
},
scrollPhysics: ClampingScrollPhysics(),
backgroundDecoration: BoxDecoration(color: Colors.black),
pageController: PageController(initialPage: _currentImageIndex),
onPageChanged: (index) => setState(() => _currentImageIndex = index),
),
Positioned(
top: 40,
right: 20,
child: IconButton(
icon: Icon(Icons.close, color: Colors.white, size: 30),
onPressed: () => setState(() => _showImageViewer = false),
),
),
],
);
}
}

View File

@ -65,6 +65,9 @@ class _CheckRecordListPageState extends State<CheckRecordListPage>
}
void getListData(){
listDates.clear();
alreadyList.clear();
overTimeList.clear();
switch(widget.type ){
case 1://
_getCheckRecordListOne();

View File

@ -0,0 +1,208 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:qhd_prevention/customWidget/photo_picker_row.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'package:qhd_prevention/http/ApiService.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
class PhotoItem {
final String id;
final String filePath;
final String type;
PhotoItem({
required this.id,
required this.filePath,
required this.type,//1 2
});
}
class DangerImageUpdataPage extends StatefulWidget {
const DangerImageUpdataPage(this.id, {super.key});
final String id;
@override
State<DangerImageUpdataPage> createState() => _DangerImageUpdataPageState();
}
class _DangerImageUpdataPageState extends State<DangerImageUpdataPage> {
List<PhotoItem> _imgList = [];
List<String> _yinHuanImages = [];
// List<dynamic> alreadyImageList=[];
@override
void initState() {
// TODO: implement initState
super.initState();
_getAlreadyUpImages();
}
Future<void> _getAlreadyUpImages() async {
try {
final result = await ApiService.getAlreadyUpImages(widget.id);
if (result['result'] == 'success') {
final List<dynamic> newList = result['imgs'] ?? [];
setState(() {
for(int i=0;i<newList.length;i++){
_imgList.add(PhotoItem(
id: newList[i]["IMGFILES_ID"], // ID
filePath: newList[i]["FILEPATH"],
type: "1",
)
);
_yinHuanImages.add(ApiService.baseImgPath +newList[i]["FILEPATH"]);
}
// alreadyImageList.addAll(newList);
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
@override
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
return Scaffold(
appBar: MyAppbar(title: "检查照片"),
body: Column(
children: [
RepairedPhotoSection(
title: "检查照片",
maxCount: 4,
mediaType: MediaType.image,
isShowAI: false,
initialMediaPaths: _yinHuanImages,
onMediaAdded: (value) {
setState(() {
_imgList.add(PhotoItem(
id: "", // ID
filePath: value,
type: "2",
));
_yinHuanImages.add(value);
});
},
onMediaRemoved: (path) {
int delete=0;
for(int i=0;i<_yinHuanImages.length;i++){
if(_yinHuanImages[i]==path){
delete=i;
}
}
_onImageRemoved(_imgList[delete]);
_yinHuanImages.removeAt(delete);
_imgList.removeAt(delete);
},
onAiIdentify: () {
}, onChanged: (List<File> value) {
},
),
//
Container(
margin: const EdgeInsets.only(bottom: 20),
height: 50,
decoration: BoxDecoration(
color: Colors.green,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: Colors.black12,
blurRadius: 6,
offset: Offset(0, 2),
),
],
),
child:
SizedBox(
width: screenWidth - 30,
height: 50,
child: TextButton(
onPressed: () {
if(_imgList.length>4){
ToastUtil.showNormal(context, "图片不能大于4张");
return;
}
for(int i=0;i<_imgList.length;i++){
if(_imgList[i].type=="2") {
_addImgFiles(_yinHuanImages[i], "14", widget.id);
}
}
ToastUtil.showNormal(context, "提交成功");
Navigator.pop(context);
},
child: Text(
"提交",
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
),
),
),
],)
);
}
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 "";
}
}
Future<String> _onImageRemoved(PhotoItem item) async {
try {
final raw = await ApiService.onImageRemoved( item.id);
if (raw['result'] == 'success') {
return raw['imgPath'];
}else{
// _showMessage('反馈提交失败');
return "";
}
} catch (e) {
// Toast
print('加载首页数据失败:$e');
return "";
}
}
}

View File

@ -49,7 +49,7 @@ class _AiAlarmPageState extends State<AiAlarmPage>
void _handleItemTap(NotificationItem item, int index) {
print("点击了是: ${item.title}");
pushPage(RiskListPage(), context);
// pushPage(RiskListPage(), context);
}
//

View File

@ -34,7 +34,7 @@ class ApplicationPage extends StatelessWidget {
switch (item) {
case AppItem.riskInspection:
//
pushPage(DangerPage(), context);
pushPage(DangerPage(1), context);
break;
case AppItem.quickReport:
//
@ -54,6 +54,7 @@ class ApplicationPage extends StatelessWidget {
break;
case AppItem.supervisionRectification:
//
pushPage(DangerPage(2), context);
//Navigator.push(context, MaterialPageRoute(builder: (_) => SupervisionRectificationPage()));
break;
case AppItem.supervisionRecord:

View File

@ -15,6 +15,8 @@ import 'hidden_record_detail_page.dart';
enum DangerType {
detailsHiddenInvestigationRecord("排查隐患记录", "排查隐患记录-详情"),
ristRecord("隐患记录", "隐患记录-详情"),
wait("待整改隐患", "隐患整改"),
expired("超期未整改", "超期未整改-详情"),
@ -22,6 +24,7 @@ enum DangerType {
acceptance("已验收隐患", "已验收隐患"),
acceptanced("已验收隐患", "已验收隐患-详情");
final String displayName;
final String detailTitle;

View File

@ -0,0 +1,79 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
import 'package:qhd_prevention/customWidget/single_image_viewer.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'package:qhd_prevention/http/ApiService.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
import 'package:qhd_prevention/tools/tools.dart';
class DetailImagesPage extends StatefulWidget {
const DetailImagesPage(this.recordItemId, {super.key});
final String recordItemId;
@override
State<DetailImagesPage> createState() => _DetailImagesPageState();
}
class _DetailImagesPageState extends State<DetailImagesPage> {
List<String> detailImageList =[];
@override
void initState() {
// TODO: implement initState
super.initState();
_getDetailImageList();
}
Future<void> _getDetailImageList() async {
try {
final result = await ApiService.getDetailImageList(widget.recordItemId);
if (result['result'] == 'success') {
final List<dynamic> newList = result['imgs'] ?? [];
for(int i=0;i<newList.length;i++){
detailImageList.add(newList[i]["FILEPATH"] as String);
}
setState(() {
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppbar(title: "图片"),
body: Padding(
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
child: ListItemFactory.createTextImageItem(
text: "图片",
imageUrls: detailImageList,
onImageTapped: (index) {
presentOpaque(
SingleImageViewer(imageUrl:ApiService.baseImgPath + detailImageList[index]),
context,
);
},
),
),
);
}
}

View File

@ -298,7 +298,7 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
Divider(height: 1),
_buildInfoItem('整改部门', pd['HAVESCHEME']=="0" ? '':''),
_buildInfoItem('整改方案', pd['HAVESCHEME']=="1" ? '':''),
Divider(height: 1),
if(pd['HAVESCHEME']=="1")
Column(
@ -340,7 +340,7 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
),
Divider(height: 1),
_buildInfoItem('整改计划', pd['HAVEPLAN']=="0" ? '':''),
_buildInfoItem('整改计划', pd['HAVEPLAN']=="1" ? '':''),
Divider(height: 1),
if(pd['HAVEPLAN']=="1")
ListItemFactory.createTextImageItem(

View File

@ -341,7 +341,7 @@ class _HomePageState extends State<HomePage> {
return GestureDetector(
onTap: () {
if (index == 1) {
pushPage(DangerPage(), context);
pushPage(DangerPage(3), context);
} else if (index == 2) {
pushPage(DangerWaitListPage(DangerType.wait, 2), context);
} else if (index == 3) {

View File

@ -4,6 +4,8 @@ import 'package:flutter/material.dart';
import 'package:qhd_prevention/customWidget/danner_repain_item.dart';
import 'package:qhd_prevention/customWidget/department_picker.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/home/scan_page.dart';
import 'package:qhd_prevention/pages/home/work/risk_list_page.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
@ -11,8 +13,9 @@ import 'package:qhd_prevention/tools/SmallWidget.dart';
import 'package:qhd_prevention/tools/tools.dart';
class DangerPage extends StatefulWidget {
const DangerPage({super.key});
const DangerPage(this.type, {super.key});
final int type;
@override
_DangerPageState createState() => _DangerPageState();
}
@ -22,36 +25,168 @@ class _DangerPageState extends State<DangerPage>
late TabController _tabController;
int _selectedTab = 0;
//
final List<NotificationItem> _notifications = List.generate(10, (i) {
bool read = i % 3 == 0;
String title = '测试数据标题标题 ${i + 1}';
String time = '2025-06-${10 + i} 12:3${i}';
return NotificationItem(title, time);
});
// //
// final List<NotificationItem> _notifications = List.generate(10, (i) {
// bool read = i % 3 == 0;
// String title = '测试数据标题标题 ${i + 1}';
// String time = '2025-06-${10 + i} 12:3${i}';
// return NotificationItem(title, time);
// });
final TextEditingController _searchController = TextEditingController();
String appBarTitle="";
String id="";
String searchKey="";
String searchName="";
bool showBottomTags=false;
List<dynamic> listOne = [];
List<dynamic> listTwo = [];
List<dynamic> listDates = [];
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
_tabController.addListener(() {
if (!_tabController.indexIsChanging) {
setState(() => _selectedTab = _tabController.index);
if (_tabController.indexIsChanging) {
setState(() => _selectedTab = _tabController.index);
print('切换到标签:${_tabController.index}');
listDates.clear();
setState(() {
if(_selectedTab==0){
listDates.addAll(listOne);
if(widget.type==1){
showBottomTags=true;
}else{
showBottomTags=false;
}
}else{
listDates.addAll(listTwo);
showBottomTags=false;
}
});
}
});
if(widget.type==1){
showBottomTags=true;
}else{
showBottomTags=false;
}
});
id=SessionService.instance.loginUser?["DEPARTMENT_ID"]??"";
getListData();
}
void getListData(){
listDates.clear();
listOne.clear();
listTwo.clear();
switch(widget.type ){
case 1://
appBarTitle="隐患排查";
_getHazardInvestigationList();
break;
case 2://
appBarTitle="标准排查";
_getStandardInvestigationList();
break;
// case 3://-
// appBarTitle="待排查";
// // _getStandardInvestigationRecordList(_page,keyWord,"","","","","","",addList);
// break;
}
}
Future<void> _getHazardInvestigationList() async {
try {
final result = await ApiService.getHazardInvestigationList(id,searchKey);
if (result['result'] == 'success') {
final List<dynamic> newList = result['varList'] ?? [];
setState(() {
for(int i=0;i<newList.length;i++){
if(newList[i]["checkCount"]==0){
listOne.add(newList[i]);
}else{
listTwo.add(newList[i]);
}
}
listDates.addAll(listOne);
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
Future<void> _getStandardInvestigationList() async {
try {
final result = await ApiService.getStandardInvestigationList(id,searchKey);
if (result['result'] == 'success') {
final List<dynamic> newList = result['varList'] ?? [];
setState(() {
for(int i=0;i<newList.length;i++){
if(newList[i]["checkCount"]==0){
listOne.add(newList[i]);
}else{
listTwo.add(newList[i]);
}
}
listDates.addAll(listOne);
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
void _handleItemTap(NotificationItem item, int index) {
print("点击了是: ${item.title}");
pushPage(RiskListPage(), context);
void _handleItemTap( item, int index) {
print("点击了是: ${index}");
switch(widget.type ){
case 1://
pushPage(RiskListPage(widget.type,item["LISTMANAGER_ID"]), context);
break;
case 2://
appBarTitle="标准排查";
pushPage(RiskListPage(widget.type,item["CUSTOM_ID"]), context);
break;
}
}
//
@ -63,6 +198,12 @@ class _DangerPageState extends State<DangerPage>
backgroundColor: Colors.transparent,
builder:
(ctx) => DepartmentPicker(onSelected: (id, name) {
setState(() {
searchKey=id;
searchName=name;
_searchController.text=name;
});
getListData();
}),
);
@ -101,49 +242,56 @@ class _DangerPageState extends State<DangerPage>
tabs: const [Tab(text: '待排查'), Tab(text: '已排查')],
),
// Search bar
Padding(
Container(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(10),
child: SearchBarWidget(
showResetButton: true,
onInputTap: () {
showCategoryPicker();
},
hintText: "",
isClickableOnly: true,
onSearch: (text) {
print('----------');
// searchKey=text;
// getListData();
},
controller: _searchController,
),
),
),
// List
Expanded(
child: ListView.separated(
itemCount: _notifications.length,
child: listDates.isEmpty
? NoDataWidget.show()
: ListView.separated(
padding: EdgeInsets.only(top: 15),
itemCount: listDates.length,
separatorBuilder: (_, __) => const SizedBox(),
itemBuilder: (context, index) {
NotificationItem item = _notifications[index];
final item = listDates[index];
return GestureDetector(
onTap: () => _handleItemTap(item, index),
child: DannerRepainItem(
title: '测试--------new',
title: item['NAME'],
details: [
'清单类型:测试',
'排查周期:测试',
'包含检查项3',
'负责人:是测试',
'起始时间2025-6-20',
'',
'测试一下是否跳过时间',
'清单类型:${item['TYPENAME']}',
'排查周期:${item['PERIODNAME']}',
'包含检查项:${item['count']}',
'负责人:${item['USER_NAME']}',
'起始时间:${item['START_DATE']}-${item['END_DATE']}',
],
showBottomTags: true,
showBottomTags: showBottomTags,
bottomTags: [
riskTagText(1, "重大风险:0"),
riskTagText(2, "较大:3"),
riskTagText(3, "一般:1"),
riskTagText(4, "低:0"),
riskTagText(1, "重大风险:${item['ACOUNT']}"),
riskTagText(2, "较大:${item['BCOUNT']}"),
riskTagText(3, "一般:${item['CCOUNT']}"),
riskTagText(4, "低:${item['DCOUNT']}"),
],
),
);

View File

@ -1,11 +1,16 @@
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'package:qhd_prevention/http/ApiService.dart';
import 'package:qhd_prevention/pages/app/Danger_paicha/danger_image_updata_page.dart';
import 'package:qhd_prevention/tools/h_colors.dart';
import 'package:qhd_prevention/tools/tools.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
class DangerProjectPage extends StatefulWidget {
const DangerProjectPage({super.key});
const DangerProjectPage(this.item, {super.key});
final item;
@override
State<DangerProjectPage> createState() => _DangerProjectPageState();
}
@ -36,88 +41,171 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
},
];
List<dynamic> listDates = [];
@override
void initState() {
// TODO: implement initState
super.initState();
_getInvestigationItems();
}
Future<void> _getInvestigationItems( ) async {
try {
final result = await ApiService.getInvestigationItems(widget.item);
if (result['result'] == 'success') {
final List<dynamic> newList = result['varList'] ?? [];
setState(() {
listDates.addAll(newList);
});
}else{
ToastUtil.showNormal(context, result['msg']);
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
@override
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
return Scaffold(
backgroundColor: h_backGroundColor(),
appBar: MyAppbar(title: "隐患排除项"),
appBar: MyAppbar(title: "排查"),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
//
Card(
color: Colors.white,
child: Container(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//
Text(
"存在风险1、罐体破损、变形、锈蚀等2、附件安装不正确、不牢固3、铭牌模糊无法识别4、压力表不灵敏、不准确5、报警装置故障失效6、阀门锈蚀、泄露7、洗眼器、防毒面具等应急设备缺失、过期。检查内容1、定期检查獬体倩况如发现破损、变形、锈蚀等情况及时进行维修2、严格按照系统设计进行安装附件确保附件安装牢固3、及时清理铭牌上的异物确保铭牌清晰可辨4、定期检查压力表确保压力表灵敏有效5、定期检查报警装置确保报警装置齐全有效6、按时对阀门进行养护及定时检查紧固及时更换阀门填料操作时注意观察压帽是否随阀轴转动7、定期检查应急设备确保应急设备齐全有效",
style: TextStyle(
fontSize: 16,
color: Colors.grey[700],
height: 1.5,
),
),
//
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children:
_options.map((option) {
return _buildOptionButton(
context: context,
value: option['value'],
label: option['label'],
icon: option['icon'],
color: option['color'],
screenWidth: screenWidth,
);
}).toList(),
),
],
child:Column(
children: [
Expanded(child: listDates.isEmpty
? NoDataWidget.show()
: ListView.separated(
itemCount: listDates.length,
separatorBuilder: (_, __) => const SizedBox(),
itemBuilder: (context, index) {
final item = listDates[index];
return GestureDetector(
// onTap: () => _selectItem(item),
child: _itemCell(screenWidth,item),
);
},
)),
//
Container(
margin: const EdgeInsets.only(bottom: 20),
height: 50,
decoration: BoxDecoration(
color: _selectedValue != null ? Colors.green : Colors.grey,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: Colors.black12,
blurRadius: 6,
offset: Offset(0, 2),
),
),
],
),
Spacer(),
//
Container(
margin: const EdgeInsets.only(bottom: 20),
child:
SizedBox(
width: screenWidth - 30,
height: 50,
decoration: BoxDecoration(
color: _selectedValue != null ? Colors.green : Colors.grey,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: Colors.black12,
blurRadius: 6,
offset: Offset(0, 2),
),
],
),
child: TextButton(
onPressed: _selectedValue != null ? _submit : null,
child: Text(
"提交",
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
),
onPressed: _selectedValue != null ? _submit : null,
child: Text(
"提交",
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
),
],
),
// _itemCell(screenWidth),
),
);
}
Widget _itemCell(final screenWidth,final item) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
//
Card(
color: Colors.white,
child: Container(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//
Text(
"检查内容:${item["CHECK_CONTENT"]}",
style: TextStyle(
fontSize: 16,
color: Colors.grey[700],
height: 1.5,
),
),
Text(
"检查标准:${item["CHECK_STANDARD"]}",
style: TextStyle(
fontSize: 16,
color: Colors.grey[700],
height: 1.5,
),
),
//
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children:
_options.map((option) {
return _buildOptionButton(
context: context,
value: option['value'],
label: option['label'],
icon: option['icon'],
color: option['color'],
screenWidth: screenWidth,
onImageTap: () {
pushPage(DangerImageUpdataPage(item["RECORDITEM_ID"]), context);
},
);
}).toList(),
),
if(_selectedValue=="option1")
Card(
color: const Color(0xFFF1F1F1),
child: Container(
width: screenWidth,
padding: EdgeInsets.all(10),
child: Text(item["CHECK_QUALIFIED"],style:TextStyle(color: Colors.black,fontSize: 12)),
)
),
],
),
),
),
// Spacer(),
],
),
);
}
@ -130,6 +218,7 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
required IconData icon,
required Color color,
required double screenWidth,
VoidCallback? onImageTap,
}) {
final isSelected = _selectedValue == value;
final buttonWidth = (screenWidth - 60) / 3 - 10; //
@ -157,6 +246,25 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
color: isSelected ? color : Colors.grey[600],
),
),
if(value=="option1"&&_selectedValue=="option1")
//
GestureDetector(
onTap: () {
// GestureDetector
if (onImageTap != null) {
onImageTap();
}
},
behavior: HitTestBehavior.opaque, //
child: Transform.translate(
offset: Offset(0, -6), // Y
child: Image.asset(
"assets/images/gantan-blue.png",
width: 15,
height: 15,
),
),
),
],
),
),

View File

@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'package:qhd_prevention/http/ApiService.dart';
import 'package:qhd_prevention/pages/home/scan_page.dart';
import 'package:qhd_prevention/pages/home/work/danger_project_page.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
@ -6,7 +8,11 @@ import 'package:qhd_prevention/tools/h_colors.dart';
import 'package:qhd_prevention/tools/tools.dart';
class RiskListPage extends StatefulWidget {
const RiskListPage({super.key});
const RiskListPage(this.type, this.id, {super.key});
final int type;
final String id;
@override
State<RiskListPage> createState() => _riskListPageState();
@ -14,19 +20,80 @@ class RiskListPage extends StatefulWidget {
class _riskListPageState extends State<RiskListPage> {
final List<Model> _dataList = [
Model("青椒皮蛋鸡尾酒哦普佛椒皮鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛"),
Model("dqfiqfjpoqo阿迪王期待期待五千多强大f"),
Model("dqfiqfjpoqof"),
Model("dqfiqfjpoqof")
];
// final List<Model> _dataList = [
// Model("青椒皮蛋鸡尾酒哦普佛椒皮鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛"),
// Model("dqfiqfjpoqo阿迪王期待期待五千多强大f"),
// Model("dqfiqfjpoqof"),
// Model("dqfiqfjpoqof")
// ];
List<dynamic> listDates = [];
@override
void initState() {
// TODO: implement initState
super.initState();
switch(widget.type ){
case 1://
_getRiskPointsList();
break;
case 2://
_getInspectionItemList();
break;
}
}
Future<void> _getRiskPointsList() async {
try {
final result = await ApiService.getRiskPointsList(widget.id);
if (result['result'] == 'success') {
final List<dynamic> newList = result['varList'] ?? [];
setState(() {
listDates.addAll(newList);
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
Future<void> _getInspectionItemList() async {
try {
final result = await ApiService.getInspectionItemList(widget.id);
if (result['result'] == 'success') {
final List<dynamic> newList = result['varList'] ?? [];
setState(() {
listDates.addAll(newList);
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: h_backGroundColor(),
appBar: MyAppbar(
title: "风险点(单元)列表",
title: widget.type==1?"风险点(单元)列表":"检查项目列表",
actions: [
TextButton(
onPressed: () {
@ -42,11 +109,13 @@ class _riskListPageState extends State<RiskListPage> {
body: SafeArea(
child: Column(
children: [
Expanded(child: ListView.separated(
itemCount: _dataList.length,
Expanded(child: listDates.isEmpty
? NoDataWidget.show()
: ListView.separated(
itemCount: listDates.length,
separatorBuilder: (_, __) => const SizedBox(),
itemBuilder: (context, index) {
Model item = _dataList[index];
final item = listDates[index];
return GestureDetector(
onTap: () => _selectItem(item),
child: _itemCell(item),
@ -69,7 +138,7 @@ class _riskListPageState extends State<RiskListPage> {
);
}
Widget _itemCell(Model item) {
Widget _itemCell(final item) {
return Padding(padding: EdgeInsets.symmetric(vertical: 7, horizontal: 15),
child: GestureDetector(
onTap: () => _selectItem(item),
@ -84,15 +153,25 @@ class _riskListPageState extends State<RiskListPage> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Image.asset("assets/images/zt-ing.png", width: 70, height: 70,),
const SizedBox(width: 10), //
Expanded( // 3:
child: Text(
item.title,
style: const TextStyle(fontSize: 16),
maxLines: 2, //
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(width: 10), //
Column(
children: [
Expanded( // 3:
child:
Center(child:
Text(
_getTitle(item),
// item.title,
style: const TextStyle(fontSize: 16),
maxLines: 2, //
overflow: TextOverflow.ellipsis,
),
),
),
],
)
],
),
),
@ -100,17 +179,53 @@ class _riskListPageState extends State<RiskListPage> {
);
}
String _getTitle(final item) {
if(widget.type==1 ){
return "${item["DEPT_NAME"]}--${item["RISKUNITNAME"]}--${item["PARTSNAME"]}\n所属电子围栏:${item["ELECTRONIC_FENCE_NAME"]}";
}else{
return item["DICTIONARY_NAMES"];
}
}
void _nextHandle() {
}
void _selectItem(Model Item) {
pushPage(DangerProjectPage(), context);
void _selectItem(final item) {
switch(widget.type ){
case 1://
_isInElectronicFence(item);
break;
case 2://
pushPage(DangerProjectPage(item), context);
break;
}
}
Future<void> _isInElectronicFence(final item ) async {
try {
final result = await ApiService.isInElectronicFence(item["ELECTRONIC_FENCE_ID"]);
if (result['result'] == 'success') {
setState(() {
// listDates.addAll(newList);
});
}else{
ToastUtil.showNormal(context, result['msg']);
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
}
class Model {
final String title;
Model(this.title);
}

File diff suppressed because it is too large Load Diff