2025.7.30 写到检查记录详情

main
xufei 2025-07-30 18:01:25 +08:00
parent 3a00844a57
commit ac79be123b
7 changed files with 1074 additions and 179 deletions

View File

@ -1656,6 +1656,51 @@ U6Hzm1ninpWeE+awIDAQAB
);
}
///
static Future<Map<String, dynamic>> getCheckRecordListOne(String id,String keyword) {
return HttpManager().request(
basePath,
'/app/checkrecord/list',
method: Method.post,
data: {
"LISTMANAGER_ID": id,
"KEYWORDS": keyword,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getCheckRecordList(String id,String keyword) {
return HttpManager().request(
basePath,
'/app/customCheckRecord/list',
method: Method.post,
data: {
"CUSTOM_ID": id,
"KEYWORDS": keyword,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
///
static Future<Map<String, dynamic>> getInspectRecordsDetail(String id) {
return HttpManager().request(
basePath,
'/app/checkrecord/goEdit',
method: Method.post,
data: {
"CHECKRECORD_ID": id,
"CORPINFO_ID": SessionService.instance.corpinfoId,
"USER_ID": SessionService.instance.loginUserId,
},
);
}
}

View File

@ -0,0 +1,441 @@
import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'package:qhd_prevention/http/ApiService.dart';
class CheckRecordDetailPage extends StatefulWidget {
const CheckRecordDetailPage(this.id, {super.key});
final String id;
@override
_CheckRecordDetailPageState createState() => _CheckRecordDetailPageState();
}
class _CheckRecordDetailPageState extends State<CheckRecordDetailPage> {
//
// List<Map<String, dynamic>> varList = [
// {"RISKPOINT_ID": "1", "CHECK_CONTENT": "安全设备检查", "ISNORMAL": "0", "IMGCOUNT": 2, "RECORDITEM_ID": "1001"},
// {"RISKPOINT_ID": "2", "CHECK_CONTENT": "消防设施检查", "ISNORMAL": "1", "HIDDEN_ID": "2001"},
// {"RISKPOINT_ID": "3", "CHECK_CONTENT": "电气线路检查", "ISNORMAL": "2"},
// ];
List<Map<String, dynamic>> otherHiddenList = [
{"HIDDEN_ID": "3001", "HIDDENDESCR": "应急通道堵塞"},
{"HIDDEN_ID": "3002", "HIDDENDESCR": "安全标识缺失"},
];
// 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 Set<Marker> _markers = {};
double _scale = 13.0;
int _currentImageIndex = 0;
bool _showImageViewer = false;
dynamic pd;
List<dynamic> imageList =[];
List<dynamic> varList =[];
@override
void initState() {
super.initState();
//
// _markers.add(Marker(
// markerId: MarkerId("checkpoint"),
// position: _center,
// icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueBlue),
// ));
_getInspectRecordsDetail();
}
Future<void> _getInspectRecordsDetail() async {
try {
final result = await ApiService.getInspectRecordsDetail(widget.id);
if (result['result'] == 'success') {
final List<dynamic> qianmingList = result['qianming'] ?? [];
setState(() {
pd= result['pd'];
varList = result['varList'] ?? [];
for(int i=0;i<qianmingList.length;i++){
imageList.add(qianmingList[i]);
}
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: _buildAppBar(),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildSectionTitle("检查内容"),
_buildCheckContentTable(),
_buildSectionTitle("其他隐患信息"),
_buildOtherHiddenTable(),
// _buildMapSection(),
_buildSectionTitle("清单信息"),
_buildInfoList(),
_buildSignPhotos(),
],
),
),
);
}
AppBar _buildAppBar() {
return AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.white),
onPressed: () => Navigator.pop(context),
),
title: Text("检查记录详情", style: TextStyle(color: Colors.white)),
backgroundColor: Colors.blue,
centerTitle: true,
);
}
Widget _buildSectionTitle(String title) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
child: Row(
children: [
Container(
width: 4,
height: 16,
color: Colors.blue,
margin: EdgeInsets.only(right: 10),
),
Text(
title,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
],
),
);
}
Widget _buildCheckContentTable() {
return Container(
margin: EdgeInsets.symmetric(horizontal: 15),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[300]!),
borderRadius: BorderRadius.circular(4),
),
child: Table(
border: TableBorder.all(color: Colors.grey[300]!),
columnWidths: const {
0: FlexColumnWidth(3),
1: FlexColumnWidth(1),
},
children: [
TableRow(
decoration: BoxDecoration(color: Colors.grey[100]),
children: [
_buildTableHeaderCell("检查内容"),
_buildTableHeaderCell("状态"),
],
),
...varList.map((item) => TableRow(
children: [
Padding(
padding: EdgeInsets.all(8),
child: Text(item["CHECK_CONTENT"]),
),
_buildStatusCell(item)
],
)),
],
),
);
}
Widget _buildStatusCell(Map<String, dynamic> item) {
String status;
Color color = Colors.black;
VoidCallback? onTap;
switch (item["ISNORMAL"]) {
case "0":
status = "合格";
color = Colors.blue;
if (item["IMGCOUNT"] > 0) {
onTap = () => _goToImgs(item["RECORDITEM_ID"]);
}
break;
case "1":
status = "不合格";
color = Colors.blue;
onTap = () => _goToDetail(item["HIDDEN_ID"]);
break;
case "2":
status = "不涉及";
color = Colors.blue;
break;
default:
status = "存在未整改隐患";
}
return GestureDetector(
onTap: onTap,
child: Padding(
padding: EdgeInsets.all(8),
child: Center(
child: Text(
status,
style: TextStyle(color: color),
),
),
),
);
}
Widget _buildOtherHiddenTable() {
return Container(
margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[300]!),
borderRadius: BorderRadius.circular(4),
),
child: Table(
border: TableBorder.all(color: Colors.grey[300]!),
columnWidths: const {
0: FlexColumnWidth(3),
1: FlexColumnWidth(1),
},
children: [
TableRow(
decoration: BoxDecoration(color: Colors.grey[100]),
children: [
_buildTableHeaderCell("隐患描述"),
_buildTableHeaderCell("操作"),
],
),
...otherHiddenList.map((item) => TableRow(
children: [
Padding(
padding: EdgeInsets.all(8),
child: Text(item["HIDDENDESCR"]),
),
GestureDetector(
onTap: () => _goToDetail(item["HIDDEN_ID"]),
child: Padding(
padding: EdgeInsets.all(8),
child: Center(
child: Text(
"查看",
style: TextStyle(color: Colors.blue),
),
),
),
),
],
)),
],
),
);
}
Widget _buildTableHeaderCell(String text) {
return Padding(
padding: EdgeInsets.all(8),
child: Center(
child: Text(
text,
style: TextStyle(fontWeight: FontWeight.bold),
),
),
);
}
// Widget _buildMapSection() {
// return Container(
// height: 300,
// margin: EdgeInsets.symmetric(vertical: 10),
// child: GoogleMap(
// initialCameraPosition: CameraPosition(
// target: _center,
// zoom: _scale,
// ),
// markers: _markers,
// ),
// );
// }
Widget _buildInfoList() {
return Container(
margin: EdgeInsets.symmetric(horizontal: 15),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[300]!),
borderRadius: BorderRadius.circular(4),
),
child: Column(
children: [
_buildInfoRow("清单名称", pd["LIST_NAME"]),
_buildInfoRow("排查清单类型", pd["SCREENTYPENAME"]),
_buildInfoRow("检查人", pd["USERS"]),
_buildInfoRow("检查时间", pd["CHECK_TIME"]),
_buildInfoRow("所属部门", pd["DEPARTMENT_NAME"]),
_buildInfoRow("所属岗位", pd["POST_NAME"]),
_buildInfoRow("排查周期", pd["PERIODNAME"]),
_buildInfoRow("清单类型", pd["TYPENAME"]),
if (pd["TYPENAME"] == "临时")
_buildInfoRow("排查日期", "${pd["START_DATE"]} - ${pd["END_DATE"]}"),
],
),
);
}
Widget _buildInfoRow(String title, String value) {
return Container(
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 15),
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.grey[300]!)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(title, style: TextStyle(fontSize: 14)),
Text(value, style: TextStyle(fontSize: 14, color: Colors.grey[600])),
],
),
);
}
Widget _buildSignPhotos() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("签字照片", style: TextStyle(fontWeight: FontWeight.bold)),
SizedBox(height: 10),
Container(
height: 120,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: files.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
setState(() {
_currentImageIndex = index;
_showImageViewer = true;
});
},
child: Container(
width: 150,
margin: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
image: DecorationImage(
image: NetworkImage(files[index]),
fit: BoxFit.cover,
),
),
),
);
},
),
),
],
),
);
}
void _goToDetail(String hiddenId) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Scaffold(
appBar: AppBar(title: Text("隐患详情")),
body: Center(child: Text("隐患ID: $hiddenId")),
),
),
);
}
void _goToImgs(String recordItemId) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Scaffold(
appBar: AppBar(title: Text("图片详情")),
body: Center(child: Text("记录项ID: $recordItemId")),
),
),
);
}
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

@ -1,14 +1,21 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:qhd_prevention/customWidget/danner_repain_item.dart';
import 'package:qhd_prevention/customWidget/department_picker.dart';
import 'package:qhd_prevention/customWidget/search_bar_widget.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'package:qhd_prevention/http/ApiService.dart';
import 'package:qhd_prevention/pages/app/Danger_paicha/check_record_detail_page.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
import 'package:qhd_prevention/tools/tools.dart';
class CheckRecordListPage extends StatefulWidget {
const CheckRecordListPage({super.key});
const CheckRecordListPage(this.id, this.type, {super.key});
final String id;
final int type;
@override
_CheckRecordListPageState createState() => _CheckRecordListPageState();
}
@ -17,36 +24,126 @@ class _CheckRecordListPageState extends State<CheckRecordListPage>
with SingleTickerProviderStateMixin {
late TabController _tabController;
int _selectedTab = 0;
String keyWord="";
//
final List<NotificationItem> _notifications = List.generate(10, (i) {
bool read = i % 3 == 0;
String title = '测试数据标题标题 ${i + 1}';
String time = '2025-06-${10 + i} 12:3${i}';
return NotificationItem(title, time);
});
final TextEditingController _searchController = TextEditingController();
List<dynamic> alreadyList = [];
List<dynamic> overTimeList = [];
dynamic ls;
List<dynamic> listDates = [];
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
_tabController.addListener(() {
if (!_tabController.indexIsChanging) {
// if (!_tabController.indexIsChanging) {
// setState(() => _selectedTab = _tabController.index);
// }
if (_tabController.indexIsChanging) {
setState(() => _selectedTab = _tabController.index);
print('切换到标签:${_tabController.index}');
listDates.clear();
if(_selectedTab==0){
listDates.addAll(alreadyList);
}else{
listDates.addAll(overTimeList);
}
}
});
getListData();
}
void getListData(){
switch(widget.type ){
case 1://
_getCheckRecordListOne();
break;
case 2://
_getCheckRecordList();
break;
}
}
Future<void> _getCheckRecordListOne() async {
try {
final result = await ApiService.getCheckRecordListOne(widget.id,keyWord);
if (result['result'] == 'success') {
final List<dynamic> newList = result['varList'] ?? [];
setState(() {
ls= result['ls'];
for(int i=0;i<newList.length;i++){
if(newList[i]["TYPE"]=="1"){
alreadyList.add(newList[i]);
}else{
overTimeList.add(newList[i]);
}
}
listDates.addAll(alreadyList);
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
Future<void> _getCheckRecordList() async {
try {
final result = await ApiService.getCheckRecordList(widget.id,keyWord);
if (result['result'] == 'success') {
final List<dynamic> newList = result['varList'] ?? [];
setState(() {
ls= result['ls'];
for(int i=0;i<newList.length;i++){
if(newList[i]["TYPE"]=="1"){
alreadyList.add(newList[i]);
}else{
overTimeList.add(newList[i]);
}
}
listDates.addAll(alreadyList);
});
}else{
ToastUtil.showNormal(context, "加载数据失败");
// _showMessage('加载数据失败');
}
} catch (e) {
// Toast
print('加载数据失败:$e');
}
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
void _handleItemTap(NotificationItem item, int index) {
print("点击了是: ${item.title}");
void _handleItemTap( item, int index) {
if(_selectedTab==0){
print("点击了是: ${index}");
pushPage(CheckRecordDetailPage(item['CHECKRECORD_ID']), context);
}
}
//
void showCategoryPicker() {
@ -86,7 +183,9 @@ class _CheckRecordListPageState extends State<CheckRecordListPage>
),
// Search bar
Padding(
Container(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(10),
child: SearchBarWidget(
showResetButton: false,
@ -97,31 +196,37 @@ class _CheckRecordListPageState extends State<CheckRecordListPage>
isClickableOnly: true,
onSearch: (text) {
print('----------');
keyWord=text;
getListData();
},
controller: _searchController,
),
),
),
// List
Expanded(
child: ListView.separated(
itemCount: _notifications.length,
child: listDates.isEmpty
? NoDataWidget.show()
: ListView.separated(
padding: EdgeInsets.only(top: 15),
itemCount: listDates.length,
separatorBuilder: (_, __) => const SizedBox(),
itemBuilder: (context, index) {
NotificationItem item = _notifications[index];
final item = listDates[index];
return GestureDetector(
onTap: () => _handleItemTap(item, index),
child: DannerRepainItem(
title: '清单名称:测试的时候写的假数据',
title: widget.type==1?'清单名称:${item['LIST_NAME']??""}':'清单名称:${item['CUSTOM_NAME']??""}',
showTitleIcon: false,
details: [
'清单类型:测试',
'排查周期:测试',
'包含检查项3',
'负责人:是测试',
'起始时间2025-6-20',
widget.type==1? '人员:${item['PRINCIPALNAME']??ls['USER_NAME']}':'人员:${item['USER_NAME']??ls['USER_NAME']}',
'',
'测试一下是否跳过时间'
'检查周期:${returnTime(item['DATESTART'])}-${returnTime(item['DATEEND']).toString()}',
'',
_selectedTab==0?'检查人:${item['CHECK_USERS']}':'清单类型:${ls['TYPENAME']}',
_selectedTab==0?'检查时间:${returnTime(item['CHECK_TIME'])}':'清单周期:${ls['PERIODNAME']}',
],
showBottomTags: false,
@ -137,12 +242,10 @@ class _CheckRecordListPageState extends State<CheckRecordListPage>
}
String returnTime(String time) {
return time.substring(0, 16);
}
}
//
class NotificationItem {
final String title;
final String time;
NotificationItem(this.title, this.time);
}

View File

@ -37,9 +37,19 @@ class _CheckRecordPageState extends State<CheckRecordPage> {
void _handleItemTap(RecordCheckModel model) {
//item
pushPage(CheckRecordListPage(), context);
void _handleItemTap(item) {
//item
String id="";
switch(widget.type ){
case 1://
id=item["LISTMANAGER_ID"];
break;
case 2://
id=item["CUSTOM_ID"];
break;
}
pushPage(CheckRecordListPage(id,widget.type), context);
}
@override
@ -176,7 +186,10 @@ class _CheckRecordPageState extends State<CheckRecordPage> {
itemBuilder: (context, index) {
final item = _list[index];
return GestureDetector(
onTap: () => _handleItemTap(item),
onTap: (){
_handleItemTap(item);
} ,
// => _handleItemTap(item),
child: DannerRepainItem(
showTitleIcon: true,
title: '清单名称:${item['NAME']}',

View File

@ -174,7 +174,7 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
responsibleId="";
responsibleName="";
// setResult();
setResult();
});
//
@ -201,7 +201,7 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
responsibleId=userId;
responsibleName=name;
// setResult();
setResult();
});
},
@ -225,7 +225,7 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
setState(() {
_selectedQDType = choice;
// setResult();
setResult();
});
}
}else if (type == 4) {
@ -244,7 +244,7 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
setState(() {
_selectedZQTime = choice;
// setResult();
setResult();
});
}
@ -274,7 +274,7 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
}
// setResult();
setResult();
});
}
@ -299,7 +299,7 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
final dateFormat = DateFormat('yyyy-MM-dd');
endTime=dateFormat.format(picked);
// setResult();
setResult();
});
}
@ -446,7 +446,7 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
onPressed: () {
// TODO: _startDate_endDate
Navigator.pop(context);
setResult();//
// setResult();//
},
),
),

View File

@ -0,0 +1,293 @@
import 'package:flutter/material.dart';
import 'package:qhd_prevention/customWidget/search_bar_widget.dart';
import 'package:qhd_prevention/http/ApiService.dart';
import 'package:qhd_prevention/pages/notif/notif_detail_page.dart';
import 'package:qhd_prevention/tools/tools.dart';
class InspectRecordsListPage extends StatefulWidget {
const InspectRecordsListPage({Key? key}) : super(key: key);
@override
_InspectRecordsListPageState createState() => _InspectRecordsListPageState();
}
class _InspectRecordsListPageState extends State<InspectRecordsListPage>
with SingleTickerProviderStateMixin {
final TextEditingController searchController = TextEditingController();
late List<dynamic> _list = [];
late TabController _tabController;
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,
};
});
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
_tabController.addListener(() {
// if (!_tabController.indexIsChanging) {
// setState(() => _selectedTab = _tabController.index);
// }
if (_tabController.indexIsChanging) {
setState(() => _selectedTab = _tabController.index);
print('切换到标签:${_tabController.index}');
reRefreshData();
}
});
_getNotifList("");
}
void reRefreshData(){
pageNum=1;
_list.clear();
searchController.text="";
if(0==_selectedTab){
_getNotifList("");
}else{
_getNotifEnterprise("");
}
}
Future<void> _getNotifList(String keyWord) async {
// LoadingDialogHelper.show(context);
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(context);
}
}
Future<void> _getNotifEnterprise(String keyWord) async {
// LoadingDialogHelper.show(context);
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(context);
}
}
Future<void> _deleteNotif(String id) async {
// LoadingDialogHelper.show(context);
try {
final result = await ApiService.deleteNotif(id);
if (result['result'] == 'success') {
setState(() {
reRefreshData();
});
}
} catch (e) {
print('加载出错: $e');
} finally {
LoadingDialogHelper.hide(context);
}
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
FocusScope.of(context).unfocus(); //
},
behavior: HitTestBehavior.opaque,
child: Scaffold(
body: SafeArea(
child: Column(
children: [
// Tab bar
TabBar(
controller: _tabController,
labelStyle: TextStyle(fontSize: 16),
indicator: UnderlineTabIndicator(
borderSide: BorderSide(width: 3.0, color: Colors.blue),
insets: EdgeInsets.symmetric(horizontal: 100.0),
),
labelColor: Colors.blue,
unselectedLabelColor: Colors.grey,
tabs: const [Tab(text: '政府公告'), Tab(text: '企业公告')],
),
// Search bar
Padding(
padding: const EdgeInsets.all(10),
child: SearchBarWidget(
key: Key("searchBody"),
controller: searchController,
onSearch: (keyword) {
print("用户输入的是: $keyword");
// TODO:
// String word="整改";
pageNum=1;
_list.clear();
if(0==_selectedTab){
_getNotifList(keyword);
}else{
_getNotifEnterprise(keyword);
}
},
),
),
// List
Expanded(
child:
_list.isEmpty
? NoDataWidget.show()
: ListView.builder(
itemCount: _list.length,
itemBuilder: (context, index) {
return _itemCell(_list[index]);
},
),
),
],
),
),
),
);
}
Widget _itemCell(final item) {
return Column(
children: [
ListTile(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => NotifDetailPage(
item,_selectedTab,
onClose: (result) {
print('详情页面已关闭,返回结果: $result');
reRefreshData();
},
),
),
);
// pushPage(NotifDetailPage(item,_selectedTab), context);
},
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 10,
),
title: Padding(
padding: const EdgeInsets.only(bottom: 20), //
child: Text(item['SYNOPSIS'], style: const TextStyle(fontSize: 14)),
),
subtitle: Text(item['CREATTIME'], style: TextStyle(fontSize: 13)),
trailing: Container(
constraints: const BoxConstraints(minHeight: 100), //
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min, // 使
crossAxisAlignment: CrossAxisAlignment.end,
children: [
if (0 != _selectedTab)
Text(
item['TYPE'] == 1 ? '已读' : '未读',
style: TextStyle(
fontSize: 12, //
color: item['TYPE'] == 1 ? Colors.grey : Colors.red,
),
),
SizedBox(height: 15),
if (0 != _selectedTab && item['TYPE'] == 1)
SizedBox(
height: 24, //
child: TextButton(
onPressed: () async{
//
bool? confirm = await showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text("确认删除"),
content: Text("确定要删除这条通知吗?"),
actions: [
TextButton(
onPressed: () => Navigator.pop(context, false),
// onPressed: () => Navigator.pop(context, false),
child: Text("取消"),
),
TextButton(
onPressed: () => Navigator.pop(context, true),
// onPressed: () => Navigator.pop(context, true),
child: Text("确定", style: TextStyle(color: Colors.red)),
),
],
),
);
if (confirm == true) {
_deleteNotif(item['NOTICECORPUSERID_ID']);
}
},
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 12),
backgroundColor: Colors.red,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: Text( '删除', style: TextStyle(fontSize: 13, color: Colors.white),),
),
),
],
),
),
),
Divider(height: 1, color: Colors.black12),
],
);
}
}

File diff suppressed because it is too large Load Diff