设置安全措施确认人,多级分类变种
parent
51c094710f
commit
9348f657e5
|
@ -24,6 +24,8 @@
|
||||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>NFCReaderUsageDescription</key>
|
||||||
|
<string>用于读取 NFC 标签</string>
|
||||||
<key>NSAppTransportSecurity</key>
|
<key>NSAppTransportSecurity</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSAllowsArbitraryLoads</key>
|
<key>NSAllowsArbitraryLoads</key>
|
||||||
|
@ -31,8 +33,6 @@
|
||||||
</dict>
|
</dict>
|
||||||
<key>NSBluetoothAlwaysUsageDescription</key>
|
<key>NSBluetoothAlwaysUsageDescription</key>
|
||||||
<string>app需要蓝牙权限连接设备</string>
|
<string>app需要蓝牙权限连接设备</string>
|
||||||
<key>NFCReaderUsageDescription</key>
|
|
||||||
<string>用于读取 NFC 标签</string>
|
|
||||||
<key>NSCameraUsageDescription</key>
|
<key>NSCameraUsageDescription</key>
|
||||||
<string>app需要相机权限来扫描二维码</string>
|
<string>app需要相机权限来扫描二维码</string>
|
||||||
<key>NSContactsUsageDescription</key>
|
<key>NSContactsUsageDescription</key>
|
||||||
|
@ -45,8 +45,10 @@
|
||||||
<string>app需要发现本地网络设备</string>
|
<string>app需要发现本地网络设备</string>
|
||||||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
||||||
<string>app需要后台定位以实现持续跟踪</string>
|
<string>app需要后台定位以实现持续跟踪</string>
|
||||||
|
<key>NSLocationAlwaysUsageDescription</key>
|
||||||
|
<string>需要位置权限以提供定位服务</string>
|
||||||
<key>NSLocationWhenInUseUsageDescription</key>
|
<key>NSLocationWhenInUseUsageDescription</key>
|
||||||
<string>app需要定位权限来提供附近服务</string>
|
<string>需要位置权限以提供定位服务</string>
|
||||||
<key>NSMicrophoneUsageDescription</key>
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
<string>app需要麦克风权限进行语音通话</string>
|
<string>app需要麦克风权限进行语音通话</string>
|
||||||
<key>NSMotionUsageDescription</key>
|
<key>NSMotionUsageDescription</key>
|
||||||
|
@ -57,10 +59,6 @@
|
||||||
<string>app需要访问相册以上传图片</string>
|
<string>app需要访问相册以上传图片</string>
|
||||||
<key>NSUserNotificationsUsageDescription</key>
|
<key>NSUserNotificationsUsageDescription</key>
|
||||||
<string>app需要发送通知提醒重要信息</string>
|
<string>app需要发送通知提醒重要信息</string>
|
||||||
<key>NSLocationWhenInUseUsageDescription</key>
|
|
||||||
<string>需要位置权限以提供定位服务</string>
|
|
||||||
<key>NSLocationAlwaysUsageDescription</key>
|
|
||||||
<string>需要位置权限以提供定位服务</string>
|
|
||||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
|
@ -70,15 +68,11 @@
|
||||||
<key>UISupportedInterfaceOrientations</key>
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
|
||||||
</array>
|
</array>
|
||||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -10,54 +10,48 @@ class Category {
|
||||||
final String name;
|
final String name;
|
||||||
final List<Category> children;
|
final List<Category> children;
|
||||||
|
|
||||||
Category({
|
Category({required this.id, required this.name, this.children = const []});
|
||||||
required this.id,
|
|
||||||
required this.name,
|
|
||||||
this.children = const [],
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Category.fromJson(Map<String, dynamic> json) {
|
factory Category.fromJson(Map<String, dynamic> json) {
|
||||||
return Category(
|
return Category(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
name: json['name'] as String,
|
name: json['name'] as String,
|
||||||
children: (json['nodes'] as List<dynamic>)
|
children:
|
||||||
.map((e) => Category.fromJson(e as Map<String, dynamic>))
|
(json['nodes'] as List<dynamic>)
|
||||||
.toList(),
|
.map((e) => Category.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 弹窗回调签名:返回选中项的 id 和 name
|
/// 弹窗回调签名:返回完整的多级路径 JSON 对象
|
||||||
typedef DeptSelectHiddenTypeCallback = void Function(String id, String name);
|
typedef DeptSelectHiddenTypeCallback =
|
||||||
|
void Function(Map<String, List<String>> result);
|
||||||
|
|
||||||
class DepartmentPickerHiddenType extends StatefulWidget {
|
class DepartmentPickerHiddenType extends StatefulWidget {
|
||||||
/// 回调,返回选中部门 id 与 name
|
|
||||||
final DeptSelectHiddenTypeCallback onSelected;
|
final DeptSelectHiddenTypeCallback onSelected;
|
||||||
|
|
||||||
const DepartmentPickerHiddenType({Key? key, required this.onSelected}) : super(key: key);
|
const DepartmentPickerHiddenType({Key? key, required this.onSelected})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_DepartmentPickerHiddenTypeState createState() => _DepartmentPickerHiddenTypeState();
|
_DepartmentPickerHiddenTypeState createState() =>
|
||||||
|
_DepartmentPickerHiddenTypeState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DepartmentPickerHiddenTypeState extends State<DepartmentPickerHiddenType> {
|
class _DepartmentPickerHiddenTypeState
|
||||||
|
extends State<DepartmentPickerHiddenType> {
|
||||||
String selectedId = '';
|
String selectedId = '';
|
||||||
String selectedName = '';
|
|
||||||
Set<String> expandedSet = {};
|
Set<String> expandedSet = {};
|
||||||
|
|
||||||
List<Category> original = [];
|
List<Category> original = [];
|
||||||
List<Category> filtered = [];
|
List<Category> filtered = [];
|
||||||
bool loading = true;
|
bool loading = true;
|
||||||
|
|
||||||
final TextEditingController _searchController = TextEditingController();
|
final TextEditingController _searchController = TextEditingController();
|
||||||
|
final Map<String, Category?> parentMap = {};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
// 初始均为空
|
|
||||||
selectedId = '';
|
|
||||||
selectedName = '';
|
|
||||||
expandedSet = {};
|
|
||||||
_searchController.addListener(_onSearchChanged);
|
_searchController.addListener(_onSearchChanged);
|
||||||
_loadData();
|
_loadData();
|
||||||
}
|
}
|
||||||
|
@ -72,102 +66,146 @@ class _DepartmentPickerHiddenTypeState extends State<DepartmentPickerHiddenType>
|
||||||
Future<void> _loadData() async {
|
Future<void> _loadData() async {
|
||||||
try {
|
try {
|
||||||
List<dynamic> raw;
|
List<dynamic> raw;
|
||||||
if (SessionService.instance.departmentHiddenTypeJsonStr?.isNotEmpty ?? false) {
|
// 从 SessionService 读取或通过 API 拉取
|
||||||
raw = json.decode(SessionService.instance.departmentHiddenTypeJsonStr!) as List<dynamic>;
|
if (SessionService.instance.departmentHiddenTypeJsonStr?.isNotEmpty ??
|
||||||
|
false) {
|
||||||
|
raw =
|
||||||
|
json.decode(SessionService.instance.departmentHiddenTypeJsonStr!)
|
||||||
|
as List;
|
||||||
} else {
|
} else {
|
||||||
final resultLevel = await ApiService. getHiddenLevelsListTwo();
|
// ... 同前逻辑,获取 parentId 并调用 API
|
||||||
|
final resultLevel = await ApiService.getHiddenLevelsListTwo();
|
||||||
List<dynamic> levelList = resultLevel['list'] as List;
|
List<dynamic> levelList = resultLevel['list'] as List;
|
||||||
String parentId="";
|
String parentId = '';
|
||||||
for(int i=0;i<levelList.length;i++){
|
for (var item in levelList) {
|
||||||
String level = levelList[i]['BIANMA'];
|
if ((item['BIANMA'] as String).contains(
|
||||||
String province= SessionService.instance.loginUser?["PROVINCE"]??"";
|
SessionService.instance.loginUser?["PROVINCE"] ?? '',
|
||||||
// 处理可能为null的情况
|
)) {
|
||||||
bool isMatch = level.contains(province);
|
parentId = item['DICTIONARIES_ID'];
|
||||||
if(isMatch){
|
break;
|
||||||
parentId=levelList[i]['DICTIONARIES_ID'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final result = await ApiService.getHiddenTypeList(parentId);
|
final result = await ApiService.getHiddenTypeList(parentId);
|
||||||
final String nodes = result['zTreeNodes'] as String;
|
final nodes = result['zTreeNodes'] as String;
|
||||||
SessionService.instance.departmentHiddenTypeJsonStr = nodes;
|
SessionService.instance.departmentHiddenTypeJsonStr = nodes;
|
||||||
raw = json.decode(nodes) as List<dynamic>;
|
raw = json.decode(nodes) as List;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 构建 Category 列表并生成 parentMap
|
||||||
|
final list =
|
||||||
|
raw.map((e) => Category.fromJson(e as Map<String, dynamic>)).toList();
|
||||||
|
_buildParentMap(list);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
original = raw.map((e) => Category.fromJson(e as Map<String, dynamic>)).toList();
|
original = list;
|
||||||
filtered = original;
|
filtered = list;
|
||||||
loading = false;
|
loading = false;
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (_) {
|
||||||
setState(() => loading = false);
|
setState(() => loading = false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _buildParentMap(List<Category> list, [Category? parent]) {
|
||||||
|
for (var cat in list) {
|
||||||
|
parentMap[cat.id] = parent;
|
||||||
|
if (cat.children.isNotEmpty) {
|
||||||
|
_buildParentMap(cat.children, cat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void _onSearchChanged() {
|
void _onSearchChanged() {
|
||||||
final query = _searchController.text.toLowerCase().trim();
|
final q = _searchController.text.toLowerCase().trim();
|
||||||
setState(() {
|
setState(() {
|
||||||
filtered = query.isEmpty ? original : _filterCategories(original, query);
|
filtered = q.isEmpty ? original : _filterCategories(original, q);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Category> _filterCategories(List<Category> list, String query) {
|
List<Category> _filterCategories(List<Category> list, String q) {
|
||||||
List<Category> result = [];
|
final res = <Category>[];
|
||||||
for (var cat in list) {
|
for (var cat in list) {
|
||||||
final children = _filterCategories(cat.children, query);
|
final children = _filterCategories(cat.children, q);
|
||||||
if (cat.name.toLowerCase().contains(query) || children.isNotEmpty) {
|
if (cat.name.toLowerCase().contains(q) || children.isNotEmpty) {
|
||||||
result.add(Category(id: cat.id, name: cat.name, children: children));
|
res.add(Category(id: cat.id, name: cat.name, children: children));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
Category? _findById(String id) {
|
||||||
|
Category? found;
|
||||||
|
void dfs(List<Category> list) {
|
||||||
|
for (var c in list) {
|
||||||
|
if (c.id == id) {
|
||||||
|
found = c;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dfs(c.children);
|
||||||
|
if (found != null) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dfs(original);
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 构建从根到选中节点的路径列表
|
||||||
|
List<Category> _buildPath(String id) {
|
||||||
|
final path = <Category>[];
|
||||||
|
var cur = _findById(id);
|
||||||
|
while (cur != null) {
|
||||||
|
path.insert(0, cur);
|
||||||
|
cur = parentMap[cur.id];
|
||||||
|
}
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRow(Category cat, int indent) {
|
Widget _buildRow(Category cat, int indent) {
|
||||||
final hasChildren = cat.children.isNotEmpty;
|
final hasChildren = cat.children.isNotEmpty;
|
||||||
final isExpanded = expandedSet.contains(cat.id);
|
final expanded = expandedSet.contains(cat.id);
|
||||||
final isSelected = cat.id == selectedId;
|
final selected = cat.id == selectedId;
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
if (hasChildren) {
|
if (hasChildren) {
|
||||||
isExpanded ? expandedSet.remove(cat.id) : expandedSet.add(cat.id);
|
expanded ? expandedSet.remove(cat.id) : expandedSet.add(cat.id);
|
||||||
}
|
}
|
||||||
selectedId = cat.id;
|
selectedId = cat.id;
|
||||||
selectedName = cat.name;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 16.0 * indent),
|
SizedBox(width: 16.0 * indent),
|
||||||
SizedBox(
|
if (hasChildren)
|
||||||
width: 24,
|
Icon(
|
||||||
child: hasChildren
|
expanded
|
||||||
? Icon(isExpanded ? Icons.arrow_drop_down_rounded : Icons.arrow_right_rounded,
|
? Icons.arrow_drop_down_rounded
|
||||||
size: 35, color: Colors.grey[600])
|
: Icons.arrow_right_rounded,
|
||||||
: const SizedBox.shrink(),
|
size: 24,
|
||||||
),
|
color: Colors.grey[600],
|
||||||
const SizedBox(width: 5),
|
)
|
||||||
Expanded(
|
else
|
||||||
child: Padding(
|
const SizedBox(width: 24),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
const SizedBox(width: 8),
|
||||||
child: Text(cat.name),
|
Expanded(child: Text(cat.name)),
|
||||||
),
|
Icon(
|
||||||
),
|
selected
|
||||||
Padding(
|
? Icons.radio_button_checked
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
: Icons.radio_button_unchecked,
|
||||||
child: Icon(
|
color: Colors.green,
|
||||||
isSelected ? Icons.radio_button_checked : Icons.radio_button_unchecked,
|
|
||||||
color: Colors.green,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (hasChildren && isExpanded)
|
if (hasChildren && expanded)
|
||||||
...cat.children.map((c) => _buildRow(c, indent + 1)),
|
...cat.children.map((c) => _buildRow(c, indent + 1)),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -176,52 +214,55 @@ class _DepartmentPickerHiddenTypeState extends State<DepartmentPickerHiddenType>
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
width: MediaQuery.of(context).size.width,
|
width: double.infinity,
|
||||||
height: MediaQuery.of(context).size.height * 0.7,
|
height: MediaQuery.of(context).size.height * 0.7,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
// 顶部操作栏
|
||||||
color: Colors.white,
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => Navigator.of(context).pop(),
|
onTap: () => Navigator.of(context).pop(),
|
||||||
child: const Text('取消', style: TextStyle(fontSize: 16)),
|
child: const Text('取消'),
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: SearchBarWidget(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
controller: _searchController,
|
||||||
child: SearchBarWidget(
|
isShowSearchButton: false,
|
||||||
controller: _searchController,
|
onSearch: (_) {},
|
||||||
isShowSearchButton: false,
|
|
||||||
onSearch: (keyboard) {
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
final pathCats = _buildPath(selectedId);
|
||||||
|
final ids = pathCats.map((e) => e.id).toList();
|
||||||
|
final names = pathCats.map((e) => e.name).toList();
|
||||||
|
widget.onSelected({'id': ids, 'name': names});
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
widget.onSelected(selectedId, selectedName);
|
|
||||||
},
|
},
|
||||||
child: const Text('确定', style: TextStyle(fontSize: 16, color: Colors.green)),
|
child: const Text(
|
||||||
|
'确定',
|
||||||
|
style: TextStyle(color: Colors.green),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Divider(),
|
const Divider(height: 1),
|
||||||
|
// 列表区
|
||||||
Expanded(
|
Expanded(
|
||||||
child: loading
|
child:
|
||||||
? const Center(child: CircularProgressIndicator())
|
loading
|
||||||
: Container(
|
? const Center(child: CircularProgressIndicator())
|
||||||
color: Colors.white,
|
: ListView.builder(
|
||||||
child: ListView.builder(
|
itemCount: filtered.length,
|
||||||
itemCount: filtered.length,
|
itemBuilder: (_, idx) => _buildRow(filtered[idx], 0),
|
||||||
itemBuilder: (ctx, idx) => _buildRow(filtered[idx], 0),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
|
||||||
/// print('用户选择的时间:$picked');
|
/// print('用户选择的时间:$picked');
|
||||||
/// }
|
/// }
|
||||||
class BottomDateTimePicker {
|
class BottomDateTimePicker {
|
||||||
static Future<DateTime?> show(BuildContext context) {
|
static Future<DateTime?> showDate(BuildContext context) {
|
||||||
return showModalBottomSheet<DateTime>(
|
return showModalBottomSheet<DateTime>(
|
||||||
context: context,
|
context: context,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
|
|
|
@ -9,7 +9,7 @@ class SingleImageViewer extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.black.withValues(alpha: 0.7),
|
backgroundColor: Colors.black.withValues(alpha: 0.5),
|
||||||
appBar: MyAppbar(
|
appBar: MyAppbar(
|
||||||
isBack: false,
|
isBack: false,
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -17,12 +17,12 @@ class SingleImageViewer extends StatelessWidget {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}, icon: Icon(Icons.close, color: Colors.white, size: 40,),)
|
}, icon: Icon(Icons.close, color: Colors.white, size: 40,),)
|
||||||
],
|
],
|
||||||
backgroundColor: Colors.black.withValues(alpha:0.7), title: '',
|
backgroundColor: Colors.black.withValues(alpha:0.5), title: '',
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
child: PhotoView(
|
child: PhotoView(
|
||||||
imageProvider: NetworkImage(imageUrl),
|
imageProvider: NetworkImage(imageUrl),
|
||||||
backgroundDecoration: BoxDecoration(color: Colors.black.withValues(alpha:00.5)),
|
backgroundDecoration: BoxDecoration(color: Colors.black.withValues(alpha:0.5)),
|
||||||
minScale: PhotoViewComputedScale.contained,
|
minScale: PhotoViewComputedScale.contained,
|
||||||
maxScale: PhotoViewComputedScale.covered * 2,
|
maxScale: PhotoViewComputedScale.covered * 2,
|
||||||
onTapUp: (context, details, controllerValue) {
|
onTapUp: (context, details, controllerValue) {
|
||||||
|
|
|
@ -657,14 +657,13 @@ U6Hzm1ninpWeE+awIDAQAB
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/// 气体分析详情列表删除
|
/// 气体分析详情列表删除
|
||||||
static Future<Map<String, dynamic>> hotworkGasDelete(String hotworkId) {
|
static Future<Map<String, dynamic>> hotworkGasDelete(String hotworkGasId) {
|
||||||
return HttpManager().request(
|
return HttpManager().request(
|
||||||
basePath,
|
basePath,
|
||||||
'/app/hotwork/gas/delete',
|
'/app/hotwork/gas/delete',
|
||||||
method: Method.post,
|
method: Method.post,
|
||||||
data: {
|
data: {
|
||||||
"HOTWORK_ID":hotworkId,
|
"HOTWORKGAS_ID":hotworkGasId,
|
||||||
"tm": DateTime.now().millisecondsSinceEpoch,
|
|
||||||
"CORPINFO_ID":SessionService.instance.corpinfoId,
|
"CORPINFO_ID":SessionService.instance.corpinfoId,
|
||||||
"USER_ID":SessionService.instance.loginUserId,
|
"USER_ID":SessionService.instance.loginUserId,
|
||||||
},
|
},
|
||||||
|
@ -692,6 +691,21 @@ U6Hzm1ninpWeE+awIDAQAB
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
/// 所有安全防护措施
|
||||||
|
static Future<Map<String, dynamic>> listSignFinishAllMeasures(String hotworkId) {
|
||||||
|
final String tm = DateTime.now().millisecondsSinceEpoch.toString();
|
||||||
|
return HttpManager().request(
|
||||||
|
basePath,
|
||||||
|
'/app/hotwork/listAllMeasuresForSign?tm=$tm',
|
||||||
|
method: Method.post,
|
||||||
|
data: {
|
||||||
|
"CORPINFO_ID":SessionService.instance.corpinfoId,
|
||||||
|
"CONFIRM_ID":SessionService.instance.loginUserId,
|
||||||
|
"HOTWORK_ID":hotworkId,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// 关联的特殊作业列表
|
/// 关联的特殊作业列表
|
||||||
static Future<Map<String, dynamic>> getEightWorkStartList(Map data) {
|
static Future<Map<String, dynamic>> getEightWorkStartList(Map data) {
|
||||||
return HttpManager().request(
|
return HttpManager().request(
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
@ -180,11 +181,9 @@ class _QuickReportPageState extends State<QuickReportPage> {
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
builder:
|
builder:
|
||||||
(ctx) => DepartmentPickerHiddenType(
|
(ctx) => DepartmentPickerHiddenType(
|
||||||
onSelected: (id, name) async {
|
onSelected: (json) {
|
||||||
setState(() {
|
print(jsonEncode(json));
|
||||||
yinHuanId = id;
|
|
||||||
yinHuanName = name;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -209,7 +209,7 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
|
||||||
text: "隐患照片",
|
text: "隐患照片",
|
||||||
imageUrls: files,
|
imageUrls: files,
|
||||||
onImageTapped: (index) {
|
onImageTapped: (index) {
|
||||||
present(
|
presentOpaque(
|
||||||
SingleImageViewer(imageUrl:ApiService.baseImgPath + files[index]),
|
SingleImageViewer(imageUrl:ApiService.baseImgPath + files[index]),
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
|
@ -264,7 +264,7 @@ class _HiddenRecordDetailPageState extends State<HiddenRecordDetailPage> {
|
||||||
text: "整改后图片",
|
text: "整改后图片",
|
||||||
imageUrls: files2,
|
imageUrls: files2,
|
||||||
onImageTapped: (index) {
|
onImageTapped: (index) {
|
||||||
present(
|
presentOpaque(
|
||||||
SingleImageViewer(imageUrl: ApiService.baseImgPath +files2[index]),
|
SingleImageViewer(imageUrl: ApiService.baseImgPath +files2[index]),
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
|
|
|
@ -243,7 +243,7 @@ class _PendingRectificationDetailPageState extends State<PendingRectificationDet
|
||||||
text: "隐患照片",
|
text: "隐患照片",
|
||||||
imageUrls: files,
|
imageUrls: files,
|
||||||
onImageTapped: (index) {
|
onImageTapped: (index) {
|
||||||
present(
|
presentOpaque(
|
||||||
SingleImageViewer(imageUrl:ApiService.baseImgPath + files[index]),
|
SingleImageViewer(imageUrl:ApiService.baseImgPath + files[index]),
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
|
|
|
@ -7,11 +7,11 @@ import 'package:qhd_prevention/customWidget/department_person_picker.dart';
|
||||||
import 'package:qhd_prevention/customWidget/department_picker.dart';
|
import 'package:qhd_prevention/customWidget/department_picker.dart';
|
||||||
import 'package:qhd_prevention/customWidget/toast_util.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/home/tap/item_list_widget.dart';
|
||||||
import 'package:qhd_prevention/pages/home/tap/tabList/special_Wrok/dh_work_detai/hotwork_gas_list.dart';
|
|
||||||
import 'package:qhd_prevention/tools/tools.dart';
|
import 'package:qhd_prevention/tools/tools.dart';
|
||||||
import '../../../../../../customWidget/bottom_picker.dart';
|
import '../../../../../../customWidget/bottom_picker.dart';
|
||||||
import '../../../../../../http/ApiService.dart';
|
import '../../../../../../http/ApiService.dart';
|
||||||
import '../../../../../my_appbar.dart';
|
import '../../../../../my_appbar.dart';
|
||||||
|
import '../../special_Wrok/qtfx_work_detail/hotwork_gas_list.dart';
|
||||||
import 'MeasuresListWidget.dart';
|
import 'MeasuresListWidget.dart';
|
||||||
|
|
||||||
enum EditUserType {
|
enum EditUserType {
|
||||||
|
|
|
@ -1,188 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:qhd_prevention/customWidget/custom_alert_dialog.dart';
|
|
||||||
import 'package:qhd_prevention/customWidget/toast_util.dart';
|
|
||||||
import 'package:qhd_prevention/http/ApiService.dart';
|
|
||||||
import 'package:qhd_prevention/pages/home/tap/tabList/special_wrok/home_gas_test_page.dart';
|
|
||||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
|
||||||
import 'package:photo_view/photo_view.dart';
|
|
||||||
import 'package:photo_view/photo_view_gallery.dart';
|
|
||||||
|
|
||||||
import '../../../../../../customWidget/single_image_viewer.dart';
|
|
||||||
import '../../../../../../tools/tools.dart';
|
|
||||||
|
|
||||||
/// 气体分析详情
|
|
||||||
class HotworkGasList extends StatefulWidget {
|
|
||||||
const HotworkGasList({
|
|
||||||
super.key,
|
|
||||||
required this.HOTWORK_ID,
|
|
||||||
this.addFlag = false,
|
|
||||||
});
|
|
||||||
|
|
||||||
final String HOTWORK_ID;
|
|
||||||
final bool addFlag;
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<HotworkGasList> createState() => _HotworkGasListState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _HotworkGasListState extends State<HotworkGasList> {
|
|
||||||
List list = [];
|
|
||||||
bool isLoading = true;
|
|
||||||
Future<void> _getListData() async {
|
|
||||||
final data = await ApiService.hotworkGasList(widget.HOTWORK_ID);
|
|
||||||
setState(() {
|
|
||||||
list = data['varList'] ?? [];
|
|
||||||
isLoading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void _deleteItem(String id) async {
|
|
||||||
showDialog<void>(
|
|
||||||
context: context,
|
|
||||||
builder:
|
|
||||||
(_) => CustomAlertDialog(
|
|
||||||
title: '温馨提示',
|
|
||||||
content: '确定要删除这条记录?',
|
|
||||||
cancelText: '取消',
|
|
||||||
onCancel: () {},
|
|
||||||
onConfirm: () async {
|
|
||||||
final result = await ApiService.hotworkGasDelete(id);
|
|
||||||
if (result['result']) {
|
|
||||||
ToastUtil.showNormal(context, '删除成功');
|
|
||||||
_getListData();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Widget _buildListItem(Map item) {
|
|
||||||
final images = (item['SIGN_PATH'] as String?)?.split(',') ?? [];
|
|
||||||
final baseImgPath = ApiService.baseImgPath;
|
|
||||||
|
|
||||||
return Container(
|
|
||||||
color: Colors.white,
|
|
||||||
margin: const EdgeInsets.symmetric(vertical: 5, horizontal: 5),
|
|
||||||
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text('分析时间: ${item['ANALYZE_TIME'] ?? ''}'),
|
|
||||||
Text('代表性气体: ${item['ANALYZE_GAS'] ?? ''}'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text('分析数据: ${item['ANALYZE_RESULT'] ?? ''}'),
|
|
||||||
if ((item['ANALYZE_PLACE'] ?? '').toString().isNotEmpty)
|
|
||||||
Text('分析地点: ${item['ANALYZE_PLACE']}'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
const Text('分析人:'),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Expanded(
|
|
||||||
child: Wrap(
|
|
||||||
spacing: 8,
|
|
||||||
runSpacing: 4,
|
|
||||||
children: List.generate(images.length, (i) {
|
|
||||||
final img = baseImgPath + images[i];
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
present(
|
|
||||||
SingleImageViewer(imageUrl: img),
|
|
||||||
context,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Image.network(
|
|
||||||
img,
|
|
||||||
width: 50,
|
|
||||||
height: 30,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (widget.addFlag)
|
|
||||||
TextButton(
|
|
||||||
onPressed: () =>
|
|
||||||
_deleteItem(item['HOTWORKGAS_ID'].toString()),
|
|
||||||
style: TextButton.styleFrom(
|
|
||||||
backgroundColor: Colors.red,
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
minimumSize: const Size(0, 32),
|
|
||||||
),
|
|
||||||
child: const Text(
|
|
||||||
'删除',
|
|
||||||
style: TextStyle(color: Colors.white),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildListContent() {
|
|
||||||
if (isLoading) {
|
|
||||||
return const Center(child: CircularProgressIndicator());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (list.isEmpty) {
|
|
||||||
return NoDataWidget.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ListView.builder(
|
|
||||||
itemCount: list.length,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
final item = list[index];
|
|
||||||
return _buildListItem(item);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_getListData();
|
|
||||||
}
|
|
||||||
void _pyshAddGas() async {
|
|
||||||
await pushPage(HomeGasTestPage(HOTWORK_ID: widget.HOTWORK_ID,), context);
|
|
||||||
_getListData();
|
|
||||||
|
|
||||||
}
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
appBar: MyAppbar(
|
|
||||||
title: '气体分析详情',
|
|
||||||
actions: [
|
|
||||||
if (widget.addFlag)
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
_pyshAddGas();
|
|
||||||
},
|
|
||||||
child: const Text('添加', style: TextStyle(color: Colors.white, fontSize: 16)),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
body: _buildListContent(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -38,7 +38,7 @@ class _HomeGasTestPageState extends State<HomeGasTestPage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _chooseDatePicker() async {
|
Future<void> _chooseDatePicker() async {
|
||||||
DateTime? picked = await BottomDateTimePicker.show(context);
|
DateTime? picked = await BottomDateTimePicker.showDate(context);
|
||||||
if (picked != null) {
|
if (picked != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectData = DateFormat('yyyy-MM-dd HH:mm').format(picked);
|
_selectData = DateFormat('yyyy-MM-dd HH:mm').format(picked);
|
||||||
|
@ -57,7 +57,7 @@ class _HomeGasTestPageState extends State<HomeGasTestPage> {
|
||||||
setState(() {
|
setState(() {
|
||||||
imagePaths.add(path);
|
imagePaths.add(path);
|
||||||
signTimes.add(now);
|
signTimes.add(now);
|
||||||
|
FocusHelper.clearFocus(context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,12 +68,13 @@ class _HomeGasTestPageState extends State<HomeGasTestPage> {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
const DottedLine(
|
// const DottedLine(
|
||||||
dashLength: 6.0,
|
// dashLength: 6.0,
|
||||||
dashGapLength: 4.0,
|
// dashGapLength: 4.0,
|
||||||
lineThickness: 0.5,
|
// lineThickness: 0.5,
|
||||||
dashColor: Colors.grey,
|
// dashColor: Colors.grey,
|
||||||
),
|
// ),
|
||||||
|
const Divider(),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
@ -190,7 +191,8 @@ class _HomeGasTestPageState extends State<HomeGasTestPage> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: MyAppbar(title: '气体检测'),
|
appBar: MyAppbar(title: '气体检测'),
|
||||||
body: _loading
|
body: SafeArea(child:
|
||||||
|
_loading
|
||||||
? const Center(child: CircularProgressIndicator())
|
? const Center(child: CircularProgressIndicator())
|
||||||
: SingleChildScrollView(
|
: SingleChildScrollView(
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
|
@ -275,6 +277,7 @@ class _HomeGasTestPageState extends State<HomeGasTestPage> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,12 @@ import 'package:qhd_prevention/customWidget/department_person_picker.dart';
|
||||||
import 'package:qhd_prevention/customWidget/department_picker.dart';
|
import 'package:qhd_prevention/customWidget/department_picker.dart';
|
||||||
import 'package:qhd_prevention/customWidget/toast_util.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/home/tap/item_list_widget.dart';
|
||||||
import 'package:qhd_prevention/pages/home/tap/tabList/special_Wrok/dh_work_detai/hotwork_gas_list.dart';
|
|
||||||
import 'package:qhd_prevention/tools/tools.dart';
|
import 'package:qhd_prevention/tools/tools.dart';
|
||||||
import '../../../../../../customWidget/bottom_picker.dart';
|
import '../../../../../../customWidget/bottom_picker.dart';
|
||||||
import '../../../../../../http/ApiService.dart';
|
import '../../../../../../http/ApiService.dart';
|
||||||
import '../../../../../my_appbar.dart';
|
import '../../../../../my_appbar.dart';
|
||||||
import '../../special_Wrok/dh_work_detai/MeasuresListWidget.dart';
|
import '../../special_Wrok/dh_work_detai/MeasuresListWidget.dart';
|
||||||
|
import '../../special_Wrok/qtfx_work_detail/hotwork_gas_list.dart';
|
||||||
|
|
||||||
enum EditUserType {
|
enum EditUserType {
|
||||||
ANALYZE('分析单位', '分析单位负责人'),
|
ANALYZE('分析单位', '分析单位负责人'),
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:qhd_prevention/customWidget/custom_alert_dialog.dart';
|
import 'package:qhd_prevention/customWidget/custom_alert_dialog.dart';
|
||||||
import 'package:qhd_prevention/customWidget/toast_util.dart';
|
import 'package:qhd_prevention/customWidget/toast_util.dart';
|
||||||
import 'package:qhd_prevention/http/ApiService.dart';
|
import 'package:qhd_prevention/http/ApiService.dart';
|
||||||
|
import 'package:qhd_prevention/pages/home/tap/tabList/special_wrok/home_gas_test_page.dart';
|
||||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||||
import 'package:photo_view/photo_view.dart';
|
import 'package:photo_view/photo_view.dart';
|
||||||
import 'package:photo_view/photo_view_gallery.dart';
|
import 'package:photo_view/photo_view_gallery.dart';
|
||||||
|
@ -25,9 +26,11 @@ class HotworkGasList extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _HotworkGasListState extends State<HotworkGasList> {
|
class _HotworkGasListState extends State<HotworkGasList> {
|
||||||
List list = [];
|
late List list = [];
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
|
|
||||||
Future<void> _getListData() async {
|
Future<void> _getListData() async {
|
||||||
|
|
||||||
final data = await ApiService.hotworkGasList(widget.HOTWORK_ID);
|
final data = await ApiService.hotworkGasList(widget.HOTWORK_ID);
|
||||||
setState(() {
|
setState(() {
|
||||||
list = data['varList'] ?? [];
|
list = data['varList'] ?? [];
|
||||||
|
@ -46,9 +49,9 @@ class _HotworkGasListState extends State<HotworkGasList> {
|
||||||
onCancel: () {},
|
onCancel: () {},
|
||||||
onConfirm: () async {
|
onConfirm: () async {
|
||||||
final result = await ApiService.hotworkGasDelete(id);
|
final result = await ApiService.hotworkGasDelete(id);
|
||||||
if (result['result']) {
|
if (result['result'] == 'success') {
|
||||||
ToastUtil.showNormal(context, '删除成功');
|
|
||||||
_getListData();
|
_getListData();
|
||||||
|
ToastUtil.showNormal(context, '删除成功');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -160,23 +163,24 @@ class _HotworkGasListState extends State<HotworkGasList> {
|
||||||
super.initState();
|
super.initState();
|
||||||
_getListData();
|
_getListData();
|
||||||
}
|
}
|
||||||
|
void _pyshAddGas() async {
|
||||||
|
await pushPage(HomeGasTestPage(HOTWORK_ID: widget.HOTWORK_ID,), context);
|
||||||
|
_getListData();
|
||||||
|
|
||||||
|
}
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
appBar: MyAppbar(
|
appBar: MyAppbar(
|
||||||
title: '气体分析详情',
|
title: '气体分析详情',
|
||||||
actions: [
|
actions: [
|
||||||
if (widget.addFlag)
|
if (widget.addFlag)
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pushNamed(
|
_pyshAddGas();
|
||||||
context,
|
|
||||||
'/hotworkGasDetail',
|
|
||||||
arguments: {'HOTWORK_ID': widget.HOTWORK_ID},
|
|
||||||
).then((_) => _getListData());
|
|
||||||
},
|
},
|
||||||
child: const Text('添加', style: TextStyle(color: Colors.white)),
|
child: const Text('添加', style: TextStyle(color: Colors.white, fontSize: 16)),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:qhd_prevention/customWidget/toast_util.dart';
|
import 'package:qhd_prevention/customWidget/toast_util.dart';
|
||||||
import 'package:qhd_prevention/pages/home/tap/tabList/special_Wrok/dh_work_detai/hotwork_apply_detail.dart';
|
import 'package:qhd_prevention/pages/home/tap/tabList/special_Wrok/dh_work_detai/hotwork_apply_detail.dart';
|
||||||
|
import 'package:qhd_prevention/pages/home/tap/tabList/special_wrok/szaq_work_detail/hotwork_set_safe_detail.dart';
|
||||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||||
import 'package:qhd_prevention/tools/tools.dart';
|
import 'package:qhd_prevention/tools/tools.dart';
|
||||||
import '../../../../../customWidget/bottom_picker.dart';
|
import '../../../../../customWidget/bottom_picker.dart';
|
||||||
import '../../../../../customWidget/custom_button.dart';
|
import '../../../../../customWidget/custom_button.dart';
|
||||||
import '../../../../../customWidget/search_bar_widget.dart';
|
import '../../../../../customWidget/search_bar_widget.dart';
|
||||||
import '../../../../../http/ApiService.dart';
|
import '../../../../../http/ApiService.dart';
|
||||||
import '../special_Wrok/dh_work_detai/hotwork_gas_list.dart';
|
import '../special_Wrok/qtfx_work_detail/hotwork_gas_list.dart';
|
||||||
|
|
||||||
class SpecialWorkListPage extends StatefulWidget {
|
class SpecialWorkListPage extends StatefulWidget {
|
||||||
final String flow;
|
final String flow;
|
||||||
|
@ -192,7 +193,7 @@ class _SpecialWorkListPageState extends State<SpecialWorkListPage> {
|
||||||
pushPage(HotworkGasList(HOTWORK_ID: item['HOTWORK_ID'], addFlag:true), context);
|
pushPage(HotworkGasList(HOTWORK_ID: item['HOTWORK_ID'], addFlag:true), context);
|
||||||
break;
|
break;
|
||||||
case '设置安全措施确认人':
|
case '设置安全措施确认人':
|
||||||
routeName = '/hotwork-measures-detail';
|
await pushPage(HotworkSetSafeDetail(HOTWORK_ID: item['HOTWORK_ID'], flow: widget.flow), context);
|
||||||
break;
|
break;
|
||||||
case '安全措施确认':
|
case '安全措施确认':
|
||||||
routeName = '/hotwork-measures-confirm-detail';
|
routeName = '/hotwork-measures-confirm-detail';
|
||||||
|
|
|
@ -0,0 +1,809 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||||
|
import 'package:qhd_prevention/customWidget/custom_button.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/pages/home/tap/item_list_widget.dart';
|
||||||
|
import 'package:qhd_prevention/tools/tools.dart';
|
||||||
|
import '../../../../../../customWidget/bottom_picker.dart';
|
||||||
|
import '../../../../../../http/ApiService.dart';
|
||||||
|
import '../../../../../my_appbar.dart';
|
||||||
|
import '../../special_Wrok/dh_work_detai/MeasuresListWidget.dart';
|
||||||
|
import '../../special_Wrok/qtfx_work_detail/hotwork_gas_list.dart';
|
||||||
|
|
||||||
|
enum EditUserType {
|
||||||
|
ANALYZE('分析单位', '分析单位负责人'),
|
||||||
|
GUARDIAN('监护人单位', '监护人'),
|
||||||
|
CONFESS('安全交底人单位', '安全交底人'),
|
||||||
|
ACCEPT_CONFESS('接受交底人单位', '接受交底人'),
|
||||||
|
CONFIRM('作业负责人单位', '作业负责人'),
|
||||||
|
LEADER('所在单位', '所在单位负责人'),
|
||||||
|
AUDIT('安全管理部门', '安全管理部门负责人'),
|
||||||
|
APPROVE('动火审批单位', '动火审批负责人'),
|
||||||
|
MONITOR('动火前在岗部门', '动火前在岗班长'),
|
||||||
|
WORK_START('作业开始负责人单位', '作业开始负责人'),
|
||||||
|
WORK_END('作业结束负责人单位', '作业结束负责人'),
|
||||||
|
ACCEPT('验收部门', '验收部门负责人');
|
||||||
|
|
||||||
|
/// 对应的单位显示名
|
||||||
|
final String displayName;
|
||||||
|
final String personName;
|
||||||
|
|
||||||
|
const EditUserType(this.displayName, this.personName);
|
||||||
|
}
|
||||||
|
|
||||||
|
class HotworkSetSafeDetail extends StatefulWidget {
|
||||||
|
const HotworkSetSafeDetail({
|
||||||
|
super.key,
|
||||||
|
required this.HOTWORK_ID,
|
||||||
|
required this.flow,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String HOTWORK_ID;
|
||||||
|
final String flow;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<HotworkSetSafeDetail> createState() => _HotworkSetSafeDetailState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HotworkSetSafeDetailState extends State<HotworkSetSafeDetail> {
|
||||||
|
late bool isEditable = false;
|
||||||
|
final levelList = ["特级", "一级", "二级"];
|
||||||
|
|
||||||
|
/// 编辑还是新增
|
||||||
|
late String msg = 'add';
|
||||||
|
|
||||||
|
/// 详情
|
||||||
|
late Map<String, dynamic> pd = {};
|
||||||
|
late List<Map<String, dynamic>> measuresList = [];
|
||||||
|
|
||||||
|
final TextEditingController _contentController = TextEditingController();
|
||||||
|
final TextEditingController _locationController = TextEditingController();
|
||||||
|
final TextEditingController _methodController = TextEditingController();
|
||||||
|
final TextEditingController _hotworkPersonController =
|
||||||
|
TextEditingController();
|
||||||
|
final TextEditingController _relatedController = TextEditingController();
|
||||||
|
final TextEditingController _riskController = TextEditingController();
|
||||||
|
|
||||||
|
/// 动火人及证书编号
|
||||||
|
late List<dynamic> workUserList = [];
|
||||||
|
/// 安全防护措施列表
|
||||||
|
late List<dynamic> measuresListCopy = [];
|
||||||
|
|
||||||
|
// 存储各单位的人员列表
|
||||||
|
final Map<EditUserType, List<Map<String, dynamic>>> _personCache = {};
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_getData();
|
||||||
|
_getHotWorkNameList();
|
||||||
|
addMeasuresListCopy();
|
||||||
|
_contentController.addListener(() {
|
||||||
|
setState(() {
|
||||||
|
pd['WORK_CONTENT'] = _contentController.text.trim();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
_locationController.addListener(() {
|
||||||
|
pd['WORK_PLACE'] = _locationController.text.trim();
|
||||||
|
});
|
||||||
|
_methodController.addListener(() {
|
||||||
|
pd['WORK_FUNCTION'] = _methodController.text.trim();
|
||||||
|
});
|
||||||
|
_hotworkPersonController.addListener(() {
|
||||||
|
pd['WORK_USER'] = _hotworkPersonController.text.trim();
|
||||||
|
});
|
||||||
|
_relatedController.addListener(() {
|
||||||
|
pd['SPECIAL_WORK'] = _relatedController.text.trim();
|
||||||
|
});
|
||||||
|
_riskController.addListener(() {
|
||||||
|
pd['RISK_IDENTIFICATION'] = _riskController.text.trim();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_pd_DEPARTMENT_ID(EditUserType type, String id) {
|
||||||
|
pd['${type.name}_DEPARTMENT_ID'] = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_pd_DEPARTMENT_NAME(EditUserType type, String name) {
|
||||||
|
pd['${type.name}_DEPARTMENT_NAME'] = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_pd_USER_ID(EditUserType type, String id) {
|
||||||
|
pd['${type.name}_USER_ID'] = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_pd_USER_Name(EditUserType type, String name) {
|
||||||
|
pd['${type.name}_USER_NAME'] = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
String get_pd_DEPARTMENT_ID(EditUserType type) {
|
||||||
|
return pd['${type.name}_DEPARTMENT_ID'] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
String get_pd_DEPARTMENT_NAME(EditUserType type) {
|
||||||
|
return pd['${type.name}_DEPARTMENT_NAME'] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
String get_pd_USER_ID(EditUserType type) {
|
||||||
|
return pd['${type.name}_USER_ID'] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
String get_pd_USER_Name(EditUserType type) {
|
||||||
|
return pd['${type.name}_USER_NAME'] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _chooseLevel() async {
|
||||||
|
final choice = await BottomPicker.show<String>(
|
||||||
|
context,
|
||||||
|
items: levelList,
|
||||||
|
itemBuilder: (item) => Text(item, textAlign: TextAlign.center),
|
||||||
|
initialIndex: 0,
|
||||||
|
);
|
||||||
|
if (choice != null) {
|
||||||
|
// 用户点击确定并选择了 choice
|
||||||
|
setState(() {
|
||||||
|
pd['WORK_LEVEL'] = choice;
|
||||||
|
FocusHelper.clearFocus(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _chooseHorkUser() async {
|
||||||
|
final choice = await BottomPicker.show<String>(
|
||||||
|
context,
|
||||||
|
items: workUserList.map((item) => item['NAME'] as String).toList(),
|
||||||
|
itemBuilder: (item) => Text(item, textAlign: TextAlign.center),
|
||||||
|
initialIndex: 0,
|
||||||
|
);
|
||||||
|
if (choice != null) {
|
||||||
|
setState(() {
|
||||||
|
pd['WORK_USER'] = choice;
|
||||||
|
_hotworkPersonController.text = choice;
|
||||||
|
Map<String, dynamic> result = workUserList.firstWhere(
|
||||||
|
(item) => item['NAME'] == choice,
|
||||||
|
orElse: () => {}, // 避免找不到时报错
|
||||||
|
);
|
||||||
|
if (FormUtils.hasValue(result, 'USER_ID')) {
|
||||||
|
pd['WORK_USER_ID'] = result['USER_ID'];
|
||||||
|
}
|
||||||
|
FocusHelper.clearFocus(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _defaultDetail() {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
ItemListWidget.singleLineTitleText(
|
||||||
|
label: '申请单位:',
|
||||||
|
isEditable: false,
|
||||||
|
text: pd['APPLY_DEPARTMENT_NAME'] ?? '',
|
||||||
|
),
|
||||||
|
Divider(),
|
||||||
|
ItemListWidget.singleLineTitleText(
|
||||||
|
label: '申请人:',
|
||||||
|
isEditable: false,
|
||||||
|
text: pd['APPLY_USER_NAME'] ?? '',
|
||||||
|
),
|
||||||
|
if (FormUtils.hasValue(pd, 'CHECK_NO'))
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Divider(),
|
||||||
|
ItemListWidget.singleLineTitleText(
|
||||||
|
label: '编号:',
|
||||||
|
isEditable: false,
|
||||||
|
text: pd['CHECK_NO'] ?? '',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
Divider(),
|
||||||
|
ItemListWidget.multiLineTitleTextField(
|
||||||
|
label: '作业内容:',
|
||||||
|
isEditable: isEditable,
|
||||||
|
controller: _contentController,
|
||||||
|
text: pd['WORK_CONTENT'] ?? '',
|
||||||
|
),
|
||||||
|
Divider(),
|
||||||
|
ItemListWidget.singleLineTitleText(
|
||||||
|
label: '动火地点及动火部位:',
|
||||||
|
isEditable: isEditable,
|
||||||
|
controller: _locationController,
|
||||||
|
text: pd['WORK_PLACE'] ?? '',
|
||||||
|
),
|
||||||
|
Divider(),
|
||||||
|
ItemListWidget.selectableLineTitleTextField(
|
||||||
|
label: '动火作业级别',
|
||||||
|
isEditable: isEditable,
|
||||||
|
onTap: () {
|
||||||
|
_chooseLevel();
|
||||||
|
},
|
||||||
|
text: pd['WORK_LEVEL'] ?? '',
|
||||||
|
),
|
||||||
|
Divider(),
|
||||||
|
ItemListWidget.singleLineTitleText(
|
||||||
|
label: '动火方式:',
|
||||||
|
isEditable: isEditable,
|
||||||
|
controller: _methodController,
|
||||||
|
text: pd['WORK_FUNCTION'] ?? '',
|
||||||
|
),
|
||||||
|
if (pd['WORK_START_DATE'] != null &&
|
||||||
|
pd['WORK_START_DATE'].toString().isNotEmpty)
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Divider(),
|
||||||
|
ItemListWidget.singleLineTitleText(
|
||||||
|
label: '动火作业\n实施时间:',
|
||||||
|
isEditable: isEditable,
|
||||||
|
controller: _methodController,
|
||||||
|
text:
|
||||||
|
pd['WORK_START_DATE'] ??
|
||||||
|
'' +
|
||||||
|
'至' +
|
||||||
|
(pd['WORK_END_DATE']
|
||||||
|
? pd['WORK_END_DATE'] ?? ''
|
||||||
|
: '--') ??
|
||||||
|
'',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Divider(),
|
||||||
|
ItemListWidget.twoRowSelectableTitleText(
|
||||||
|
label: '动火人及证书编号:',
|
||||||
|
isEditable: isEditable,
|
||||||
|
onTap: () {
|
||||||
|
_chooseHorkUser();
|
||||||
|
},
|
||||||
|
controller: _hotworkPersonController,
|
||||||
|
text: pd['WORK_USER'] ?? '',
|
||||||
|
),
|
||||||
|
Divider(),
|
||||||
|
ItemListWidget.twoRowButtonTitleText(
|
||||||
|
label: '关联的其他特殊作业及安全作业票编号',
|
||||||
|
isEditable: isEditable,
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder:
|
||||||
|
(_) => SelectionPopup(
|
||||||
|
type: 'assignments',
|
||||||
|
initialValue: pd['SPECIAL_WORK'] ?? '',
|
||||||
|
onConfirm: (val) {
|
||||||
|
// val 为逗号分隔的选中值
|
||||||
|
setState(() {
|
||||||
|
pd['SPECIAL_WORK'] = val;
|
||||||
|
_relatedController.text = val;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
).then((_) {
|
||||||
|
FocusHelper.clearFocus(context);
|
||||||
|
});
|
||||||
|
// identification
|
||||||
|
},
|
||||||
|
hintText: '请输入关联的其他特殊作业及安全作业票编号',
|
||||||
|
controller: _relatedController,
|
||||||
|
text: pd['SPECIAL_WORK'] ?? '',
|
||||||
|
),
|
||||||
|
Divider(),
|
||||||
|
ItemListWidget.twoRowButtonTitleText(
|
||||||
|
label: '风险辨识结果',
|
||||||
|
isEditable: isEditable,
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder:
|
||||||
|
(_) => SelectionPopup(
|
||||||
|
type: 'identification',
|
||||||
|
initialValue: pd['RISK_IDENTIFICATION'] ?? '',
|
||||||
|
onConfirm: (val) {
|
||||||
|
// val 为逗号分隔的选中值
|
||||||
|
setState(() {
|
||||||
|
pd['RISK_IDENTIFICATION'] = val;
|
||||||
|
_riskController.text = val;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
).then((_) {
|
||||||
|
FocusHelper.clearFocus(context);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
hintText: '请输入风险辨识结果',
|
||||||
|
controller: _riskController,
|
||||||
|
text: pd['RISK_IDENTIFICATION'] ?? '',
|
||||||
|
),
|
||||||
|
if (FormUtils.hasValue(pd, 'ANALYZE_TIME'))
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Divider(),
|
||||||
|
ItemListWidget.OneRowButtonTitleText(
|
||||||
|
label: '分析人',
|
||||||
|
text: pd['ANALYZE_USER_NAME'] ?? '',
|
||||||
|
onTap: () {
|
||||||
|
pushPage(
|
||||||
|
HotworkGasList(HOTWORK_ID: widget.HOTWORK_ID),
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _card(Widget child) {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _chooseItem(EditUserType type) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
ItemListWidget.selectableLineTitleTextField(
|
||||||
|
label: type.displayName,
|
||||||
|
isEditable: isEditable,
|
||||||
|
text: pd['${type.name}_DEPARTMENT_NAME'] ?? '请选择',
|
||||||
|
onTap: () => chooseUnitHandle(type),
|
||||||
|
),
|
||||||
|
Divider(),
|
||||||
|
ItemListWidget.selectableLineTitleTextField(
|
||||||
|
label: type.personName,
|
||||||
|
isEditable: isEditable,
|
||||||
|
text: pd['${type.name}_USER_NAME'] ?? '请选择',
|
||||||
|
onTap: () => choosePersonHandle(type),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 弹出单位选择
|
||||||
|
void chooseUnitHandle(EditUserType type) {
|
||||||
|
FocusHelper.clearFocus(context);
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
barrierColor: Colors.black54,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
builder:
|
||||||
|
(_) => DepartmentPicker(
|
||||||
|
onSelected: (id, name) async {
|
||||||
|
setState(() {
|
||||||
|
set_pd_DEPARTMENT_ID(type, id);
|
||||||
|
set_pd_DEPARTMENT_NAME(type, name);
|
||||||
|
set_pd_USER_ID(type, '');
|
||||||
|
set_pd_USER_Name(type, '');
|
||||||
|
});
|
||||||
|
_getPersonListForUnitId(id, type);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
).then((_) {
|
||||||
|
FocusHelper.clearFocus(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _getPersonListForUnitId(String id, EditUserType type) async {
|
||||||
|
// 拉取该单位的人员列表并缓存
|
||||||
|
final result = await ApiService.getListTreePersonList(id);
|
||||||
|
setState(() {
|
||||||
|
_personCache[type] = List<Map<String, dynamic>>.from(
|
||||||
|
result['userList'] as List,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 弹出人员选择,需先选择单位
|
||||||
|
void choosePersonHandle(EditUserType type) async {
|
||||||
|
FocusHelper.clearFocus(context);
|
||||||
|
|
||||||
|
String unitId = get_pd_DEPARTMENT_ID(type);
|
||||||
|
final personList = _personCache[type] ?? [];
|
||||||
|
if (!unitId.isNotEmpty) {
|
||||||
|
final unitName = type.displayName;
|
||||||
|
ToastUtil.showNormal(context, '请先选择$unitName');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (personList.isEmpty) {
|
||||||
|
// 一般这种情况是因为重新编辑没有缓存对应部门的负责人,所以先拉取一下接口
|
||||||
|
await _getPersonListForUnitId(unitId, type);
|
||||||
|
final list = _personCache[type] ?? [];
|
||||||
|
|
||||||
|
if (list.isEmpty) {
|
||||||
|
// 如果还是没数据,说明该部门没有可选的人
|
||||||
|
ToastUtil.showNormal(context, '暂无数据,请选择其他单位');
|
||||||
|
} else {
|
||||||
|
choosePersonHandle(type);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DepartmentPersonPicker.show(
|
||||||
|
context,
|
||||||
|
personsData: personList,
|
||||||
|
onSelected: (userId, name) {
|
||||||
|
setState(() {
|
||||||
|
set_pd_USER_ID(type, userId);
|
||||||
|
set_pd_USER_Name(type, name);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
).then((_) {
|
||||||
|
FocusHelper.clearFocus(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 提交 1 提交 0暂存
|
||||||
|
Future<void> _submit(String status) async {
|
||||||
|
// 通用文本字段校验规则
|
||||||
|
final textRules = <Map<String, dynamic>>[
|
||||||
|
{'value': _contentController.text.trim(), 'message': '请填写作业内容'},
|
||||||
|
{'value': _locationController.text.trim(), 'message': '请填写动火地点及部位'},
|
||||||
|
{'value': _methodController.text.trim(), 'message': '请填写动火方式'},
|
||||||
|
{'value': _hotworkPersonController.text.trim(), 'message': '请填写动火人及证书编号'},
|
||||||
|
{
|
||||||
|
'value': _relatedController.text.trim(),
|
||||||
|
'message': '请输入关联的其他特殊作业及安全作业票编号',
|
||||||
|
},
|
||||||
|
{'value': _riskController.text.trim(), 'message': '请填写风险辨识结果'},
|
||||||
|
];
|
||||||
|
final level = pd['WORK_LEVEL'] ?? '';
|
||||||
|
print('---level-$level');
|
||||||
|
|
||||||
|
/// 各项负责人校验
|
||||||
|
final unitRules = <EditUserType>[
|
||||||
|
EditUserType.ANALYZE,
|
||||||
|
EditUserType.GUARDIAN,
|
||||||
|
EditUserType.CONFESS,
|
||||||
|
EditUserType.ACCEPT_CONFESS,
|
||||||
|
EditUserType.CONFIRM,
|
||||||
|
EditUserType.LEADER,
|
||||||
|
EditUserType.AUDIT,
|
||||||
|
EditUserType.APPROVE,
|
||||||
|
EditUserType.MONITOR,
|
||||||
|
EditUserType.WORK_START,
|
||||||
|
EditUserType.WORK_END,
|
||||||
|
EditUserType.ACCEPT,
|
||||||
|
];
|
||||||
|
if (status == '1') {
|
||||||
|
// 文本校验
|
||||||
|
for (var rule in textRules) {
|
||||||
|
if ((rule['value'] as String).isEmpty) {
|
||||||
|
ToastUtil.showNormal(context, rule['message']);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 级别校验
|
||||||
|
if (level.length == 0) {
|
||||||
|
ToastUtil.showNormal(context, '请选择动火级别');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var type in unitRules) {
|
||||||
|
if (get_pd_DEPARTMENT_ID(type).length == 0) {
|
||||||
|
ToastUtil.showNormal(context, '请选择${type.displayName}');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (get_pd_USER_ID(type).length == 0) {
|
||||||
|
ToastUtil.showNormal(context, '请选择${type.displayName}负责人');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// LoadingDialogHelper.show(context);
|
||||||
|
|
||||||
|
String taskId = '0';
|
||||||
|
if (level == '特级') {
|
||||||
|
taskId = '1';
|
||||||
|
} else if (level == '一级') {
|
||||||
|
taskId = '2';
|
||||||
|
} else if (level == '二级') {
|
||||||
|
taskId = '3';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交参数
|
||||||
|
if (msg == 'add') {
|
||||||
|
pd['CORPINFO_ID'] = SessionService.instance.corpinfoId;
|
||||||
|
pd['CREATOR'] = SessionService.instance.loginUserId;
|
||||||
|
pd['OPERATOR'] = SessionService.instance.loginUserId;
|
||||||
|
pd['ACTION_USER'] = SessionService.instance.username;
|
||||||
|
pd['APPLY_STATUS'] = status;
|
||||||
|
pd['STEP_ID'] = status;
|
||||||
|
pd['TASK_ID'] = taskId;
|
||||||
|
pd['HOTWORK_ID'] = widget.HOTWORK_ID;
|
||||||
|
pd['APPLY_DEPARTMENT_ID'] = SessionService.instance.deptId;
|
||||||
|
pd['APPLY_DEPARTMENT_NAME'] =
|
||||||
|
SessionService.instance.loginUser?['DEPARTMENT_NAME'] ?? '';
|
||||||
|
pd['APPLY_USER_ID'] = SessionService.instance.loginUserId;
|
||||||
|
pd['APPLY_USER_NAME'] = SessionService.instance.username;
|
||||||
|
pd['USER_ID'] = SessionService.instance.loginUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadingDialogHelper.show(context);
|
||||||
|
String jsonStr = jsonEncode(pd);
|
||||||
|
printLongString(jsonStr);
|
||||||
|
try {
|
||||||
|
String url = "/app/hotwork/" + msg;
|
||||||
|
final result = await ApiService.submitHotwork(url, pd);
|
||||||
|
LoadingDialogHelper.hide(context);
|
||||||
|
if (result['result'] == 'success') {
|
||||||
|
ToastUtil.showSuccess(context, status == '1' ? '提交成功' : '已暂存');
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
LoadingDialogHelper.hide(context);
|
||||||
|
ToastUtil.showNormal(context, '操作失败:$e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void printLongString(String text, {int chunkSize = 800}) {
|
||||||
|
final pattern = RegExp('.{1,$chunkSize}'); // 每 chunkSize 个字符一组
|
||||||
|
for (final match in pattern.allMatches(text)) {
|
||||||
|
print(match.group(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _getHotWorkNameList() async {
|
||||||
|
final result = await ApiService.getHotWorkNameList();
|
||||||
|
setState(() {
|
||||||
|
workUserList = result['varList'] ?? '';
|
||||||
|
List<String> names =
|
||||||
|
workUserList.map((item) => item['NAME'] as String).toList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 初始化拉取数据
|
||||||
|
Future<void> _getData() async {
|
||||||
|
final data = await ApiService.getHomeworkFindById(widget.HOTWORK_ID);
|
||||||
|
setState(() {
|
||||||
|
pd = data['pd'];
|
||||||
|
if (pd['STEP_ID'] == 0) {
|
||||||
|
isEditable = true;
|
||||||
|
} else {
|
||||||
|
_getMeasures(pd['HOTWORK_ID'] ?? '');
|
||||||
|
}
|
||||||
|
// 给所有输入框赋值
|
||||||
|
_contentController.text = pd['WORK_CONTENT'] ?? '';
|
||||||
|
_locationController.text = pd['WORK_PLACE'] ?? '';
|
||||||
|
_methodController.text = pd['WORK_FUNCTION'] ?? '';
|
||||||
|
_hotworkPersonController.text = pd['WORK_USER'] ?? '';
|
||||||
|
_relatedController.text = pd['SPECIAL_WORK'] ?? '';
|
||||||
|
_riskController.text = pd['RISK_IDENTIFICATION'] ?? '';
|
||||||
|
});
|
||||||
|
// final data = await ApiService.getHomeworkFindById(widget.HOTWORK_ID);
|
||||||
|
// setState(() {
|
||||||
|
// pd = data['pd'];
|
||||||
|
// });
|
||||||
|
// LoadingDialogHelper.hide(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _getMeasures(String homework_id) async {
|
||||||
|
final data = await ApiService.listSignFinishAllMeasures(
|
||||||
|
homework_id.length > 0 ? homework_id : widget.HOTWORK_ID,
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
measuresList = List<Map<String, dynamic>>.from(
|
||||||
|
data['finishMeasuresList'] ?? <Map<String, dynamic>>[],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
void removeMeasuresListCopy(int index) {
|
||||||
|
setState(() {
|
||||||
|
measuresListCopy.removeAt(index);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
void addMeasuresListCopy() {
|
||||||
|
setState(() {
|
||||||
|
measuresListCopy.add(
|
||||||
|
MeasureItem(
|
||||||
|
id: Random().nextDouble(),
|
||||||
|
DEPARTMENT_ID: '',
|
||||||
|
DEPARTMENT_NAME: '',
|
||||||
|
USER_ID: '',
|
||||||
|
USER_NAME: '',
|
||||||
|
userList: [],
|
||||||
|
userIndex: -1,
|
||||||
|
selectMeasures: [],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: MyAppbar(title: '选择安全措施确认人'),
|
||||||
|
body: SafeArea(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_card(_defaultDetail()),
|
||||||
|
|
||||||
|
SizedBox(height: 20),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 5),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
ListItemFactory.createBuildSimpleSection('安全防护措施'),
|
||||||
|
CustomButton(
|
||||||
|
text: '添加',
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
|
backgroundColor: Colors.blue,
|
||||||
|
height: 36,
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
...measuresListCopy.asMap().entries.map((entry) {
|
||||||
|
int index = entry.key;
|
||||||
|
MeasureItem item = entry.value;
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Card(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// 部门 picker
|
||||||
|
ItemListWidget.selectableLineTitleTextField(
|
||||||
|
label: '确认单位:',
|
||||||
|
isEditable: isEditable,
|
||||||
|
onTap: () {
|
||||||
|
|
||||||
|
},
|
||||||
|
text:item.DEPARTMENT_NAME ?? '请选择',
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
// 用户 picker
|
||||||
|
ItemListWidget.selectableLineTitleTextField(
|
||||||
|
label: '确认人:',
|
||||||
|
isEditable: isEditable,
|
||||||
|
onTap: () {
|
||||||
|
|
||||||
|
},
|
||||||
|
text:item.USER_NAME ?? '请选择',
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
// 安全措施
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text('安全措施:'),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {},
|
||||||
|
style: ElevatedButton.styleFrom(shape: StadiumBorder()),
|
||||||
|
child: Text('选择安全措施'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
...item.selectMeasures.asMap().entries.map((e) {
|
||||||
|
int idx = e.key;
|
||||||
|
String txt = e.value;
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.only(top: 4),
|
||||||
|
child: Text('${idx + 1}. $txt'),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (index != 0)
|
||||||
|
Positioned(
|
||||||
|
top: 0,
|
||||||
|
right: 0,
|
||||||
|
child: IconButton(
|
||||||
|
icon: Icon(Icons.close, color: Colors.red),
|
||||||
|
onPressed: () => removeMeasuresListCopy(index),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
isEditable
|
||||||
|
? Row(
|
||||||
|
spacing: 10,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: CustomButton(
|
||||||
|
height: 45,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
text: '提交',
|
||||||
|
backgroundColor: Colors.blue,
|
||||||
|
onPressed: () {
|
||||||
|
_submit('1');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
Expanded(
|
||||||
|
child: CustomButton(
|
||||||
|
textStyle: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
text: '暂存',
|
||||||
|
backgroundColor: Colors.green,
|
||||||
|
onPressed: () {
|
||||||
|
_submit('0');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(height: 20),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(width: 50),
|
||||||
|
Expanded(
|
||||||
|
child: CustomButton(
|
||||||
|
height: 45,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
text: '返回',
|
||||||
|
backgroundColor: Colors.green,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 50),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class MeasureItem {
|
||||||
|
final double id;
|
||||||
|
String DEPARTMENT_ID;
|
||||||
|
String DEPARTMENT_NAME;
|
||||||
|
String USER_ID;
|
||||||
|
String USER_NAME;
|
||||||
|
List<String> userList;
|
||||||
|
int userIndex;
|
||||||
|
List<String> selectMeasures;
|
||||||
|
|
||||||
|
MeasureItem({
|
||||||
|
required this.id,
|
||||||
|
this.DEPARTMENT_ID = '',
|
||||||
|
this.DEPARTMENT_NAME = '',
|
||||||
|
this.USER_ID = '',
|
||||||
|
this.USER_NAME = '',
|
||||||
|
List<String>? userList,
|
||||||
|
this.userIndex = -1,
|
||||||
|
List<String>? selectMeasures,
|
||||||
|
}) : userList = userList ?? [],
|
||||||
|
selectMeasures = selectMeasures ?? [];
|
||||||
|
}
|
|
@ -49,7 +49,7 @@ class DangerDetail extends StatelessWidget {
|
||||||
text: "隐患照片",
|
text: "隐患照片",
|
||||||
imageUrls: imgUrls,
|
imageUrls: imgUrls,
|
||||||
onImageTapped: (index) {
|
onImageTapped: (index) {
|
||||||
present(
|
presentOpaque(
|
||||||
SingleImageViewer(imageUrl: imgUrls[index]),
|
SingleImageViewer(imageUrl: imgUrls[index]),
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
|
|
|
@ -67,7 +67,7 @@ class _DangerAcceptanceFinishState extends State<DangerAcceptanceFinish> {
|
||||||
text: "验收图片",
|
text: "验收图片",
|
||||||
imageUrls: imgUrls,
|
imageUrls: imgUrls,
|
||||||
onImageTapped: (index) {
|
onImageTapped: (index) {
|
||||||
present(
|
presentOpaque(
|
||||||
SingleImageViewer(imageUrl: imgUrls[index]),
|
SingleImageViewer(imageUrl: imgUrls[index]),
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
|
|
|
@ -61,7 +61,7 @@ class _DannerRepairFinishState extends State<DannerRepairFinish> {
|
||||||
text: "整改后图片",
|
text: "整改后图片",
|
||||||
imageUrls: imgUrls,
|
imageUrls: imgUrls,
|
||||||
onImageTapped: (index) {
|
onImageTapped: (index) {
|
||||||
present(
|
presentOpaque(
|
||||||
SingleImageViewer(imageUrl: imgUrls[index]),
|
SingleImageViewer(imageUrl: imgUrls[index]),
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
|
|
|
@ -19,11 +19,26 @@ Future<T?> pushPage<T>(Widget page, BuildContext context) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
void present(Widget page, BuildContext context) {
|
void present(Widget page, BuildContext context) {
|
||||||
Navigator.push(
|
Navigator.of(context).push(
|
||||||
context,
|
PageRouteBuilder(
|
||||||
MaterialPageRoute(fullscreenDialog: true, builder: (context) => page),
|
pageBuilder: (context, animation, secondaryAnimation) => page,
|
||||||
|
transitionDuration: Duration.zero,
|
||||||
|
reverseTransitionDuration: Duration.zero,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
void presentOpaque(Widget page, BuildContext context) {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
PageRouteBuilder(
|
||||||
|
opaque: false, // 允许下层透出
|
||||||
|
barrierColor: Colors.black.withOpacity(0.5), //路由遮罩色
|
||||||
|
pageBuilder: (context, animation, secondaryAnimation) => page,
|
||||||
|
transitionDuration: Duration.zero,
|
||||||
|
reverseTransitionDuration: Duration.zero,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
class FocusHelper {
|
class FocusHelper {
|
||||||
static final FocusNode _emptyNode = FocusNode();
|
static final FocusNode _emptyNode = FocusNode();
|
||||||
/// 延迟一帧后再移交焦点,避免不生效的问题
|
/// 延迟一帧后再移交焦点,避免不生效的问题
|
||||||
|
|
292
pubspec.lock
292
pubspec.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue