Merge remote-tracking branch 'origin/main'
commit
fa4b765565
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/customWidget/toast_util.dart';
|
||||
|
||||
import '../http/ApiService.dart';
|
||||
import '../tools/tools.dart';
|
||||
|
@ -365,4 +366,77 @@ class ListItemFactory {
|
|||
}
|
||||
|
||||
|
||||
/// 分类头部
|
||||
static Widget createYesNoSectionTwo({
|
||||
required String title,
|
||||
required String yesLabel,
|
||||
required String noLabel,
|
||||
required bool groupValue,
|
||||
required bool canClick,
|
||||
required BuildContext context,
|
||||
required ValueChanged<bool> onChanged,
|
||||
double verticalPadding = 15,
|
||||
double horizontalPadding = 10,
|
||||
}) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: 0, right: horizontalPadding, left: horizontalPadding, bottom: verticalPadding),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Radio<bool>(
|
||||
activeColor: Colors.blue,
|
||||
value: true,
|
||||
groupValue: groupValue,
|
||||
onChanged:(val) {
|
||||
if(canClick){
|
||||
onChanged(val!);
|
||||
}else{
|
||||
ToastUtil.showNormal(context, "重大隐患不允许选此项");
|
||||
}
|
||||
}
|
||||
// (val) => onChanged(val!),
|
||||
),
|
||||
Text(yesLabel),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Row(
|
||||
children: [
|
||||
Radio<bool>(
|
||||
activeColor: Colors.blue,
|
||||
value: false,
|
||||
groupValue: groupValue,
|
||||
onChanged: (val) => onChanged(val!),
|
||||
),
|
||||
Text(noLabel),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class BottomPickerTwo {
|
|||
double height = 250,
|
||||
}) {
|
||||
// 当前选中项
|
||||
T selected = items[initialIndex];
|
||||
dynamic selected = items[initialIndex];
|
||||
|
||||
return showModalBottomSheet<T>(
|
||||
context: context,
|
||||
|
@ -55,7 +55,7 @@ class BottomPickerTwo {
|
|||
child: const Text('取消'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(selected),
|
||||
onPressed: () => Navigator.of(ctx).pop(selected["NAME"]),
|
||||
child: const Text('确定'),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -42,6 +42,7 @@ class DepartmentPickerHiddenType extends StatefulWidget {
|
|||
class _DepartmentPickerHiddenTypeState
|
||||
extends State<DepartmentPickerHiddenType> {
|
||||
String selectedId = '';
|
||||
String selectedName = '';
|
||||
Set<String> expandedSet = {};
|
||||
List<Category> original = [];
|
||||
List<Category> filtered = [];
|
||||
|
|
|
@ -0,0 +1,226 @@
|
|||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/customWidget/search_bar_widget.dart';
|
||||
import 'package:qhd_prevention/http/ApiService.dart';
|
||||
import '../tools/tools.dart'; // 包含 SessionService
|
||||
|
||||
// 数据模型
|
||||
class Category {
|
||||
final String id;
|
||||
final String name;
|
||||
final String pdId;
|
||||
final List<Category> children;
|
||||
|
||||
Category({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.pdId,
|
||||
this.children = const [],
|
||||
});
|
||||
|
||||
factory Category.fromJson(Map<String, dynamic> json) {
|
||||
return Category(
|
||||
id: json['id'] as String,
|
||||
name: json['name'] as String,
|
||||
pdId: json['PARENT_ID'] as String,
|
||||
children: (json['children'] as List<dynamic>)
|
||||
.map((e) => Category.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 弹窗回调签名:返回选中项的 id 和 name
|
||||
typedef DeptSelectCallback = void Function(String id, String name,String pdId);
|
||||
|
||||
class DepartmentPickerTwo extends StatefulWidget {
|
||||
/// 回调,返回选中部门 id 与 name
|
||||
final DeptSelectCallback onSelected;
|
||||
|
||||
const DepartmentPickerTwo({Key? key, required this.onSelected}) : super(key: key);
|
||||
|
||||
@override
|
||||
_DepartmentPickerTwoState createState() => _DepartmentPickerTwoState();
|
||||
}
|
||||
|
||||
class _DepartmentPickerTwoState extends State<DepartmentPickerTwo> {
|
||||
String selectedId = '';
|
||||
String selectedPDId = '';
|
||||
String selectedName = '';
|
||||
Set<String> expandedSet = {};
|
||||
|
||||
List<Category> original = [];
|
||||
List<Category> filtered = [];
|
||||
bool loading = true;
|
||||
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// 初始均为空
|
||||
selectedId = '';
|
||||
selectedName = '';
|
||||
selectedPDId = '';
|
||||
expandedSet = {};
|
||||
_searchController.addListener(_onSearchChanged);
|
||||
_loadData();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_searchController.removeListener(_onSearchChanged);
|
||||
_searchController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _loadData() async {
|
||||
try {
|
||||
List<dynamic> raw;
|
||||
if (SessionService.instance.departmentJsonStr?.isNotEmpty ?? false) {
|
||||
raw = json.decode(SessionService.instance.departmentJsonStr!) as List<dynamic>;
|
||||
} else {
|
||||
final result = await ApiService.getHiddenTreatmentListTree();
|
||||
final String nodes = result['zTreeNodes'] as String;
|
||||
SessionService.instance.departmentJsonStr = nodes;
|
||||
raw = json.decode(nodes) as List<dynamic>;
|
||||
}
|
||||
setState(() {
|
||||
original = raw.map((e) => Category.fromJson(e as Map<String, dynamic>)).toList();
|
||||
filtered = original;
|
||||
loading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() => loading = false);
|
||||
}
|
||||
}
|
||||
|
||||
void _onSearchChanged() {
|
||||
final query = _searchController.text.toLowerCase().trim();
|
||||
setState(() {
|
||||
filtered = query.isEmpty ? original : _filterCategories(original, query);
|
||||
});
|
||||
}
|
||||
|
||||
List<Category> _filterCategories(List<Category> list, String query) {
|
||||
List<Category> result = [];
|
||||
for (var cat in list) {
|
||||
final children = _filterCategories(cat.children, query);
|
||||
if (cat.name.toLowerCase().contains(query) || children.isNotEmpty) {
|
||||
result.add(Category(id: cat.id, name: cat.name,pdId:cat.pdId, children: children));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Widget _buildRow(Category cat, int indent) {
|
||||
final hasChildren = cat.children.isNotEmpty;
|
||||
final isExpanded = expandedSet.contains(cat.id);
|
||||
final isSelected = cat.id == selectedId;
|
||||
return Column(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (hasChildren) {
|
||||
isExpanded ? expandedSet.remove(cat.id) : expandedSet.add(cat.id);
|
||||
selectedPDId=cat.pdId;
|
||||
}else{
|
||||
selectedPDId=cat.id;
|
||||
}
|
||||
selectedId = cat.id;
|
||||
selectedName = cat.name;
|
||||
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 16.0 * indent),
|
||||
SizedBox(
|
||||
width: 24,
|
||||
child: hasChildren
|
||||
? Icon(isExpanded ? Icons.arrow_drop_down_rounded : Icons.arrow_right_rounded,
|
||||
size: 35, color: Colors.grey[600])
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: Text(cat.name),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Icon(
|
||||
isSelected ? Icons.radio_button_checked : Icons.radio_button_unchecked,
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (hasChildren && isExpanded)
|
||||
...cat.children.map((c) => _buildRow(c, indent + 1)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height * 0.7,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: const Text('取消', style: TextStyle(fontSize: 16)),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: SearchBarWidget(
|
||||
controller: _searchController,
|
||||
isShowSearchButton: false,
|
||||
onSearch: (keyboard) {
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
widget.onSelected(selectedId, selectedName,selectedPDId);
|
||||
},
|
||||
child: const Text('确定', style: TextStyle(fontSize: 16, color: Colors.green)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Expanded(
|
||||
child: loading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: Container(
|
||||
color: Colors.white,
|
||||
child: ListView.builder(
|
||||
itemCount: filtered.length,
|
||||
itemBuilder: (ctx, idx) => _buildRow(filtered[idx], 0),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ class ApiService {
|
|||
// static const String basePath = "http://192.168.0.25:28199/";
|
||||
// static const String basePath = "http://192.168.20.240:8500/integrated_whb";
|
||||
// static const String baseFacePath = "http://192.168.0.25:38199/";
|
||||
// 人脸识别服务
|
||||
// ///人脸识别服务
|
||||
// static const String baseFacePath = "https://qaaqwh.qhdsafety.com/whb_stu_face/";
|
||||
|
||||
// static const String basePath = "https://qaaqwh.qhdsafety.com/integrated_whb/";
|
||||
|
@ -855,7 +855,7 @@ U6Hzm1ninpWeE+awIDAQAB
|
|||
final fileName = file.path.split(Platform.pathSeparator).last;
|
||||
return HttpManager().uploadFaceImage(
|
||||
baseUrl: basePath,
|
||||
path: '/app/feedback/upload',
|
||||
path: '/app/imgfiles/add',
|
||||
fromData: {
|
||||
'FOREIGN_KEY': id,
|
||||
'TYPE': type,
|
||||
|
@ -870,6 +870,28 @@ U6Hzm1ninpWeE+awIDAQAB
|
|||
);
|
||||
}
|
||||
|
||||
/// ai识别图片隐患
|
||||
static Future<Map<String, dynamic>> identifyImg(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/hidden/identifyImg',
|
||||
fromData: {
|
||||
'CORPINFO_ID': SessionService.instance.corpinfoId,
|
||||
'USER_ID': SessionService.instance.loginUserId,
|
||||
'FFILE': await MultipartFile.fromFile(
|
||||
file.path,
|
||||
filename: fileName
|
||||
),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/// 修改密码
|
||||
static Future<Map<String, dynamic>> changePassWord(String oldPwd,String confirmPwd) {
|
||||
return HttpManager().request(
|
||||
|
@ -1447,6 +1469,140 @@ U6Hzm1ninpWeE+awIDAQAB
|
|||
);
|
||||
}
|
||||
|
||||
/// 上传隐患快报
|
||||
static Future<Map<String, dynamic>> addRiskListCheckApp(
|
||||
String hazardDescription,String partDescription,String latitude,String longitude,
|
||||
String dangerDetail,String dataTime,String type,String responsibleId,
|
||||
String yinHuanTypeIds,String hazardLeve,String buMenId,String buMenPDId,
|
||||
String yinHuanTypeNames,String hiddenType1,String hiddenType2,String hiddenType3,) {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/app/hidden/riskListCheckAppAdd',
|
||||
method: Method.post,
|
||||
data: {
|
||||
"HIDDEN_ID": "",
|
||||
"SOURCE": '1',
|
||||
"HIDDENDESCR": hazardDescription,
|
||||
"HIDDENPART": partDescription,
|
||||
"LATITUDE": latitude,
|
||||
"LONGITUDE": longitude,
|
||||
|
||||
"RECTIFYDESCR": dangerDetail,
|
||||
"RECTIFICATIONDEADLINE": dataTime,
|
||||
"RECTIFICATIONTYPE": type,
|
||||
"RECTIFICATIONOR": responsibleId,
|
||||
|
||||
"HIDDENTYPE": yinHuanTypeIds,
|
||||
"HIDDENLEVEL":hazardLeve,
|
||||
"RECTIFICATIONDEPT": buMenId,
|
||||
"HIDDENFINDDEPT": buMenPDId.isNotEmpty?buMenPDId:buMenId,
|
||||
|
||||
"CREATOR": SessionService.instance.loginUserId,
|
||||
"HIDDENTYPE_NAME": yinHuanTypeNames,
|
||||
"HIDDENTYPE1": hiddenType1 ,
|
||||
"HIDDENTYPE2": hiddenType2 ,
|
||||
"HIDDENTYPE3": hiddenType3 ,
|
||||
"CORPINFO_ID": SessionService.instance.corpinfoId,
|
||||
"USER_ID": SessionService.instance.loginUserId,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 提交隐患验收接口
|
||||
static Future<Map<String, dynamic>> addHazardAcceptance(String type,String miaoshu,String dataTime,String id) {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/app/hidden/riskListCheckInspection',
|
||||
method: Method.post,
|
||||
data: {
|
||||
"ISQUALIFIED": type,
|
||||
"CHECKDESCR": miaoshu,
|
||||
"CHECK_TIME": dataTime,
|
||||
"HIDDEN_ID": id,
|
||||
"CHECKOR": SessionService.instance.loginUserId,
|
||||
"CORPINFO_ID": SessionService.instance.corpinfoId,
|
||||
"USER_ID": SessionService.instance.loginUserId,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 隐患检查列表
|
||||
static Future<Map<String, dynamic>> getHazardInspectionRecordList(
|
||||
int currentPage,String keyWord,String id,String dept,
|
||||
String starDate,String endDate,String periodId,String userName,String typeId,) {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/app/listmanager/recordList?showCount=-1¤tPage=$currentPage',
|
||||
method: Method.post,
|
||||
data: {
|
||||
"DEPARTMENT_ID": id,
|
||||
"DEPT_ID": dept,
|
||||
"STARTTIME": starDate,
|
||||
"ENDTIME": endDate,
|
||||
"PERIOD": periodId,
|
||||
"USERNAME": userName,
|
||||
"TYPE": typeId,
|
||||
"tm": DateTime.now().millisecondsSinceEpoch.toString(),
|
||||
"KEYWORDS": keyWord, //关键字模糊查询
|
||||
"CORPINFO_ID": SessionService.instance.corpinfoId,
|
||||
"USER_ID": SessionService.instance.loginUserId,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 标准排查列表
|
||||
static Future<Map<String, dynamic>> getStandardInvestigationRecordList(
|
||||
int currentPage,String keyWord,String id,String dept,
|
||||
String starDate,String endDate,String periodId,String userName,String typeId,) {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/app/hiddenDangerCheckStandardCustom/recordList?showCount=-1¤tPage=$currentPage',
|
||||
method: Method.post,
|
||||
data: {
|
||||
"DEPARTMENT_ID": id,
|
||||
"DEPT_ID": dept,
|
||||
"STARTTIME": starDate,
|
||||
"ENDTIME": endDate,
|
||||
"PERIOD": periodId,
|
||||
"USERNAME": userName,
|
||||
"TYPE": typeId,
|
||||
"tm": DateTime.now().millisecondsSinceEpoch.toString(),
|
||||
"KEYWORDS": keyWord, //关键字模糊查询
|
||||
"CORPINFO_ID": SessionService.instance.corpinfoId,
|
||||
"USER_ID": SessionService.instance.loginUserId,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 获取清单类型
|
||||
static Future<Map<String, dynamic>> getListType() {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/dictionaries/getLevels?tm=${DateTime.now().millisecondsSinceEpoch.toString()}',
|
||||
method: Method.post,
|
||||
data: {
|
||||
"DICTIONARIES_ID": '4a3d0d99b0ea4e268c11dd0b18866917',
|
||||
"CORPINFO_ID": SessionService.instance.corpinfoId,
|
||||
"USER_ID": SessionService.instance.loginUserId,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 获取清单类型
|
||||
static Future<Map<String, dynamic>> getListInspectionCycle() {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/dictionaries/getLevels?tm=${DateTime.now().millisecondsSinceEpoch.toString()}',
|
||||
method: Method.post,
|
||||
data: {
|
||||
"DICTIONARIES_ID": 'f60cf0e8315b4993b6d6049dd29f2ba5',
|
||||
"CORPINFO_ID": SessionService.instance.corpinfoId,
|
||||
"USER_ID": SessionService.instance.loginUserId,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import 'package:flutter/material.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_list_page.dart';
|
||||
import 'package:qhd_prevention/pages/app/Danger_paicha/custom_record_drawer.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'package:qhd_prevention/tools/h_colors.dart';
|
||||
import 'package:qhd_prevention/tools/tools.dart';
|
||||
|
||||
import '../../../Model/list_model.dart';
|
||||
|
@ -10,24 +13,65 @@ import '../../../customWidget/danner_repain_item.dart';
|
|||
import '../../home/scan_page.dart';
|
||||
|
||||
class CheckRecordPage extends StatefulWidget {
|
||||
const CheckRecordPage({super.key});
|
||||
const CheckRecordPage(this.type, {super.key});
|
||||
|
||||
final int type;
|
||||
@override
|
||||
State<CheckRecordPage> createState() => _CheckRecordPageState();
|
||||
}
|
||||
|
||||
class _CheckRecordPageState extends State<CheckRecordPage> {
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
final List<RecordCheckModel> _notifications = List.generate(10, (i) {
|
||||
bool read = i % 3 == 0;
|
||||
String title = '测试数据标题标题 ${i + 1}';
|
||||
String time = '2025-06-${10 + i} 12:3${i}';
|
||||
return RecordCheckModel(title, time);
|
||||
});
|
||||
|
||||
String appBarTitle="";
|
||||
String id="";
|
||||
int _page = 1;
|
||||
String searchKey="";
|
||||
int _totalPage=1;
|
||||
List<dynamic> _list = [];
|
||||
bool _isLoading = false;
|
||||
bool _hasMore = true;
|
||||
|
||||
List<dynamic> listType = [];
|
||||
List<dynamic> listInspectionCycle = [];
|
||||
|
||||
|
||||
|
||||
void _handleItemTap(RecordCheckModel model) {
|
||||
//item点击事件
|
||||
pushPage(CheckRecordListPage(), context);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
id=SessionService.instance.loginUser?["DEPARTMENT_ID"]??"";
|
||||
print("======>$id");
|
||||
getListData(false,"");
|
||||
_getListType();
|
||||
_getListInspectionCycle();
|
||||
SessionService.instance.setCustomRecordDangerJson("");
|
||||
|
||||
}
|
||||
|
||||
|
||||
void getListData(bool addList,String keyWord){
|
||||
switch(widget.type ){
|
||||
case 1://检查记录
|
||||
appBarTitle="检查记录";
|
||||
_getHazardInspectionRecordList(_page,keyWord,"","","","","","",addList);
|
||||
|
||||
break;
|
||||
case 2://标准排查清单
|
||||
appBarTitle="标准排查清单";
|
||||
_getStandardInvestigationRecordList(_page,keyWord,"","","","","","",addList);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 取屏幕宽度
|
||||
|
@ -38,7 +82,7 @@ class _CheckRecordPageState extends State<CheckRecordPage> {
|
|||
key: _scaffoldKey, // ② 绑定 key
|
||||
|
||||
appBar: MyAppbar(
|
||||
title: "清单检查记录",
|
||||
title: appBarTitle,
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
|
@ -51,57 +95,246 @@ class _CheckRecordPageState extends State<CheckRecordPage> {
|
|||
),
|
||||
],
|
||||
),
|
||||
|
||||
endDrawer: Drawer(
|
||||
// 用 Container 限制宽度为屏幕的 3/5
|
||||
child: Container(
|
||||
width: screenWidth * 3 / 5,
|
||||
color: Colors.white,
|
||||
child: const CustomRecordDrawer(),
|
||||
child: CustomRecordDrawer(
|
||||
listType,listInspectionCycle,
|
||||
onClose: (String departmentId,String responsibleName,String selectedQDTypeId,String selectedZQTimeId
|
||||
,String startDate,String endDate) {
|
||||
|
||||
_page=1;
|
||||
switch(widget.type ){
|
||||
case 1://检查记录
|
||||
_getHazardInspectionRecordList(_page,searchKey,departmentId,startDate,endDate,selectedZQTimeId,responsibleName,selectedQDTypeId,false);
|
||||
|
||||
break;
|
||||
case 2://标准排查清单
|
||||
// _getStandardInvestigationRecordList(_page,searchKey,departmentId,startDate,endDate,selectedZQTimeId,responsibleName,selectedQDTypeId,false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
),
|
||||
),
|
||||
),
|
||||
body: SafeArea(child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(15),
|
||||
color: Colors.white,
|
||||
|
||||
|
||||
body: SafeArea(
|
||||
child: NotificationListener<ScrollNotification>(
|
||||
onNotification: _onScroll,
|
||||
child:_vcDetailWidget()
|
||||
)
|
||||
),
|
||||
// backgroundColor: Colors.white,
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
Widget _vcDetailWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: SearchBarWidget(
|
||||
controller: _searchController,
|
||||
autoFocus: true,
|
||||
onSearch: (keyboard) {
|
||||
// 输入请求接口
|
||||
_page=1;
|
||||
searchKey=keyboard;
|
||||
getListData(false,keyboard);
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
),
|
||||
|
||||
child: ListView.separated(
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
itemCount: _notifications.length,
|
||||
separatorBuilder: (_, __) => const SizedBox(),
|
||||
itemBuilder: (context, index) {
|
||||
RecordCheckModel item = _notifications[index];
|
||||
return GestureDetector(
|
||||
onTap: () => _handleItemTap(item),
|
||||
child: DannerRepainItem(
|
||||
showTitleIcon: false,
|
||||
title: '测试--------new',
|
||||
details: [
|
||||
'清单类型:测试',
|
||||
'排查周期:测试',
|
||||
'包含检查项:3',
|
||||
'',
|
||||
'起始时间:2025-6-20------',
|
||||
'测试',"ccccc",'sssss'
|
||||
],
|
||||
showBottomTags: false,
|
||||
Container(
|
||||
height: 5,
|
||||
color: h_backGroundColor(),
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
Expanded(
|
||||
|
||||
],
|
||||
)),
|
||||
child:_list.isEmpty
|
||||
? NoDataWidget.show()
|
||||
: ListView.separated(
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
itemCount: _list.length,
|
||||
separatorBuilder: (_, __) => const SizedBox(),
|
||||
itemBuilder: (context, index) {
|
||||
final item = _list[index];
|
||||
return GestureDetector(
|
||||
onTap: () => _handleItemTap(item),
|
||||
child: DannerRepainItem(
|
||||
showTitleIcon: true,
|
||||
title: '清单名称:${item['NAME']}',
|
||||
details: [
|
||||
'清单类型:${item['TYPENAME']}',
|
||||
'排查周期:${item['PERIODNAME']}',
|
||||
'部门:${item['DEPARTMENT_NAME']}',
|
||||
'',
|
||||
'岗位:${item['POST_NAME']}',
|
||||
'人员:${item['USER_NAME']}',
|
||||
"检查次数:${item['count']}",
|
||||
'超期未检查次数:${item['overTimeCount']}'
|
||||
],
|
||||
showBottomTags: false,
|
||||
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
bool _onScroll(ScrollNotification n) {
|
||||
if (n.metrics.pixels > n.metrics.maxScrollExtent - 100 &&
|
||||
_hasMore && !_isLoading) {
|
||||
|
||||
_page++;
|
||||
getListData(true,"");
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<void> _getHazardInspectionRecordList( int currentPage,String keyWord,String dept,
|
||||
String starDate,String endDate,String periodId,String userName,String typeId,bool loadMore) async {
|
||||
try {
|
||||
if (_isLoading) return;
|
||||
_isLoading = true;
|
||||
|
||||
|
||||
final result = await ApiService.getHazardInspectionRecordList(
|
||||
currentPage, keyWord, id, dept,
|
||||
starDate, endDate, periodId, userName, typeId);
|
||||
|
||||
if (result['result'] == 'success') {
|
||||
|
||||
_totalPage =result["page"]['totalPage'] ?? 1;
|
||||
final List<dynamic> newList = result['varList'] ?? [];
|
||||
// setState(() {
|
||||
// _list.addAll(newList);
|
||||
// });
|
||||
|
||||
setState(() {
|
||||
if (loadMore) {
|
||||
_list.addAll(newList);
|
||||
} else {
|
||||
_list = newList;
|
||||
}
|
||||
_hasMore = _page < _totalPage;
|
||||
// if (_hasMore) _page++;
|
||||
});
|
||||
|
||||
}else{
|
||||
ToastUtil.showNormal(context, '加载数据失败');
|
||||
// _showMessage('加载数据失败');
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
||||
print('加载数据失败:$e');
|
||||
} finally {
|
||||
// if (!loadMore) LoadingDialogHelper.hide(context);
|
||||
_isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Future<void> _getStandardInvestigationRecordList( int currentPage,String keyWord,String dept,
|
||||
String starDate,String endDate,String periodId,String userName,String typeId,bool loadMore) async {
|
||||
try {
|
||||
if (_isLoading) return;
|
||||
_isLoading = true;
|
||||
|
||||
|
||||
final result = await ApiService.getStandardInvestigationRecordList(
|
||||
currentPage, keyWord, id, dept,
|
||||
starDate, endDate, periodId, userName, typeId);
|
||||
|
||||
if (result['result'] == 'success') {
|
||||
|
||||
_totalPage =result["page"]['totalPage'] ?? 1;
|
||||
final List<dynamic> newList = result['varList'] ?? [];
|
||||
// setState(() {
|
||||
// _list.addAll(newList);
|
||||
// });
|
||||
|
||||
setState(() {
|
||||
if (loadMore) {
|
||||
_list.addAll(newList);
|
||||
} else {
|
||||
_list = newList;
|
||||
}
|
||||
_hasMore = _page < _totalPage;
|
||||
// if (_hasMore) _page++;
|
||||
});
|
||||
|
||||
}else{
|
||||
ToastUtil.showNormal(context, '加载数据失败');
|
||||
// _showMessage('加载数据失败');
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
||||
print('加载数据失败:$e');
|
||||
} finally {
|
||||
// if (!loadMore) LoadingDialogHelper.hide(context);
|
||||
_isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _getListType() async {
|
||||
try {
|
||||
|
||||
final result = await ApiService.getListType();
|
||||
if (result['result'] == 'success') {
|
||||
setState(() {
|
||||
listType= result['list'];
|
||||
});
|
||||
|
||||
}else{
|
||||
ToastUtil.showNormal(context, "加载数据失败");
|
||||
// _showMessage('加载数据失败');
|
||||
}
|
||||
} catch (e) {
|
||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
||||
print('加载数据失败:$e');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<void> _getListInspectionCycle() async {
|
||||
try {
|
||||
|
||||
final result = await ApiService.getListInspectionCycle();
|
||||
if (result['result'] == 'success') {
|
||||
setState(() {
|
||||
listInspectionCycle= result['list'];
|
||||
});
|
||||
|
||||
}else{
|
||||
ToastUtil.showNormal(context, "加载数据失败");
|
||||
// _showMessage('加载数据失败');
|
||||
}
|
||||
} catch (e) {
|
||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
||||
print('加载数据失败:$e');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,32 +1,160 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart' show DateFormat;
|
||||
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||
import 'package:qhd_prevention/customWidget/bottom_picker.dart';
|
||||
import 'package:qhd_prevention/customWidget/bottom_picker_two.dart';
|
||||
import 'package:qhd_prevention/customWidget/department_person_picker.dart';
|
||||
import 'package:qhd_prevention/customWidget/department_picker.dart';
|
||||
import 'package:qhd_prevention/customWidget/toast_util.dart';
|
||||
import 'package:qhd_prevention/http/ApiService.dart';
|
||||
import 'package:qhd_prevention/tools/tools.dart';
|
||||
import '../../../tools/h_colors.dart';
|
||||
import '/customWidget/custom_button.dart';
|
||||
|
||||
|
||||
class CustomRecordBean {
|
||||
|
||||
// 已选择的分类 id
|
||||
final String departmentId;
|
||||
final String departmentName;
|
||||
|
||||
final String responsibleId;
|
||||
final String responsibleName;
|
||||
|
||||
// 清单类型
|
||||
final String? selectedQDType;
|
||||
final String? selectedQDTypeId;
|
||||
// 排查周期
|
||||
final String? selectedZQTime;
|
||||
final String? selectedZQTimeId;
|
||||
|
||||
// 新增:开始/结束时间
|
||||
final String startTime;
|
||||
final String endTime;
|
||||
|
||||
|
||||
CustomRecordBean({
|
||||
required this.departmentId,
|
||||
required this.departmentName,
|
||||
required this.responsibleId,
|
||||
required this.responsibleName,
|
||||
|
||||
required this.selectedQDType,
|
||||
required this.selectedQDTypeId,
|
||||
required this.selectedZQTime,
|
||||
required this.selectedZQTimeId,
|
||||
|
||||
|
||||
required this.startTime,
|
||||
required this.endTime,
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
factory CustomRecordBean.fromJson(
|
||||
String departmentId,String departmentName, String responsibleId, String responsibleName,
|
||||
String selectedQDType, String selectedQDTypeId, String selectedZQTime,String selectedZQTimeId,
|
||||
String startTime,String endTime,
|
||||
) {
|
||||
return CustomRecordBean(
|
||||
departmentId:departmentId,
|
||||
departmentName:departmentName,
|
||||
responsibleId:responsibleId,
|
||||
responsibleName:responsibleName,
|
||||
|
||||
selectedQDType:selectedQDType,
|
||||
selectedQDTypeId:selectedQDTypeId,
|
||||
selectedZQTime:selectedZQTime,
|
||||
selectedZQTimeId:selectedZQTimeId,
|
||||
|
||||
|
||||
startTime:startTime,
|
||||
endTime:endTime,
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {"departmentId":departmentId,"departmentName":departmentName, "responsibleId":responsibleId,"responsibleName":responsibleName,
|
||||
"selectedQDType":selectedQDType,"selectedQDTypeId":selectedQDTypeId,"selectedZQTime":selectedZQTime,"selectedZQTimeId":selectedZQTimeId,
|
||||
"startTime":startTime,"endTime":endTime,};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// 自定义抽屉
|
||||
class CustomRecordDrawer extends StatefulWidget {
|
||||
const CustomRecordDrawer({super.key});
|
||||
const CustomRecordDrawer(this.listType,this.listInspectionCycle, {super.key,required this.onClose});
|
||||
|
||||
final List<dynamic> listType ;
|
||||
final List<dynamic> listInspectionCycle ;
|
||||
final Function(String,String,String,String,String,String,) onClose;
|
||||
@override
|
||||
_CustomRecordDrawerState createState() => _CustomRecordDrawerState();
|
||||
}
|
||||
|
||||
class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
||||
// 四个选项的单选 index
|
||||
int _selectedOption = -1;
|
||||
|
||||
// 存储各单位的人员列表
|
||||
List<Map<String, dynamic>> _personCache = [];
|
||||
|
||||
|
||||
// 已选择的分类 id
|
||||
String? _selectedCategoryId;
|
||||
// 检查人
|
||||
String? _selectedPerson;
|
||||
String departmentId="";
|
||||
String departmentName="";
|
||||
|
||||
String responsibleId="";
|
||||
String responsibleName="";
|
||||
|
||||
// 清单类型
|
||||
String? _selectedQDType;
|
||||
String _selectedQDType="";
|
||||
String _selectedQDTypeId="";
|
||||
// 排查周期
|
||||
String? _selectedZQTime;
|
||||
String _selectedZQTime="";
|
||||
String _selectedZQTimeId="";
|
||||
|
||||
// 新增:开始/结束时间
|
||||
DateTime? _startDate;
|
||||
DateTime? _endDate;
|
||||
String startTime="";
|
||||
String endTime="";
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
setState(() {
|
||||
|
||||
try {
|
||||
String? dangerJson = SessionService.instance.customRecordDangerJson;
|
||||
if(null!=dangerJson&&dangerJson.isNotEmpty) {
|
||||
Map<String, dynamic> dangerWaitBean = json.decode(dangerJson);
|
||||
departmentId= dangerWaitBean["departmentId"];
|
||||
departmentName= dangerWaitBean["departmentName"];
|
||||
responsibleId= dangerWaitBean["responsibleId"];
|
||||
responsibleName= dangerWaitBean["responsibleName"];
|
||||
|
||||
_selectedQDType= dangerWaitBean["selectedQDType"];
|
||||
_selectedQDTypeId= dangerWaitBean["selectedQDTypeId"];
|
||||
_selectedZQTime= dangerWaitBean["selectedZQTime"];
|
||||
_selectedZQTimeId= dangerWaitBean["selectedZQTimeId"];
|
||||
|
||||
startTime= dangerWaitBean["startTime"];
|
||||
endTime= dangerWaitBean["endTime"];
|
||||
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
print("解析失败: $e");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -38,48 +166,87 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
|||
isScrollControlled: true,
|
||||
barrierColor: Colors.black54,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (ctx) => DepartmentPicker(onSelected: (id, name) {
|
||||
builder: (ctx) => DepartmentPicker(onSelected: (id, name) async {
|
||||
setState(() {
|
||||
_selectedCategoryId = id;
|
||||
|
||||
departmentId=id;
|
||||
departmentName=name;
|
||||
|
||||
responsibleId="";
|
||||
responsibleName="";
|
||||
// setResult();
|
||||
});
|
||||
|
||||
// 拉取该单位的人员列表并缓存
|
||||
final result = await ApiService.getListTreePersonList(id);
|
||||
_personCache=List<Map<String, dynamic>>.from(
|
||||
result['userList'] as List,
|
||||
);
|
||||
|
||||
}),
|
||||
);
|
||||
} else if (type == 2) {
|
||||
final choice = await BottomPicker.show<String>(
|
||||
context,
|
||||
items: ['未知'],
|
||||
itemBuilder: (item) => Text(item, textAlign: TextAlign.center),
|
||||
initialIndex: 0,
|
||||
);
|
||||
if (choice != null) {
|
||||
// 用户点击确定并选择了 choice
|
||||
setState(() {
|
||||
_selectedPerson = choice;
|
||||
});
|
||||
}
|
||||
|
||||
if ( departmentId.isEmpty) {
|
||||
ToastUtil.showNormal(context, '请先选择部门');
|
||||
return;
|
||||
}
|
||||
DepartmentPersonPicker.show(
|
||||
context,
|
||||
personsData: _personCache,
|
||||
onSelected: (userId, name) {
|
||||
setState(() {
|
||||
// renYuanId = userId;
|
||||
// renYuanName = name;
|
||||
|
||||
responsibleId=userId;
|
||||
responsibleName=name;
|
||||
// setResult();
|
||||
});
|
||||
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
|
||||
}else if (type == 3) {
|
||||
final choice = await BottomPicker.show<String>(
|
||||
final choice = await BottomPickerTwo.show<String>(
|
||||
context,
|
||||
items: ['日常', '综合', '专业', '季节性','节假日'],
|
||||
itemBuilder: (item) => Text(item, textAlign: TextAlign.center),
|
||||
items: widget.listType,
|
||||
itemBuilder: (item) => Text(item["NAME"], textAlign: TextAlign.center),
|
||||
initialIndex: 0,
|
||||
);
|
||||
if (choice != null) {
|
||||
for(int i=0;i<widget.listType.length;i++){
|
||||
if(choice==widget.listType[i]["NAME"]){
|
||||
_selectedQDTypeId = widget.listType[i]["BIANMA"];
|
||||
}
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_selectedQDType = choice;
|
||||
// setResult();
|
||||
});
|
||||
}
|
||||
}else if (type == 4) {
|
||||
final choice = await BottomPicker.show<String>(
|
||||
final choice = await BottomPickerTwo.show<String>(
|
||||
context,
|
||||
items: ['每日', '每周', '每旬', '每月', '每季', '半年', '每年'],
|
||||
itemBuilder: (item) => Text(item, textAlign: TextAlign.center),
|
||||
items: widget.listInspectionCycle,
|
||||
itemBuilder: (item) => Text(item["NAME"], textAlign: TextAlign.center),
|
||||
initialIndex: 0,
|
||||
);
|
||||
if (choice != null) {
|
||||
for(int i=0;i<widget.listInspectionCycle.length;i++){
|
||||
if(choice==widget.listInspectionCycle[i]["NAME"]){
|
||||
_selectedZQTimeId = widget.listInspectionCycle[i]["BIANMA"];
|
||||
}
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_selectedZQTime = choice;
|
||||
// setResult();
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,11 +263,19 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
|||
);
|
||||
if (picked != null) {
|
||||
setState(() {
|
||||
|
||||
_startDate = picked;
|
||||
final dateFormat = DateFormat('yyyy-MM-dd');
|
||||
startTime=dateFormat.format(picked);
|
||||
|
||||
// 保证开始 <= 结束
|
||||
if (_endDate != null && _endDate!.isBefore(picked)) {
|
||||
_endDate = null;
|
||||
}
|
||||
|
||||
|
||||
// setResult();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +295,12 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
|||
if (picked != null) {
|
||||
setState(() {
|
||||
_endDate = picked;
|
||||
|
||||
final dateFormat = DateFormat('yyyy-MM-dd');
|
||||
endTime=dateFormat.format(picked);
|
||||
|
||||
// setResult();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -170,25 +351,25 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
|||
// 分类筛选
|
||||
_buildDropdownBox(
|
||||
"检查部门",
|
||||
display: _selectedCategoryId ?? '请选择',
|
||||
display: departmentName.isNotEmpty ?departmentName: '请选择',
|
||||
onTap: () => showCategoryPicker(1),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildDropdownBox(
|
||||
"检查人",
|
||||
display: _selectedPerson ?? '请选择',
|
||||
display: responsibleName .isNotEmpty ?responsibleName: '请选择',
|
||||
onTap: () => showCategoryPicker(2),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildDropdownBox(
|
||||
"清单类型",
|
||||
display: _selectedQDType ?? '请选择',
|
||||
display: _selectedQDType .isNotEmpty ?_selectedQDType: '请选择',
|
||||
onTap: () => showCategoryPicker(3),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildDropdownBox(
|
||||
"排查周期",
|
||||
display: _selectedZQTime ?? '请选择',
|
||||
display: _selectedZQTime .isNotEmpty ?_selectedZQTime: '请选择',
|
||||
onTap: () => showCategoryPicker(4),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
@ -232,10 +413,26 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
|||
textStyle: const TextStyle(color: Colors.black45),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_selectedOption = -1;
|
||||
_selectedCategoryId = null;
|
||||
_startDate = null;
|
||||
_endDate = null;
|
||||
|
||||
// 已选择的分类 id
|
||||
departmentId="";
|
||||
departmentName="";
|
||||
responsibleId="";
|
||||
responsibleName="";
|
||||
|
||||
// 清单类型
|
||||
_selectedQDType="";
|
||||
_selectedQDTypeId="";
|
||||
// 排查周期
|
||||
_selectedZQTime="";
|
||||
_selectedZQTimeId="";
|
||||
|
||||
// 新增:开始/结束时间
|
||||
_startDate=null;
|
||||
_endDate=null;
|
||||
startTime="";
|
||||
endTime="";
|
||||
|
||||
});
|
||||
},
|
||||
),
|
||||
|
@ -248,6 +445,8 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
|||
backgroundColor: Colors.blue,
|
||||
onPressed: () {
|
||||
// TODO: 提交筛选条件,包括 _startDate、_endDate
|
||||
Navigator.pop(context);
|
||||
setResult();// 关闭加载对话框
|
||||
},
|
||||
),
|
||||
),
|
||||
|
@ -286,4 +485,24 @@ class _CustomRecordDrawerState extends State<CustomRecordDrawer> {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
void setResult(){
|
||||
|
||||
CustomRecordBean waitBean= CustomRecordBean.fromJson(
|
||||
departmentId ?? "", departmentName?? "", responsibleId?? "",responsibleName?? "",
|
||||
_selectedQDType?? "", _selectedQDTypeId?? "",_selectedZQTime?? "", _selectedZQTimeId?? "",
|
||||
startTime, endTime);
|
||||
|
||||
String jsonString = jsonEncode(waitBean.toJson());
|
||||
SessionService.instance.setCustomRecordDangerJson(jsonString);
|
||||
|
||||
widget.onClose(
|
||||
departmentId ?? "", responsibleName ?? "",
|
||||
_selectedQDTypeId ?? "", _selectedZQTimeId ?? "",
|
||||
_startDate!=null?startTime:"",
|
||||
_endDate!=null?endTime:"",
|
||||
); // 触发回调
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||
import 'package:qhd_prevention/customWidget/bottom_picker.dart';
|
||||
import 'package:qhd_prevention/customWidget/bottom_picker_two.dart';
|
||||
import 'package:qhd_prevention/customWidget/custom_button.dart';
|
||||
import 'package:qhd_prevention/customWidget/date_picker_dialog.dart';
|
||||
import 'package:qhd_prevention/customWidget/department_person_picker.dart';
|
||||
import 'package:qhd_prevention/customWidget/department_picker.dart';
|
||||
import 'package:qhd_prevention/customWidget/department_picker_hidden_type.dart';
|
||||
import 'package:qhd_prevention/customWidget/department_picker_two.dart';
|
||||
import 'package:qhd_prevention/customWidget/toast_util.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'package:qhd_prevention/tools/tools.dart';
|
||||
import '../../../customWidget/photo_picker_row.dart';
|
||||
import '../../../http/ApiService.dart';
|
||||
|
||||
|
@ -25,21 +30,31 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
|||
final _partController = TextEditingController();
|
||||
final _dangerDetailController = TextEditingController();
|
||||
|
||||
String _repairLevel = "";
|
||||
|
||||
|
||||
String _repairLevelName = "";
|
||||
late bool _isDanger = false;
|
||||
|
||||
late bool _canClick = true;
|
||||
late List<dynamic> _hazardLeveLlist = []; //隐患级别
|
||||
// 存储各单位的人员列表
|
||||
List<Map<String, dynamic>> _personCache = [];
|
||||
|
||||
|
||||
List<String> _yinHuanImages = [];
|
||||
String _yinHuanVido="";
|
||||
dynamic _hazardLeve;
|
||||
String yinHuanId = "";
|
||||
String yinHuanName = "";
|
||||
String buMenId = "";
|
||||
String buMenPDId = "";
|
||||
String buMenName = "";
|
||||
String responsibleId="";
|
||||
String responsibleName="";
|
||||
String dataTime = "";
|
||||
|
||||
List<String> _zhengGaiImages = [];
|
||||
List<String> _yinHuanTypeIds = [];
|
||||
List<String> _yinHuanTypeNames = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
|
@ -52,7 +67,7 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
|||
try {
|
||||
final result = await ApiService.getHazardLevel();
|
||||
if (result['result'] == 'success') {
|
||||
final List<dynamic> newList = result['varList'] ?? [];
|
||||
final List<dynamic> newList = result['list'] ?? [];
|
||||
setState(() {
|
||||
_hazardLeveLlist.addAll(newList);
|
||||
});
|
||||
|
@ -116,9 +131,22 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
|||
isShowAI: true,
|
||||
onChanged: (List<File> files) {
|
||||
// 上传图片 files
|
||||
_yinHuanImages.clear();
|
||||
for(int i=0;i<files.length;i++){
|
||||
_yinHuanImages.add(files[i].path);
|
||||
}
|
||||
},
|
||||
onAiIdentify: () {
|
||||
// AI 识别逻辑
|
||||
if(_yinHuanImages.isEmpty){
|
||||
ToastUtil.showNormal(context, "请先上传一张图片");
|
||||
return;
|
||||
}
|
||||
if(_yinHuanImages.length>1){
|
||||
ToastUtil.showNormal(context, "识别暂时只能上传一张图片");
|
||||
return;
|
||||
}
|
||||
_identifyImg(_yinHuanImages[0]);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
@ -129,6 +157,7 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
|||
mediaType: MediaType.video,
|
||||
onChanged: (List<File> files) {
|
||||
// 上传视频 files
|
||||
_yinHuanVido=files[0].path;
|
||||
},
|
||||
onAiIdentify: () {
|
||||
// AI 视频识别逻辑
|
||||
|
@ -151,23 +180,35 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
|||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
final choice = await BottomPickerTwo.show<String>(
|
||||
String choice = await BottomPickerTwo.show<String>(
|
||||
context,
|
||||
items: _hazardLeveLlist,
|
||||
itemBuilder: (item) => Text(item, textAlign: TextAlign.center),
|
||||
itemBuilder: (item) => Text(item["NAME"], textAlign: TextAlign.center),
|
||||
initialIndex: 0,
|
||||
);
|
||||
if (choice != null) {
|
||||
for(int i=0;i<_hazardLeveLlist.length;i++){
|
||||
if(choice==_hazardLeveLlist[i]["NAME"]){
|
||||
_hazardLeve = _hazardLeveLlist[i];
|
||||
}
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_hazardLeve = choice;
|
||||
_repairLevel=_hazardLeve[""];
|
||||
_repairLevelName=_hazardLeve["NAME"];
|
||||
if("5ff9daf78e9a4fb1b40d77980656799d"==_hazardLeve["DICTIONARIES_ID"]){
|
||||
_isDanger=false;
|
||||
_canClick=false;
|
||||
}else{
|
||||
_canClick=true;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
},
|
||||
child: _buildSectionContainer(
|
||||
child: ListItemFactory.createRowSpaceBetweenItem(
|
||||
leftText: "隐患级别",
|
||||
rightText: _repairLevel.isNotEmpty?_repairLevel:"请选择",
|
||||
rightText: _repairLevelName.isNotEmpty?_repairLevelName:"请选择",
|
||||
isRight: true,
|
||||
),
|
||||
),
|
||||
|
@ -181,9 +222,18 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
|||
backgroundColor: Colors.transparent,
|
||||
builder:
|
||||
(ctx) => DepartmentPickerHiddenType(
|
||||
onSelected: (json) {
|
||||
print(jsonEncode(json));
|
||||
onSelected: (jsonString) {
|
||||
Map<String, List<String>> result = jsonString;
|
||||
_yinHuanTypeIds = List<String>.from(result['id']!);
|
||||
_yinHuanTypeNames = List<String>.from(result['name']!);
|
||||
setState(() {
|
||||
yinHuanName=_yinHuanTypeNames[_yinHuanTypeNames.length-1];
|
||||
});
|
||||
|
||||
|
||||
// print(jsonEncode(json));
|
||||
// List<String> _yinHuanTypeIds = [];
|
||||
// List<String> _yinHuanTypeNames = [];
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -197,13 +247,15 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
|||
),
|
||||
),
|
||||
_buildSectionContainer(
|
||||
child: ListItemFactory.createYesNoSection(
|
||||
child: ListItemFactory.createYesNoSectionTwo(
|
||||
title: "是否立即整改",
|
||||
horizontalPadding: 0,
|
||||
verticalPadding: 0,
|
||||
yesLabel: "是",
|
||||
noLabel: "否",
|
||||
groupValue: _isDanger,
|
||||
canClick: _canClick,
|
||||
context:context,
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
_isDanger = val;
|
||||
|
@ -231,8 +283,15 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
|||
isShowAI: false,
|
||||
onChanged: (List<File> files) {
|
||||
// 上传图片 files
|
||||
_zhengGaiImages.clear();
|
||||
for(int i=0;i<files.length;i++){
|
||||
_zhengGaiImages.add(files[i].path);
|
||||
}
|
||||
|
||||
},
|
||||
onAiIdentify: () {
|
||||
|
||||
},
|
||||
onAiIdentify: () {},
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -248,12 +307,21 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
|||
barrierColor: Colors.black54,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder:
|
||||
(ctx) => DepartmentPicker(
|
||||
onSelected: (id, name) async {
|
||||
(ctx) => DepartmentPickerTwo(
|
||||
onSelected: (id, name,pdId) async {
|
||||
setState(() {
|
||||
buMenId = id;
|
||||
buMenName = name;
|
||||
buMenPDId=pdId;
|
||||
|
||||
responsibleId="";
|
||||
responsibleName="";
|
||||
});
|
||||
// 拉取该单位的人员列表并缓存
|
||||
final result = await ApiService.getListTreePersonList(id);
|
||||
_personCache=List<Map<String, dynamic>>.from(
|
||||
result['userList'] as List,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -266,6 +334,46 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
|||
),
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
SizedBox(height: 10),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if ( buMenId.isEmpty) {
|
||||
ToastUtil.showNormal(context, '请先选择部门');
|
||||
return;
|
||||
}
|
||||
DepartmentPersonPicker.show(
|
||||
context,
|
||||
personsData: _personCache,
|
||||
onSelected: (userId, name) {
|
||||
setState(() {
|
||||
// renYuanId = userId;
|
||||
// renYuanName = name;
|
||||
|
||||
responsibleId=userId;
|
||||
responsibleName=name;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
);
|
||||
},
|
||||
child:Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: ListItemFactory.createRowSpaceBetweenItem(
|
||||
leftText: "整改负责人",
|
||||
rightText: responsibleName.isNotEmpty?responsibleName:"请选择",
|
||||
isRight: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
|
@ -274,13 +382,15 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
|||
(_) => HDatePickerDialog(
|
||||
initialDate: DateTime.now(),
|
||||
onCancel: () => Navigator.of(context).pop(),
|
||||
onConfirm: (selected) {
|
||||
onConfirm: (selected) async {
|
||||
Navigator.of(context).pop();
|
||||
setState(() {
|
||||
dataTime = DateFormat(
|
||||
'yyyy-MM-dd',
|
||||
).format(selected);
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -298,7 +408,9 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
|||
|
||||
SizedBox(height: 30),
|
||||
CustomButton(
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
_riskListCheckAppAdd();
|
||||
},
|
||||
text: "提交",
|
||||
backgroundColor: Colors.blue,
|
||||
),
|
||||
|
@ -307,4 +419,237 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _riskListCheckAppAdd() async {
|
||||
if(_yinHuanImages.isEmpty){
|
||||
ToastUtil.showNormal(context, "请上传隐患图片");
|
||||
return;
|
||||
}
|
||||
|
||||
String hazardDescription=_standardController.text.trim();
|
||||
if(hazardDescription.isEmpty){
|
||||
ToastUtil.showNormal(context, "请填隐患描述");
|
||||
return;
|
||||
}
|
||||
|
||||
String partDescription=_partController.text.trim();
|
||||
if(partDescription.isEmpty){
|
||||
ToastUtil.showNormal(context, "请填隐患部位");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(_hazardLeve.isEmpty){
|
||||
ToastUtil.showNormal(context, "请选择隐患级别");
|
||||
return;
|
||||
}
|
||||
String hazardLeve = _hazardLeve["BIANMA"];
|
||||
|
||||
if(_yinHuanTypeIds.isEmpty){
|
||||
ToastUtil.showNormal(context, "请选择隐患类型");
|
||||
return;
|
||||
}
|
||||
|
||||
String type="1";
|
||||
String dangerDetail="";
|
||||
if(_isDanger){
|
||||
type="1";
|
||||
dangerDetail=_dangerDetailController.text.trim();
|
||||
if(dangerDetail.isEmpty){
|
||||
ToastUtil.showNormal(context, "请填整改描述");
|
||||
return;
|
||||
}
|
||||
|
||||
if(_zhengGaiImages.isEmpty){
|
||||
ToastUtil.showNormal(context, "请上传整改后图片");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
type="2";
|
||||
if(buMenId.isEmpty){
|
||||
ToastUtil.showNormal(context, "请选择整改部门");
|
||||
return;
|
||||
}
|
||||
|
||||
if(responsibleId.isEmpty){
|
||||
ToastUtil.showNormal(context, "请选择整改人");
|
||||
return;
|
||||
}
|
||||
|
||||
if(dataTime.isEmpty){
|
||||
ToastUtil.showNormal(context, "请选择整改期限");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String yinHuanTypeIds="";
|
||||
String yinHuanTypeNames="";
|
||||
for(int i=0;i<_yinHuanTypeIds.length;i++){
|
||||
String yinHuanTypeId= _yinHuanTypeIds[i];
|
||||
String yinHuanTypeName= _yinHuanTypeNames[i];
|
||||
if(yinHuanTypeIds.isEmpty){
|
||||
yinHuanTypeIds=yinHuanTypeId;
|
||||
}else{
|
||||
yinHuanTypeIds="$yinHuanTypeIds,$yinHuanTypeId";
|
||||
}
|
||||
if(yinHuanTypeNames.isEmpty){
|
||||
yinHuanTypeNames=yinHuanTypeName;
|
||||
}else{
|
||||
yinHuanTypeNames="$yinHuanTypeNames/$yinHuanTypeName";
|
||||
}
|
||||
}
|
||||
|
||||
String hiddenType1="";
|
||||
if(_yinHuanTypeIds.length>1){
|
||||
hiddenType1=_yinHuanTypeIds[0];
|
||||
}
|
||||
String hiddenType2="";
|
||||
if(_yinHuanTypeIds.length>2){
|
||||
hiddenType1=_yinHuanTypeIds[1];
|
||||
}
|
||||
String hiddenType3="";
|
||||
if(_yinHuanTypeIds.length>3){
|
||||
hiddenType1=_yinHuanTypeIds[2];
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取定位
|
||||
Position position = await _determinePosition();
|
||||
String longitude=position.longitude.toString();
|
||||
String latitude=position.latitude.toString();
|
||||
|
||||
try {
|
||||
final result = await ApiService.addRiskListCheckApp(
|
||||
hazardDescription, partDescription, latitude, longitude,
|
||||
dangerDetail, dataTime, type, responsibleId,
|
||||
yinHuanTypeIds, hazardLeve, buMenId, buMenPDId,
|
||||
yinHuanTypeNames, hiddenType1, hiddenType2, hiddenType3,);
|
||||
if (result['result'] == 'success') {
|
||||
|
||||
String hiddenId = result['pd']['HIDDEN_ID'] ;
|
||||
|
||||
|
||||
for (int i=0;i<_yinHuanImages.length;i++){
|
||||
_addImgFiles(_yinHuanImages[i],"3",hiddenId);
|
||||
}
|
||||
|
||||
_addImgFiles(_yinHuanVido,"3",hiddenId);
|
||||
|
||||
if(_isDanger){
|
||||
for (int i=0;i<_zhengGaiImages.length;i++){
|
||||
_addImgFiles(_zhengGaiImages[i],"4",hiddenId);
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
ToastUtil.showNormal(context, "提交成功");
|
||||
Navigator.pop(context);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error fetching data: $e');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Future<String> _addImgFiles(String imagePath,String type,String id) async {
|
||||
try {
|
||||
|
||||
final raw = await ApiService.addImgFiles( imagePath, type, id);
|
||||
if (raw['result'] == 'success') {
|
||||
return raw['imgPath'];
|
||||
}else{
|
||||
// _showMessage('反馈提交失败');
|
||||
return "";
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
||||
print('加载首页数据失败:$e');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<void> _identifyImg(String imagePath) async {
|
||||
try {
|
||||
LoadingDialogHelper.show(context);
|
||||
final raw = await ApiService.identifyImg( imagePath);
|
||||
if (raw['result'] == 'success') {
|
||||
final List<dynamic> newList = raw['aiHiddens'] ?? [];
|
||||
|
||||
String miaoShuText="";
|
||||
String zhengGaiText="";
|
||||
for(int i=0;i<newList.length;i++){
|
||||
// 1. 将字符串解析为 Map
|
||||
final Map<String, dynamic> item1 = jsonDecode(newList[i]);
|
||||
if(miaoShuText.isEmpty){
|
||||
miaoShuText=item1["hiddenDescr"];
|
||||
}else{
|
||||
miaoShuText=miaoShuText+";"+item1["hiddenDescr"];
|
||||
}
|
||||
|
||||
if(zhengGaiText.isEmpty){
|
||||
zhengGaiText=item1["rectificationSuggestions"];
|
||||
}else{
|
||||
zhengGaiText=zhengGaiText+";"+item1["rectificationSuggestions"];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LoadingDialogHelper.hide(context);
|
||||
setState(() {
|
||||
_isDanger=true;
|
||||
_standardController.text=miaoShuText;
|
||||
_dangerDetailController.text=zhengGaiText;
|
||||
});
|
||||
}else{
|
||||
ToastUtil.showNormal(context, "识别失败");
|
||||
LoadingDialogHelper.hide(context);
|
||||
// _showMessage('反馈提交失败');
|
||||
// return "";
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
||||
print('加载首页数据失败:$e');
|
||||
// return "";
|
||||
LoadingDialogHelper.hide(context);
|
||||
}
|
||||
}
|
||||
|
||||
Future<Position> _determinePosition() async {
|
||||
bool serviceEnabled;
|
||||
LocationPermission permission;
|
||||
|
||||
// 检查定位服务是否启用
|
||||
serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||
if (!serviceEnabled) {
|
||||
return Future.error('Location services are disabled.');
|
||||
}
|
||||
|
||||
// 获取权限
|
||||
permission = await Geolocator.checkPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
permission = await Geolocator.requestPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
return Future.error('Location permissions are denied');
|
||||
}
|
||||
}
|
||||
|
||||
if (permission == LocationPermission.deniedForever) {
|
||||
return Future.error(
|
||||
'Location permissions are permanently denied, we cannot request permissions.');
|
||||
}
|
||||
|
||||
// 获取当前位置
|
||||
return await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class ApplicationPage extends StatelessWidget {
|
|||
break;
|
||||
case AppItem.checkRecord:
|
||||
// 跳转到检查记录页面
|
||||
pushPage(CheckRecordPage(), context);
|
||||
pushPage(CheckRecordPage(1), context);
|
||||
break;
|
||||
case AppItem.specialRectification:
|
||||
// 跳转到专项检查隐患整改页面
|
||||
|
@ -59,6 +59,7 @@ class ApplicationPage extends StatelessWidget {
|
|||
case AppItem.supervisionRecord:
|
||||
// 跳转到监管帮扶隐患记录页面
|
||||
//Navigator.push(context, MaterialPageRoute(builder: (_) => SupervisionRecordPage()));
|
||||
pushPage(CheckRecordPage(2), context);
|
||||
break;
|
||||
|
||||
case AppItem.riskRecord:
|
||||
|
@ -82,7 +83,7 @@ class ApplicationPage extends StatelessWidget {
|
|||
pushPage(DangerWaitListPage(DangerType.acceptanced,5), context);
|
||||
break;
|
||||
case AppItem.aiAlarm:
|
||||
// 跳转到隐患排查页面
|
||||
// ai
|
||||
pushPage(AiAlarmPage(), context);
|
||||
break;
|
||||
}
|
||||
|
@ -110,7 +111,7 @@ class ApplicationPage extends StatelessWidget {
|
|||
],
|
||||
},
|
||||
{
|
||||
'title': '监管帮扶',
|
||||
'title': '标准排查',
|
||||
'list': [
|
||||
{'item': AppItem.supervisionRectification, 'icon': 'assets/icon-apps/icon-zl-6.png', 'title': '标准排查', 'num': 2},
|
||||
{'item': AppItem.supervisionRecord, 'icon': 'assets/icon-apps/icon-zl-2.png', 'title': '检查记录', 'num': 0},
|
||||
|
|
|
@ -10,6 +10,7 @@ import '../../http/ApiService.dart';
|
|||
import 'application_page.dart';
|
||||
import '/customWidget/search_bar_widget.dart';
|
||||
import '../home/work/danger_wait_deawer.dart';
|
||||
import 'hidden_danger_acceptance_page.dart';
|
||||
import 'hidden_record_detail_page.dart';
|
||||
|
||||
enum DangerType {
|
||||
|
@ -217,6 +218,7 @@ class _DangerWaitListPageState extends State<DangerWaitListPage> {
|
|||
widget.dangerType,item,
|
||||
onClose: (result) {
|
||||
print('详情页面已关闭,返回结果: $result');
|
||||
_page=1;
|
||||
getListData(widget.appItem,false,"");
|
||||
SessionService.instance.setDangerWaitInfo("");
|
||||
// reRefreshData();
|
||||
|
@ -231,7 +233,23 @@ class _DangerWaitListPageState extends State<DangerWaitListPage> {
|
|||
|
||||
break;
|
||||
case 4://隐患验收
|
||||
pushPage(HiddenRecordDetailPage(widget.dangerType,item), context);
|
||||
// pushPage(HiddenRecordDetailPage(widget.dangerType,item), context);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => HiddenDangerAcceptancePage(
|
||||
widget.dangerType,item,
|
||||
onClose: (result) {
|
||||
print('详情页面已关闭,返回结果: $result');
|
||||
_page=1;
|
||||
getListData(widget.appItem,false,"");
|
||||
SessionService.instance.setDangerWaitInfo("");
|
||||
// reRefreshData();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
break;
|
||||
case 5://已验收隐患
|
||||
pushPage(HiddenRecordDetailPage(widget.dangerType,item), context);
|
||||
|
|
|
@ -0,0 +1,639 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:qhd_prevention/customWidget/big_video_viewer.dart';
|
||||
import 'package:qhd_prevention/customWidget/custom_button.dart';
|
||||
import 'package:qhd_prevention/customWidget/date_picker_dialog.dart';
|
||||
import 'package:qhd_prevention/customWidget/photo_picker_row.dart';
|
||||
import 'package:qhd_prevention/customWidget/picker/CupertinoDatePicker.dart';
|
||||
import 'package:qhd_prevention/customWidget/toast_util.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/item_list_widget.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
||||
import '../../customWidget/ItemWidgetFactory.dart';
|
||||
import '../../customWidget/full_screen_video_page.dart';
|
||||
import '../../customWidget/single_image_viewer.dart';
|
||||
import '../../customWidget/video_player_widget.dart';
|
||||
import '../../http/ApiService.dart';
|
||||
import '../../tools/tools.dart';
|
||||
import 'danger_wait_list_page.dart';
|
||||
|
||||
|
||||
class HiddenDangerAcceptancePage extends StatefulWidget {
|
||||
const HiddenDangerAcceptancePage(this.dangerType, this.item, {super.key,required this.onClose});
|
||||
|
||||
final Function(String) onClose; // 回调函数
|
||||
final DangerType dangerType;
|
||||
final item;
|
||||
|
||||
@override
|
||||
_HiddenDangerAcceptancePageState createState() => _HiddenDangerAcceptancePageState();
|
||||
}
|
||||
|
||||
class _HiddenDangerAcceptancePageState extends State<HiddenDangerAcceptancePage> {
|
||||
late Map<String, dynamic> pd = {};
|
||||
late Map<String, dynamic> hs = {};
|
||||
List<String> files = [];
|
||||
List<String> files2 = [];
|
||||
List<String> files4 = [];
|
||||
List<String> files5 = [];
|
||||
List<dynamic> files6 = [];
|
||||
List<dynamic> videoList = [];
|
||||
List<dynamic> checkList = [];
|
||||
|
||||
bool modalShow = false;
|
||||
String videoSrc = "";
|
||||
VideoPlayerController? _videoController;
|
||||
final TextEditingController miaoShuController = TextEditingController();
|
||||
// 整改后图片
|
||||
List<String> gaiHouImages = [];
|
||||
String dataTime="";
|
||||
|
||||
// 是否整改
|
||||
bool _accepted = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if("2"==widget.item['HIDDEN_RISKSTANDARD']){
|
||||
getDataTwo();
|
||||
}else {
|
||||
getData();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_videoController?.dispose();
|
||||
miaoShuController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> getData() async {
|
||||
try {
|
||||
final data = await ApiService.getDangerDetail(widget.item['HIDDEN_ID']);
|
||||
if (data['result'] == 'success') {
|
||||
|
||||
setState(() {
|
||||
pd = data['pd'];
|
||||
hs = data['hs'] ?? {};
|
||||
|
||||
// 处理图片和视频
|
||||
for (var img in data['hImgs']) {
|
||||
if (img['FILEPATH'].toString().endsWith('.mp4')) {
|
||||
videoList.add(img);
|
||||
} else {
|
||||
files.add(img["FILEPATH"]);
|
||||
}
|
||||
}
|
||||
|
||||
// List<dynamic> filesZheng = data['rImgs'] ?? [];
|
||||
for (var img in data['rImgs']) {
|
||||
files2.add(img["FILEPATH"]);
|
||||
}
|
||||
// files2=data['rImgs'] ?? [];
|
||||
// files4 = data['sImgs'] ?? [];
|
||||
for (var img in data['sImgs']) {
|
||||
files4.add(img["FILEPATH"]);
|
||||
}
|
||||
// files5 = data['pImgs'] ?? [];
|
||||
for (var img in data['pImgs']) {
|
||||
files5.add(img["FILEPATH"]);
|
||||
}
|
||||
files6 = data['yImgs'] ?? [];
|
||||
checkList = data['checkList'] ?? [];
|
||||
});
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
print('Error fetching data: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getDataTwo() async {
|
||||
try {
|
||||
final data = await ApiService.getDangerDetailTwo(widget.item['HIDDEN_ID']);
|
||||
if (data['result'] == 'success') {
|
||||
|
||||
setState(() {
|
||||
pd = data['pd'];
|
||||
hs = data['hs'] ?? {};
|
||||
|
||||
// 处理图片和视频
|
||||
for (var img in data['hImgs']) {
|
||||
if (img['FILEPATH'].toString().endsWith('.mp4')) {
|
||||
videoList.add(img);
|
||||
} else {
|
||||
files.add(img["FILEPATH"]);
|
||||
}
|
||||
}
|
||||
|
||||
// List<dynamic> filesZheng = data['rImgs'] ?? [];
|
||||
for (var img in data['rImgs']) {
|
||||
files2.add(img["FILEPATH"]);
|
||||
}
|
||||
// files2=data['rImgs'] ?? [];
|
||||
// files4 = data['sImgs'] ?? [];
|
||||
for (var img in data['sImgs']) {
|
||||
files4.add(img["FILEPATH"]);
|
||||
}
|
||||
// files5 = data['pImgs'] ?? [];
|
||||
for (var img in data['pImgs']) {
|
||||
files5.add(img["FILEPATH"]);
|
||||
}
|
||||
files6 = data['yImgs'] ?? [];
|
||||
checkList = data['checkList'] ?? [];
|
||||
});
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
print('Error fetching data: $e');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Widget _buildInfoItem(String title, String value) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 120,
|
||||
child: Text(
|
||||
title,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(child: Text(value,textAlign: TextAlign.right,)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: MyAppbar(title: widget.dangerType.detailTitle),
|
||||
body: pd.isEmpty
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.maxHeight,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildInfoItem('隐患描述', pd['HIDDENDESCR'] ?? ''),
|
||||
|
||||
Divider(height: 1),
|
||||
// 隐患来源
|
||||
_buildInfoItem('隐患来源', _getSourceText(pd['SOURCE'])),
|
||||
Divider(height: 1),
|
||||
// 条件渲染部分
|
||||
if (pd['SOURCE'] == '2') ...[
|
||||
_buildInfoItem('风险点(单元)', pd['RISK_UNIT'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('辨识部位', pd['IDENTIFICATION'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('存在风险', pd['RISK_DESCR'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('风险分级', pd['LEVEL'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('检查内容', pd['CHECK_CONTENT'] ?? ''),
|
||||
Divider(height: 1),
|
||||
],
|
||||
|
||||
_buildInfoItem('隐患部位', pd['HIDDENPART'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('发现人', pd['CREATORNAME'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('发现时间', pd['CREATTIME'] ?? ''),
|
||||
Divider(height: 1),
|
||||
|
||||
if (pd['HIDDEN_CATEGORY']?.isNotEmpty == true)
|
||||
_buildInfoItem('隐患类别', pd['HIDDEN_CATEGORY_NAME'] ?? ''),
|
||||
|
||||
_buildInfoItem('隐患类型', pd['HIDDENTYPE_NAME'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('整改类型', _getRectificationType(pd['RECTIFICATIONTYPE'])),
|
||||
|
||||
if (pd['RECTIFICATIONTYPE'] == '2')
|
||||
_buildInfoItem('整改期限', pd['RECTIFICATIONDEADLINE'] ?? ''),
|
||||
Divider(height: 1),
|
||||
// 隐患照片
|
||||
// const Text('隐患照片', style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
// _buildImageGrid(files, onTap: (index) => _showImageGallery(files, index)),
|
||||
ListItemFactory.createTextImageItem(
|
||||
text: "隐患照片",
|
||||
imageUrls: files,
|
||||
onImageTapped: (index) {
|
||||
presentOpaque(
|
||||
SingleImageViewer(imageUrl:ApiService.baseImgPath + files[index]),
|
||||
context,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
|
||||
// 隐患视频
|
||||
if (videoList.isNotEmpty) ...[
|
||||
const SizedBox(height: 16),
|
||||
const Text('隐患视频', style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierColor: Colors.black54,
|
||||
builder: (_) => VideoPlayerPopup(videoUrl: ApiService.baseImgPath + videoList[0]['FILEPATH']),
|
||||
);
|
||||
|
||||
// present(
|
||||
// BigVideoViewer(videoUrl:ApiService.baseImgPath + videoList[0]['FILEPATH']),
|
||||
// context,
|
||||
// );
|
||||
},
|
||||
// => _playVideo(ApiService.baseImgPath + videoList[0]['FILEPATH']),
|
||||
child: Image.asset(
|
||||
'assets/image/videostart.png', // 替换为你的视频占位图
|
||||
color: Colors.blue,
|
||||
width: 120,
|
||||
height: 120,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
SizedBox(height: 10,),
|
||||
// 整改信息部分
|
||||
if (pd['STATE'] != null && int.parse(pd['STATE']) >= 2 && int.parse(pd['STATE']) <= 4) ...[
|
||||
// const Divider(height: 10,color: Colors.grey,),
|
||||
Row(
|
||||
children: [
|
||||
Container(width: 3, height: 15, color: Colors.blue),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
"整改信息",
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
// const Text('整改信息', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('整改描述', pd['RECTIFYDESCR'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('整改部门', pd['RECTIFICATIONDEPTNAME'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('整改人', pd['RECTIFICATIONORNAME'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('整改时间', pd['RECTIFICATIONTIME'] ?? ''),
|
||||
Divider(height: 1),
|
||||
// const Text('整改后图片', style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
// _buildImageGrid(files2, onTap: (index) => _showImageGallery(files2, index)),
|
||||
ListItemFactory.createTextImageItem(
|
||||
text: "整改后图片",
|
||||
imageUrls: files2,
|
||||
onImageTapped: (index) {
|
||||
presentOpaque(
|
||||
SingleImageViewer(imageUrl: ApiService.baseImgPath +files2[index]),
|
||||
context,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('整改部门', pd['HAVESCHEME']=="0" ? '无':'有'),
|
||||
Divider(height: 1),
|
||||
if(pd['HAVESCHEME']=="1")
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildInfoItem('排查日期', hs['SCREENINGDATE'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('隐患清单', hs['LISTNAME'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('治理标准要求', hs['GOVERNSTANDARDS'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('治理方法', hs['GOVERNMETHOD'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('经费和物资的落实', hs['EXPENDITURE'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('负责治理人员', hs['PRINCIPAL'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('工时安排', hs['PROGRAMMING'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('时限要求', hs['TIMELIMITFOR'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('工作要求', hs['JOBREQUIREMENT'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('其他事项', hs['OTHERBUSINESS'] ?? ''),
|
||||
Divider(height: 1),
|
||||
ListItemFactory.createTextImageItem(
|
||||
text: "方案图片",
|
||||
imageUrls: files4,
|
||||
onImageTapped: (index) {
|
||||
presentOpaque(
|
||||
SingleImageViewer(imageUrl: ApiService.baseImgPath +files2[index]),
|
||||
context,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('整改计划', pd['HAVEPLAN']=="0" ? '无':'有'),
|
||||
Divider(height: 1),
|
||||
if(pd['HAVEPLAN']=="1")
|
||||
ListItemFactory.createTextImageItem(
|
||||
text: "计划图片",
|
||||
imageUrls: files2,
|
||||
onImageTapped: (index) {
|
||||
presentOpaque(
|
||||
SingleImageViewer(imageUrl: ApiService.baseImgPath +files2[index]),
|
||||
context,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
|
||||
// 隐患整改
|
||||
_danner_type_wait(),
|
||||
|
||||
// ... 其他整改信息字段
|
||||
],
|
||||
|
||||
// 添加底部安全区域间距
|
||||
SizedBox(height: MediaQuery.of(context).padding.bottom + 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/// 隐患整改
|
||||
Widget _danner_type_wait() {
|
||||
return SizedBox(
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
|
||||
_getRepairState(),
|
||||
// 整改选项
|
||||
// _accepted ? _getRepairState() : _noAccepet_repair(_accepted),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
CustomButton(
|
||||
text: "提交",
|
||||
backgroundColor: Colors.blue,
|
||||
onPressed: () {
|
||||
// ToastUtil
|
||||
//接口请求
|
||||
// _submitToServer();
|
||||
|
||||
// _accepted ? _normalRectificationSubmission() : _rectificationSubmission();
|
||||
_addHazardAcceptance();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _getRepairState() {
|
||||
return Container(
|
||||
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Column(
|
||||
|
||||
children: [
|
||||
|
||||
ListItemFactory.createBuildSimpleSection("隐患验收"),
|
||||
Divider(height: 1),
|
||||
|
||||
ListItemFactory.createYesNoSection(
|
||||
horizontalPadding: 5,
|
||||
title: '是否合格',
|
||||
yesLabel: '是',
|
||||
noLabel: '否',
|
||||
groupValue: _accepted,
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
_accepted = val;
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
// _accepted ? _getRepairState() : _noAccepet_repair(_accepted),
|
||||
if(_accepted)
|
||||
Column(children: [
|
||||
Divider(),
|
||||
Container(
|
||||
height: 130,
|
||||
padding: EdgeInsets.all(15),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [HhTextStyleUtils.mainTitle("验收描述", fontSize: 15)],
|
||||
),
|
||||
TextField(
|
||||
controller: miaoShuController,
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null, // 不限制行数,输入多少文字就撑开多少行
|
||||
style: TextStyle(fontSize: 15),
|
||||
decoration: InputDecoration(
|
||||
hintText: '请对隐患进行详细描述(必填项)',
|
||||
border: InputBorder.none,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(height: 1),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
|
||||
DateTime? picked = await BottomDateTimePicker.showDate(context);
|
||||
if (picked != null) {
|
||||
setState(() {
|
||||
dataTime = DateFormat('yyyy-MM-dd HH:mm').format(picked);
|
||||
});
|
||||
}
|
||||
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder:
|
||||
// (_) => HDatePickerDialog(
|
||||
// initialDate: DateTime.now(),
|
||||
// onCancel: () => Navigator.of(context).pop(),
|
||||
// onConfirm: (selected) {
|
||||
// Navigator.of(context).pop();
|
||||
// setState(() {
|
||||
// // _selectData = selected;
|
||||
// dataTime= DateFormat('yyyy-MM-dd').format(selected);
|
||||
//
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 15),
|
||||
child: ListItemFactory.createRowSpaceBetweenItem(
|
||||
leftText: "验收日期",
|
||||
rightText: dataTime.isEmpty?"请选择":dataTime,
|
||||
isRight: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
RepairedPhotoSection(
|
||||
title: "验收照片",
|
||||
maxCount: 4,
|
||||
mediaType: MediaType.image,
|
||||
onChanged: (files) {
|
||||
// 上传 files 到服务器
|
||||
gaiHouImages.clear();
|
||||
for(int i=0;i<files.length;i++){
|
||||
gaiHouImages.add(files[i].path);
|
||||
}
|
||||
},
|
||||
onAiIdentify: () {
|
||||
|
||||
},
|
||||
),
|
||||
],),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// #region 不整改
|
||||
Widget _noAccepet_repair(bool _accept) {
|
||||
return Column(
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _addHazardAcceptance() async {
|
||||
try {
|
||||
|
||||
String type="1";
|
||||
String miaoshu="";
|
||||
if(_accepted){
|
||||
type="1";
|
||||
|
||||
miaoshu=miaoShuController.text.trim();
|
||||
if(miaoshu.isEmpty){
|
||||
ToastUtil.showNormal(context, "请填验收描述");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(dataTime.isEmpty){
|
||||
ToastUtil.showNormal(context, "请选择验收时间");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(gaiHouImages.isEmpty){
|
||||
ToastUtil.showNormal(context, "请上传验收照片");
|
||||
return;
|
||||
}
|
||||
} else{
|
||||
type="0";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
final data = await ApiService.addHazardAcceptance( type, miaoshu, dataTime,widget.item['HIDDEN_ID']);
|
||||
if (data['result'] == 'success') {
|
||||
|
||||
String hiddenCheckId="";
|
||||
try{
|
||||
data['check']['HIDDENCHECK_ID'];
|
||||
}catch(e){
|
||||
hiddenCheckId="";
|
||||
}
|
||||
|
||||
for(int i=0;i<gaiHouImages.length;i++){
|
||||
_addImgFiles(gaiHouImages[i],"5",hiddenCheckId) ;
|
||||
|
||||
}
|
||||
setState(() {
|
||||
ToastUtil.showNormal(context, "提交成功");
|
||||
Navigator.of(context).pop();
|
||||
widget.onClose('关闭详情'); // 触发回调
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
print('Error fetching data: $e');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<String> _addImgFiles(String imagePath,String type,String id) async {
|
||||
try {
|
||||
|
||||
final raw = await ApiService.addImgFiles( imagePath, type, id);
|
||||
if (raw['result'] == 'success') {
|
||||
return raw['imgPath'];
|
||||
}else{
|
||||
// _showMessage('反馈提交失败');
|
||||
return "";
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
||||
print('加载首页数据失败:$e');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String _getSourceText(String? source) {
|
||||
switch (source) {
|
||||
case '1': return '隐患快报';
|
||||
case '2': return '隐患排查清单检查';
|
||||
case '3': return '标准排查清单检查';
|
||||
case '4': return '专项检查';
|
||||
case '5': return '安全检查';
|
||||
default: return '';
|
||||
}
|
||||
}
|
||||
|
||||
String _getRectificationType(String? type) {
|
||||
switch (type) {
|
||||
case '1': return '立即整改';
|
||||
case '2': return '限期整改';
|
||||
default: return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:qhd_prevention/customWidget/big_video_viewer.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/item_list_widget.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
@ -30,8 +31,8 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
|
|||
late Map<String, dynamic> hs = {};
|
||||
List<String> files = [];
|
||||
List<String> files2 = [];
|
||||
List<dynamic> files4 = [];
|
||||
List<dynamic> files5 = [];
|
||||
List<String> files4 = [];
|
||||
List<String> files5 = [];
|
||||
List<dynamic> files6 = [];
|
||||
List<dynamic> videoList = [];
|
||||
List<dynamic> checkList = [];
|
||||
|
@ -79,8 +80,14 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
|
|||
files2.add(img["FILEPATH"]);
|
||||
}
|
||||
// files2=data['rImgs'] ?? [];
|
||||
files4 = data['sImgs'] ?? [];
|
||||
files5 = data['pImgs'] ?? [];
|
||||
// files4 = data['sImgs'] ?? [];
|
||||
for (var img in data['sImgs']) {
|
||||
files4.add(img["FILEPATH"]);
|
||||
}
|
||||
// files5 = data['pImgs'] ?? [];
|
||||
for (var img in data['pImgs']) {
|
||||
files5.add(img["FILEPATH"]);
|
||||
}
|
||||
files6 = data['yImgs'] ?? [];
|
||||
checkList = data['checkList'] ?? [];
|
||||
});
|
||||
|
@ -114,8 +121,14 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
|
|||
files2.add(img["FILEPATH"]);
|
||||
}
|
||||
// files2=data['rImgs'] ?? [];
|
||||
files4 = data['sImgs'] ?? [];
|
||||
files5 = data['pImgs'] ?? [];
|
||||
// files4 = data['sImgs'] ?? [];
|
||||
for (var img in data['sImgs']) {
|
||||
files4.add(img["FILEPATH"]);
|
||||
}
|
||||
// files5 = data['pImgs'] ?? [];
|
||||
for (var img in data['pImgs']) {
|
||||
files5.add(img["FILEPATH"]);
|
||||
}
|
||||
files6 = data['yImgs'] ?? [];
|
||||
checkList = data['checkList'] ?? [];
|
||||
});
|
||||
|
@ -248,7 +261,19 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
|
|||
// 整改信息部分
|
||||
if (pd['STATE'] != null && int.parse(pd['STATE']) >= 2 && int.parse(pd['STATE']) <= 4) ...[
|
||||
// const Divider(height: 10,color: Colors.grey,),
|
||||
const Text('整改信息', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
Row(
|
||||
children: [
|
||||
Container(width: 3, height: 15, color: Colors.blue),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
"整改信息",
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
// const Text('整改信息', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('整改描述', pd['RECTIFYDESCR'] ?? ''),
|
||||
Divider(height: 1),
|
||||
|
@ -271,6 +296,64 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
|
|||
},
|
||||
),
|
||||
|
||||
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('整改部门', pd['HAVESCHEME']=="0" ? '无':'有'),
|
||||
Divider(height: 1),
|
||||
if(pd['HAVESCHEME']=="1")
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildInfoItem('排查日期', hs['SCREENINGDATE'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('隐患清单', hs['LISTNAME'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('治理标准要求', hs['GOVERNSTANDARDS'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('治理方法', hs['GOVERNMETHOD'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('经费和物资的落实', hs['EXPENDITURE'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('负责治理人员', hs['PRINCIPAL'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('工时安排', hs['PROGRAMMING'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('时限要求', hs['TIMELIMITFOR'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('工作要求', hs['JOBREQUIREMENT'] ?? ''),
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('其他事项', hs['OTHERBUSINESS'] ?? ''),
|
||||
Divider(height: 1),
|
||||
ListItemFactory.createTextImageItem(
|
||||
text: "方案图片",
|
||||
imageUrls: files4,
|
||||
onImageTapped: (index) {
|
||||
presentOpaque(
|
||||
SingleImageViewer(imageUrl: ApiService.baseImgPath +files2[index]),
|
||||
context,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('整改计划', pd['HAVEPLAN']=="0" ? '无':'有'),
|
||||
Divider(height: 1),
|
||||
if(pd['HAVEPLAN']=="1")
|
||||
ListItemFactory.createTextImageItem(
|
||||
text: "计划图片",
|
||||
imageUrls: files2,
|
||||
onImageTapped: (index) {
|
||||
presentOpaque(
|
||||
SingleImageViewer(imageUrl: ApiService.baseImgPath +files2[index]),
|
||||
context,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
// ... 其他整改信息字段
|
||||
],
|
||||
|
||||
|
|
|
@ -181,6 +181,7 @@ class SessionService {
|
|||
String? riskJson;
|
||||
String? departmentJsonStr;
|
||||
String? departmentHiddenTypeJsonStr;
|
||||
String? customRecordDangerJson;
|
||||
|
||||
/// 如果以下任何一项为空,则跳转到登录页
|
||||
void loginSession(BuildContext context) {
|
||||
|
@ -220,7 +221,7 @@ class SessionService {
|
|||
|
||||
void setDepartmentJsonStr(String json) => departmentJsonStr = json;
|
||||
|
||||
|
||||
void setCustomRecordDangerJson(String json) => customRecordDangerJson = json;
|
||||
|
||||
}
|
||||
|
||||
|
|
278
pubspec.lock
278
pubspec.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue