Merge remote-tracking branch 'origin/main'
commit
5846e0c04d
|
|
@ -1659,6 +1659,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,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,14 +1,21 @@
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.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/app/Danger_paicha/check_record_detail_page.dart';
|
||||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||||
|
import 'package:qhd_prevention/tools/tools.dart';
|
||||||
|
|
||||||
|
|
||||||
class CheckRecordListPage extends StatefulWidget {
|
class CheckRecordListPage extends StatefulWidget {
|
||||||
const CheckRecordListPage({super.key});
|
const CheckRecordListPage(this.id, this.type, {super.key});
|
||||||
|
|
||||||
|
final String id;
|
||||||
|
final int type;
|
||||||
@override
|
@override
|
||||||
_CheckRecordListPageState createState() => _CheckRecordListPageState();
|
_CheckRecordListPageState createState() => _CheckRecordListPageState();
|
||||||
}
|
}
|
||||||
|
|
@ -17,36 +24,126 @@ class _CheckRecordListPageState extends State<CheckRecordListPage>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late TabController _tabController;
|
late TabController _tabController;
|
||||||
int _selectedTab = 0;
|
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();
|
final TextEditingController _searchController = TextEditingController();
|
||||||
|
List<dynamic> alreadyList = [];
|
||||||
|
List<dynamic> overTimeList = [];
|
||||||
|
dynamic ls;
|
||||||
|
|
||||||
|
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) {
|
// if (!_tabController.indexIsChanging) {
|
||||||
|
// setState(() => _selectedTab = _tabController.index);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (_tabController.indexIsChanging) {
|
||||||
setState(() => _selectedTab = _tabController.index);
|
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
|
@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}");
|
if(_selectedTab==0){
|
||||||
|
print("点击了是: ${index}");
|
||||||
|
pushPage(CheckRecordDetailPage(item['CHECKRECORD_ID']), context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 显示分类选择器
|
// 显示分类选择器
|
||||||
void showCategoryPicker() {
|
void showCategoryPicker() {
|
||||||
|
|
@ -86,7 +183,9 @@ class _CheckRecordListPageState extends State<CheckRecordListPage>
|
||||||
),
|
),
|
||||||
|
|
||||||
// Search bar
|
// Search bar
|
||||||
Padding(
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(10),
|
padding: const EdgeInsets.all(10),
|
||||||
child: SearchBarWidget(
|
child: SearchBarWidget(
|
||||||
showResetButton: false,
|
showResetButton: false,
|
||||||
|
|
@ -97,31 +196,37 @@ class _CheckRecordListPageState extends State<CheckRecordListPage>
|
||||||
isClickableOnly: true,
|
isClickableOnly: true,
|
||||||
onSearch: (text) {
|
onSearch: (text) {
|
||||||
print('----------');
|
print('----------');
|
||||||
|
keyWord=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: '清单名称:测试的时候写的假数据',
|
title: widget.type==1?'清单名称:${item['LIST_NAME']??""}':'清单名称:${item['CUSTOM_NAME']??""}',
|
||||||
showTitleIcon: false,
|
showTitleIcon: false,
|
||||||
details: [
|
details: [
|
||||||
'清单类型:测试',
|
widget.type==1? '人员:${item['PRINCIPALNAME']??ls['USER_NAME']}':'人员:${item['USER_NAME']??ls['USER_NAME']}',
|
||||||
'排查周期:测试',
|
|
||||||
'包含检查项:3',
|
|
||||||
'负责人:是测试',
|
|
||||||
'起始时间:2025-6-20',
|
|
||||||
'',
|
'',
|
||||||
'测试一下是否跳过时间'
|
'检查周期:${returnTime(item['DATESTART'])}-${returnTime(item['DATEEND']).toString()}',
|
||||||
|
'',
|
||||||
|
_selectedTab==0?'检查人:${item['CHECK_USERS']}':'清单类型:${ls['TYPENAME']}',
|
||||||
|
_selectedTab==0?'检查时间:${returnTime(item['CHECK_TIME'])}':'清单周期:${ls['PERIODNAME']}',
|
||||||
],
|
],
|
||||||
showBottomTags: false,
|
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);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,19 @@ class _CheckRecordPageState extends State<CheckRecordPage> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void _handleItemTap(RecordCheckModel model) {
|
void _handleItemTap(item) {
|
||||||
//item点击事件
|
//item点击事件
|
||||||
pushPage(CheckRecordListPage(), context);
|
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
|
@override
|
||||||
|
|
@ -176,7 +186,10 @@ class _CheckRecordPageState extends State<CheckRecordPage> {
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final item = _list[index];
|
final item = _list[index];
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => _handleItemTap(item),
|
onTap: (){
|
||||||
|
_handleItemTap(item);
|
||||||
|
} ,
|
||||||
|
// => _handleItemTap(item),
|
||||||
child: DannerRepainItem(
|
child: DannerRepainItem(
|
||||||
showTitleIcon: true,
|
showTitleIcon: true,
|
||||||
title: '清单名称:${item['NAME']}',
|
title: '清单名称:${item['NAME']}',
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
||||||
|
|
||||||
responsibleId="";
|
responsibleId="";
|
||||||
responsibleName="";
|
responsibleName="";
|
||||||
// setResult();
|
setResult();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 拉取该单位的人员列表并缓存
|
// 拉取该单位的人员列表并缓存
|
||||||
|
|
@ -201,7 +201,7 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
||||||
|
|
||||||
responsibleId=userId;
|
responsibleId=userId;
|
||||||
responsibleName=name;
|
responsibleName=name;
|
||||||
// setResult();
|
setResult();
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
@ -225,7 +225,7 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedQDType = choice;
|
_selectedQDType = choice;
|
||||||
// setResult();
|
setResult();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else if (type == 4) {
|
}else if (type == 4) {
|
||||||
|
|
@ -244,7 +244,7 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedZQTime = choice;
|
_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');
|
final dateFormat = DateFormat('yyyy-MM-dd');
|
||||||
endTime=dateFormat.format(picked);
|
endTime=dateFormat.format(picked);
|
||||||
|
|
||||||
// setResult();
|
setResult();
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -446,7 +446,7 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// TODO: 提交筛选条件,包括 _startDate、_endDate
|
// TODO: 提交筛选条件,包括 _startDate、_endDate
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
setResult();// 关闭加载对话框
|
// setResult();// 关闭加载对话框
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -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),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
278
pubspec.lock
278
pubspec.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue