2025.8.7 隐患排查完成,隐患排查成功后,表单还在

main
xufei 2025-08-07 17:37:21 +08:00
parent 5365a91e49
commit d0d8ca36ee
10 changed files with 851 additions and 234 deletions

View File

@ -2027,7 +2027,7 @@ U6Hzm1ninpWeE+awIDAQAB
}
///
///
static Future<Map<String, dynamic>> getCheckInformationList(String id) {
return HttpManager().request(
basePath,
@ -2114,5 +2114,213 @@ U6Hzm1ninpWeE+awIDAQAB
///
static Future<Map<String, dynamic>> getInvestigationItemsYinHuan(final item) {
return HttpManager().request(
basePath,
'/app/listmanager/goCheck',
method: Method.post,
data: {
"LISTMANAGER_ID": item["LISTMANAGER_ID"],
"IDENTIFICATIONPARTS_ID": item["IDENTIFICATIONPARTS_ID"],
"USER_NAME": SessionService.instance.username,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID":SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getYinHuanTemporaryStorageOfHidden(String id) {
return HttpManager().request(
basePath,
'/app/hidden/goRiskListCheckEdit',
method: Method.post,
data: {
"HIDDEN_ID": id,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID":SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> temporaryStorageOfHiddenYinHuan(
String msg,item,unqualifiedInspectionItemID,
String hazardDescription,String partDescription,String latitude,String longitude,
String dangerDetail,String dataTime,String type,String responsibleId,
String yinHuanTypeIds,String hazardLeve,String buMenId,String buMenPDId,
String yinHuanTypeNames,String hiddenType1,String hiddenType2,String hiddenType3,result) {
print("======>$type");
return HttpManager().request(
basePath,
'/app/hidden/$msg',
method: Method.post,
data: {
"HIDDEN_ID":unqualifiedInspectionItemID,
"SOURCE": '2',
"STATE": '0',
"HIDDEN_CATEGORY": result["HIDDEN_CATEGORY"] ?? '',
"LISTMANAGER_ID": item["LISTMANAGER_ID"],
"RISKITEM_ID": result["LISTCHECKITEM_ID"],
"CHECK_CONTENT": item["CHECK_CONTENT"]??"",
"RECORDITEM_ID": item["RECORDITEM_ID"]??"",
"HIDDENDESCR": hazardDescription,
"HIDDENPART": partDescription,
"LATITUDE": latitude,
"LONGITUDE": longitude,
"RECTIFYDESCR": dangerDetail,
"RECTIFICATIONDEADLINE": dataTime,
"RECTIFICATIONTYPE": type,
"RECTIFICATIONOR": responsibleId,
"HIDDENTYPE": yinHuanTypeIds,
"HIDDENLEVEL":hazardLeve,
"RECTIFICATIONDEPT": buMenId,
"HIDDENFINDDEPT": buMenPDId.isNotEmpty?buMenPDId:buMenId,
"CREATOR": SessionService.instance.loginUserId,
"CLEARIMG": '1',
"HIDDENTYPE_NAME": yinHuanTypeNames,
"HIDDENTYPE1": hiddenType1 ,
"HIDDENTYPE2": hiddenType2 ,
"HIDDENTYPE3": hiddenType3 ,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> submitInvestigationItemsYinHuan(
item,String longitude,String latitude,
String itemsString,String idsString,String checkrecordId,) {
return HttpManager().request(
basePath,
'/app/checkrecord/add',
method: Method.post,
data: {
// "CUSTOM_ID": item["CUSTOM_ID"],
"LISTMANAGER_ID": item["LISTMANAGER_ID"],
"LIST_NAME": SessionService.instance.listItemNameJson,
"CREATOR": SessionService.instance.username,
"LATITUDE": latitude,
"LONGITUDE": longitude,
"ITEMS": itemsString,
"IDS": idsString,
"CHECKRECORD_ID": checkrecordId,
"tm": DateTime.now().millisecondsSinceEpoch.toString(),
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getCheckInformationListYinHuan(String id) {
return HttpManager().request(
basePath,
'/app/hidden/getOtherHidden',
method: Method.post,
data: {
"LISTMANAGER_ID": id,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> customCheckRecordFinishYinHuan(String time,String text,
String CHECKRECORD_ID,String id,String json) {
return HttpManager().request(
basePath,
'/app/checkrecord/finish',
method: Method.post,
data: {
"CHECK_TIME": time,
"DESCR": text,
"CHECKRECORD_ID": CHECKRECORD_ID,
"LISTMANAGER_ID": id,
"OTHER": json,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getTemporaryStorageOfHiddenYinHuan(String id) {
return HttpManager().request(
basePath,
'/app/customHidden/goEdit',
method: Method.post,
data: {
"HIDDEN_ID": id,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID":SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> checkInformationOneItemDataYinHuan(
String msg,String id,unqualifiedInspectionItemID,
String hazardDescription,String partDescription,String latitude,String longitude,
String dangerDetail,String dataTime,String type,String responsibleId,
String yinHuanTypeIds,String hazardLeve,String buMenId,String buMenPDId,
String yinHuanTypeNames,String hiddenType1,String hiddenType2,String hiddenType3,) {
print("======>$type");
return HttpManager().request(
basePath,
'/app/hidden/$msg',
method: Method.post,
data: {
"HIDDEN_ID":unqualifiedInspectionItemID,
"SOURCE": '3',
"STATE": '0',
"HIDDENDESCR": hazardDescription,
"HIDDENPART": partDescription,
"LATITUDE": latitude,
"LONGITUDE": longitude,
"RECTIFYDESCR": dangerDetail,
"RECTIFICATIONDEADLINE": dataTime,
"RECTIFICATIONTYPE": type,
"RECTIFICATIONOR": responsibleId,
"HIDDENTYPE": yinHuanTypeIds,
"HIDDENLEVEL":hazardLeve,
"RECTIFICATIONDEPT": buMenId,
"HIDDENFINDDEPT": buMenPDId.isNotEmpty?buMenPDId:buMenId,
"CREATOR": SessionService.instance.loginUserId,
"LISTMANAGER_ID": id,
"HIDDENTYPE_NAME": yinHuanTypeNames,
"HIDDENTYPE1": hiddenType1 ,
"HIDDENTYPE2": hiddenType2 ,
"HIDDENTYPE3": hiddenType3 ,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
}

View File

@ -20,8 +20,9 @@ import '../../../customWidget/photo_picker_row.dart';
import '../../../http/ApiService.dart';
class CheckInformationOneItem extends StatefulWidget {
const CheckInformationOneItem(this.id,this.item, this.result, {super.key,required this.onClose});
const CheckInformationOneItem(this.id,this.item, this.result, this.type, {super.key,required this.onClose});
final int type;
final String id;
final item;
final Map<String, dynamic> result;
@ -620,12 +621,29 @@ class _CheckInformationOneItemState extends State<CheckInformationOneItem> {
// yinHuanTypeIds, hazardLeve, buMenId, buMenPDId,
// yinHuanTypeNames, hiddenType1, hiddenType2, hiddenType3,);
final result = await ApiService.checkInformationOneItemData(
final Map<String, dynamic> result;
if(widget.type==1){
result = await ApiService.checkInformationOneItemDataYinHuan(
unqualifiedInspectionItemID.isNotEmpty?"riskListCheckEdit":"riskListCheckAdd",listId,unqualifiedInspectionItemID,
hazardDescription, partDescription, latitude, longitude,
dangerDetail, dataTime, type, responsibleId,
yinHuanTypeIds, hazardLeve, buMenId, buMenPDId,
yinHuanTypeNames, hiddenType1, hiddenType2, hiddenType3,);
}else{
result = await ApiService.checkInformationOneItemData(
unqualifiedInspectionItemID.isNotEmpty?"edit":"add",listId,unqualifiedInspectionItemID,
hazardDescription, partDescription, latitude, longitude,
dangerDetail, dataTime, type, responsibleId,
yinHuanTypeIds, hazardLeve, buMenId, buMenPDId,
yinHuanTypeNames, hiddenType1, hiddenType2, hiddenType3,);
}
// final result = await ApiService.checkInformationOneItemData(
// unqualifiedInspectionItemID.isNotEmpty?"edit":"add",listId,unqualifiedInspectionItemID,
// hazardDescription, partDescription, latitude, longitude,
// dangerDetail, dataTime, type, responsibleId,
// yinHuanTypeIds, hazardLeve, buMenId, buMenPDId,
// yinHuanTypeNames, hiddenType1, hiddenType2, hiddenType3,);
if (result['result'] == 'success') {

View File

@ -20,9 +20,10 @@ import '../../../customWidget/photo_picker_row.dart';
import '../../../http/ApiService.dart';
class HazardRegistrationPage extends StatefulWidget {
const HazardRegistrationPage(this.item, this.result, {super.key,required this.onClose});
const HazardRegistrationPage(this.item, this.result, this.type, {super.key,required this.onClose});
final item;
final int type;
final Map<String, dynamic> result;
final Function(String,String) onClose;
@override
@ -612,12 +613,27 @@ class _HazardRegistrationPageState extends State<HazardRegistrationPage> {
String latitude=position.latitude.toString();
try {
final result = await ApiService.temporaryStorageOfHidden(
final Map<String, dynamic> result;
if(widget.type==1){
result = await ApiService.temporaryStorageOfHiddenYinHuan(
unqualifiedInspectionItemID.isNotEmpty?"riskListCheckEdit":"riskListCheckAdd",widget.item,unqualifiedInspectionItemID,
hazardDescription, partDescription, latitude, longitude,
dangerDetail, dataTime, type, responsibleId,
yinHuanTypeIds, hazardLeve, buMenId, buMenPDId,
yinHuanTypeNames, hiddenType1, hiddenType2, hiddenType3,widget.result);
}else{
result = await ApiService.temporaryStorageOfHidden(
unqualifiedInspectionItemID.isNotEmpty?"edit":"add",widget.item,unqualifiedInspectionItemID,
hazardDescription, partDescription, latitude, longitude,
dangerDetail, dataTime, type, responsibleId,
yinHuanTypeIds, hazardLeve, buMenId, buMenPDId,
yinHuanTypeNames, hiddenType1, hiddenType2, hiddenType3,);
}
if (result['result'] == 'success') {
String hiddenId = result['pd']['HIDDEN_ID'] ;

View File

@ -22,8 +22,9 @@ import 'danner_repair.dart';
class CheckingInformationOnePage extends StatefulWidget {
const CheckingInformationOnePage(this.id,this.checkrecordId, {super.key});
const CheckingInformationOnePage(this.id,this.checkrecordId,this.type, {super.key});
final int type;
final String id;
final String checkrecordId;
@ -57,9 +58,57 @@ class _CheckingInformationOnePageState extends State<CheckingInformationOnePage>
final now =DateTime.now();
dataTime=DateFormat('yyyy-MM-dd').format(now);
stringTime=DateFormat('HH:mm').format(now);
_getCheckInformationList();
_getData();
}
void _getData(){
listDates.clear();
switch(widget.type ){
case 1://
_getCheckInformationListYinHuan();
break;
case 2://
_getCheckInformationList();
break;
}
}
Future<void> _getCheckInformationListYinHuan() async {
try {
final result = await ApiService.getCheckInformationListYinHuan(widget.id);
if (result['result'] == 'success') {
final List<dynamic> newList = result['hiddenList'] ?? [];
setState(() {
CHECKRECORD_ID= result['CHECKRECORD_ID'];
listDates.addAll(newList);//"HIDDENDESCR" -> "3111111"
for(int i=0;i<listDates.length;i++){
try{
otherHidden.add(DepartmentEntry(department: listDates[i]["HIDDENDESCR"], responsible: '请选择',index:'',departmentId:listDates[i]['HIDDEN_ID'] ,responsibleId:''));
}catch(e){
otherHidden.add(DepartmentEntry(department: "", responsible: '请选择',index:'',departmentId:listDates[i]['HIDDEN_ID'],responsibleId:''));
}
}
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
Future<void> _getCheckInformationList() async {
try {
@ -513,10 +562,18 @@ class _CheckingInformationOnePageState extends State<CheckingInformationOnePage>
void _selectItem(final item,int index) {
String hiddenId=item.departmentId;
if(hiddenId.isNotEmpty) {
_getTemporaryStorageOfHidden(item,hiddenId,index);
switch(widget.type ) {
case 1: //
_getTemporaryStorageOfHiddenYinHuan(item, hiddenId, index);
break;
case 2: //
_getTemporaryStorageOfHidden(item, hiddenId, index);
break;
}
}else{
pushPage(CheckInformationOneItem(
widget.id,item,nullResult,
widget.id,item,nullResult,widget.type,
onClose: (String departmentId,String yinHuanText) {
setState(() {
// this.yinHuanText=yinHuanText;
@ -533,6 +590,36 @@ class _CheckingInformationOnePageState extends State<CheckingInformationOnePage>
}
Future<void> _getTemporaryStorageOfHiddenYinHuan( item,String hiddenId,int index) async {
try {
final result = await ApiService.getYinHuanTemporaryStorageOfHidden(hiddenId);
if (result['result'] == 'success') {
pushPage(CheckInformationOneItem(
widget.id,item,result,widget.type,
onClose: (String departmentId,String yinHuanText) {
setState(() {
// this.yinHuanText=yinHuanText;
// unqualifiedInspectionItemID=departmentId;
otherHidden[index].department=yinHuanText;
otherHidden[index].departmentId=departmentId;
});
},
), context);
} else {
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
Future<void> _getTemporaryStorageOfHidden( item,String hiddenId,int index) async {
try {
@ -540,7 +627,7 @@ class _CheckingInformationOnePageState extends State<CheckingInformationOnePage>
if (result['result'] == 'success') {
pushPage(CheckInformationOneItem(
widget.id,item,result,
widget.id,item,result,widget.type,
onClose: (String departmentId,String yinHuanText) {
setState(() {
// this.yinHuanText=yinHuanText;
@ -621,7 +708,13 @@ class _CheckingInformationOnePageState extends State<CheckingInformationOnePage>
// JSON
String json = _convertDepartmentsToJson(departments);
final result = await ApiService.customCheckRecordFinish(time,text,CHECKRECORD_ID,widget.id,json);
final Map<String, dynamic> result;
if(widget.type==1){
result = await ApiService.customCheckRecordFinishYinHuan(time,text,CHECKRECORD_ID,widget.id,json);
}else{
result = await ApiService.customCheckRecordFinish(time,text,CHECKRECORD_ID,widget.id,json);
}
// final result = await ApiService.customCheckRecordFinish(time,text,CHECKRECORD_ID,widget.id,json);
if (result['result'] == 'success') {
setState(() {

View File

@ -208,7 +208,8 @@ class _HomeDangerPageState extends State<HomeDangerPage>
actions: [
TextButton(
onPressed: () {
pushPage(ScanPage(), context);
// pushPage(ScanPage(), context);
_goScan();
},
child: Text(
"清单扫描",
@ -378,6 +379,37 @@ class _HomeDangerPageState extends State<HomeDangerPage>
),
);
}
Future<void> _goScan() async {
final result = await Navigator.push(
context,
MaterialPageRoute(builder: (_) => ScanPage()),
);
dynamic item;
for(int i=0;i<listDates.length;i++){
final listItem= listDates[i];
String code="";
switch(_selectedTab){
case 0://
code= listItem["LISTMANAGER_ID"];
break;
case 1://
code= listItem["CUSTOM_ID"];
break;
}
if(code==result){
item=listItem;
}
}
_handleItemTap(item,0);
}
}
//

View File

@ -48,22 +48,23 @@ class _ScanPageState extends State<ScanPage> {
}
void _showResult(String code) {
showDialog(
context: context,
builder: (_) => AlertDialog(
title: const Text('扫描结果'),
content: Text(code),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
_controller.start(); //
},
child: const Text('确定'),
),
],
),
);
Navigator.of(context).pop(code);
// showDialog(
// context: context,
// builder: (_) => AlertDialog(
// title: const Text('扫描结果'),
// content: Text(code),
// actions: [
// TextButton(
// onPressed: () {
// Navigator.of(context).pop(code);
// _controller.start(); //
// },
// child: const Text('确定'),
// ),
// ],
// ),
// );
}
@override

View File

@ -96,11 +96,11 @@ class _DangerPageState extends State<DangerPage>
listTwo.clear();
switch(widget.type ){
case 1://
appBarTitle="隐患排查";
appBarTitle="隐患排查清单";
_getHazardInvestigationList();
break;
case 2://
appBarTitle="标准排查";
appBarTitle="标准排查清单";
_getStandardInvestigationList();
break;
// case 3://-
@ -225,7 +225,9 @@ class _DangerPageState extends State<DangerPage>
actions: [
TextButton(
onPressed: () {
pushPage(ScanPage(), context);
// pushPage(ScanPage(), context);
_goScan();
},
child: Text(
"清单扫描",
@ -395,8 +397,38 @@ class _DangerPageState extends State<DangerPage>
),
);
}
Future<void> _goScan() async {
final result = await Navigator.push(
context,
MaterialPageRoute(builder: (_) => ScanPage()),
);
dynamic item;
for(int i=0;i<listDates.length;i++){
final listItem= listDates[i];
String code="";
switch(widget.type ){
case 1://
code= listItem["LISTMANAGER_ID"];
break;
case 2://
code= listItem["CUSTOM_ID"];
break;
}
if(code==result){
item=listItem;
}
}
_handleItemTap(item,0);
}
}
//
class NotificationItem {
final String title;

View File

@ -12,8 +12,9 @@ import 'package:qhd_prevention/tools/tools.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
class DangerProjectPage extends StatefulWidget {
const DangerProjectPage(this.item, {super.key});
const DangerProjectPage(this.item, this.type, {super.key});
final int type;
final item;
@override
State<DangerProjectPage> createState() => _DangerProjectPageState();
@ -21,7 +22,7 @@ class DangerProjectPage extends StatefulWidget {
class _DangerProjectPageState extends State<DangerProjectPage> {
//
String? _selectedValue;
// String? _selectedValue;
//
final List<Map<String, dynamic>> _options = [
@ -46,7 +47,7 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
];
List<dynamic> listDates = [];
List<dynamic> listDatesTwo = [];
List<dynamic> listDatesSelect = [];
String unqualifiedInspectionItemID="";
Map<String, dynamic> nullResult={};
List<dynamic> upDataItemList=[];
@ -60,19 +61,84 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
SessionService.instance.setUnqualifiedInspectionItemIDJson("");
_getData();
if(listDatesSelect.isNotEmpty){
}
}
void _getData(){
listDates.clear();
switch(widget.type ){
case 1://
_getInvestigationItemsYinHuan();
break;
case 2://
_getInvestigationItems();
break;
}
}
Future<void> _getInvestigationItemsYinHuan( ) async {
try {
final result = await ApiService.getInvestigationItemsYinHuan(widget.item);
if (result['result'] == 'success') {
final List<dynamic> newList = result['varList'] ?? [];
final List<dynamic> newListTwo = result['records'] ?? [];
setState(() {
if(newListTwo.isNotEmpty){
if( newListTwo[0]["LISTCHECKITEM_ID"]==listDates[0]["LISTCHECKITEM_ID"]){
listDatesSelect.addAll(newListTwo);
}
}
listDates.addAll(newList);
// listDatesTwo.addAll(newListTwo);
for(int i=0;i<listDates.length;i++){
(listDates[i] as Map<String, dynamic>)["ids"] ="";
}
});
}else{
ToastUtil.showNormal(context, result['msg']);
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
Future<void> _getInvestigationItems( ) async {
try {
listDates.clear();
final result = await ApiService.getInvestigationItems(widget.item);
if (result['result'] == 'success') {
final List<dynamic> newList = result['varList'] ?? [];
// final List<dynamic> newListTwo = result['records'] ?? [];
final List<dynamic> newListTwo = result['records'] ?? [];
setState(() {
if(newListTwo.isNotEmpty){
if( newListTwo[0]["CUSTOM_ID"]==listDates[0]["CUSTOM_ID"]){
listDatesSelect.addAll(newListTwo);
}
}
listDates.addAll(newList);
// listDatesTwo.addAll(newListTwo);
for(int i=0;i<listDates.length;i++){
(listDates[i] as Map<String, dynamic>)["ids"] ="";
}
});
}else{
@ -114,7 +180,7 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
margin: const EdgeInsets.only(bottom: 20),
height: 50,
decoration: BoxDecoration(
color: _selectedValue != null ? Colors.green : Colors.grey,
color: Colors.green ,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
@ -166,6 +232,15 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if(widget.type==1)
Text(
"存在风险:${item["RISK_DESCR"]}",
style: TextStyle(
fontSize: 16,
color: Colors.grey[700],
height: 1.5,
),
),
//
Text(
"检查内容:${item["CHECK_CONTENT"]}",
@ -175,6 +250,7 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
height: 1.5,
),
),
if(widget.type==2)
Text(
"检查标准:${item["CHECK_STANDARD"]}",
style: TextStyle(
@ -198,9 +274,9 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
screenWidth: screenWidth,
item: item,
onImageTap: () {
if(_selectedValue=="option1") {
if(item["REFERENCE_BASIS"]=="option1") {
_getAlreadyUpImages(item);
}else if(_selectedValue=="option2") {
}else if(item["REFERENCE_BASIS"]=="option2") {
_goUnqualifiedPage(item);
}
},
@ -208,7 +284,7 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
}).toList(),
),
if(_selectedValue=="option1")
if(item["REFERENCE_BASIS"]=="option1"&& widget.type==2)
Card(
color: const Color(0xFFF1F1F1),
child: Container(
@ -246,6 +322,7 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
),
);
}
pushPage(DangerImageUpdataPage(item["RECORDITEM_ID"], imgList: imgList), context);
} else {
@ -269,7 +346,7 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
required dynamic item,
VoidCallback? onImageTap,
}) {
final isSelected = _selectedValue == value;
final isSelected = item["REFERENCE_BASIS"] == value;
final buttonWidth = (screenWidth - 60) / 3 - 10; //
return GestureDetector(
@ -277,7 +354,7 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
setState(() {
if(value!="option2") {
SessionService.instance.setUnqualifiedInspectionItemIDJson("");
_selectedValue = value;
// _selectedValue = value;
item["REFERENCE_BASIS"]=value;
}else{
_goUnqualifiedPage(item);
@ -305,8 +382,8 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
),
),
],),
if((value=="option1"&&_selectedValue=="option1")||
(value=="option2"&&_selectedValue=="option2"&&unqualifiedInspectionItemID.isNotEmpty))
if((value=="option1"&&item["REFERENCE_BASIS"]=="option1")||
(value=="option2"&&item["REFERENCE_BASIS"]=="option2"&&item["ids"].isNotEmpty))
//
GestureDetector(
onTap: () {
@ -333,18 +410,29 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
void _goUnqualifiedPage(item) {
String hiddenId=SessionService.instance.unqualifiedInspectionItemID.toString();
// String hiddenId=SessionService.instance.unqualifiedInspectionItemID.toString();
String hiddenId=item["ids"];
if(hiddenId.isNotEmpty) {
switch(widget.type ){
case 1://
_getTemporaryStorageOfHiddenYinHuan(item,hiddenId);
break;
case 2://
_getTemporaryStorageOfHidden(item,hiddenId);
break;
}
}else{
pushPage(HazardRegistrationPage(
item,nullResult,
item,nullResult,widget.type,
onClose: (String departmentId,String yinHuanText) {
setState(() {
this.yinHuanText=yinHuanText;
item["REFERENCE_BASIS"]="option2";
_selectedValue="option2";
unqualifiedInspectionItemID=departmentId;
// _selectedValue="option2";
// unqualifiedInspectionItemID=departmentId;
item["ids"]=departmentId;
});
},
@ -352,6 +440,53 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
}
}
Future<void> _getTemporaryStorageOfHiddenYinHuan(Map item,String hiddenId) async {
try {
final result = await ApiService.getTemporaryStorageOfHiddenYinHuan(hiddenId);
if (result['result'] == 'success') {
try{
dynamic pd=result["pd"];
if(pd["HIDDEN_CATEGORY"]!=null){
if(pd["HIDDEN_CATEGORY"]=='aa0b9abb642146588bc71a12272942db'){
result["pd"]["HIDDEN_CATEGORY_NAME"]= "技术负责人登记隐患";
}else if(pd["HIDDEN_CATEGORY"]=='355ff0ead356428fa83a01330cfe10c6'){
result["pd"]["HIDDEN_CATEGORY_NAME"]= "主要负责人登记隐患";
}else if(pd["HIDDEN_CATEGORY"]=='a92911891ea847cc8f4cfac2455170bd'){
result["pd"]["HIDDEN_CATEGORY_NAME"]= "其他隐患";
}else if(pd["HIDDEN_CATEGORY"]=='44f8ce46372d4616a654cd07f1ec9a48'){
result["pd"]["HIDDEN_CATEGORY_NAME"]= "操作负责人登记隐患";
}
}
}catch(e){
print('数据获取失败:$e');
}
pushPage(HazardRegistrationPage(
item,result,widget.type,
onClose: (String departmentId,String yinHuanText) {
setState(() {
this.yinHuanText=yinHuanText;
item["REFERENCE_BASIS"]="option2";
// _selectedValue="option2";
// unqualifiedInspectionItemID=departmentId;
item["ids"]=departmentId;
});
},
), context);
} else {
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
Future<void> _getTemporaryStorageOfHidden(Map item,String hiddenId) async {
try {
@ -359,13 +494,14 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
if (result['result'] == 'success') {
pushPage(HazardRegistrationPage(
item,result,
item,result,widget.type,
onClose: (String departmentId,String yinHuanText) {
setState(() {
this.yinHuanText=yinHuanText;
item["REFERENCE_BASIS"]="option2";
_selectedValue="option2";
unqualifiedInspectionItemID=departmentId;
// _selectedValue="option2";
// unqualifiedInspectionItemID=departmentId;
item["ids"]=departmentId;
});
},
@ -399,7 +535,7 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
void _submit() {
if (_selectedValue == null) return;
// if (_selectedValue == null) return;
LoadingDialogHelper.show(context);
_submitInvestigationItems();
//
@ -414,14 +550,17 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
String longitude=position.longitude.toString();
String latitude=position.latitude.toString();
upDataItemList.clear();
bool hasNoSelectItem=false;
String ids="";
for(int i=0;i<listDates.length;i++){
final item=listDates[i];
// final itemTwo=listDatesTwo[i];
if(item["REFERENCE_BASIS"]=="option1"){
upDataItemList.add( {
"CUSTOM_ITEM_ID": item["CUSTOM_ITEM_ID"],
"LISTCHECKITEM_ID": item["LISTCHECKITEM_ID"],
"RECORDITEM_ID": item["RECORDITEM_ID"],
"ISNORMAL": "0",
"CHECK_RESULT": item["CHECK_QUALIFIED"],
@ -429,6 +568,8 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
}else if(item["REFERENCE_BASIS"]=="option2"){
upDataItemList.add( {
"CUSTOM_ITEM_ID": item["CUSTOM_ITEM_ID"],
"LISTCHECKITEM_ID": item["LISTCHECKITEM_ID"],
"RECORDITEM_ID": item["RECORDITEM_ID"],
"ISNORMAL": "1",
"CHECK_RESULT":yinHuanText.isNotEmpty?yinHuanText:item["CHECK_QUALIFIED"],
@ -438,6 +579,8 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
}else if(item["REFERENCE_BASIS"]=="option3"){
upDataItemList.add( {
"CUSTOM_ITEM_ID": item["CUSTOM_ITEM_ID"],
"LISTCHECKITEM_ID": item["LISTCHECKITEM_ID"],
"RECORDITEM_ID": item["RECORDITEM_ID"],
"ISNORMAL": "2",
"CHECK_RESULT":"",
@ -447,6 +590,15 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
hasNoSelectItem=true;
}
if(item["ids"].toString().isNotEmpty) {
if (ids.isEmpty) {
ids = item["ids"];
} else {
ids = "$ids," + item["ids"];
}
}
}
if(hasNoSelectItem){
@ -455,11 +607,19 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
return;
}
String itemsString= jsonEncode(upDataItemList);
String CHECKRECORD_ID= widget.item["CHECKRECORD_ID"] ?? "";
try {
final result = await ApiService.submitInvestigationItems(widget.item,longitude,latitude,itemsString,"","");
if (result['result'] == 'success') {
final Map<String, dynamic> result;
if(widget.type==1){
result = await ApiService.submitInvestigationItemsYinHuan(
widget.item,longitude,latitude,itemsString,ids,CHECKRECORD_ID);
}else{
result = await ApiService.submitInvestigationItems(
widget.item,longitude,latitude,itemsString,ids,CHECKRECORD_ID);
}
if (result['result'] == 'success') {
setState(() {
ToastUtil.showNormal(context, "提交成功");
Navigator.pop(context);

View File

@ -65,6 +65,36 @@ class _riskListPageState extends State<RiskListPage> {
setState(() {
listDates.addAll(newList);
try{
checkrecordId=result['CHECKRECORD_ID'];
checkMap.addAll(result['checkmap'] ?? []);
if(checkMap.isNotEmpty){
for(int i=0;i<listDates.length;i++){
try{
(listDates[i] as Map<String, dynamic>)["LISTMANAGER_ID"] =widget.id;
if(checkMap[listDates[i]["IDENTIFICATIONPARTS_ID"]]!=null) {
String num = checkMap[listDates[i]["IDENTIFICATIONPARTS_ID"]].toString();
(listDates[i] as Map<String, dynamic>)["checkmap"] = num;
}else{
(listDates[i] as Map<String, dynamic>)["checkmap"] ="";
}
}catch(e){
(listDates[i] as Map<String, dynamic>)["LISTMANAGER_ID"] =widget.id;
print('加载数据失败:$e');
(listDates[i] as Map<String, dynamic>)["checkmap"] ="";
}
}
}
}catch(e){
for(int i=0;i<listDates.length;i++) {
(listDates[i] as Map<String, dynamic>)["LISTMANAGER_ID"] =widget.id;
(listDates[i] as Map<String, dynamic>)["checkmap"] = "";
}
print('没有这些数据:$e');
}
});
}else{
@ -93,8 +123,14 @@ class _riskListPageState extends State<RiskListPage> {
if(checkMap.isNotEmpty){
for(int i=0;i<listDates.length;i++){
try{
String num= checkMap[listDates[i]["CHECK_ITEM"]].toString();
(listDates[i] as Map<String, dynamic>)["checkmap"] =num;
// String num= checkMap[listDates[i]["CHECK_ITEM"]].toString();
// (listDates[i] as Map<String, dynamic>)["checkmap"] =num;
if(checkMap[listDates[i]["CHECK_ITEM"]]!=null) {
String num = checkMap[listDates[i]["CHECK_ITEM"]].toString();
(listDates[i] as Map<String, dynamic>)["checkmap"] = num;
}else{
(listDates[i] as Map<String, dynamic>)["checkmap"] ="";
}
}catch(e){
print('加载数据失败:$e');
@ -132,17 +168,17 @@ class _riskListPageState extends State<RiskListPage> {
backgroundColor: h_backGroundColor(),
appBar: MyAppbar(
title: widget.type==1?"风险点(单元)列表":"检查项目列表",
actions: [
TextButton(
onPressed: () {
pushPage(ScanPage(), context);
},
child: Text(
"扫描",
style: TextStyle(color: Colors.white, fontSize: 16),
),
),
],
// actions: [
// TextButton(
// onPressed: () {
// pushPage(ScanPage(), context);
// },
// child: Text(
// "扫描",
// style: TextStyle(color: Colors.white, fontSize: 16),
// ),
// ),
// ],
),
body: SafeArea(
child: Column(
@ -191,7 +227,7 @@ class _riskListPageState extends State<RiskListPage> {
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Image.asset(item["checkmap"].toString().isEmpty?"assets/images/zt-ing.png":"assets/images/zt-over.png", width: 70, height: 70,),
Image.asset(item["checkmap"].toString().isEmpty?"assets/images/zt-ing.png":"assets/images/zt-over.png", width: 50, height: 50,),
const SizedBox(width: 10), //
Column(
children: [
@ -201,7 +237,7 @@ class _riskListPageState extends State<RiskListPage> {
Text(
_getTitle(item),
// item.title,
style: const TextStyle(fontSize: 16),
style: const TextStyle(fontSize: 13),
maxLines: 2, //
overflow: TextOverflow.ellipsis,
),
@ -220,7 +256,7 @@ 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"]}";
return "${item["DEPT_NAME"]}--${item["RISKUNITNAME"]}--${item["PARTSNAME"]}${_dianZiString(item)}";
}else{
return item["DICTIONARY_NAMES"];
}
@ -231,13 +267,22 @@ class _riskListPageState extends State<RiskListPage> {
Future<void> _selectItem(final item) async {
switch(widget.type ){
case 1://
if(item["ELECTRONIC_FENCE_ID"]!=null){
_isInElectronicFence(item);
}else{
final result = await Navigator.push(
context,
MaterialPageRoute(builder: (_) => DangerProjectPage(item,widget.type )),
);
_getData();
}
break;
case 2://
// pushPage(DangerProjectPage(item), context);
final result = await Navigator.push(
context,
MaterialPageRoute(builder: (_) => DangerProjectPage(item)),
MaterialPageRoute(builder: (_) => DangerProjectPage(item,widget.type )),
);
_getData();
break;
@ -267,12 +312,24 @@ class _riskListPageState extends State<RiskListPage> {
}
}
String _dianZiString(item) {
try{
if(item["ELECTRONIC_FENCE_NAME"]==null){
return "";
}else{
return "\n所属电子围栏:${item["ELECTRONIC_FENCE_NAME"]}";
}
}catch(e){
return "";
}
}
void _nextHandle() {
bool canGo=true;
for(int i=0;i<listDates.length;i++){
try{
int num= listDates[i]["checkmap"];
if(1!=num){
String num= listDates[i]["checkmap"];
if(num.isEmpty){
canGo=false;
}
}catch(e){
@ -284,7 +341,7 @@ class _riskListPageState extends State<RiskListPage> {
ToastUtil.showNormal(context, "清单为全部检查,无法提交");
return;
}
pushPage(CheckingInformationOnePage(widget.id,checkrecordId), context);
pushPage(CheckingInformationOnePage(widget.id,checkrecordId,widget.type), context);
}

File diff suppressed because it is too large Load Diff