2026.4.16 重点作业

master^2
xufei 2026-04-16 16:58:53 +08:00
parent 9376cb6acd
commit fb4df426ba
8 changed files with 2155 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

View File

@ -396,6 +396,9 @@ enum UploadFileType {
/// - : '173', : 'key_projects_hidden_dangers_video' /// - : '173', : 'key_projects_hidden_dangers_video'
keyProjectsHiddenDangersVideo('173', 'key_projects_hidden_dangers_video'), keyProjectsHiddenDangersVideo('173', 'key_projects_hidden_dangers_video'),
/// - : '174', : 'key_homework_rectification_pictures'
keyHomeworkRectificationPictures('174', 'key_homework_rectification_pictures'),
/// - : '175', : 'key_homework_signature_inspector' /// - : '175', : 'key_homework_signature_inspector'
keyHomeworkSignatureInspector('175', 'key_homework_signature_inspector'), keyHomeworkSignatureInspector('175', 'key_homework_signature_inspector'),

View File

@ -924,6 +924,7 @@ class ItemListWidget {
double fontSize = 14, // double fontSize = 14, //
Color btnColor = Colors.blue, Color btnColor = Colors.blue,
bool isRequired = false, bool isRequired = false,
bool isShowPoint = true,
}) { }) {
return Container( return Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@ -935,6 +936,7 @@ class ItemListWidget {
children: [ children: [
Row( Row(
children: [ children: [
if(isShowPoint)
Text("* ", style: TextStyle(color: Colors.red)), Text("* ", style: TextStyle(color: Colors.red)),
Text( Text(
label, label,

View File

@ -94,5 +94,43 @@ class KeyTasksApi {
} }
///
static Future<Map<String, dynamic>> setKeyTasksHiddenDangerList(Map data) {
return HttpManager().request(
'${ApiService.basePath}/keyProject',
'/hidden/list',
method: Method.post,
data: {
...data
},
);
}
///
static Future<Map<String, dynamic>> getKeyTasksHiddenDangerDetail(String id) {
return HttpManager().request(
'${ApiService.basePath}/keyProject',
'/hidden/$id',
method: Method.get,
data: {
// ...data
},
);
}
///
static Future<Map<String, dynamic>> setHiddenDangerRectification(Map data) {
return HttpManager().request(
'${ApiService.basePath}/keyProject',
'/hiddenRectificationRecord/rectification',
method: Method.post,
data: {
...data
},
);
}
} }

View File

@ -0,0 +1,596 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:qhd_prevention/CustomWidget/range_filter_bar.dart';
import 'package:qhd_prevention/customWidget/custom_button.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/http/modules/key_tasks_api.dart';
import 'package:qhd_prevention/pages/home/keyTasks/keyTasksDetail/keyTasksHiddenDanger/key_tasks_hidden_danger_detail.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
import 'package:qhd_prevention/tools/h_colors.dart';
import 'package:qhd_prevention/tools/tools.dart';
import 'dart:async';
class KeyTasksHiddenDangerList extends StatefulWidget {
const KeyTasksHiddenDangerList( this.appItem, {super.key});
final int appItem;// 1 2
@override
State<KeyTasksHiddenDangerList> createState() => _KeyTasksHiddenDangerListState();
}
class _KeyTasksHiddenDangerListState extends State<KeyTasksHiddenDangerList> {
int _page = 1;
String searchKey = "";
int _totalPage = 1;
late List<dynamic> _list = [];
bool _isLoading = false;
bool _hasMore = true;
Timer? _debounceTimer;
String buttonTextOne = '查看';
String buttonTextTwo = '确认';
String title = "隐患记录";
final TextEditingController _searchController = TextEditingController();
bool isJGD = false;
@override
void initState() {
super.initState();
//
_searchController.addListener(_onSearchChanged);
switch (widget.appItem) {
case 1:
buttonTextTwo = '整改';
title = "隐患整改";
keyTasksHiddenDangerListData['stateList']=[1];
break;
case 2:
buttonTextTwo = '查看';
title = "隐患记录";
keyTasksHiddenDangerListData['stateList']=[1,2,3,4];
break;
}
_getListData(false);
}
@override
void dispose() {
_debounceTimer?.cancel();
_searchController.removeListener(_onSearchChanged);
_searchController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
//
final double screenWidth = MediaQuery.of(context).size.width;
return Scaffold(
appBar: MyAppbar(title:title),
body: SafeArea(
child: NotificationListener<ScrollNotification>(
onNotification: _onScroll,
child: _vcDetailWidget(),
),
),
backgroundColor: Colors.white,
);
}
Widget _vcDetailWidget() {
return Column(
children: [
if(widget.appItem==1)
Padding(
padding: EdgeInsets.all(10),
child: SearchBarWidget(
controller: _searchController,
isShowSearchButton: true,
showResetButton:true,
hintText: '请输入隐患描述',
onTextChanged: (value) {},
onSearch: (keyboard) {
_performSearch(_searchController.text);
},
),
),
if(widget.appItem==2)
RangeFilterBar(
initial: RangeOption.none,
onRangeChanged: (range) {
String searchData='';
switch (range) {
case RangeOption.oneWeek:
final data = DateTime.now().subtract(
const Duration(days: 7),
);
final time = DateFormat('yyyy-MM-dd').format(data);
searchData = time;
break;
case RangeOption.oneMonth:
final data = DateTime.now().subtract(
const Duration(days: 30),
);
final time = DateFormat('yyyy-MM-dd').format(data);
searchData = time;
break;
case RangeOption.threeMonths:
final data = DateTime.now().subtract(
const Duration(days: 90),
);
final time = DateFormat('yyyy-MM-dd').format(data);
searchData = time;
case RangeOption.none:
break;
case RangeOption.oneDay:
break;
}
_performSearch(searchData);
},
onFilterPressed: () async {
//
String searchData='';
// searchData = await pushPage(
// SafecheckListfilterPage(
// searchData: searchData,
// mode: widget.mode,
// ),
// context,
// );
_performSearch(searchData);
},
),
Container(height: 5, color: h_backGroundColor()),
Expanded(
child:
_list.isEmpty
? NoDataWidget.show()
: ListView.builder(
itemCount: _list.length,
itemBuilder: (context, index) {
final item = _list[index];
return _fxitemCell(item);
},
),
),
],
);
}
Widget _fxitemCell(pageData) {
// 使GestureDetector
return GestureDetector(
onTap: () {},
child: Container(
margin: EdgeInsets.all(6),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.3),
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 3),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, //
children: [
Expanded(
child: Padding(
padding: EdgeInsets.only(left: 10, top: 15, right: 8),
child: Text(
'隐患描述: ${pageData['hiddenDesc'] ?? ''}',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
maxLines: 1, //
overflow: TextOverflow.ellipsis, //
),
),
),
//
Container(
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: _getLevelColor(pageData),
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(12),
topRight: Radius.circular(12), //
),
),
child: Text(
pageData['hiddenLevelName'] ?? '',
style: TextStyle(
color: Colors.white,
fontSize: 12,
fontWeight: FontWeight.bold,
),
),
),
],
),
SizedBox(height: 16),
Padding(
padding: EdgeInsets.only(left: 10, right: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//
Expanded(
child: Text(
_getSourceDangers(pageData),
style: TextStyle(fontSize: 14, color: Colors.black87),
),
),
//
// Expanded(
// child: Text(
// '隐患状态: ${_getState(pageData)}',
// style: TextStyle(fontSize: 14, color: Colors.black87),
// ),
// ),
],
),
),
SizedBox(height: 8),
Padding(
padding: EdgeInsets.only(left: 10, right: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//
// Expanded(
// child: Text(
// _getSourceDangers(pageData),
// style: TextStyle(fontSize: 14, color: Colors.black87),
// ),
// ),
//
Expanded(
child: Text(
'隐患状态: ${_getState(pageData)}',
style: TextStyle(fontSize: 14, color: Colors.black87),
),
),
],
),
),
SizedBox(height: 8),
Padding(
padding: EdgeInsets.only(left: 10, right: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// - 使 Expanded
Expanded(
child: Text(
'发现人:${truncateString(pageData['createName'] ?? '')}',
style: TextStyle(fontSize: 14, color: Colors.black87),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
// - 使 Expanded
Expanded(
child: Text(
'发现时间:${_changeTime(pageData['createTime'] ?? '')}',
style: TextStyle(fontSize: 14, color: Colors.black87),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
),
),
],
),
),
if(widget.appItem==2)...[
if (pageData['rectificationUserId'] != null &&
pageData['rectificationUserId'].isNotEmpty)...[
SizedBox(height: 8),
Padding(
padding: EdgeInsets.only(left: 10, right: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//
Expanded(
child: Text(
'整改人:${pageData['rectificationUserName'] ?? ''}',
style: TextStyle(fontSize: 14, color: Colors.black87),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
Expanded(
child: Text(
'整改时间:${_changeTime(pageData['rectificationTime'] ?? '')}',
style: TextStyle(fontSize: 14, color: Colors.black87),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
),
),
],
),
),
],
if (pageData['acceptUserId'] != null &&
pageData['acceptUserId'].isNotEmpty)...[
SizedBox(height: 8),
Padding(
padding: EdgeInsets.only(left: 10, right: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
//
Text(
'验收人: ${pageData['acceptUserName'] ?? ''}',
style: TextStyle(fontSize: 14, color: Colors.black87),
),
Text(
'隐患验收时间: ${_changeTime(pageData['acceptUserTime']??'')}',
style: TextStyle(
fontSize: 14,
color: Colors.black87,
),
),
],
),
),
],
],
SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
//
Expanded(
child: CustomButton(
height: 35,
onPressed: () async {
// print('查看: ${pageData['title']}');
pushPage(
KeyTasksHiddenDangerDetail(
2,
pageData['id'],
pageData['hiddenId'],
pageData['foreignKey'],
false,
),
context,
);
},
backgroundColor: h_backGroundColor(),
textStyle: const TextStyle(color: Colors.black),
buttonStyle: ButtonStyleType.secondary,
text: buttonTextOne,
),
),
if(widget.appItem==1)
SizedBox(width: 10), // 使widthheight
//
if(widget.appItem==1)
Expanded(
child: CustomButton(
height: 35,
onPressed: () async {
pushPage(
KeyTasksHiddenDangerDetail(
1,
pageData['id'],
pageData['hiddenId'],
pageData['foreignKey'],
false,
),
context,
);
},
backgroundColor: h_AppBarColor(),
textStyle: const TextStyle(color: Colors.white),
buttonStyle: ButtonStyleType.primary,
text: buttonTextTwo,
),
),
],
),
SizedBox(height: 10),
],
),
),
);
}
void _performSearch(String keyword) {
//
// if (keyword.isNotEmpty) {
// print('执行搜索: $keyword');
// API
//
_page = 1;
searchKey = keyword;
_getListData(false);
// }
}
bool _onScroll(ScrollNotification n) {
if (n.metrics.pixels > n.metrics.maxScrollExtent - 100 &&
_hasMore &&
!_isLoading) {
_page++;
_getListData(true);
}
return false;
}
void _onSearchChanged() {
final query = _searchController.text.toLowerCase().trim();
setState(() {
print("=====>" + query);
// filtered = query.isEmpty ? original : _filterCategories(original, query);
});
}
Future<void> _getListData(bool loadMore) async {
try {
if (_isLoading) return;
_isLoading = true;
keyTasksHiddenDangerListData['pageIndex']=_page;
keyTasksHiddenDangerListData['hiddenDesc']=searchKey;
LoadingDialogHelper.show();
final Map<String, dynamic> result = await KeyTasksApi.setKeyTasksHiddenDangerList(keyTasksHiddenDangerListData);
LoadingDialogHelper.hide();
if (result['success']) {
_totalPage = result['pageSize'] ?? 1;
final List<dynamic> newList = result['data'] ?? [];
// setState(() {
// _list.addAll(newList);
// });
setState(() {
if (loadMore) {
_list.addAll(newList);
} else {
_list = newList;
}
_hasMore = _page < _totalPage;
// if (_hasMore) _page++;
});
} else {
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
LoadingDialogHelper.hide();
// Toast
print('加载数据失败:$e');
} finally {
// if (!loadMore) LoadingDialogHelper.hide();
_isLoading = false;
}
}
String _getSourceDangers(final item) {
int type = item["source"] ?? 0;
if (1 == type) {
return "隐患来源:安全环保检查(监管端)";
} else if (2 == type) {
return "隐患来源:安全环保检查(企业端)";
} else {
return "隐患来源:";
}
}
//
Color _getLevelColor(final item) {
String type = item["hiddenLevelName"] ?? '';
if ("重大隐患" == type) {
return Colors.red;
} else if ("较大隐患" == type) {
return Color(0xFFFF6A4D);
} else if ("一般隐患" == type) {
return Colors.orange;
} else if ("轻微隐患" == type) {
return h_AppBarColor();
} else {
return Colors.green;
}
}
String _getState(final item) {
//1,,2:,3:,4:
int type = item["state"];
if(1==type){
return "未整改";
}else if(2==type){
return "已整改";
}else if(3==type){
return "已验收";
}else if(4==type){
return "验收打回";
}else{
return "";
}
}
String _changeTime(String time) {
try {
// ISO 8601
DateTime dateTime = DateTime.parse(time);
//
return DateFormat('yyyy-MM-dd').format(dateTime);
} catch (e) {
//
return ' ';
}
}
String truncateString(String input) {
if (input.length > 10) {
return '${input.substring(0, 10)}...';
}
return input;
}
Map<String, dynamic> keyTasksHiddenDangerListData={
"hiddenDesc": "",
"stateList": [],
"pageSize": 20,
"pageIndex": 1
};
}

View File

@ -56,7 +56,7 @@ class _KeyTasksCheckListPageState extends State<KeyTasksCheckListPage> {
super.initState(); super.initState();
title='检查发起'; title='被检查确认';
keyTasksInspectionListData['statusList']=[2]; keyTasksInspectionListData['statusList']=[2];

View File

@ -3,6 +3,7 @@ import 'dart:ffi';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:qhd_prevention/pages/home/doorAndCar/doorCar_tab_page.dart'; import 'package:qhd_prevention/pages/home/doorAndCar/doorCar_tab_page.dart';
import 'package:qhd_prevention/pages/home/keyTasks/keyTasksDetail/keyTasksHiddenDanger/key_tasks_hidden_danger_list.dart';
import 'package:qhd_prevention/pages/home/keyTasks/key_tasks_check_list_page.dart'; import 'package:qhd_prevention/pages/home/keyTasks/key_tasks_check_list_page.dart';
import 'package:qhd_prevention/pages/home/keyTasks/key_tasks_confirm_list_page.dart'; import 'package:qhd_prevention/pages/home/keyTasks/key_tasks_confirm_list_page.dart';
import 'package:qhd_prevention/pages/my_appbar.dart'; import 'package:qhd_prevention/pages/my_appbar.dart';
@ -60,7 +61,7 @@ class _DoorcarTabPageState extends State<KeyTasksTabPage> {
icon: 'assets/images/door_ico9.png', icon: 'assets/images/door_ico9.png',
badge: 0, badge: 0,
onTap: () async { onTap: () async {
// await pushPage(KeyTasksHiddenList(1), context); await pushPage(KeyTasksHiddenDangerList(1), context);
_getDoorCarCount(); _getDoorCarCount();
}, },
), ),
@ -69,7 +70,7 @@ class _DoorcarTabPageState extends State<KeyTasksTabPage> {
icon: 'assets/images/door_ico9.png', icon: 'assets/images/door_ico9.png',
badge: 0, badge: 0,
onTap: () async { onTap: () async {
// await pushPage(KeyTasksHiddenList(2), context); await pushPage(KeyTasksHiddenDangerList(2), context);
_getDoorCarCount(); _getDoorCarCount();
}, },
), ),