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/profile
/android/app/release /android/app/release
/android/key.properties /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) { static Future<Map<String, dynamic>> getInspectRecordsDetail(String id) {
return HttpManager().request( return HttpManager().request(
basePath, basePath,
'/app/checkrecord/goEdit', '/app/customCheckRecord/goEdit',
method: Method.post, method: Method.post,
data: { data: {
"CHECKRECORD_ID": id, "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>{}; : <String, dynamic>{};
final result = json['result'] as String?; final result = json['result'] as String?;
final msg = json['msg'] as String? ?? json['message'] as String? ?? ''; final msg = json['msg'] as String? ?? json['message'] as String? ?? '';
if (result != 'success') { // if (result != 'success') {
// success // // success
throw ApiException(result ?? 'unknown', msg); // throw ApiException(result ?? 'unknown', msg);
} // }
return json; 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.dart';
import 'package:photo_view/photo_view_gallery.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/customWidget/toast_util.dart';
import 'package:qhd_prevention/http/ApiService.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"}, // {"RISKPOINT_ID": "3", "CHECK_CONTENT": "电气线路检查", "ISNORMAL": "2"},
// ]; // ];
List<Map<String, dynamic>> otherHiddenList = [ // List<Map<String, dynamic>> otherHiddenList = [
{"HIDDEN_ID": "3001", "HIDDENDESCR": "应急通道堵塞"}, // {"HIDDEN_ID": "3001", "HIDDENDESCR": "应急通道堵塞"},
{"HIDDEN_ID": "3002", "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); // final LatLng _center = const LatLng(39.8883, 119.519);
@ -55,9 +58,10 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
bool _showImageViewer = false; bool _showImageViewer = false;
dynamic pd; // dynamic pd;
List<dynamic> imageList =[]; List<String> imageList =[];
List<dynamic> varList =[]; List<dynamic> varList =[];
List<dynamic> hiddenList =[];
@override @override
void initState() { void initState() {
@ -71,6 +75,7 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
_getInspectRecordsDetail(); _getInspectRecordsDetail();
_getInspectRecordsDetailTwo();
} }
Future<void> _getInspectRecordsDetail() async { Future<void> _getInspectRecordsDetail() async {
@ -83,7 +88,7 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
pd= result['pd']; pd= result['pd'];
varList = result['varList'] ?? []; varList = result['varList'] ?? [];
for(int i=0;i<qianmingList.length;i++){ 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -197,19 +224,19 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
VoidCallback? onTap; VoidCallback? onTap;
switch (item["ISNORMAL"]) { switch (item["ISNORMAL"]) {
case "0": case 0:
status = "合格"; status = "合格";
color = Colors.blue; color = Colors.blue;
if (item["IMGCOUNT"] > 0) { if (item["IMGCOUNT"] > 0) {
onTap = () => _goToImgs(item["RECORDITEM_ID"]); onTap = () => _goToImgs(item["RECORDITEM_ID"]);
} }
break; break;
case "1": case 1:
status = "不合格"; status = "不合格";
color = Colors.blue; color = Colors.blue;
onTap = () => _goToDetail(item["HIDDEN_ID"]); onTap = () => _goToDetail(item["HIDDEN_ID"]);
break; break;
case "2": case 2:
status = "不涉及"; status = "不涉及";
color = Colors.blue; color = Colors.blue;
break; break;
@ -252,7 +279,7 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
_buildTableHeaderCell("操作"), _buildTableHeaderCell("操作"),
], ],
), ),
...otherHiddenList.map((item) => TableRow( ...hiddenList.map((item) => TableRow(
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
@ -312,14 +339,14 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
), ),
child: Column( child: Column(
children: [ children: [
_buildInfoRow("清单名称", pd["LIST_NAME"]), _buildInfoRow("清单名称", pd["LIST_NAME"]?? ''),
_buildInfoRow("排查清单类型", pd["SCREENTYPENAME"]), _buildInfoRow("排查清单类型", pd["SCREENTYPENAME"]?? ''),
_buildInfoRow("检查人", pd["USERS"]), _buildInfoRow("检查人", pd["USERS"]?? ''),
_buildInfoRow("检查时间", pd["CHECK_TIME"]), _buildInfoRow("检查时间", pd["CHECK_TIME"]?? ''),
_buildInfoRow("所属部门", pd["DEPARTMENT_NAME"]), _buildInfoRow("所属部门", pd["DEPARTMENT_NAME"]?? ''),
_buildInfoRow("所属岗位", pd["POST_NAME"]), _buildInfoRow("所属岗位", pd["POST_NAME"]?? ''),
_buildInfoRow("排查周期", pd["PERIODNAME"]), _buildInfoRow("排查周期", pd["PERIODNAME"]?? ''),
_buildInfoRow("清单类型", pd["TYPENAME"]), _buildInfoRow("清单类型", pd["TYPENAME"]?? ''),
if (pd["TYPENAME"] == "临时") if (pd["TYPENAME"] == "临时")
_buildInfoRow("排查日期", "${pd["START_DATE"]} - ${pd["END_DATE"]}"), _buildInfoRow("排查日期", "${pd["START_DATE"]} - ${pd["END_DATE"]}"),
], ],
@ -346,96 +373,48 @@ class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
Widget _buildSignPhotos() { Widget _buildSignPhotos() {
return Padding( return Padding(
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20), padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
child: Column( child: ListItemFactory.createTextImageItem(
crossAxisAlignment: CrossAxisAlignment.start, text: "签字照片",
children: [ imageUrls: imageList,
Text("签字照片", style: TextStyle(fontWeight: FontWeight.bold)), onImageTapped: (index) {
SizedBox(height: 10), presentOpaque(
Container( SingleImageViewer(imageUrl:ApiService.baseImgPath + imageList[index]),
height: 120, context,
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,
),
),
),
);
},
),
),
],
), ),
); );
} }
void _goToDetail(String hiddenId) { void _goToDetail(String hiddenId) {
Navigator.push( dynamic item={"HIDDEN_RISKSTANDARD":"2","HIDDEN_ID":hiddenId};
context, pushPage(HiddenRecordDetailPage(DangerType.detailsHiddenInvestigationRecord,item), context);
MaterialPageRoute( // Navigator.push(
builder: (context) => Scaffold( // context,
appBar: AppBar(title: Text("隐患详情")), // MaterialPageRoute(
body: Center(child: Text("隐患ID: $hiddenId")), // builder: (context) => Scaffold(
), // appBar: AppBar(title: Text("隐患详情")),
), // body: Center(child: Text("隐患ID: $hiddenId")),
); // ),
// ),
// );
} }
void _goToImgs(String recordItemId) { void _goToImgs(String recordItemId) {
Navigator.push( pushPage(DetailImagesPage(recordItemId), context);
context, // Navigator.push(
MaterialPageRoute( // context,
builder: (context) => Scaffold( // MaterialPageRoute(
appBar: AppBar(title: Text("图片详情")), // builder: (context) => Scaffold(
body: Center(child: Text("记录项ID: $recordItemId")), // 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(){ void getListData(){
listDates.clear();
alreadyList.clear();
overTimeList.clear();
switch(widget.type ){ switch(widget.type ){
case 1:// case 1://
_getCheckRecordListOne(); _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) { void _handleItemTap(NotificationItem item, int index) {
print("点击了是: ${item.title}"); print("点击了是: ${item.title}");
pushPage(RiskListPage(), context); // pushPage(RiskListPage(), context);
} }
// //

View File

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

View File

@ -15,6 +15,8 @@ import 'hidden_record_detail_page.dart';
enum DangerType { enum DangerType {
detailsHiddenInvestigationRecord("排查隐患记录", "排查隐患记录-详情"),
ristRecord("隐患记录", "隐患记录-详情"), ristRecord("隐患记录", "隐患记录-详情"),
wait("待整改隐患", "隐患整改"), wait("待整改隐患", "隐患整改"),
expired("超期未整改", "超期未整改-详情"), expired("超期未整改", "超期未整改-详情"),
@ -22,6 +24,7 @@ enum DangerType {
acceptance("已验收隐患", "已验收隐患"), acceptance("已验收隐患", "已验收隐患"),
acceptanced("已验收隐患", "已验收隐患-详情"); acceptanced("已验收隐患", "已验收隐患-详情");
final String displayName; final String displayName;
final String detailTitle; 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), Divider(height: 1),
_buildInfoItem('整改部门', pd['HAVESCHEME']=="0" ? '':''), _buildInfoItem('整改方案', pd['HAVESCHEME']=="1" ? '':''),
Divider(height: 1), Divider(height: 1),
if(pd['HAVESCHEME']=="1") if(pd['HAVESCHEME']=="1")
Column( Column(
@ -340,7 +340,7 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
), ),
Divider(height: 1), Divider(height: 1),
_buildInfoItem('整改计划', pd['HAVEPLAN']=="0" ? '':''), _buildInfoItem('整改计划', pd['HAVEPLAN']=="1" ? '':''),
Divider(height: 1), Divider(height: 1),
if(pd['HAVEPLAN']=="1") if(pd['HAVEPLAN']=="1")
ListItemFactory.createTextImageItem( ListItemFactory.createTextImageItem(

View File

@ -341,7 +341,7 @@ class _HomePageState extends State<HomePage> {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
if (index == 1) { if (index == 1) {
pushPage(DangerPage(), context); pushPage(DangerPage(3), context);
} else if (index == 2) { } else if (index == 2) {
pushPage(DangerWaitListPage(DangerType.wait, 2), context); pushPage(DangerWaitListPage(DangerType.wait, 2), context);
} else if (index == 3) { } 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/danner_repain_item.dart';
import 'package:qhd_prevention/customWidget/department_picker.dart'; import 'package:qhd_prevention/customWidget/department_picker.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/home/scan_page.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/home/work/risk_list_page.dart';
import 'package:qhd_prevention/pages/my_appbar.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'; import 'package:qhd_prevention/tools/tools.dart';
class DangerPage extends StatefulWidget { class DangerPage extends StatefulWidget {
const DangerPage({super.key}); const DangerPage(this.type, {super.key});
final int type;
@override @override
_DangerPageState createState() => _DangerPageState(); _DangerPageState createState() => _DangerPageState();
} }
@ -22,36 +25,168 @@ class _DangerPageState extends State<DangerPage>
late TabController _tabController; late TabController _tabController;
int _selectedTab = 0; int _selectedTab = 0;
// // //
final List<NotificationItem> _notifications = List.generate(10, (i) { // final List<NotificationItem> _notifications = List.generate(10, (i) {
bool read = i % 3 == 0; // bool read = i % 3 == 0;
String title = '测试数据标题标题 ${i + 1}'; // String title = '测试数据标题标题 ${i + 1}';
String time = '2025-06-${10 + i} 12:3${i}'; // String time = '2025-06-${10 + i} 12:3${i}';
return NotificationItem(title, time); // return NotificationItem(title, time);
}); // });
final TextEditingController _searchController = TextEditingController(); 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 @override
void initState() { void initState() {
super.initState(); super.initState();
_tabController = TabController(length: 2, vsync: this); _tabController = TabController(length: 2, vsync: this);
_tabController.addListener(() { _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 @override
void dispose() { void dispose() {
_tabController.dispose(); _tabController.dispose();
super.dispose(); super.dispose();
} }
void _handleItemTap(NotificationItem item, int index) { void _handleItemTap( item, int index) {
print("点击了是: ${item.title}"); print("点击了是: ${index}");
pushPage(RiskListPage(), context); 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, backgroundColor: Colors.transparent,
builder: builder:
(ctx) => DepartmentPicker(onSelected: (id, name) { (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: '已排查')], tabs: const [Tab(text: '待排查'), Tab(text: '已排查')],
), ),
// Search bar Container(
Padding( color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: SearchBarWidget( child: SearchBarWidget(
showResetButton: true, showResetButton: true,
onInputTap: () { onInputTap: () {
showCategoryPicker(); showCategoryPicker();
}, },
hintText: "", hintText: "",
isClickableOnly: true, isClickableOnly: true,
onSearch: (text) { onSearch: (text) {
print('----------'); print('----------');
// searchKey=text;
// getListData();
}, },
controller: _searchController, controller: _searchController,
), ),
), ),
),
// List // List
Expanded( Expanded(
child: ListView.separated( child: listDates.isEmpty
itemCount: _notifications.length, ? NoDataWidget.show()
: ListView.separated(
padding: EdgeInsets.only(top: 15),
itemCount: listDates.length,
separatorBuilder: (_, __) => const SizedBox(), separatorBuilder: (_, __) => const SizedBox(),
itemBuilder: (context, index) { itemBuilder: (context, index) {
NotificationItem item = _notifications[index]; final item = listDates[index];
return GestureDetector( return GestureDetector(
onTap: () => _handleItemTap(item, index), onTap: () => _handleItemTap(item, index),
child: DannerRepainItem( child: DannerRepainItem(
title: '测试--------new', title: item['NAME'],
details: [ details: [
'清单类型:测试', '清单类型:${item['TYPENAME']}',
'排查周期:测试', '排查周期:${item['PERIODNAME']}',
'包含检查项3', '包含检查项:${item['count']}',
'负责人:是测试', '负责人:${item['USER_NAME']}',
'起始时间2025-6-20', '起始时间:${item['START_DATE']}-${item['END_DATE']}',
'',
'测试一下是否跳过时间',
], ],
showBottomTags: true, showBottomTags: showBottomTags,
bottomTags: [ bottomTags: [
riskTagText(1, "重大风险:0"), riskTagText(1, "重大风险:${item['ACOUNT']}"),
riskTagText(2, "较大:3"), riskTagText(2, "较大:${item['BCOUNT']}"),
riskTagText(3, "一般:1"), riskTagText(3, "一般:${item['CCOUNT']}"),
riskTagText(4, "低:0"), riskTagText(4, "低:${item['DCOUNT']}"),
], ],
), ),
); );

View File

@ -1,11 +1,16 @@
import 'package:flutter/material.dart'; 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/h_colors.dart';
import 'package:qhd_prevention/tools/tools.dart'; import 'package:qhd_prevention/tools/tools.dart';
import 'package:qhd_prevention/pages/my_appbar.dart'; import 'package:qhd_prevention/pages/my_appbar.dart';
class DangerProjectPage extends StatefulWidget { class DangerProjectPage extends StatefulWidget {
const DangerProjectPage({super.key}); const DangerProjectPage(this.item, {super.key});
final item;
@override @override
State<DangerProjectPage> createState() => _DangerProjectPageState(); 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width; final screenWidth = MediaQuery.of(context).size.width;
return Scaffold( return Scaffold(
backgroundColor: h_backGroundColor(), backgroundColor: h_backGroundColor(),
appBar: MyAppbar(title: "隐患排除项"), appBar: MyAppbar(title: "排查"),
body: SafeArea( body: SafeArea(
child: Padding( child:Column(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), children: [
child: Column( Expanded(child: listDates.isEmpty
crossAxisAlignment: CrossAxisAlignment.stretch, ? NoDataWidget.show()
children: [ : ListView.separated(
// itemCount: listDates.length,
Card( separatorBuilder: (_, __) => const SizedBox(),
color: Colors.white, itemBuilder: (context, index) {
child: Container( final item = listDates[index];
padding: const EdgeInsets.all(16), return GestureDetector(
child: Column( // onTap: () => _selectItem(item),
crossAxisAlignment: CrossAxisAlignment.start, child: _itemCell(screenWidth,item),
children: [ );
// },
Text( )),
"存在风险1、罐体破损、变形、锈蚀等2、附件安装不正确、不牢固3、铭牌模糊无法识别4、压力表不灵敏、不准确5、报警装置故障失效6、阀门锈蚀、泄露7、洗眼器、防毒面具等应急设备缺失、过期。检查内容1、定期检查獬体倩况如发现破损、变形、锈蚀等情况及时进行维修2、严格按照系统设计进行安装附件确保附件安装牢固3、及时清理铭牌上的异物确保铭牌清晰可辨4、定期检查压力表确保压力表灵敏有效5、定期检查报警装置确保报警装置齐全有效6、按时对阀门进行养护及定时检查紧固及时更换阀门填料操作时注意观察压帽是否随阀轴转动7、定期检查应急设备确保应急设备齐全有效", //
style: TextStyle( Container(
fontSize: 16, margin: const EdgeInsets.only(bottom: 20),
color: Colors.grey[700], height: 50,
height: 1.5, decoration: BoxDecoration(
), color: _selectedValue != null ? Colors.green : Colors.grey,
), borderRadius: BorderRadius.circular(10),
boxShadow: [
// BoxShadow(
Row( color: Colors.black12,
mainAxisAlignment: MainAxisAlignment.spaceAround, blurRadius: 6,
children: offset: Offset(0, 2),
_options.map((option) {
return _buildOptionButton(
context: context,
value: option['value'],
label: option['label'],
icon: option['icon'],
color: option['color'],
screenWidth: screenWidth,
);
}).toList(),
),
],
), ),
), ],
), ),
Spacer(), child:
// SizedBox(
Container( width: screenWidth - 30,
margin: const EdgeInsets.only(bottom: 20),
height: 50, 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( child: TextButton(
onPressed: _selectedValue != null ? _submit : null, onPressed: _selectedValue != null ? _submit : null,
child: Text( child: Text(
"提交", "提交",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, 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 IconData icon,
required Color color, required Color color,
required double screenWidth, required double screenWidth,
VoidCallback? onImageTap,
}) { }) {
final isSelected = _selectedValue == value; final isSelected = _selectedValue == value;
final buttonWidth = (screenWidth - 60) / 3 - 10; // final buttonWidth = (screenWidth - 60) / 3 - 10; //
@ -157,6 +246,25 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
color: isSelected ? color : Colors.grey[600], 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: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/scan_page.dart';
import 'package:qhd_prevention/pages/home/work/danger_project_page.dart'; import 'package:qhd_prevention/pages/home/work/danger_project_page.dart';
import 'package:qhd_prevention/pages/my_appbar.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'; import 'package:qhd_prevention/tools/tools.dart';
class RiskListPage extends StatefulWidget { class RiskListPage extends StatefulWidget {
const RiskListPage({super.key}); const RiskListPage(this.type, this.id, {super.key});
final int type;
final String id;
@override @override
State<RiskListPage> createState() => _riskListPageState(); State<RiskListPage> createState() => _riskListPageState();
@ -14,19 +20,80 @@ class RiskListPage extends StatefulWidget {
class _riskListPageState extends State<RiskListPage> { class _riskListPageState extends State<RiskListPage> {
final List<Model> _dataList = [ // final List<Model> _dataList = [
Model("青椒皮蛋鸡尾酒哦普佛椒皮鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛"), // Model("青椒皮蛋鸡尾酒哦普佛椒皮鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛椒皮鸡尾鸡尾酒哦普佛"),
Model("dqfiqfjpoqo阿迪王期待期待五千多强大f"), // Model("dqfiqfjpoqo阿迪王期待期待五千多强大f"),
Model("dqfiqfjpoqof"), // Model("dqfiqfjpoqof"),
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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: h_backGroundColor(), backgroundColor: h_backGroundColor(),
appBar: MyAppbar( appBar: MyAppbar(
title: "风险点(单元)列表", title: widget.type==1?"风险点(单元)列表":"检查项目列表",
actions: [ actions: [
TextButton( TextButton(
onPressed: () { onPressed: () {
@ -42,11 +109,13 @@ class _riskListPageState extends State<RiskListPage> {
body: SafeArea( body: SafeArea(
child: Column( child: Column(
children: [ children: [
Expanded(child: ListView.separated( Expanded(child: listDates.isEmpty
itemCount: _dataList.length, ? NoDataWidget.show()
: ListView.separated(
itemCount: listDates.length,
separatorBuilder: (_, __) => const SizedBox(), separatorBuilder: (_, __) => const SizedBox(),
itemBuilder: (context, index) { itemBuilder: (context, index) {
Model item = _dataList[index]; final item = listDates[index];
return GestureDetector( return GestureDetector(
onTap: () => _selectItem(item), onTap: () => _selectItem(item),
child: _itemCell(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), return Padding(padding: EdgeInsets.symmetric(vertical: 7, horizontal: 15),
child: GestureDetector( child: GestureDetector(
onTap: () => _selectItem(item), onTap: () => _selectItem(item),
@ -84,15 +153,25 @@ class _riskListPageState extends State<RiskListPage> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Image.asset("assets/images/zt-ing.png", width: 70, height: 70,), Image.asset("assets/images/zt-ing.png", width: 70, height: 70,),
const SizedBox(width: 10), // const SizedBox(width: 10), //
Expanded( // 3: Column(
child: Text( children: [
item.title, Expanded( // 3:
style: const TextStyle(fontSize: 16), child:
maxLines: 2, // Center(child:
overflow: TextOverflow.ellipsis, 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 _nextHandle() {
} }
void _selectItem(Model Item) { void _selectItem(final item) {
pushPage(DangerProjectPage(), context); 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