2025.8.8 排查项提交后。数据再返回显示逻辑完成,提交都添加了loading

main
xufei 2025-08-08 16:18:07 +08:00
parent 698ccad423
commit 04fb1fc0a3
8 changed files with 338 additions and 279 deletions

View File

@ -2265,7 +2265,7 @@ U6Hzm1ninpWeE+awIDAQAB
static Future<Map<String, dynamic>> getTemporaryStorageOfHiddenYinHuan(String id) {
return HttpManager().request(
basePath,
'/app/customHidden/goEdit',
'/app/hidden/goEdit',
method: Method.post,
data: {
"HIDDEN_ID": id,
@ -2322,5 +2322,20 @@ U6Hzm1ninpWeE+awIDAQAB
}
///
static Future<Map<String, dynamic>> getSafetyMeetingList(int page,int selectedTab) {
return HttpManager().request(
basePath,
'/app/safetyMeeting/list?selectType=$selectedTab &showCount=10&currentPage=$page',
method: Method.post,
data: {
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
}

View File

@ -664,11 +664,12 @@ class _CheckInformationOneItemState extends State<CheckInformationOneItem> {
_addImgFiles(_zhengGaiImages[i],"4",hiddenId);
}
}
LoadingDialogHelper.hide();
setState(() {
ToastUtil.showNormal(context, "提交成功");
Navigator.pop(context);
widget.onClose(hiddenId,_standardController.text.trim());
LoadingDialogHelper.hide();
});
}
} catch (e) {

View File

@ -693,11 +693,13 @@ class _CheckingInformationOnePageState extends State<CheckingInformationOnePage>
if(!departmentsAllInput){
LoadingDialogHelper.hide();
ToastUtil.showNormal(context, "请添加验收部门负责人");
return;
}
if(departmentsSameMan){
LoadingDialogHelper.hide();
ToastUtil.showNormal(context, "不能选择重复的验收部门负责人");
return;
}
@ -720,6 +722,7 @@ class _CheckingInformationOnePageState extends State<CheckingInformationOnePage>
if (result['result'] == 'success') {
setState(() {
LoadingDialogHelper.hide();
Navigator.pop(context);
Navigator.pop(context);
});

View File

@ -585,6 +585,7 @@ class _HiddenDangerAcceptancePageState extends State<HiddenDangerAcceptancePage>
}
setState(() {
LoadingDialogHelper.hide();
ToastUtil.showNormal(context, "提交成功");
Navigator.of(context).pop();
widget.onClose('关闭详情'); //

View File

@ -564,10 +564,8 @@ class _PendingRectificationDetailPageState extends State<PendingRectificationDet
}
}
setState(() {
LoadingDialogHelper.show();
});
LoadingDialogHelper.show();
List<DepartmentEntry> departments = dannerRepairKey.currentState!.departments;
bool departmentsAllInput=true;
bool departmentsSameMan=false;
@ -585,17 +583,13 @@ class _PendingRectificationDetailPageState extends State<PendingRectificationDet
if(!departmentsAllInput){
setState(() {
LoadingDialogHelper.hide();
});
ToastUtil.showNormal(context, "请添加验收部门负责人");
return;
}
if(departmentsSameMan){
setState(() {
LoadingDialogHelper.hide();
});
ToastUtil.showNormal(context, "不能选择重复的验收部门负责人");
return;
}
@ -629,6 +623,7 @@ class _PendingRectificationDetailPageState extends State<PendingRectificationDet
workTime, time, work, other, json);
if (result['result'] == 'success') {
setState(() {
LoadingDialogHelper.hide();
ToastUtil.showNormal(context, "提交成功");
Navigator.of(context).pop();
widget.onClose('关闭详情'); //
@ -651,7 +646,7 @@ class _PendingRectificationDetailPageState extends State<PendingRectificationDet
final result = await ApiService.rectificationSubmission(pd["HIDDEN_ID"],buMenId,renYuanId);
if (result['result'] == 'success') {
setState(() {
LoadingDialogHelper.hide();
ToastUtil.showNormal(context, "提交成功");
Navigator.of(context).pop();
widget.onClose('关闭详情'); //

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:qhd_prevention/customWidget/search_bar_widget.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'dart:convert';
import 'dart:math' as math;
@ -21,21 +22,18 @@ class _SafetyMeetingListPageState extends State<SafetyMeetingListPage>
with SingleTickerProviderStateMixin{
final TextEditingController searchController = TextEditingController();
late List<dynamic> _list = [];
late TabController _tabController= TabController(length: 2, vsync: this);
int _selectedTab = 0;
int pageNum = 1;
//
final List<Map<String, dynamic>> _notifications = List.generate(10, (i) {
bool read = i % 3 == 0;
return {
'title': '测试数据标题标题 ${i + 1}',
'time': '2025-06-${10 + i} 12:3${i}',
'read': read,
};
});
int _page = 1;
String searchKey="";
int _totalPage=1;
late List<dynamic> _list = [];
bool _isLoading = false;
bool _hasMore = true;
@override
void initState() {
@ -54,53 +52,60 @@ class _SafetyMeetingListPageState extends State<SafetyMeetingListPage>
});
_getNotifList("");
_getSafetyMeetingList(false);
}
void reRefreshData(){
pageNum=1;
_page=1;
_list.clear();
searchController.text="";
if(0==_selectedTab){
_getNotifList("");
_getSafetyMeetingList(false);
}
Future<void> _getSafetyMeetingList(bool loadMore) async {
// LoadingDialogHelper.show();
try {
if (_isLoading) return;
_isLoading = true;
final result = await ApiService.getSafetyMeetingList(_page,_selectedTab );
if (result['result'] == 'success') {
_totalPage =result["page"]['totalPage'] ?? 1;
final List<dynamic> newList = result['varList'] ?? [];
// setState(() {
// _list.addAll(newList);
// });
setState(() {
if (loadMore) {
_list.addAll(newList);
} else {
_getNotifEnterprise("");
_list = newList;
}
_hasMore = _page < _totalPage;
// if (_hasMore) _page++;
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
} finally {
// if (!loadMore) LoadingDialogHelper.hide();
_isLoading = false;
}
}
Future<void> _getNotifList(String keyWord) async {
// LoadingDialogHelper.show();
try {
final result = await ApiService.getNotifList("-1", pageNum.toString(),keyWord);
if (result['result'] == 'success') {
final List<dynamic> newList = result['varList'] ?? [];
setState(() {
_list.addAll(newList);
});
}
} catch (e) {
print('加载出错: $e');
} finally {
LoadingDialogHelper.hide();
}
}
Future<void> _getNotifEnterprise(String keyWord) async {
// LoadingDialogHelper.show();
try {
final result = await ApiService.getNotifEnterprise("-1", pageNum.toString(),keyWord);
if (result['result'] == 'success') {
final List<dynamic> newList = result['varList'] ?? [];
setState(() {
_list.addAll(newList);
});
}
} catch (e) {
print('加载出错: $e');
} finally {
LoadingDialogHelper.hide();
}
}
Future<void> _deleteNotif(String id) async {
// LoadingDialogHelper.show();
@ -156,7 +161,9 @@ class _SafetyMeetingListPageState extends State<SafetyMeetingListPage>
// Search bar
// List
Expanded(
NotificationListener<ScrollNotification>(
onNotification: _onScroll,
child: Expanded(
child:
_list.isEmpty
? NoDataWidget.show()
@ -167,6 +174,8 @@ class _SafetyMeetingListPageState extends State<SafetyMeetingListPage>
},
),
),
),
],
),
),
@ -272,6 +281,19 @@ class _SafetyMeetingListPageState extends State<SafetyMeetingListPage>
],
);
}
bool _onScroll(ScrollNotification n) {
if (n.metrics.pixels > n.metrics.maxScrollExtent - 100 &&
_hasMore && !_isLoading) {
_page++;
_getSafetyMeetingList(true);
}
return false;
}
}

View File

@ -63,9 +63,7 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
_getData();
if(listDatesSelect.isNotEmpty){
}
}
@ -90,19 +88,24 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
final List<dynamic> newList = result['varList'] ?? [];
final List<dynamic> newListTwo = result['records'] ?? [];
setState(() {
listDates.addAll(newList);
if(newListTwo.isNotEmpty&&newListTwo[0]["LISTCHECKITEM_ID"]!=null){
if( newListTwo[0]["LISTCHECKITEM_ID"]==listDates[0]["LISTCHECKITEM_ID"]){
if(newListTwo.isNotEmpty){
listDatesSelect.addAll(newListTwo);
}
}
// listDatesTwo.addAll(newListTwo);option1
for(int i=0;i<listDates.length;i++){
for(int m=0;m<listDatesSelect.length;m++){
if(newListTwo.isNotEmpty&&newListTwo[m]["LISTCHECKITEM_ID"]!=null){
if( newListTwo[m]["LISTCHECKITEM_ID"]==listDates[i]["LISTCHECKITEM_ID"]){
if(listDatesSelect.isNotEmpty){
switch(listDatesSelect[i]["ISNORMAL"] ){
switch(listDatesSelect[m]["ISNORMAL"] ){
case 0:
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "option1";
break;
@ -113,12 +116,21 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "option3";
break;
}
(listDates[i] as Map<String, dynamic>)["ids"] = listDatesSelect[i]["HIDDEN_ID"];
SessionService.instance.setUnqualifiedInspectionItemIDJson(listDatesSelect[i]["HIDDEN_ID"]);
}else {
(listDates[i] as Map<String, dynamic>)["ids"] = "";
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "";
}
if(listDatesSelect[m].containsKey("HIDDEN_ID")){
(listDates[i] as Map<String, dynamic>)["ids"] = listDatesSelect[m]["HIDDEN_ID"];
SessionService.instance.setUnqualifiedInspectionItemIDJson(listDatesSelect[m]["HIDDEN_ID"]);
}else{
(listDates[i] as Map<String, dynamic>)["ids"] = "";
}
}
}
}
}
@ -145,17 +157,18 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
setState(() {
listDates.addAll(newList);
if(newListTwo.isNotEmpty&&newListTwo[0]["CUSTOM_ID"]!=null){
if( newListTwo[0]["CUSTOM_ID"]==listDates[0]["CUSTOM_ID"]){
if(newListTwo.isNotEmpty){
listDatesSelect.addAll(newListTwo);
}
}
// listDatesTwo.addAll(newListTwo);
for(int i=0;i<listDates.length;i++){
for(int m=0;m<listDatesSelect.length;m++){
if(newListTwo.isNotEmpty&&newListTwo[m]["CUSTOM_ITEM_ID"]!=null){
if( newListTwo[m]["CUSTOM_ITEM_ID"]==listDates[i]["CUSTOM_ITEM_ID"]){
if(listDatesSelect.isNotEmpty){
switch(listDatesSelect[i]["ISNORMAL"] ){
switch(listDatesSelect[m]["ISNORMAL"] ){
case 0:
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "option1";
break;
@ -165,16 +178,24 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
case 2:
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "option3";
break;
}
(listDates[i] as Map<String, dynamic>)["ids"] = listDatesSelect[i]["HIDDEN_ID"];
SessionService.instance.setUnqualifiedInspectionItemIDJson(listDatesSelect[i]["HIDDEN_ID"]);
}else {
(listDates[i] as Map<String, dynamic>)["ids"] = "";
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "";
}
if(listDatesSelect[m].containsKey("HIDDEN_ID")){
(listDates[i] as Map<String, dynamic>)["ids"] = listDatesSelect[m]["HIDDEN_ID"];
SessionService.instance.setUnqualifiedInspectionItemIDJson(listDatesSelect[m]["HIDDEN_ID"]);
}else{
(listDates[i] as Map<String, dynamic>)["ids"] = "";
}
}
}
}
}
});
@ -420,10 +441,11 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
),
],),
if((value=="option1"&&item["REFERENCE_BASIS"]=="option1")||
(value=="option2"&&item["REFERENCE_BASIS"]=="option2"&&item["ids"].isNotEmpty))
(value=="option2"&&item["REFERENCE_BASIS"]=="option2"&&item.containsKey("ids")&&item["ids"].toString().isNotEmpty))
//
GestureDetector(
onTap: () {
// GestureDetector
if (onImageTap != null) {
onImageTap();

File diff suppressed because it is too large Load Diff