我的-更新签名缺失上传代码
parent
6fd181636e
commit
566ab85147
Binary file not shown.
After Width: | Height: | Size: 345 KiB |
|
@ -1511,6 +1511,28 @@ U6Hzm1ninpWeE+awIDAQAB
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
/// 更新签字信息
|
||||||
|
static Future<Map<String, dynamic>> refreshSignInfo(String imagePath) async{
|
||||||
|
final file = File(imagePath);
|
||||||
|
if (!await file.exists()) {
|
||||||
|
throw ApiException('file_not_found', '图片不存在:$imagePath');
|
||||||
|
}
|
||||||
|
final fileName = file.path.split(Platform.pathSeparator).last;
|
||||||
|
|
||||||
|
return HttpManager().uploadFaceImage(
|
||||||
|
baseUrl: basePath,
|
||||||
|
path: '/app/user/updateUserSign',
|
||||||
|
fromData: {
|
||||||
|
'CORPINFO_ID': SessionService.instance.corpinfoId,
|
||||||
|
'USER_ID': SessionService.instance.loginUserId,
|
||||||
|
'FFILE': await MultipartFile.fromFile(
|
||||||
|
file.path,
|
||||||
|
filename: fileName
|
||||||
|
),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// 问题反馈图片
|
/// 问题反馈图片
|
||||||
static Future<Map<String, dynamic>> reloadFeedBack(String imagePath) async {
|
static Future<Map<String, dynamic>> reloadFeedBack(String imagePath) async {
|
||||||
|
@ -3444,8 +3466,8 @@ U6Hzm1ninpWeE+awIDAQAB
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
///NFC任务详情列表
|
///NFC任务详情
|
||||||
static Future<Map<String, dynamic>> nfcTaskDetailList(int showCount, int currentPage) {
|
static Future<Map<String, dynamic>> nfcTaskDetailList(int showCount, int currentPage, String PATROL_TASK_ID) {
|
||||||
return HttpManager().request(
|
return HttpManager().request(
|
||||||
baseNFCPath,
|
baseNFCPath,
|
||||||
'/pipelineInspection/getPatrolTaskDetailList?showCount=$showCount¤tPage=$currentPage',
|
'/pipelineInspection/getPatrolTaskDetailList?showCount=$showCount¤tPage=$currentPage',
|
||||||
|
@ -3453,7 +3475,7 @@ U6Hzm1ninpWeE+awIDAQAB
|
||||||
data: {
|
data: {
|
||||||
"CORPINFO_ID":SessionService.instance.corpinfoId,
|
"CORPINFO_ID":SessionService.instance.corpinfoId,
|
||||||
"USER_ID":SessionService.instance.loginUserId,
|
"USER_ID":SessionService.instance.loginUserId,
|
||||||
|
"PATROL_TASK_ID":PATROL_TASK_ID
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:qhd_prevention/http/ApiService.dart';
|
||||||
|
import 'package:qhd_prevention/pages/home/tap/item_list_widget.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 HomeNfcDetailPage extends StatefulWidget {
|
class HomeNfcDetailPage extends StatefulWidget {
|
||||||
const HomeNfcDetailPage({super.key, required this.info});
|
const HomeNfcDetailPage({super.key, required this.info});
|
||||||
|
|
||||||
final Map<String, dynamic> info;
|
final Map<String, dynamic> info;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -10,26 +17,146 @@ class HomeNfcDetailPage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _HomeNfcDetailPageState extends State<HomeNfcDetailPage> {
|
class _HomeNfcDetailPageState extends State<HomeNfcDetailPage> {
|
||||||
|
List<ProgressItem> items = [];
|
||||||
|
int currentPage = 1;
|
||||||
|
final int pageSize = 10;
|
||||||
|
|
||||||
final List<ProgressItem> demoData = const [
|
bool isLoading = false; // 当前请求中
|
||||||
ProgressItem(status: '未查', location: '到期哦i维护经费欺废气阀我废费欺废气阀我废费欺废气阀我废气阀', code: 'XJ1001'),
|
bool hasMore = true; // 是否还有更多数据
|
||||||
ProgressItem(status: '已查', location: 'B区-配电室', code: 'XJ1002', checkTime: '2025-07-28 15:32'),
|
bool firstLoad = true; // 第一次加载标志
|
||||||
ProgressItem(status: '已查', location: 'B区-配电室', code: 'XJ1002', checkTime: '2025-07-28 15:32'),
|
|
||||||
ProgressItem(status: '已查', location: 'B区-配电室', code: 'XJ1002', checkTime: '2025-07-28 15:32'),
|
final ScrollController _scrollController = ScrollController();
|
||||||
ProgressItem(status: '已查', location: 'B区-配电室', code: 'XJ1002', checkTime: '2025-07-28 15:32'),
|
|
||||||
ProgressItem(status: '已查', location: 'B区-配电室', code: 'XJ1002', checkTime: '2025-07-28 15:32'),
|
@override
|
||||||
ProgressItem(status: '已查', location: 'B区-配电室', code: 'XJ1002', checkTime: '2025-07-28 15:32'),
|
void initState() {
|
||||||
ProgressItem(status: '已查', location: 'B区-配电室', code: 'XJ1002', checkTime: '2025-07-28 15:32'),
|
super.initState();
|
||||||
ProgressItem(status: '已查', location: 'B区-配电室', code: 'XJ1002', checkTime: '2025-07-28 15:32'),
|
_loadInitial();
|
||||||
ProgressItem(status: '已查', location: 'B区-配电室', code: 'XJ1002', checkTime: '2025-07-28 15:32'),
|
|
||||||
|
// 监听滚动到底部触发加载更多
|
||||||
|
_scrollController.addListener(() {
|
||||||
|
if (_scrollController.position.pixels >=
|
||||||
|
_scrollController.position.maxScrollExtent - 200 &&
|
||||||
|
!isLoading &&
|
||||||
|
hasMore) {
|
||||||
|
_getTaskDetail(); // 加载下一页
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _loadInitial() async {
|
||||||
|
await _getTaskDetail(refresh: true);
|
||||||
|
firstLoad = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// pageSize: 每页条数;currentPage 初始为 1
|
||||||
|
Future<void> _getTaskDetail({bool refresh = false}) async {
|
||||||
|
if (isLoading) return;
|
||||||
|
setState(() {
|
||||||
|
isLoading = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (refresh) {
|
||||||
|
currentPage = 1;
|
||||||
|
hasMore = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 调用后端 API:我保持你原来的签名 ApiService.nfcTaskDetailList(pageSize, page)
|
||||||
|
final result = await ApiService.nfcTaskDetailList(
|
||||||
|
pageSize,
|
||||||
|
currentPage,
|
||||||
|
widget.info['PATROL_TASK_ID'] ?? '',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result == null) {
|
||||||
|
_showMessage('请求失败:结果为 null');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
printLongString(jsonEncode(result));
|
||||||
|
if (result['result'] == 'success') {
|
||||||
|
// 兼容常见返回字段,尽量从 data / rows / list 里取
|
||||||
|
final dynamic rawList = result['varList'];
|
||||||
|
|
||||||
|
List<ProgressItem> fetched = [];
|
||||||
|
if (rawList is List) {
|
||||||
|
fetched =
|
||||||
|
rawList.map<ProgressItem>((e) {
|
||||||
|
if (e is ProgressItem) return e;
|
||||||
|
if (e is Map<String, dynamic>) return ProgressItem.fromJson(e);
|
||||||
|
return ProgressItem(
|
||||||
|
status: '未查',
|
||||||
|
location: e?.toString() ?? '',
|
||||||
|
code: '',
|
||||||
|
checkTime: null,
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
if (refresh) {
|
||||||
|
items = fetched;
|
||||||
|
} else {
|
||||||
|
items.addAll(fetched);
|
||||||
|
}
|
||||||
|
// 如果本次返回少于 pageSize 则说明没有更多
|
||||||
|
if (fetched.length < pageSize) {
|
||||||
|
hasMore = false;
|
||||||
|
} else {
|
||||||
|
// 成功拿到一页,页码自增
|
||||||
|
currentPage++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
final msg = result['message'] ?? result['msg'] ?? '加载失败';
|
||||||
|
_showMessage('请求出错:$msg');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
_showMessage('请求异常:$e');
|
||||||
|
} finally {
|
||||||
|
if (mounted) {
|
||||||
|
setState(() {
|
||||||
|
isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showMessage(String msg) {
|
||||||
|
if (!mounted) return;
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(msg)));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _startCheckItem(ProgressItem item, int index) async {
|
||||||
|
// TODO: 根据业务替换为真实逻辑(例如跳转到检查页面或调用写 NFC)
|
||||||
|
// 这里示例:将当前项标记为已查并设置检查时间(仅本地更新)
|
||||||
|
final now = DateTime.now();
|
||||||
|
setState(() {
|
||||||
|
items[index] = items[index].copyWith(
|
||||||
|
status: '已查',
|
||||||
|
checkTime:
|
||||||
|
'${now.year}-${_two(now.month)}-${_two(now.day)} ${_two(now.hour)}:${_two(now.minute)}',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 额外:你可能需要调用后端接口上报检查结果
|
||||||
|
// await ApiService.reportCheck(items[index].code, ...);
|
||||||
|
}
|
||||||
|
|
||||||
|
String _two(int v) => v.toString().padLeft(2, '0');
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_scrollController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
];
|
|
||||||
Widget _pendingTopCard(Map<String, dynamic> item) {
|
Widget _pendingTopCard(Map<String, dynamic> item) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 180,
|
height: 180,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
|
// 背景图片(上部)
|
||||||
ClipRRect(
|
ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
|
@ -45,7 +172,7 @@ class _HomeNfcDetailPageState extends State<HomeNfcDetailPage> {
|
||||||
top: 12,
|
top: 12,
|
||||||
left: 12,
|
left: 12,
|
||||||
child: Text(
|
child: Text(
|
||||||
item['title']!,
|
item['TASK_NAME']?.toString() ?? '',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
|
@ -53,37 +180,42 @@ class _HomeNfcDetailPageState extends State<HomeNfcDetailPage> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 12,
|
top: 12,
|
||||||
right: 12,
|
right: 12,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 30,
|
height: 30,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.blue.withOpacity(0.7),
|
color: Colors.blue.withOpacity(0.3),
|
||||||
borderRadius: BorderRadius.circular(4),
|
borderRadius: BorderRadius.circular(4),
|
||||||
),
|
),
|
||||||
|
child: Center(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
item['status']!,
|
item['PATROL_TYPE_NAME'] ?? '',
|
||||||
style: const TextStyle(color: Colors.white, fontSize: 14),
|
style: TextStyle(
|
||||||
|
color: Colors.blue,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
// 白色信息区域(盖住图片部分)
|
// 白色信息区域(覆盖图片底部)
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
top: 50, // 盖住图片底部
|
top: 50, // 覆盖图片底部
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 0),
|
margin: const EdgeInsets.symmetric(horizontal: 0),
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
boxShadow: [
|
boxShadow: const [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black12,
|
color: Colors.black12,
|
||||||
blurRadius: 4,
|
blurRadius: 4,
|
||||||
|
@ -98,196 +230,80 @@ class _HomeNfcDetailPageState extends State<HomeNfcDetailPage> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 构建信息网格
|
/// 构建信息网格
|
||||||
Widget _buildInfoGrid(Map<String, dynamic> item) {
|
Widget _buildInfoGrid(Map<String, dynamic> item) {
|
||||||
return Row(
|
return Expanded(
|
||||||
children: [
|
child: Column(
|
||||||
Expanded(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text('负责部门:${item['DEPARTMENT_NAME'] ?? ''}'),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Text('巡检类型:${item['PATROL_TYPE_NAME'] ?? ''}'),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Text('已巡点位:${item['INSPECTED_POINTS'] ?? '0'}'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
Text('负责人:${item['USER_NAME'] ?? ''}'),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Text('巡检周期:${item['PATROL_PERIOD_NAME'] ?? ''}'),
|
|
||||||
|
|
||||||
// isFinish
|
|
||||||
// ? Text('涉及管道区域:${item['department'] ?? ''}')
|
|
||||||
// : const SizedBox(height: 25),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Future<void> _startCheckItem(ProgressItem item) async {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
appBar: MyAppbar(title: '任务详情'),
|
|
||||||
body: SafeArea(child: Padding(padding: EdgeInsets.all(16), child: Column(
|
|
||||||
children: [
|
children: [
|
||||||
_pendingTopCard(widget.info),
|
// const SizedBox(height: 8),
|
||||||
Expanded(child: Container(
|
ItemListWidget.singleLineTitleText(
|
||||||
decoration: BoxDecoration(
|
label: '负责部门',
|
||||||
color: Colors.white,
|
isEditable: false,
|
||||||
borderRadius: BorderRadius.circular(10),
|
text: item['DEPARTMENT_NAME'] ?? '',
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black12,
|
|
||||||
blurRadius: 4,
|
|
||||||
offset: Offset(0, 1),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: ProgressList(
|
|
||||||
items: demoData,
|
|
||||||
onStartCheck: (idx) {
|
|
||||||
_startCheckItem(demoData[idx]);
|
|
||||||
print('开始检查第 $idx 项');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
))
|
|
||||||
],
|
|
||||||
),)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// 单条进度数据模型
|
|
||||||
class ProgressItem {
|
|
||||||
final String status; // “未查” 或 “已查”
|
|
||||||
final String location; // 地点
|
|
||||||
final String code; // 编码
|
|
||||||
final String? checkTime; // 检查时间(已查时有值)
|
|
||||||
|
|
||||||
const ProgressItem({
|
|
||||||
required this.status,
|
|
||||||
required this.location,
|
|
||||||
required this.code,
|
|
||||||
this.checkTime,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 进度列表组件
|
|
||||||
class ProgressList extends StatelessWidget {
|
|
||||||
/// 数据源
|
|
||||||
final List<ProgressItem> items;
|
|
||||||
|
|
||||||
/// 点击“开始检查”后的回调,index 对应 items 的下标
|
|
||||||
final void Function(int index) onStartCheck;
|
|
||||||
|
|
||||||
const ProgressList({
|
|
||||||
Key? key,
|
|
||||||
required this.items,
|
|
||||||
required this.onStartCheck,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
// 整体用 Column 包裹标题和列表
|
|
||||||
return Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
// 标题
|
|
||||||
const Padding(
|
|
||||||
padding: EdgeInsets.all(16),
|
|
||||||
child: Text(
|
|
||||||
'已查点位1/5',
|
|
||||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
|
||||||
),
|
),
|
||||||
),
|
ItemListWidget.singleLineTitleText(
|
||||||
const Divider(height: 1),
|
label: '负责人',
|
||||||
|
isEditable: false,
|
||||||
// 列表
|
text: item['USER_NAME'] ?? '',
|
||||||
ListView.builder(
|
),
|
||||||
physics: const NeverScrollableScrollPhysics(), // 让父级滚动
|
ItemListWidget.singleLineTitleText(
|
||||||
shrinkWrap: true,
|
label: '涉及管道区域:',
|
||||||
itemCount: items.length,
|
isEditable: false,
|
||||||
itemBuilder: (ctx, idx) {
|
text: item['PIPELINE_AREAS_NAMES'] ?? '',
|
||||||
return _ProgressListItem(
|
),
|
||||||
item: items[idx],
|
ItemListWidget.singleLineTitleText(
|
||||||
onStart: () => onStartCheck(idx),
|
label: '巡检周期',
|
||||||
);
|
isEditable: false,
|
||||||
},
|
text: item['PATROL_PERIOD_NAME'] ?? '',
|
||||||
),
|
),
|
||||||
],
|
ItemListWidget.singleLineTitleText(
|
||||||
|
label: '任务时间',
|
||||||
|
isEditable: false,
|
||||||
|
text: item['OPERATTIME'] ?? '',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// 单行进度条目
|
Widget _buildListItem(BuildContext context, int idx) {
|
||||||
class _ProgressListItem extends StatelessWidget {
|
final item = items[idx];
|
||||||
final ProgressItem item;
|
|
||||||
final VoidCallback onStart;
|
|
||||||
|
|
||||||
const _ProgressListItem({
|
|
||||||
Key? key,
|
|
||||||
required this.item,
|
|
||||||
required this.onStart,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final bool unchecked = item.status == '未查';
|
final bool unchecked = item.status == '未查';
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
height: 100,
|
height: 100,
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
children: [
|
||||||
// 左侧状态区
|
// 左侧状态区
|
||||||
Column(children: [
|
Column(
|
||||||
Stack(
|
children: [
|
||||||
alignment: Alignment.center,
|
Stack(
|
||||||
children: [
|
alignment: Alignment.center,
|
||||||
Image.asset(
|
children: [
|
||||||
unchecked
|
Image.asset(
|
||||||
? 'assets/images/xj_wait.png'
|
unchecked
|
||||||
: 'assets/images/xj_finish.png',
|
? 'assets/images/xj_wait.png'
|
||||||
width: 50,
|
: 'assets/images/xj_finish.png',
|
||||||
height: 30,
|
width: 50,
|
||||||
fit: BoxFit.cover,
|
height: 30,
|
||||||
),
|
fit: BoxFit.cover,
|
||||||
Positioned(
|
|
||||||
top: 2,
|
|
||||||
child: Text(
|
|
||||||
item.status,
|
|
||||||
style: const TextStyle(color: Colors.white, fontSize: 14),
|
|
||||||
),
|
),
|
||||||
),
|
Positioned(
|
||||||
|
top: 2,
|
||||||
],
|
child: Text(
|
||||||
),
|
item.status,
|
||||||
SizedBox(height: 15,),
|
style: const TextStyle(color: Colors.white, fontSize: 14),
|
||||||
Positioned(
|
),
|
||||||
// bottom: 0,
|
),
|
||||||
// right: 17,
|
],
|
||||||
child: Image.asset(
|
|
||||||
'assets/images/xjjd_top.png',
|
|
||||||
width: 15,
|
|
||||||
height: 30,
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 8),
|
||||||
],),
|
Image.asset('assets/images/xjjd_top.png', width: 15, height: 30),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
const SizedBox(width: 20),
|
const SizedBox(width: 20),
|
||||||
|
|
||||||
|
@ -295,7 +311,6 @@ class _ProgressListItem extends StatelessWidget {
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
item.location,
|
item.location,
|
||||||
|
@ -303,19 +318,16 @@ class _ProgressListItem extends StatelessWidget {
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
maxLines: 1, // 最多一行
|
maxLines: 1, // 最多一行
|
||||||
overflow: TextOverflow.ellipsis, // 超出省略号
|
overflow: TextOverflow.ellipsis, // 超出省略号
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text('NFC编码:${item.code}'),
|
Text('NFC编码:${item.code}'),
|
||||||
|
const SizedBox(height: 6),
|
||||||
unchecked
|
unchecked
|
||||||
? InkWell(
|
? InkWell(
|
||||||
onTap: onStart,
|
onTap: () => _startCheckItem(item, idx),
|
||||||
child: Column(
|
child: Container(
|
||||||
children: [
|
|
||||||
SizedBox(height: 5,),
|
|
||||||
Container(
|
|
||||||
height: 35,
|
height: 35,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 1),
|
padding: const EdgeInsets.symmetric(vertical: 1),
|
||||||
|
@ -330,29 +342,203 @@ class _ProgressListItem extends StatelessWidget {
|
||||||
style: TextStyle(color: Colors.white, fontSize: 14),
|
style: TextStyle(color: Colors.white, fontSize: 14),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
)
|
||||||
)
|
|
||||||
)
|
|
||||||
: Text(
|
: Text(
|
||||||
'检查时间:' + (item.checkTime ?? ''),
|
'检查时间:${item.checkTime ?? ''}',
|
||||||
style: const TextStyle(fontSize: 14),
|
style: const TextStyle(fontSize: 14),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// 操作区或时间
|
// 右侧箭头
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Column(
|
const Icon(Icons.chevron_right, color: Colors.grey),
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
const Icon(Icons.chevron_right, color: Colors.grey),
|
|
||||||
SizedBox()
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: MyAppbar(title: '任务详情'),
|
||||||
|
body: SafeArea(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_pendingTopCard(widget.info),
|
||||||
|
const SizedBox(height: 60),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
boxShadow: const [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black12,
|
||||||
|
blurRadius: 4,
|
||||||
|
offset: Offset(0, 1),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: RefreshIndicator(
|
||||||
|
onRefresh: () => _getTaskDetail(refresh: true),
|
||||||
|
child:
|
||||||
|
firstLoad && isLoading
|
||||||
|
? const Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(16.0),
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: items.isEmpty
|
||||||
|
? ListView(
|
||||||
|
controller: _scrollController,
|
||||||
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 80),
|
||||||
|
Center(
|
||||||
|
child: Text(isLoading ? '加载中...' : '暂无数据'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
controller: _scrollController,
|
||||||
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
|
itemCount: items.length + 1, // 多一个用于加载状态/底部提示
|
||||||
|
itemBuilder: (ctx, idx) {
|
||||||
|
if (idx < items.length) {
|
||||||
|
return _buildListItem(ctx, idx);
|
||||||
|
} else {
|
||||||
|
// 底部加载/没有更多提示
|
||||||
|
if (hasMore) {
|
||||||
|
// 触发加载(以防没有触发)
|
||||||
|
if (!isLoading) {
|
||||||
|
// 预防性触发下一页
|
||||||
|
// _getTaskDetail(); // 不在此直接调用,scroll listener 会负责
|
||||||
|
}
|
||||||
|
return const Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
vertical: 12,
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
vertical: 12,
|
||||||
|
),
|
||||||
|
child: Center(child: Text('没有更多了')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 单条进度数据模型
|
||||||
|
class ProgressItem {
|
||||||
|
final String status; // “未查” 或 “已查”
|
||||||
|
final String location; // 地点
|
||||||
|
final String code; // 编码
|
||||||
|
final String? checkTime; // 检查时间(已查时有值)
|
||||||
|
|
||||||
|
ProgressItem({
|
||||||
|
required this.status,
|
||||||
|
required this.location,
|
||||||
|
required this.code,
|
||||||
|
this.checkTime,
|
||||||
|
});
|
||||||
|
|
||||||
|
ProgressItem copyWith({
|
||||||
|
String? status,
|
||||||
|
String? location,
|
||||||
|
String? code,
|
||||||
|
String? checkTime,
|
||||||
|
}) {
|
||||||
|
return ProgressItem(
|
||||||
|
status: status ?? this.status,
|
||||||
|
location: location ?? this.location,
|
||||||
|
code: code ?? this.code,
|
||||||
|
checkTime: checkTime ?? this.checkTime,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 宽容解析后端返回(根据常见字段名)
|
||||||
|
factory ProgressItem.fromJson(Map<String, dynamic> json) {
|
||||||
|
String status =
|
||||||
|
(json['status'] ??
|
||||||
|
json['STATUS'] ??
|
||||||
|
(json['checked'] == true ? '已查' : null) ??
|
||||||
|
(json['is_checked'] == 1 ? '已查' : null) ??
|
||||||
|
json['state'] ??
|
||||||
|
json['check_status'])
|
||||||
|
?.toString() ??
|
||||||
|
'';
|
||||||
|
|
||||||
|
if (status.isEmpty) {
|
||||||
|
// 有些 API 用 0/1 表示
|
||||||
|
final s = json['status'] ?? json['STATUS'] ?? json['check_status'];
|
||||||
|
if (s is num) {
|
||||||
|
status = (s == 0) ? '未查' : '已查';
|
||||||
|
} else if (s is String && (s == '0' || s == '1')) {
|
||||||
|
status = (s == '0') ? '未查' : '已查';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (status.isEmpty) status = '未查';
|
||||||
|
|
||||||
|
final location =
|
||||||
|
(json['location'] ??
|
||||||
|
json['LOCATION'] ??
|
||||||
|
json['point_name'] ??
|
||||||
|
json['address'] ??
|
||||||
|
json['point'] ??
|
||||||
|
'')
|
||||||
|
.toString();
|
||||||
|
final code =
|
||||||
|
(json['code'] ??
|
||||||
|
json['CODE'] ??
|
||||||
|
json['nfcCode'] ??
|
||||||
|
json['nfc_code'] ??
|
||||||
|
json['NFC_CODE'] ??
|
||||||
|
json['id'] ??
|
||||||
|
'')
|
||||||
|
.toString();
|
||||||
|
final checkTime =
|
||||||
|
(json['checkTime'] ??
|
||||||
|
json['CHECK_TIME'] ??
|
||||||
|
json['checked_at'] ??
|
||||||
|
json['check_time'] ??
|
||||||
|
json['inspect_time'] ??
|
||||||
|
null)
|
||||||
|
?.toString();
|
||||||
|
|
||||||
|
return ProgressItem(
|
||||||
|
status: status,
|
||||||
|
location: location,
|
||||||
|
code: code,
|
||||||
|
checkTime: checkTime,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
'status': status,
|
||||||
|
'location': location,
|
||||||
|
'code': code,
|
||||||
|
'checkTime': checkTime,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ class _HomeNfcListPageState extends State<HomeNfcListPage>
|
||||||
// 滚动监听,上拉触底加载更多
|
// 滚动监听,上拉触底加载更多
|
||||||
_pendingScrollController.addListener(() {
|
_pendingScrollController.addListener(() {
|
||||||
if (_pendingScrollController.position.pixels >=
|
if (_pendingScrollController.position.pixels >=
|
||||||
_pendingScrollController.position.maxScrollExtent - 80 &&
|
_pendingScrollController.position.maxScrollExtent - 80 &&
|
||||||
!_pendingLoading &&
|
!_pendingLoading &&
|
||||||
_pendingHasMore) {
|
_pendingHasMore) {
|
||||||
_loadMorePending();
|
_loadMorePending();
|
||||||
|
@ -66,7 +66,7 @@ class _HomeNfcListPageState extends State<HomeNfcListPage>
|
||||||
|
|
||||||
_recordScrollController.addListener(() {
|
_recordScrollController.addListener(() {
|
||||||
if (_recordScrollController.position.pixels >=
|
if (_recordScrollController.position.pixels >=
|
||||||
_recordScrollController.position.maxScrollExtent - 80 &&
|
_recordScrollController.position.maxScrollExtent - 80 &&
|
||||||
!_recordLoading &&
|
!_recordLoading &&
|
||||||
_recordHasMore) {
|
_recordHasMore) {
|
||||||
_loadMoreRecord();
|
_loadMoreRecord();
|
||||||
|
@ -86,14 +86,15 @@ class _HomeNfcListPageState extends State<HomeNfcListPage>
|
||||||
_recordScrollController.dispose();
|
_recordScrollController.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
String _checkStatusName(String status) {
|
String _checkStatusName(String status) {
|
||||||
if (status == '0') {
|
if (status == '0') {
|
||||||
return '已巡检';
|
return '已巡检';
|
||||||
}else if (status == '1') {
|
} else if (status == '1') {
|
||||||
return '超期未巡检';
|
return '超期未巡检';
|
||||||
}else if (status == '2') {
|
} else if (status == '2') {
|
||||||
return '巡检中';
|
return '巡检中';
|
||||||
}else{
|
} else {
|
||||||
return '待巡检';
|
return '待巡检';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,34 +156,39 @@ class _HomeNfcListPageState extends State<HomeNfcListPage>
|
||||||
if (res['result'] == 'success') {
|
if (res['result'] == 'success') {
|
||||||
List<dynamic> list = res['varList'];
|
List<dynamic> list = res['varList'];
|
||||||
|
|
||||||
final parsed = list.map<Map<String, dynamic>>((e) {
|
final parsed =
|
||||||
return e;
|
list.map<Map<String, dynamic>>((e) {
|
||||||
}).toList();
|
return e;
|
||||||
|
}).toList();
|
||||||
|
|
||||||
//
|
//
|
||||||
// 判断是否还有更多:如果返回数量 < pageSize 则没有更多
|
// 判断是否还有更多:如果返回数量 < pageSize 则没有更多
|
||||||
final bool gotLessThanPage = parsed.length < _pageSize;
|
final bool gotLessThanPage = parsed.length < _pageSize;
|
||||||
|
|
||||||
if (replace) {
|
if (replace) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_pendingList.clear();
|
_pendingList.clear();
|
||||||
_pendingList.addAll(parsed);
|
_pendingList.addAll(parsed);
|
||||||
_pendingPage = 1;
|
_pendingPage = 1;
|
||||||
_pendingHasMore = !gotLessThanPage;
|
_pendingHasMore = !gotLessThanPage;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
_pendingList.addAll(parsed);
|
_pendingList.addAll(parsed);
|
||||||
_pendingPage = page;
|
_pendingPage = page;
|
||||||
if (parsed.isEmpty) _pendingHasMore = false;
|
if (parsed.isEmpty)
|
||||||
else if (parsed.length < _pageSize) _pendingHasMore = false;
|
_pendingHasMore = false;
|
||||||
});
|
else if (parsed.length < _pageSize)
|
||||||
}
|
_pendingHasMore = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// 错误处理
|
// 错误处理
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('获取待巡检列表失败:$e')));
|
ScaffoldMessenger.of(
|
||||||
|
context,
|
||||||
|
).showSnackBar(SnackBar(content: Text('获取待巡检列表失败:$e')));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
|
@ -193,12 +199,15 @@ class _HomeNfcListPageState extends State<HomeNfcListPage>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getTaskDetailList({required int page, required bool replace}) async {
|
Future<void> _getTaskDetailList({
|
||||||
|
required int page,
|
||||||
|
required bool replace,
|
||||||
|
}) async {
|
||||||
setState(() {
|
setState(() {
|
||||||
_recordLoading = true;
|
_recordLoading = true;
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
final res = await ApiService.nfcTaskDetailList(_pageSize, page);
|
// final res = await ApiService.nfcTaskDetailList(_pageSize, page);
|
||||||
List<dynamic>? list;
|
List<dynamic>? list;
|
||||||
// if (res == null) {
|
// if (res == null) {
|
||||||
// list = [];
|
// list = [];
|
||||||
|
@ -253,7 +262,9 @@ class _HomeNfcListPageState extends State<HomeNfcListPage>
|
||||||
// }
|
// }
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('获取巡检记录失败:$e')));
|
ScaffoldMessenger.of(
|
||||||
|
context,
|
||||||
|
).showSnackBar(SnackBar(content: Text('获取巡检记录失败:$e')));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
|
@ -269,17 +280,20 @@ class _HomeNfcListPageState extends State<HomeNfcListPage>
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: MyAppbar(title: '巡检列表', actions: [
|
appBar: MyAppbar(
|
||||||
TextButton(
|
title: '巡检列表',
|
||||||
onPressed: () {
|
actions: [
|
||||||
pushPage(const HomeNfcAddPage(), context);
|
TextButton(
|
||||||
},
|
onPressed: () {
|
||||||
child: const Text(
|
pushPage(const HomeNfcAddPage(), context);
|
||||||
"NFC绑定",
|
},
|
||||||
style: TextStyle(color: Colors.white, fontSize: 16),
|
child: const Text(
|
||||||
|
"NFC绑定",
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 16),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
],
|
||||||
]),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
@ -435,7 +449,10 @@ class _HomeNfcListPageState extends State<HomeNfcListPage>
|
||||||
right: 12,
|
right: 12,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 30,
|
height: 30,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white.withOpacity(0.5),
|
color: Colors.white.withOpacity(0.5),
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
|
@ -443,7 +460,13 @@ class _HomeNfcListPageState extends State<HomeNfcListPage>
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
item['INSPECTED_POINTS'] > 0 ? '巡检中' : '待巡检',
|
item['INSPECTED_POINTS'] > 0 ? '巡检中' : '待巡检',
|
||||||
style: TextStyle(color: item['INSPECTED_POINTS'] as int > 0 ? Colors.blue : Colors.deepOrange, fontSize: 14),
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
item['INSPECTED_POINTS'] as int > 0
|
||||||
|
? Colors.blue
|
||||||
|
: Colors.deepOrange,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -483,7 +506,6 @@ class _HomeNfcListPageState extends State<HomeNfcListPage>
|
||||||
|
|
||||||
/// 构建信息网格
|
/// 构建信息网格
|
||||||
Widget _buildInfoGrid(Map<String, dynamic> item, bool isFinish) {
|
Widget _buildInfoGrid(Map<String, dynamic> item, bool isFinish) {
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|
|
@ -22,9 +22,6 @@ class DangerProjectPage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DangerProjectPageState extends State<DangerProjectPage> {
|
class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
// 单选按钮的值
|
|
||||||
// String? _selectedValue;
|
|
||||||
|
|
||||||
// 单选按钮选项
|
// 单选按钮选项
|
||||||
final List<Map<String, dynamic>> _options = [
|
final List<Map<String, dynamic>> _options = [
|
||||||
{
|
{
|
||||||
|
@ -49,63 +46,53 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
|
|
||||||
List<dynamic> listDates = [];
|
List<dynamic> listDates = [];
|
||||||
List<dynamic> listDatesSelect = [];
|
List<dynamic> listDatesSelect = [];
|
||||||
String unqualifiedInspectionItemID="";
|
String unqualifiedInspectionItemID = "";
|
||||||
Map<String, dynamic> nullResult={};
|
Map<String, dynamic> nullResult = {};
|
||||||
List<dynamic> upDataItemList=[];
|
List<dynamic> upDataItemList = [];
|
||||||
|
|
||||||
String yinHuanText="";
|
String yinHuanText = "";
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
SessionService.instance.setUnqualifiedInspectionItemIDJson("");
|
SessionService.instance.setUnqualifiedInspectionItemIDJson("");
|
||||||
|
|
||||||
_getData();
|
_getData();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _getData(){
|
void _getData() {
|
||||||
listDates.clear();
|
listDates.clear();
|
||||||
switch(widget.type ){
|
switch (widget.type) {
|
||||||
case 1://隐患排查
|
case 1: //隐患排查
|
||||||
_getInvestigationItemsYinHuan();
|
_getInvestigationItemsYinHuan();
|
||||||
break;
|
break;
|
||||||
case 2://标准排查
|
case 2: //标准排查
|
||||||
_getInvestigationItems();
|
_getInvestigationItems();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getInvestigationItemsYinHuan( ) async {
|
Future<void> _getInvestigationItemsYinHuan() async {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
final result = await ApiService.getInvestigationItemsYinHuan(widget.item);
|
final result = await ApiService.getInvestigationItemsYinHuan(widget.item);
|
||||||
if (result['result'] == 'success') {
|
if (result['result'] == 'success') {
|
||||||
final List<dynamic> newList = result['varList'] ?? [];
|
final List<dynamic> newList = result['varList'] ?? [];
|
||||||
final List<dynamic> newListTwo = result['records'] ?? [];
|
final List<dynamic> newListTwo = result['records'] ?? [];
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
||||||
listDates.addAll(newList);
|
listDates.addAll(newList);
|
||||||
|
|
||||||
if(newListTwo.isNotEmpty){
|
if (newListTwo.isNotEmpty) {
|
||||||
listDatesSelect.addAll(newListTwo);
|
listDatesSelect.addAll(newListTwo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < listDates.length; i++) {
|
||||||
// listDatesTwo.addAll(newListTwo);option1
|
if (newListTwo.isNotEmpty) {
|
||||||
for(int i=0;i<listDates.length;i++){
|
for (int m = 0; m < newListTwo.length; m++) {
|
||||||
if(newListTwo.isNotEmpty){
|
if (newListTwo.isNotEmpty && newListTwo[m]["LISTCHECKITEM_ID"] != null) {
|
||||||
for(int m=0;m<newListTwo.length;m++){
|
if (newListTwo[m]["LISTCHECKITEM_ID"] == listDates[i]["LISTCHECKITEM_ID"]) {
|
||||||
if(newListTwo.isNotEmpty&&newListTwo[m]["LISTCHECKITEM_ID"]!=null){
|
if (listDatesSelect.isNotEmpty) {
|
||||||
if( newListTwo[m]["LISTCHECKITEM_ID"]==listDates[i]["LISTCHECKITEM_ID"]){
|
switch (listDatesSelect[m]["ISNORMAL"]) {
|
||||||
|
|
||||||
if(listDatesSelect.isNotEmpty){
|
|
||||||
switch(listDatesSelect[m]["ISNORMAL"] ){
|
|
||||||
case 0:
|
case 0:
|
||||||
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "option1";
|
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "option1";
|
||||||
break;
|
break;
|
||||||
|
@ -116,46 +103,38 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "option3";
|
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "option3";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "";
|
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(listDatesSelect[m].containsKey("HIDDEN_ID")){
|
if (listDatesSelect[m].containsKey("HIDDEN_ID")) {
|
||||||
(listDates[i] as Map<String, dynamic>)["ids"] = listDatesSelect[m]["HIDDEN_ID"];
|
(listDates[i] as Map<String, dynamic>)["ids"] = listDatesSelect[m]["HIDDEN_ID"];
|
||||||
SessionService.instance.setUnqualifiedInspectionItemIDJson(listDatesSelect[m]["HIDDEN_ID"]);
|
SessionService.instance.setUnqualifiedInspectionItemIDJson(listDatesSelect[m]["HIDDEN_ID"]);
|
||||||
}else{
|
} else {
|
||||||
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}else{
|
|
||||||
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
}else{
|
|
||||||
ToastUtil.showNormal(context, result['msg']);
|
ToastUtil.showNormal(context, result['msg']);
|
||||||
// _showMessage('加载数据失败');
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
|
||||||
print('加载数据失败:$e');
|
print('加载数据失败:$e');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getInvestigationItems( ) async {
|
Future<void> _getInvestigationItems() async {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
final result = await ApiService.getInvestigationItems(widget.item);
|
final result = await ApiService.getInvestigationItems(widget.item);
|
||||||
if (result['result'] == 'success') {
|
if (result['result'] == 'success') {
|
||||||
final List<dynamic> newList = result['varList'] ?? [];
|
final List<dynamic> newList = result['varList'] ?? [];
|
||||||
|
@ -163,19 +142,17 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
setState(() {
|
setState(() {
|
||||||
listDates.addAll(newList);
|
listDates.addAll(newList);
|
||||||
|
|
||||||
if(newListTwo.isNotEmpty){
|
if (newListTwo.isNotEmpty) {
|
||||||
listDatesSelect.addAll(newListTwo);
|
listDatesSelect.addAll(newListTwo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < listDates.length; i++) {
|
||||||
for(int i=0;i<listDates.length;i++){
|
if (newListTwo.isNotEmpty) {
|
||||||
if(newListTwo.isNotEmpty){
|
for (int m = 0; m < newListTwo.length; m++) {
|
||||||
for(int m=0;m<newListTwo.length;m++){
|
if (newListTwo.isNotEmpty && newListTwo[m]["CUSTOM_ITEM_ID"] != null) {
|
||||||
if(newListTwo.isNotEmpty&&newListTwo[m]["CUSTOM_ITEM_ID"]!=null){
|
if (newListTwo[m]["CUSTOM_ITEM_ID"] == listDates[i]["CUSTOM_ITEM_ID"]) {
|
||||||
if( newListTwo[m]["CUSTOM_ITEM_ID"]==listDates[i]["CUSTOM_ITEM_ID"]){
|
if (listDatesSelect.isNotEmpty) {
|
||||||
|
switch (listDatesSelect[m]["ISNORMAL"]) {
|
||||||
if(listDatesSelect.isNotEmpty){
|
|
||||||
switch(listDatesSelect[m]["ISNORMAL"] ){
|
|
||||||
case 0:
|
case 0:
|
||||||
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "option1";
|
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "option1";
|
||||||
break;
|
break;
|
||||||
|
@ -186,42 +163,33 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "option3";
|
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "option3";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "";
|
(listDates[i] as Map<String, dynamic>)["REFERENCE_BASIS"] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(listDatesSelect[m].containsKey("HIDDEN_ID")){
|
if (listDatesSelect[m].containsKey("HIDDEN_ID")) {
|
||||||
(listDates[i] as Map<String, dynamic>)["ids"] = listDatesSelect[m]["HIDDEN_ID"];
|
(listDates[i] as Map<String, dynamic>)["ids"] = listDatesSelect[m]["HIDDEN_ID"];
|
||||||
SessionService.instance.setUnqualifiedInspectionItemIDJson(listDatesSelect[m]["HIDDEN_ID"]);
|
SessionService.instance.setUnqualifiedInspectionItemIDJson(listDatesSelect[m]["HIDDEN_ID"]);
|
||||||
}else{
|
} else {
|
||||||
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}else{
|
|
||||||
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
(listDates[i] as Map<String, dynamic>)["ids"] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
}else{
|
|
||||||
ToastUtil.showNormal(context, result['msg']);
|
ToastUtil.showNormal(context, result['msg']);
|
||||||
// _showMessage('加载数据失败');
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
|
||||||
print('加载数据失败:$e');
|
print('加载数据失败:$e');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,29 +201,29 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
backgroundColor: h_backGroundColor(),
|
backgroundColor: h_backGroundColor(),
|
||||||
appBar: MyAppbar(title: "排查项"),
|
appBar: MyAppbar(title: "排查项"),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child:Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: listDates.isEmpty
|
Expanded(
|
||||||
? NoDataWidget.show()
|
child: listDates.isEmpty
|
||||||
: ListView.separated(
|
? NoDataWidget.show()
|
||||||
itemCount: listDates.length,
|
: ListView.separated(
|
||||||
separatorBuilder: (_, __) => const SizedBox(),
|
itemCount: listDates.length,
|
||||||
itemBuilder: (context, index) {
|
separatorBuilder: (_, __) => const SizedBox(),
|
||||||
final item = listDates[index];
|
itemBuilder: (context, index) {
|
||||||
return GestureDetector(
|
final item = listDates[index];
|
||||||
// onTap: () => _selectItem(item),
|
return GestureDetector(
|
||||||
child: _itemCell(screenWidth,item),
|
child: _itemCell(screenWidth, item),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
// 下一步按钮
|
// 下一步按钮
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.only(bottom: 20),
|
margin: const EdgeInsets.only(bottom: 20),
|
||||||
height: 50,
|
height: 50,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.green ,
|
color: Colors.green,
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
boxShadow: [
|
boxShadow: const [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black12,
|
color: Colors.black12,
|
||||||
blurRadius: 6,
|
blurRadius: 6,
|
||||||
|
@ -263,36 +231,30 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child:
|
child: SizedBox(
|
||||||
SizedBox(
|
|
||||||
width: screenWidth - 30,
|
width: screenWidth - 30,
|
||||||
height: 50,
|
height: 50,
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: _submit,//_selectedValue != null ? _submit : null,
|
onPressed: _submit,
|
||||||
child: Text(
|
child: const Text(
|
||||||
"提交",
|
"提交",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
// _itemCell(screenWidth),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _itemCell(final screenWidth, final item) {
|
||||||
|
return Padding(
|
||||||
Widget _itemCell(final screenWidth,final item) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
@ -305,15 +267,15 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
if(widget.type==1)
|
if (widget.type == 1)
|
||||||
Text(
|
Text(
|
||||||
"存在风险:${item["RISK_DESCR"]}",
|
"存在风险:${item["RISK_DESCR"]}",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: Colors.grey[700],
|
color: Colors.grey[700],
|
||||||
height: 1.5,
|
height: 1.5,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
// 问题描述
|
// 问题描述
|
||||||
Text(
|
Text(
|
||||||
"检查内容:${item["CHECK_CONTENT"]}",
|
"检查内容:${item["CHECK_CONTENT"]}",
|
||||||
|
@ -323,21 +285,20 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
height: 1.5,
|
height: 1.5,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if(widget.type==2)
|
if (widget.type == 2)
|
||||||
Text(
|
Text(
|
||||||
"检查标准:${item["CHECK_STANDARD"]}",
|
"检查标准:${item["CHECK_STANDARD"]}",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: Colors.grey[700],
|
color: Colors.grey[700],
|
||||||
height: 1.5,
|
height: 1.5,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
// 单选按钮组
|
// 单选按钮组
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children:
|
children: _options.map((option) {
|
||||||
_options.map((option) {
|
|
||||||
return _buildOptionButton(
|
return _buildOptionButton(
|
||||||
context: context,
|
context: context,
|
||||||
value: option['value'],
|
value: option['value'],
|
||||||
|
@ -347,63 +308,57 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
screenWidth: screenWidth,
|
screenWidth: screenWidth,
|
||||||
item: item,
|
item: item,
|
||||||
onImageTap: () {
|
onImageTap: () {
|
||||||
if(item["REFERENCE_BASIS"]=="option1") {
|
if (item["REFERENCE_BASIS"] == "option1") {
|
||||||
_getAlreadyUpImages(item);
|
_getAlreadyUpImages(item);
|
||||||
}else if(item["REFERENCE_BASIS"]=="option2") {
|
} else if (item["REFERENCE_BASIS"] == "option2") {
|
||||||
_goUnqualifiedPage(item);
|
_goUnqualifiedPage(item);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
|
|
||||||
if(item["REFERENCE_BASIS"]=="option1"&& widget.type==2)
|
if (item["REFERENCE_BASIS"] == "option1" && widget.type == 2)
|
||||||
Card(
|
Card(
|
||||||
color: const Color(0xFFF1F1F1),
|
color: const Color(0xFFF1F1F1),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
padding: EdgeInsets.all(10),
|
padding: const EdgeInsets.all(10),
|
||||||
child: Text(item["CHECK_QUALIFIED"],style:TextStyle(color: Colors.black,fontSize: 12)),
|
child:
|
||||||
)
|
Text(item["CHECK_QUALIFIED"], style: const TextStyle(color: Colors.black, fontSize: 12)),
|
||||||
),
|
)),
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Spacer(),
|
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getAlreadyUpImages(Map item) async {
|
Future<void> _getAlreadyUpImages(Map item) async {
|
||||||
try {
|
try {
|
||||||
final result = await ApiService.getAlreadyUpImages(item["RECORDITEM_ID"]);
|
final result = await ApiService.getAlreadyUpImages(item["RECORDITEM_ID"]);
|
||||||
if (result['result'] == 'success') {
|
if (result['result'] == 'success') {
|
||||||
final List<dynamic> newList = result['imgs'] ?? [];
|
final List<dynamic> newList = result['imgs'] ?? [];
|
||||||
List<PhotoItem> imgList = [];
|
List<PhotoItem> imgList = [];
|
||||||
for (Map item in newList) {
|
for (Map item in newList) {
|
||||||
String id = item['IMGFILES_ID'] ?? '';
|
String id = item['IMGFILES_ID'] ?? '';
|
||||||
String filePath = item['FILEPATH'] ?? '';
|
String filePath = item['FILEPATH'] ?? '';
|
||||||
imgList.add(
|
imgList.add(
|
||||||
PhotoItem(
|
PhotoItem(
|
||||||
id: id, // 新图片没有ID
|
id: id, // 新图片没有ID
|
||||||
filePath: ApiService.baseImgPath+filePath,
|
filePath: ApiService.baseImgPath + filePath,
|
||||||
type: "1",
|
type: "1",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pushPage(DangerImageUpdataPage(item["RECORDITEM_ID"], imgList: imgList), context);
|
pushPage(DangerImageUpdataPage(item["RECORDITEM_ID"], imgList: imgList), context);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.showNormal(context, "加载数据失败");
|
ToastUtil.showNormal(context, "加载数据失败");
|
||||||
// _showMessage('加载数据失败');
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
|
||||||
print('加载数据失败:$e');
|
print('加载数据失败:$e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -425,50 +380,59 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
if(value!="option2") {
|
if (value != "option2") {
|
||||||
SessionService.instance.setUnqualifiedInspectionItemIDJson("");
|
SessionService.instance.setUnqualifiedInspectionItemIDJson("");
|
||||||
// _selectedValue = value;
|
item["REFERENCE_BASIS"] = value;
|
||||||
item["REFERENCE_BASIS"]=value;
|
} else {
|
||||||
}else{
|
|
||||||
_goUnqualifiedPage(item);
|
_goUnqualifiedPage(item);
|
||||||
// pushPage(HazardRegistrationPage(item), context);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: buttonWidth,
|
width: buttonWidth,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
|
// 不要在这里放 Expanded(非 Flex 父组件)
|
||||||
child: Expanded(child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(children: [
|
SizedBox(
|
||||||
Icon(icon, color: isSelected ? color : Colors.grey, size: 30),
|
height: 30,
|
||||||
const SizedBox(width: 8),
|
width: 90,
|
||||||
Text(
|
child: Row(
|
||||||
label,
|
children: [
|
||||||
style: TextStyle(
|
Icon(icon, color: isSelected ? color : Colors.grey, size: 30),
|
||||||
fontSize: 14,
|
const SizedBox(width: 8),
|
||||||
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
Flexible(
|
||||||
color: isSelected ? color : Colors.grey[600],
|
child: Text(
|
||||||
),
|
label,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
||||||
|
color: isSelected ? color : Colors.grey[600],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],),
|
),
|
||||||
if((value=="option1"&&item["REFERENCE_BASIS"]=="option1")||
|
const SizedBox(width: 6),
|
||||||
(value=="option2"&&item["REFERENCE_BASIS"]=="option2"&&item.containsKey("ids")&&item["ids"].toString().isNotEmpty))
|
if ((value == "option1" && item["REFERENCE_BASIS"] == "option1") ||
|
||||||
// 添加图片点击处理
|
(value == "option2" &&
|
||||||
|
item["REFERENCE_BASIS"] == "option2" &&
|
||||||
|
item.containsKey("ids") &&
|
||||||
|
item["ids"].toString().isNotEmpty))
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|
||||||
// 防止事件冒泡到父级 GestureDetector
|
|
||||||
if (onImageTap != null) {
|
if (onImageTap != null) {
|
||||||
onImageTap();
|
onImageTap();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
behavior: HitTestBehavior.opaque, // 确保透明区域也能点击
|
behavior: HitTestBehavior.opaque,
|
||||||
child: Transform.translate(
|
child: Transform.translate(
|
||||||
offset: Offset(0, -6), // Y轴负值向上移动
|
offset: const Offset(0, -6),
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
"assets/images/gantan-blue.png",
|
"assets/images/gantan-blue.png",
|
||||||
width: 15,
|
width: 15,
|
||||||
|
@ -477,220 +441,154 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void _goUnqualifiedPage(item) {
|
void _goUnqualifiedPage(item) {
|
||||||
// String hiddenId=SessionService.instance.unqualifiedInspectionItemID.toString();
|
String hiddenId = item["ids"] ?? "";
|
||||||
String hiddenId=item["ids"];
|
if (hiddenId.isNotEmpty) {
|
||||||
if(hiddenId.isNotEmpty) {
|
switch (widget.type) {
|
||||||
switch(widget.type ){
|
case 1: //隐患排查
|
||||||
case 1://隐患排查
|
_getTemporaryStorageOfHiddenYinHuan(item, hiddenId);
|
||||||
_getTemporaryStorageOfHiddenYinHuan(item,hiddenId);
|
|
||||||
break;
|
break;
|
||||||
case 2://标准排查
|
case 2: //标准排查
|
||||||
_getTemporaryStorageOfHidden(item,hiddenId);
|
_getTemporaryStorageOfHidden(item, hiddenId);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}else{
|
pushPage(
|
||||||
pushPage(HazardRegistrationPage(
|
HazardRegistrationPage(item, nullResult, widget.type, onClose: (String departmentId, String yinHuanText) {
|
||||||
item,nullResult,widget.type,
|
|
||||||
onClose: (String departmentId,String yinHuanText) {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
this.yinHuanText=yinHuanText;
|
this.yinHuanText = yinHuanText;
|
||||||
item["REFERENCE_BASIS"]="option2";
|
item["REFERENCE_BASIS"] = "option2";
|
||||||
// _selectedValue="option2";
|
item["ids"] = departmentId;
|
||||||
// unqualifiedInspectionItemID=departmentId;
|
|
||||||
item["ids"]=departmentId;
|
|
||||||
});
|
});
|
||||||
|
}), context);
|
||||||
},
|
|
||||||
), context);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getTemporaryStorageOfHiddenYinHuan(Map item,String hiddenId) async {
|
Future<void> _getTemporaryStorageOfHiddenYinHuan(Map item, String hiddenId) async {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final result = await ApiService.getTemporaryStorageOfHiddenYinHuan(hiddenId);
|
final result = await ApiService.getTemporaryStorageOfHiddenYinHuan(hiddenId);
|
||||||
if (result['result'] == 'success') {
|
if (result['result'] == 'success') {
|
||||||
try{
|
try {
|
||||||
dynamic pd=result["pd"];
|
dynamic pd = result["pd"];
|
||||||
if(pd["HIDDEN_CATEGORY"]!=null){
|
if (pd["HIDDEN_CATEGORY"] != null) {
|
||||||
if(pd["HIDDEN_CATEGORY"]=='aa0b9abb642146588bc71a12272942db'){
|
if (pd["HIDDEN_CATEGORY"] == 'aa0b9abb642146588bc71a12272942db') {
|
||||||
result["pd"]["HIDDEN_CATEGORY_NAME"]= "技术负责人登记隐患";
|
result["pd"]["HIDDEN_CATEGORY_NAME"] = "技术负责人登记隐患";
|
||||||
}else if(pd["HIDDEN_CATEGORY"]=='355ff0ead356428fa83a01330cfe10c6'){
|
} else if (pd["HIDDEN_CATEGORY"] == '355ff0ead356428fa83a01330cfe10c6') {
|
||||||
result["pd"]["HIDDEN_CATEGORY_NAME"]= "主要负责人登记隐患";
|
result["pd"]["HIDDEN_CATEGORY_NAME"] = "主要负责人登记隐患";
|
||||||
}else if(pd["HIDDEN_CATEGORY"]=='a92911891ea847cc8f4cfac2455170bd'){
|
} else if (pd["HIDDEN_CATEGORY"] == 'a92911891ea847cc8f4cfac2455170bd') {
|
||||||
result["pd"]["HIDDEN_CATEGORY_NAME"]= "其他隐患";
|
result["pd"]["HIDDEN_CATEGORY_NAME"] = "其他隐患";
|
||||||
}else if(pd["HIDDEN_CATEGORY"]=='44f8ce46372d4616a654cd07f1ec9a48'){
|
} else if (pd["HIDDEN_CATEGORY"] == '44f8ce46372d4616a654cd07f1ec9a48') {
|
||||||
result["pd"]["HIDDEN_CATEGORY_NAME"]= "操作负责人登记隐患";
|
result["pd"]["HIDDEN_CATEGORY_NAME"] = "操作负责人登记隐患";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
print('数据获取失败:$e');
|
print('数据获取失败:$e');
|
||||||
}
|
}
|
||||||
|
|
||||||
pushPage(HazardRegistrationPage(
|
pushPage(HazardRegistrationPage(item, result, widget.type, onClose: (String departmentId, String yinHuanText) {
|
||||||
item,result,widget.type,
|
setState(() {
|
||||||
onClose: (String departmentId,String yinHuanText) {
|
this.yinHuanText = yinHuanText;
|
||||||
setState(() {
|
item["REFERENCE_BASIS"] = "option2";
|
||||||
this.yinHuanText=yinHuanText;
|
item["ids"] = departmentId;
|
||||||
item["REFERENCE_BASIS"]="option2";
|
});
|
||||||
// _selectedValue="option2";
|
}), context);
|
||||||
// unqualifiedInspectionItemID=departmentId;
|
|
||||||
item["ids"]=departmentId;
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
), context);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.showNormal(context, "加载数据失败");
|
ToastUtil.showNormal(context, "加载数据失败");
|
||||||
// _showMessage('加载数据失败');
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
|
||||||
print('加载数据失败:$e');
|
print('加载数据失败:$e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getTemporaryStorageOfHidden(Map item,String hiddenId) async {
|
Future<void> _getTemporaryStorageOfHidden(Map item, String hiddenId) async {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final result = await ApiService.getTemporaryStorageOfHidden(hiddenId);
|
final result = await ApiService.getTemporaryStorageOfHidden(hiddenId);
|
||||||
if (result['result'] == 'success') {
|
if (result['result'] == 'success') {
|
||||||
|
pushPage(HazardRegistrationPage(item, result, widget.type, onClose: (String departmentId, String yinHuanText) {
|
||||||
pushPage(HazardRegistrationPage(
|
setState(() {
|
||||||
item,result,widget.type,
|
this.yinHuanText = yinHuanText;
|
||||||
onClose: (String departmentId,String yinHuanText) {
|
item["REFERENCE_BASIS"] = "option2";
|
||||||
setState(() {
|
item["ids"] = departmentId;
|
||||||
this.yinHuanText=yinHuanText;
|
});
|
||||||
item["REFERENCE_BASIS"]="option2";
|
}), context);
|
||||||
// _selectedValue="option2";
|
|
||||||
// unqualifiedInspectionItemID=departmentId;
|
|
||||||
item["ids"]=departmentId;
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
), context);
|
|
||||||
|
|
||||||
// final List<dynamic> newList = result['imgs'] ?? [];
|
|
||||||
// List<PhotoItem> imgList = [];
|
|
||||||
// for (Map item in newList) {
|
|
||||||
// String id = item['IMGFILES_ID'] ?? '';
|
|
||||||
// String filePath = item['FILEPATH'] ?? '';
|
|
||||||
// imgList.add(
|
|
||||||
// PhotoItem(
|
|
||||||
// id: id, // 新图片没有ID
|
|
||||||
// filePath: ApiService.baseImgPath+filePath,
|
|
||||||
// type: "1",
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// pushPage(DangerImageUpdataPage(item["RECORDITEM_ID"], imgList: imgList), context);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.showNormal(context, "加载数据失败");
|
ToastUtil.showNormal(context, "加载数据失败");
|
||||||
// _showMessage('加载数据失败');
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
|
||||||
print('加载数据失败:$e');
|
print('加载数据失败:$e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void _submit() {
|
void _submit() {
|
||||||
// if (_selectedValue == null) return;
|
|
||||||
LoadingDialogHelper.show();
|
LoadingDialogHelper.show();
|
||||||
_submitInvestigationItems();
|
_submitInvestigationItems();
|
||||||
// 这里可以添加导航到下一页的代码
|
|
||||||
// Navigator.push(context, MaterialPageRoute(builder: (_) => NextPage()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<void> _submitInvestigationItems() async {
|
Future<void> _submitInvestigationItems() async {
|
||||||
|
|
||||||
//获取定位
|
|
||||||
Position position = await _determinePosition();
|
Position position = await _determinePosition();
|
||||||
String longitude=position.longitude.toString();
|
String longitude = position.longitude.toString();
|
||||||
String latitude=position.latitude.toString();
|
String latitude = position.latitude.toString();
|
||||||
|
|
||||||
upDataItemList.clear();
|
upDataItemList.clear();
|
||||||
bool hasNoSelectItem=false;
|
bool hasNoSelectItem = false;
|
||||||
String ids="";
|
String ids = "";
|
||||||
for(int i=0;i<listDates.length;i++){
|
for (int i = 0; i < listDates.length; i++) {
|
||||||
final item=listDates[i];
|
final item = listDates[i];
|
||||||
// final itemTwo=listDatesTwo[i];
|
if (item["REFERENCE_BASIS"] == "option1") {
|
||||||
if(item["REFERENCE_BASIS"]=="option1"){
|
upDataItemList.add({
|
||||||
upDataItemList.add( {
|
|
||||||
"CUSTOM_ITEM_ID": item["CUSTOM_ITEM_ID"],
|
"CUSTOM_ITEM_ID": item["CUSTOM_ITEM_ID"],
|
||||||
"LISTCHECKITEM_ID": item["LISTCHECKITEM_ID"],
|
"LISTCHECKITEM_ID": item["LISTCHECKITEM_ID"],
|
||||||
|
|
||||||
"RECORDITEM_ID": item["RECORDITEM_ID"],
|
"RECORDITEM_ID": item["RECORDITEM_ID"],
|
||||||
"ISNORMAL": "0",
|
"ISNORMAL": "0",
|
||||||
"CHECK_RESULT": item["CHECK_QUALIFIED"],
|
"CHECK_RESULT": item["CHECK_QUALIFIED"],
|
||||||
});
|
});
|
||||||
}else if(item["REFERENCE_BASIS"]=="option2"){
|
} else if (item["REFERENCE_BASIS"] == "option2") {
|
||||||
upDataItemList.add( {
|
upDataItemList.add({
|
||||||
"CUSTOM_ITEM_ID": item["CUSTOM_ITEM_ID"],
|
"CUSTOM_ITEM_ID": item["CUSTOM_ITEM_ID"],
|
||||||
"LISTCHECKITEM_ID": item["LISTCHECKITEM_ID"],
|
"LISTCHECKITEM_ID": item["LISTCHECKITEM_ID"],
|
||||||
|
|
||||||
"RECORDITEM_ID": item["RECORDITEM_ID"],
|
"RECORDITEM_ID": item["RECORDITEM_ID"],
|
||||||
"ISNORMAL": "1",
|
"ISNORMAL": "1",
|
||||||
"CHECK_RESULT":yinHuanText.isNotEmpty?yinHuanText:item["CHECK_QUALIFIED"],
|
"CHECK_RESULT": yinHuanText.isNotEmpty ? yinHuanText : item["CHECK_QUALIFIED"],
|
||||||
});
|
});
|
||||||
// upDataItemList.add(UpDataItem.fromJson(itemTwo["CUSTOM_ITEM_ID"], itemTwo["CUSTOM_ITEM_ID"], "1",
|
} else if (item["REFERENCE_BASIS"] == "option3") {
|
||||||
// yinHuanText.isNotEmpty?yinHuanText:item["CHECK_QUALIFIED"]));
|
upDataItemList.add({
|
||||||
}else if(item["REFERENCE_BASIS"]=="option3"){
|
|
||||||
upDataItemList.add( {
|
|
||||||
"CUSTOM_ITEM_ID": item["CUSTOM_ITEM_ID"],
|
"CUSTOM_ITEM_ID": item["CUSTOM_ITEM_ID"],
|
||||||
"LISTCHECKITEM_ID": item["LISTCHECKITEM_ID"],
|
"LISTCHECKITEM_ID": item["LISTCHECKITEM_ID"],
|
||||||
|
|
||||||
"RECORDITEM_ID": item["RECORDITEM_ID"],
|
"RECORDITEM_ID": item["RECORDITEM_ID"],
|
||||||
"ISNORMAL": "2",
|
"ISNORMAL": "2",
|
||||||
"CHECK_RESULT":"",
|
"CHECK_RESULT": "",
|
||||||
});
|
});
|
||||||
// upDataItemList.add(UpDataItem.fromJson(itemTwo["CUSTOM_ITEM_ID"], itemTwo["CUSTOM_ITEM_ID"], "2", ""));
|
} else {
|
||||||
}else{
|
hasNoSelectItem = true;
|
||||||
hasNoSelectItem=true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(item["ids"].toString().isNotEmpty) {
|
if (item["ids"].toString().isNotEmpty) {
|
||||||
if (ids.isEmpty) {
|
if (ids.isEmpty) {
|
||||||
ids = item["ids"];
|
ids = item["ids"];
|
||||||
} else {
|
} else {
|
||||||
ids = "$ids," + item["ids"];
|
ids = "$ids," + item["ids"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasNoSelectItem){
|
if (hasNoSelectItem) {
|
||||||
ToastUtil.showNormal(context, "还有位选择的排查项");
|
ToastUtil.showNormal(context, "还有位选择的排查项");
|
||||||
LoadingDialogHelper.hide();
|
LoadingDialogHelper.hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String itemsString= jsonEncode(upDataItemList);
|
String itemsString = jsonEncode(upDataItemList);
|
||||||
String CHECKRECORD_ID= widget.checkrecordId?? "";
|
String CHECKRECORD_ID = widget.checkrecordId ?? "";
|
||||||
try {
|
try {
|
||||||
|
|
||||||
final Map<String, dynamic> result;
|
final Map<String, dynamic> result;
|
||||||
if(widget.type==1){
|
if (widget.type == 1) {
|
||||||
result = await ApiService.submitInvestigationItemsYinHuan(
|
result = await ApiService.submitInvestigationItemsYinHuan(widget.item, longitude, latitude, itemsString, ids, CHECKRECORD_ID);
|
||||||
widget.item,longitude,latitude,itemsString,ids,CHECKRECORD_ID);
|
} else {
|
||||||
}else{
|
result = await ApiService.submitInvestigationItems(widget.item, longitude, latitude, itemsString, ids, CHECKRECORD_ID);
|
||||||
result = await ApiService.submitInvestigationItems(
|
|
||||||
widget.item,longitude,latitude,itemsString,ids,CHECKRECORD_ID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result['result'] == 'success') {
|
if (result['result'] == 'success') {
|
||||||
|
@ -699,16 +597,12 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
LoadingDialogHelper.hide();
|
LoadingDialogHelper.hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.showNormal(context, "加载数据失败");
|
ToastUtil.showNormal(context, "加载数据失败");
|
||||||
LoadingDialogHelper.hide();
|
LoadingDialogHelper.hide();
|
||||||
// _showMessage('加载数据失败');
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
LoadingDialogHelper.hide();
|
LoadingDialogHelper.hide();
|
||||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
|
||||||
print('加载数据失败:$e');
|
print('加载数据失败:$e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -717,13 +611,11 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
bool serviceEnabled;
|
bool serviceEnabled;
|
||||||
LocationPermission permission;
|
LocationPermission permission;
|
||||||
|
|
||||||
// 检查定位服务是否启用
|
|
||||||
serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||||
if (!serviceEnabled) {
|
if (!serviceEnabled) {
|
||||||
return Future.error('Location services are disabled.');
|
return Future.error('Location services are disabled.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取权限
|
|
||||||
permission = await Geolocator.checkPermission();
|
permission = await Geolocator.checkPermission();
|
||||||
if (permission == LocationPermission.denied) {
|
if (permission == LocationPermission.denied) {
|
||||||
permission = await Geolocator.requestPermission();
|
permission = await Geolocator.requestPermission();
|
||||||
|
@ -733,11 +625,9 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (permission == LocationPermission.deniedForever) {
|
if (permission == LocationPermission.deniedForever) {
|
||||||
return Future.error(
|
return Future.error('Location permissions are permanently denied, we cannot request permissions.');
|
||||||
'Location permissions are permanently denied, we cannot request permissions.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取当前位置
|
|
||||||
return await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
|
return await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -745,11 +635,8 @@ class _DangerProjectPageState extends State<DangerProjectPage> {
|
||||||
if (text.length <= maxLength) return text;
|
if (text.length <= maxLength) return text;
|
||||||
return '${text.substring(0, maxLength)}...';
|
return '${text.substring(0, maxLength)}...';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 模拟数据模版
|
// 模拟数据模版
|
||||||
class UpDataItem {
|
class UpDataItem {
|
||||||
final String CUSTOM_ITEM_ID;
|
final String CUSTOM_ITEM_ID;
|
||||||
|
@ -757,24 +644,9 @@ class UpDataItem {
|
||||||
final String ISNORMAL;
|
final String ISNORMAL;
|
||||||
final String CHECK_RESULT;
|
final String CHECK_RESULT;
|
||||||
|
|
||||||
UpDataItem(
|
UpDataItem(this.CUSTOM_ITEM_ID, this.RECORDITEM_ID, this.ISNORMAL, this.CHECK_RESULT);
|
||||||
this.CUSTOM_ITEM_ID,
|
|
||||||
this.RECORDITEM_ID,
|
|
||||||
this.ISNORMAL,
|
|
||||||
this.CHECK_RESULT,
|
|
||||||
);
|
|
||||||
|
|
||||||
factory UpDataItem.fromJson(
|
factory UpDataItem.fromJson(String CUSTOM_ITEM_ID, String RECORDITEM_ID, String ISNORMAL, String CHECK_RESULT) {
|
||||||
String CUSTOM_ITEM_ID,
|
return UpDataItem(CUSTOM_ITEM_ID, RECORDITEM_ID, ISNORMAL, CHECK_RESULT);
|
||||||
String RECORDITEM_ID,
|
|
||||||
String ISNORMAL,
|
|
||||||
String CHECK_RESULT,
|
|
||||||
) {
|
|
||||||
return UpDataItem(
|
|
||||||
CUSTOM_ITEM_ID, // 直接传递参数,不使用命名参数语法
|
|
||||||
RECORDITEM_ID,
|
|
||||||
ISNORMAL,
|
|
||||||
CHECK_RESULT,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,42 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:qhd_prevention/customWidget/toast_util.dart';
|
||||||
|
import 'package:qhd_prevention/http/ApiService.dart';
|
||||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||||
|
|
||||||
import '../../tools/tools.dart';
|
import '../../tools/tools.dart';
|
||||||
import 'mine_sign_page.dart';
|
import 'mine_sign_page.dart';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FirstSignPage extends StatefulWidget {
|
class FirstSignPage extends StatefulWidget {
|
||||||
const FirstSignPage({super.key});
|
const FirstSignPage({super.key});
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<FirstSignPage> createState() => _SignatureUpdatePageState();
|
State<FirstSignPage> createState() => _SignatureUpdatePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SignatureUpdatePageState extends State<FirstSignPage> {
|
class _SignatureUpdatePageState extends State<FirstSignPage> {
|
||||||
String imagePath="";
|
String imagePath = "";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Future<void> refreshSign() async {
|
||||||
|
if (imagePath.isEmpty) {
|
||||||
|
ToastUtil.showNormal(context, '请签字');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LoadingDialogHelper.show();
|
||||||
|
final result = await ApiService.refreshSignInfo(imagePath);
|
||||||
|
LoadingDialogHelper.hide();
|
||||||
|
if (result['result'] == 'success') {
|
||||||
|
ToastUtil.showSuccess(context, '保存成功');
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: MyAppbar(title: "更新签字信息"),
|
appBar: MyAppbar(title: "更新签字信息"),
|
||||||
body:
|
body: Container(
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.all(16),
|
margin: EdgeInsets.all(16),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
@ -36,7 +44,7 @@ class _SignatureUpdatePageState extends State<FirstSignPage> {
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text("用户",style: TextStyle(color: Colors.black,fontSize: 16)),
|
Text("用户", style: TextStyle(color: Colors.black, fontSize: 16)),
|
||||||
_buildConfirmButton(),
|
_buildConfirmButton(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -45,7 +53,8 @@ class _SignatureUpdatePageState extends State<FirstSignPage> {
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
if (imagePath.isNotEmpty)
|
if (imagePath.isNotEmpty)
|
||||||
Text('签字照片:',
|
Text(
|
||||||
|
'签字照片:',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
@ -54,8 +63,12 @@ class _SignatureUpdatePageState extends State<FirstSignPage> {
|
||||||
),
|
),
|
||||||
const SizedBox(width: 15),
|
const SizedBox(width: 15),
|
||||||
if (imagePath.isNotEmpty)
|
if (imagePath.isNotEmpty)
|
||||||
Image.file(File(imagePath),width: 230,height: 150,fit: BoxFit.cover,),
|
Image.file(
|
||||||
|
File(imagePath),
|
||||||
|
width: 230,
|
||||||
|
height: 150,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -66,19 +79,23 @@ class _SignatureUpdatePageState extends State<FirstSignPage> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Widget _buildTrueButton() {
|
||||||
|
return Center(
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
refreshSign();
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: const Color(0xFF4285F4),
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 80),
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
|
),
|
||||||
|
child: Text('确认', style: TextStyle(fontSize: 14, color: Colors.white)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
Widget _buildConfirmButton() {
|
Widget _buildConfirmButton() {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 80,
|
width: 80,
|
||||||
|
@ -97,14 +114,11 @@ class _SignatureUpdatePageState extends State<FirstSignPage> {
|
||||||
setState(() {
|
setState(() {
|
||||||
imagePath = path ?? '';
|
imagePath = path ?? '';
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: const Color(0xFF4285F4),
|
backgroundColor: const Color(0xFF4285F4),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 5),
|
padding: const EdgeInsets.symmetric(vertical: 5),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'手写签字',
|
'手写签字',
|
||||||
|
@ -116,27 +130,3 @@ class _SignatureUpdatePageState extends State<FirstSignPage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Widget _buildTrueButton() {
|
|
||||||
return Center(
|
|
||||||
|
|
||||||
child: ElevatedButton(
|
|
||||||
onPressed: () {
|
|
||||||
|
|
||||||
},
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: const Color(0xFF4285F4),
|
|
||||||
padding: const EdgeInsets.symmetric(vertical:5,horizontal: 80),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'确认',
|
|
||||||
style: TextStyle(fontSize: 14, color: Colors.white),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue