Compare commits
2 Commits
fe6ab0fa03
...
ccb9eb4f55
| Author | SHA1 | Date |
|---|---|---|
|
|
ccb9eb4f55 | |
|
|
87f5620000 |
|
|
@ -36,12 +36,16 @@
|
|||
<!-- 存储(非相册文件) -->
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 仅支持旧版 -->
|
||||
<!-- NFC -->
|
||||
<uses-permission android:name="android.permission.NFC" />
|
||||
<uses-feature android:name="android.hardware.nfc" android:required="true" />
|
||||
<application
|
||||
android:label="qhd_prevention"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:usesCleartextTraffic="true"
|
||||
>
|
||||
android:enableOnBackInvokedCallback="true"
|
||||
>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.9 KiB |
|
|
@ -11,6 +11,8 @@ PODS:
|
|||
- mobile_scanner (7.0.0):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- nfc_manager (0.0.1):
|
||||
- Flutter
|
||||
- package_info_plus (0.4.5):
|
||||
- Flutter
|
||||
- path_provider_foundation (0.0.1):
|
||||
|
|
@ -38,6 +40,7 @@ DEPENDENCIES:
|
|||
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
|
||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
||||
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/darwin`)
|
||||
- nfc_manager (from `.symlinks/plugins/nfc_manager/ios`)
|
||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||
- pdfx (from `.symlinks/plugins/pdfx/ios`)
|
||||
|
|
@ -59,6 +62,8 @@ EXTERNAL SOURCES:
|
|||
:path: ".symlinks/plugins/image_picker_ios/ios"
|
||||
mobile_scanner:
|
||||
:path: ".symlinks/plugins/mobile_scanner/darwin"
|
||||
nfc_manager:
|
||||
:path: ".symlinks/plugins/nfc_manager/ios"
|
||||
package_info_plus:
|
||||
:path: ".symlinks/plugins/package_info_plus/ios"
|
||||
path_provider_foundation:
|
||||
|
|
@ -81,6 +86,7 @@ SPEC CHECKSUMS:
|
|||
fluttertoast: 2c67e14dce98bbdb200df9e1acf610d7a6264ea1
|
||||
image_picker_ios: 7fe1ff8e34c1790d6fff70a32484959f563a928a
|
||||
mobile_scanner: 9157936403f5a0644ca3779a38ff8404c5434a93
|
||||
nfc_manager: f6d5609c09b4640b914a3dc67479a2e392965fd0
|
||||
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
|
||||
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
|
||||
pdfx: 77f4dddc48361fbb01486fa2bdee4532cbb97ef3
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
|
||||
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
45D597292E2F804B009DEAE7 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
|
||||
71118A79D1B878EF92EF0C82 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -130,6 +131,7 @@
|
|||
97C146F01CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
45D597292E2F804B009DEAE7 /* Runner.entitlements */,
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
||||
|
|
@ -469,12 +471,14 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 8AKCJ9LW7D;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
|
|
@ -658,12 +662,14 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 8AKCJ9LW7D;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
|
|
@ -684,12 +690,14 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 8AKCJ9LW7D;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
|
|
@ -54,6 +55,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
</dict>
|
||||
<key>NSBluetoothAlwaysUsageDescription</key>
|
||||
<string>app需要蓝牙权限连接设备</string>
|
||||
<key>NFCReaderUsageDescription</key>
|
||||
<string>用于读取 NFC 标签</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>app需要相机权限来扫描二维码</string>
|
||||
<key>NSContactsUsageDescription</key>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.developer.nfc.readersession.formats</key>
|
||||
<array>
|
||||
<string>TAG</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -198,7 +198,6 @@ class ListItemFactory {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
///类型4:一个文本(自适应高度)
|
||||
static Widget createAloneTextItem({
|
||||
required String text,
|
||||
|
|
@ -355,4 +354,6 @@ class ListItemFactory {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,143 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:nfc_manager/nfc_manager.dart';
|
||||
import 'package:nfc_manager/ndef_record.dart';
|
||||
import 'package:nfc_manager/nfc_manager_android.dart';
|
||||
import 'package:nfc_manager/nfc_manager_ios.dart';
|
||||
import 'package:nfc_manager_ndef/nfc_manager_ndef.dart';
|
||||
|
||||
class NfcTestPage extends StatefulWidget {
|
||||
const NfcTestPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_NfcTestPageState createState() => _NfcTestPageState();
|
||||
}
|
||||
|
||||
class _NfcTestPageState extends State<NfcTestPage> {
|
||||
String _nfcData = '未扫描到标签。';
|
||||
bool _scanning = false;
|
||||
|
||||
void _safeSetState(String data) {
|
||||
if (!mounted) return;
|
||||
setState(() => _nfcData = data);
|
||||
}
|
||||
|
||||
Future<void> _startNfcSession() async {
|
||||
setState(() {
|
||||
_scanning = true;
|
||||
_nfcData = '扫描中...';
|
||||
});
|
||||
|
||||
final available = await NfcManager.instance.isAvailable();
|
||||
if (!available) {
|
||||
_safeSetState('此设备不支持 NFC');
|
||||
setState(() => _scanning = false);
|
||||
return;
|
||||
}
|
||||
|
||||
NfcManager.instance.startSession(
|
||||
onDiscovered: (NfcTag tag) async {
|
||||
String text = '未知';
|
||||
|
||||
try {
|
||||
final ndef = Ndef.from(tag);
|
||||
if (ndef == null) {
|
||||
_safeSetState('标签不支持 NDEF');
|
||||
} else {
|
||||
final msg = ndef.cachedMessage;
|
||||
if (msg == null || msg.records.isEmpty) {
|
||||
_safeSetState('未找到任何 NDEF 记录');
|
||||
} else {
|
||||
// 第一条记录
|
||||
final record = msg.records.first;
|
||||
text = _parseTextRecord(record);
|
||||
_safeSetState('读取到文本: "$text"');
|
||||
|
||||
}
|
||||
}
|
||||
String uid = '未知';
|
||||
try {
|
||||
if (Platform.isAndroid) {
|
||||
final nfcA = NfcAAndroid.from(tag);
|
||||
if (nfcA != null) {
|
||||
// 正确地通过 nfcA.tag.identifier 拿到 List<int>
|
||||
final bytes = nfcA.tag.id;
|
||||
uid = bytes
|
||||
.map((b) => b.toRadixString(16).padLeft(2, '0'))
|
||||
.join(':')
|
||||
.toUpperCase();
|
||||
}
|
||||
} else if (Platform.isIOS) {
|
||||
// iOS 平台,用 MiFareIos(对于大多数 ISO14443-A,也可以用 Iso7816Ios)
|
||||
final mifare = MiFareIos.from(tag);
|
||||
final bytes = mifare!.identifier;
|
||||
uid = bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join(':').toUpperCase();
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('取 UID 错误: $e');
|
||||
} finally {
|
||||
setState(() => _nfcData = '标签 UID: $uid' + '\n读取到文本: "$text"');
|
||||
await NfcManager.instance.stopSession();
|
||||
}
|
||||
} catch (e) {
|
||||
_safeSetState('解析时出错: $e');
|
||||
} finally {
|
||||
await NfcManager.instance.stopSession();
|
||||
if (mounted) setState(() => _scanning = false);
|
||||
}
|
||||
},
|
||||
pollingOptions: {NfcPollingOption.iso14443},
|
||||
);
|
||||
}
|
||||
|
||||
/// 解析一个 NDEF Text 记录的 payload,返回纯文本内容
|
||||
String _parseTextRecord(NdefRecord record) {
|
||||
final payload = record.payload;
|
||||
if (payload.isEmpty) return '';
|
||||
|
||||
final statusByte = payload[0];
|
||||
final langCodeLen = statusByte & 0x3F;
|
||||
// 文本数据开始的位置
|
||||
final textBytes = payload.sublist(1 + langCodeLen);
|
||||
|
||||
try {
|
||||
return utf8.decode(textBytes); // 默认 UTF‑8
|
||||
} catch (e) {
|
||||
// 解码失败时,退回到直接展示 bytes
|
||||
return String.fromCharCodes(textBytes);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
NfcManager.instance.stopSession();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('NFC 测试')),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: _scanning ? null : _startNfcSession,
|
||||
child: Text(_scanning ? '扫描中...' : '开始扫描 NFC'),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Text(_nfcData, style: const TextStyle(fontSize: 16)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -108,8 +108,20 @@ U6Hzm1ninpWeE+awIDAQAB
|
|||
data: {'USER_ID': SessionService.instance.loginUserId},
|
||||
);
|
||||
}
|
||||
/// 通知红点数量
|
||||
static Future<Map<String, dynamic>> getNotifRedPoint() {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/app/notice/getRedPoint',
|
||||
method: Method.post,
|
||||
data: {
|
||||
'USER_ID': SessionService.instance.loginUserId,
|
||||
'CORPINFO_ID': SessionService.instance.corpinfoId,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// 排查数据(我的)
|
||||
static Future<Map<String, dynamic>> getUserData() {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
|
|
@ -125,6 +137,38 @@ U6Hzm1ninpWeE+awIDAQAB
|
|||
},
|
||||
);
|
||||
}
|
||||
/// 排查数据(部门)
|
||||
static Future<Map<String, dynamic>> getDeptData() {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/app/hidden/getDeptIndexData',
|
||||
method: Method.post,
|
||||
data: {
|
||||
'userId': SessionService.instance.loginUserId,
|
||||
'USER_NAME': SessionService.instance.username,
|
||||
'DEPARTMENT_ID': SessionService.instance.deptId,
|
||||
'IS_MAIN': SessionService.instance.isRest,
|
||||
'CORPINFO_ID': SessionService.instance.corpinfoId,
|
||||
'USER_ID': SessionService.instance.loginUserId,
|
||||
},
|
||||
);
|
||||
}
|
||||
/// 排查数据(监管)
|
||||
static Future<Map<String, dynamic>> getSuperviseDeptData() {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/app/hidden/getSuperviseDeptIndexData',
|
||||
method: Method.post,
|
||||
data: {
|
||||
'userId': SessionService.instance.loginUserId,
|
||||
'USER_NAME': SessionService.instance.username,
|
||||
'DEPARTMENT_ID': SessionService.instance.deptId,
|
||||
'IS_MAIN': SessionService.instance.isRest,
|
||||
'CORPINFO_ID': SessionService.instance.corpinfoId,
|
||||
'USER_ID': SessionService.instance.loginUserId,
|
||||
},
|
||||
);
|
||||
}
|
||||
/// 安全检查
|
||||
static Future<Map<String, dynamic>> getSafetyEnvironmentalInspectionCount() {
|
||||
return HttpManager().request(
|
||||
|
|
@ -150,22 +194,6 @@ U6Hzm1ninpWeE+awIDAQAB
|
|||
);
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> getDeptData() {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/app/hidden/getDeptIndexData',
|
||||
method: Method.post,
|
||||
data: {
|
||||
'userId': SessionService.instance.loginUserId,
|
||||
'USER_NAME': SessionService.instance.username,
|
||||
'DEPARTMENT_ID': SessionService.instance.deptId,
|
||||
'IS_MAIN': SessionService.instance.isRest,
|
||||
'CORPINFO_ID': SessionService.instance.corpinfoId,
|
||||
'USER_ID': SessionService.instance.loginUserId,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 月隐患 1 月隐患,2年隐患
|
||||
static Future<Map<String, dynamic>> getDanger(int type) {
|
||||
return HttpManager().request(
|
||||
|
|
@ -517,10 +545,83 @@ U6Hzm1ninpWeE+awIDAQAB
|
|||
);
|
||||
}
|
||||
|
||||
///TODO -------------–-------------------- 首页特殊作业 -------------–--------------------
|
||||
/// 特殊作业
|
||||
static Future<Map<String, dynamic>> specialCheckWork() {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/app/eightwork/checkWork',
|
||||
method: Method.post,
|
||||
data: {
|
||||
"USER_ID":SessionService.instance.loginUserId,
|
||||
},
|
||||
);
|
||||
}
|
||||
/// 特殊作业分类二级
|
||||
static Future<Map<String, dynamic>> specialcheckWorkCount(String path) {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/app/' + path + '/checkWorkCount',
|
||||
method: Method.post,
|
||||
data: {
|
||||
"tm": DateTime.now().millisecondsSinceEpoch,
|
||||
"CORPINFO_ID":SessionService.instance.corpinfoId,
|
||||
"USER_ID":SessionService.instance.loginUserId,
|
||||
},
|
||||
);
|
||||
}
|
||||
/// 动火筛选数据
|
||||
static Future<Map<String, dynamic>> dhHotGetTaskSetps(int task_id) {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/app/eightwork/getTaskSetps',
|
||||
method: Method.post,
|
||||
data: {
|
||||
"TASK_ID": task_id,
|
||||
},
|
||||
);
|
||||
}
|
||||
/// 动火筛选列表
|
||||
static Future<Map<String, dynamic>> hotCheckWorkCount(Map data, String url) {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
url,
|
||||
method: Method.post,
|
||||
data: {
|
||||
"CORPINFO_ID":SessionService.instance.corpinfoId,
|
||||
"USER_ID":SessionService.instance.loginUserId,
|
||||
...data
|
||||
},
|
||||
);
|
||||
}
|
||||
/// 动火删除
|
||||
static Future<Map<String, dynamic>> hotworkDelete(String hotworkId) {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/app/hotwork/delete',
|
||||
method: Method.post,
|
||||
data: {
|
||||
"CORPINFO_ID":SessionService.instance.corpinfoId,
|
||||
"USER_ID":SessionService.instance.loginUserId,
|
||||
"HOTWORK_ID":hotworkId
|
||||
},
|
||||
);
|
||||
}
|
||||
static Future<Map<String, dynamic>> dhGetFlowList(String hotworkId) {
|
||||
return HttpManager().request(
|
||||
basePath,
|
||||
'/app/hotwork/getFlowList',
|
||||
method: Method.post,
|
||||
data: {
|
||||
"HOTWORK_ID":hotworkId
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
///TODO -------------–-------------------- 我的 -------------–--------------------
|
||||
|
||||
///TODO -------------–-------------------- 我的 -------------–--------------------
|
||||
|
||||
/// 问题反馈
|
||||
static Future<Map<String, dynamic>> setFeedBack(String backTitle,String backContent,String backType,String imgPaths) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/pages/home/study/study_detail_page.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import './pages/login_page.dart';
|
||||
import './pages/main_tab.dart';
|
||||
|
|
@ -86,6 +85,8 @@ class MyApp extends StatelessWidget {
|
|||
endIndent: 0, // 右缩进
|
||||
),
|
||||
primarySwatch: Colors.blue,
|
||||
// 统一设置页面背景颜色
|
||||
scaffoldBackgroundColor: const Color(0xFFF5F7FA), // 浅灰色背景
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||
inputDecorationTheme: const InputDecorationTheme(
|
||||
border: InputBorder.none,
|
||||
|
|
@ -106,6 +107,8 @@ class MyApp extends StatelessWidget {
|
|||
debugShowCheckedModeBanner: false,
|
||||
routes: {
|
||||
'/login': (_) => const LoginPage(),
|
||||
//---------动火列表详情
|
||||
|
||||
// ... 其他路由
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||
import 'package:qhd_prevention/pages/home/danger_auto_scrollList.dart';
|
||||
import 'package:qhd_prevention/pages/home/low_page.dart';
|
||||
import 'package:qhd_prevention/pages/home/risk/riskControl_page.dart';
|
||||
import 'package:qhd_prevention/pages/home/study/study_garden_page.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_list_page.dart';
|
||||
import 'package:qhd_prevention/pages/home/userInfo_page.dart';
|
||||
import 'package:qhd_prevention/pages/home/work/danger_page.dart';
|
||||
import 'package:qhd_prevention/pages/home/work/danger_wait_list_page.dart';
|
||||
|
|
@ -27,24 +26,12 @@ class HomePage extends StatefulWidget {
|
|||
class _HomePageState extends State<HomePage> {
|
||||
late int _eight_work_count = 0;
|
||||
late int _safetyEnvironmentalInspection = 0;
|
||||
late final List<Map<String, dynamic>> buttonInfos;
|
||||
late List<Map<String, dynamic>> buttonInfos = [];
|
||||
|
||||
/// 我的工作
|
||||
List<Map<String, dynamic>> workInfos = [];
|
||||
final List<Map<String, dynamic>> pcData = [
|
||||
{
|
||||
"index": 1,
|
||||
"detail": {"jiancha": "2", "yinhuan": "20", "yanshou": "4"},
|
||||
},
|
||||
{
|
||||
"index": 2,
|
||||
"detail": {"jiancha": "4", "yinhuan": "10", "yanshou": "5"},
|
||||
},
|
||||
{
|
||||
"index": 3,
|
||||
"detail": {"jiancha": "3", "yinhuan": "23", "yanshou": "3"},
|
||||
},
|
||||
];
|
||||
/// 排查数据
|
||||
List<Map<String, dynamic>> pcData = [];
|
||||
final List<List<String>> tagLabels = [
|
||||
['我', '的'],
|
||||
['部', '门'],
|
||||
|
|
@ -52,12 +39,8 @@ class _HomePageState extends State<HomePage> {
|
|||
];
|
||||
|
||||
Future<void> _onRefresh() async {
|
||||
// 模拟网络请求
|
||||
await Future.delayed(const Duration(seconds: 2));
|
||||
// 刷新数据逻辑,如 fetchData()
|
||||
setState(() {
|
||||
// TODO: 更新数据源
|
||||
});
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
_fetchData();
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -199,7 +182,7 @@ class _HomePageState extends State<HomePage> {
|
|||
unreadCount: info["unreadCount"] as int,
|
||||
onPressed: () {
|
||||
final index = entry.key;
|
||||
// 你的导航逻辑
|
||||
// 导航逻辑
|
||||
if (index == 0) {
|
||||
pushPage(UserinfoPage(), context);
|
||||
} else if (index == 1) {
|
||||
|
|
@ -209,6 +192,8 @@ class _HomePageState extends State<HomePage> {
|
|||
} else if (index == 3) {
|
||||
// pushPage(LowPage(), context);
|
||||
pushPage(LawsRegulationsPage(), context);
|
||||
} else if (index == 4) {
|
||||
pushPage(WorkTabListPage(), context);
|
||||
} else if (index == 7) {
|
||||
pushPage(StudyGardenPage(), context);
|
||||
}
|
||||
|
|
@ -250,8 +235,8 @@ class _HomePageState extends State<HomePage> {
|
|||
),
|
||||
if (unreadCount > 0)
|
||||
Positioned(
|
||||
right: -4,
|
||||
top: -4,
|
||||
right: 20,
|
||||
top: -5,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 4,
|
||||
|
|
@ -406,78 +391,13 @@ class _HomePageState extends State<HomePage> {
|
|||
|
||||
void initState() {
|
||||
super.initState();
|
||||
buttonInfos = [
|
||||
{
|
||||
"icon": "assets/icon-apps/home-base.png",
|
||||
"title": "人员信息",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-rili.png",
|
||||
"title": "工作安排",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-risk.png",
|
||||
"title": "风险布控",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-fl.png",
|
||||
"title": "法律法规",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-gw.png",
|
||||
"title": "特殊作业",
|
||||
"unreadCount": _eight_work_count,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-zdgcgl.jpg",
|
||||
"title": "重点工程管理",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-cns.png",
|
||||
"title": "安全承诺",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-study.png",
|
||||
"title": "学习园地",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-base.png",
|
||||
"title": "安全检查",
|
||||
"unreadCount": _safetyEnvironmentalInspection,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-speEquip.jpg",
|
||||
"title": "设备巡检",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/safetymeeting.png",
|
||||
"title": "安全例会",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
];
|
||||
|
||||
_fetchData(); // 初始化时请求
|
||||
}
|
||||
|
||||
Future<void> _fetchData() async {
|
||||
try {
|
||||
// “我的工作” 数量
|
||||
final raw = await ApiService.getWork();
|
||||
// 如果拿到的是 String,就 decode;如果本来就是 Map,就直接用
|
||||
final Map<String, dynamic> data =
|
||||
raw is String
|
||||
? json.decode(raw as String) as Map<String, dynamic>
|
||||
: raw;
|
||||
|
||||
final hidCount = data['hidCount'] as Map<String, dynamic>;
|
||||
final data = await ApiService.getWork();
|
||||
final hidCount = data['hidCount'] as Map<String, dynamic>? ?? {};
|
||||
setState(() {
|
||||
workInfos = [
|
||||
{
|
||||
|
|
@ -512,29 +432,125 @@ class _HomePageState extends State<HomePage> {
|
|||
},
|
||||
];
|
||||
});
|
||||
// 安全检查数
|
||||
final checkJson =
|
||||
await ApiService.getSafetyEnvironmentalInspectionCount();
|
||||
setState(() {
|
||||
int confirmCount = checkJson['confirmCount']['confirmCount'];
|
||||
int repulseCount = checkJson['repulseCount']['repulseCount'];
|
||||
int repulseAndCheckCount =
|
||||
checkJson['repulseAndCheckCount']['repulseAndCheckCount'];
|
||||
// 并发请求
|
||||
final results = await Future.wait([
|
||||
ApiService.getSafetyEnvironmentalInspectionCount(),
|
||||
ApiService.getRedPoint(),
|
||||
ApiService.getUserData(),
|
||||
ApiService.getDeptData(),
|
||||
ApiService.getSuperviseDeptData(),
|
||||
]);
|
||||
|
||||
_safetyEnvironmentalInspection =
|
||||
confirmCount + repulseCount + repulseAndCheckCount;
|
||||
// 安全检查数
|
||||
final checkJson = results[0];
|
||||
setState(() {
|
||||
int confirmCount = checkJson['confirmCount']?['confirmCount'] ?? 0;
|
||||
int repulseCount = checkJson['repulseCount']?['repulseCount'] ?? 0;
|
||||
int repulseAndCheckCount = checkJson['repulseAndCheckCount']?['repulseAndCheckCount'] ?? 0;
|
||||
_safetyEnvironmentalInspection = confirmCount + repulseCount + repulseAndCheckCount;
|
||||
});
|
||||
|
||||
// 特殊作业红点
|
||||
final redPointJson = await ApiService.getRedPoint();
|
||||
final redPointJson = results[1];
|
||||
setState(() {
|
||||
final countMap = redPointJson['count'] as Map<String, dynamic>;
|
||||
final countMap = redPointJson['count'] as Map<String, dynamic>? ?? {};
|
||||
for (var item in countMap.values) {
|
||||
_eight_work_count += (item ?? 0) as int;
|
||||
}
|
||||
buttonInfos = [
|
||||
{
|
||||
"icon": "assets/icon-apps/home-base.png",
|
||||
"title": "人员信息",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-rili.png",
|
||||
"title": "工作安排",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-risk.png",
|
||||
"title": "风险布控",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-fl.png",
|
||||
"title": "法律法规",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-gw.png",
|
||||
"title": "特殊作业",
|
||||
"unreadCount": _eight_work_count,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-zdgcgl.jpg",
|
||||
"title": "重点工程管理",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-cns.png",
|
||||
"title": "安全承诺",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-study.png",
|
||||
"title": "学习园地",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-base.png",
|
||||
"title": "安全检查",
|
||||
"unreadCount": _safetyEnvironmentalInspection,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/home-speEquip.jpg",
|
||||
"title": "设备巡检",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/safetymeeting.png",
|
||||
"title": "安全例会",
|
||||
"unreadCount": 0,
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
// 排查数据
|
||||
final myData = results[2];
|
||||
final deptData = results[3];
|
||||
final superDeptData = results[4];
|
||||
|
||||
setState(() {
|
||||
pcData = [
|
||||
{
|
||||
"index": 1,
|
||||
"detail": {
|
||||
"jiancha": myData['pd']?['check_count']?.toString() ?? '0',
|
||||
"yinhuan": myData['pd']?['hidden_count']?.toString() ?? '0',
|
||||
"yanshou": myData['pd']?['rectify_count']?.toString() ?? '0',
|
||||
},
|
||||
},
|
||||
{
|
||||
"index": 2,
|
||||
"detail": {
|
||||
"jiancha": deptData['pd']?['check_count']?.toString() ?? '0',
|
||||
"yinhuan": deptData['pd']?['hidden_count']?.toString() ?? '0',
|
||||
"yanshou": deptData['pd']?['rectify_count']?.toString() ?? '0',
|
||||
},
|
||||
},
|
||||
{
|
||||
"index": 3,
|
||||
"detail": {
|
||||
"jiancha": superDeptData['pd']?['check_count']?.toString() ?? '0',
|
||||
"yinhuan": superDeptData['pd']?['hidden_count']?.toString() ?? '0',
|
||||
"yanshou": superDeptData['pd']?['rectify_count']?.toString() ?? '0',
|
||||
},
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
// 出错时可以 Toast 或者在页面上显示错误状态
|
||||
print('加载首页数据失败:$e');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,275 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/customWidget/custom_button.dart';
|
||||
|
||||
class ItemListWidget {
|
||||
/// 单行水平排列:
|
||||
/// - 可编辑时:标题 + TextField
|
||||
/// - 不可编辑时:标题 + 带省略号的文本
|
||||
static Widget singleLineTitleText({
|
||||
required String label, // 标题文本
|
||||
required bool isEditable, // 是否可编辑
|
||||
TextEditingController? controller, // 编辑时使用的控制器
|
||||
String? text, // 不可编辑时显示的文本
|
||||
double fontSize = 15, // 字体大小
|
||||
}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: isEditable
|
||||
? MainAxisAlignment.start
|
||||
: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(fontSize: fontSize, fontWeight: FontWeight.bold),
|
||||
), // 显示标题
|
||||
const SizedBox(width: 8),
|
||||
isEditable
|
||||
? Expanded(
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
style: TextStyle(fontSize: fontSize),
|
||||
maxLines: 1,
|
||||
decoration: const InputDecoration(
|
||||
isDense: true,
|
||||
hintText: '请输入',
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 8),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
text ?? '',
|
||||
style: TextStyle(fontSize: fontSize, color: Colors.grey[500]),
|
||||
overflow: TextOverflow.ellipsis, // 超出省略
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 多行垂直排列:
|
||||
/// - 可编辑时:标题 + 可扩展的多行 TextField
|
||||
/// - 不可编辑时:标题 + 带滚动的多行文本
|
||||
static Widget multiLineTitleTextField({
|
||||
required String label, // 标题文本
|
||||
required bool isEditable, // 是否可编辑
|
||||
TextEditingController? controller, // 编辑时使用的控制器
|
||||
String? text, // 不可编辑时显示的文本
|
||||
double fontSize = 15, // 字体大小
|
||||
double height = 110, // 整体高度
|
||||
}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
height: height,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(fontSize: fontSize, fontWeight: FontWeight.bold),
|
||||
), // 显示标题
|
||||
const SizedBox(height: 8),
|
||||
Expanded(
|
||||
child: isEditable
|
||||
? TextField(
|
||||
controller: controller,
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
expands: true, // 填满剩余高度
|
||||
style: TextStyle(fontSize: fontSize),
|
||||
decoration: const InputDecoration(
|
||||
hintText: '请输入'
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
|
||||
child: SingleChildScrollView(
|
||||
child: Text(
|
||||
text ?? '',
|
||||
style: TextStyle(fontSize: fontSize, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 单行可点击选择:
|
||||
/// - 可编辑时:标题 + “请选择”提示 + 右箭头
|
||||
/// - 不可编辑时:标题 + 文本内容
|
||||
static Widget selectableLineTitleTextField({
|
||||
required String label, // 标题文本
|
||||
required bool isEditable, // 是否可点击
|
||||
required String text, // 显示内容或提示
|
||||
VoidCallback? onTap, // 点击回调
|
||||
double fontSize = 15, // 字体大小
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: isEditable ? onTap : null,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(fontSize: fontSize, fontWeight: FontWeight.bold),
|
||||
), // 显示标题
|
||||
const SizedBox(width: 8),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
text.length > 0 ? text: '请选择', // 默认提示
|
||||
style: TextStyle(
|
||||
fontSize: fontSize,
|
||||
color: isEditable ? Colors.black : Colors.grey, // 不可编辑时使用灰色
|
||||
),
|
||||
overflow: TextOverflow.ellipsis, // 超出省略
|
||||
),
|
||||
if (isEditable) const Icon(Icons.chevron_right), // 只有可编辑时显示箭头
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 两行垂直布局:
|
||||
/// 第一行:可点击选择(带箭头)或仅显示标题
|
||||
/// 第二行:多行输入框或多行文本展示
|
||||
static Widget twoRowSelectableTitleText({
|
||||
required String label, // 第一行标题
|
||||
required bool isEditable, // 是否可编辑
|
||||
required String text, // 显示内容或提示
|
||||
TextEditingController? controller, // 第二行编辑控制器
|
||||
VoidCallback? onTap, // 第一行点击回调
|
||||
double fontSize = 15, // 字体大小
|
||||
double row2Height = 80, // 第二行高度
|
||||
}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 第一行:可点击区域或纯文本标题
|
||||
InkWell(
|
||||
onTap: isEditable ? onTap : null,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(fontSize: fontSize, fontWeight: FontWeight.bold),
|
||||
), // 显示标题
|
||||
const SizedBox(width: 8),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
isEditable ? '请选择' : '', // 显示内容或提示
|
||||
style: TextStyle(
|
||||
fontSize: fontSize,
|
||||
color: isEditable ? Colors.black : Colors.grey,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
if (isEditable) const Icon(Icons.chevron_right),
|
||||
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// 第二行:多行输入或展示
|
||||
Container(
|
||||
height: row2Height,
|
||||
padding: const EdgeInsets.all(8),
|
||||
|
||||
child: isEditable
|
||||
? TextField(
|
||||
controller: controller,
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
expands: true,
|
||||
style: TextStyle(fontSize: fontSize),
|
||||
decoration: const InputDecoration(
|
||||
hintText: '请输入'
|
||||
),
|
||||
)
|
||||
: SingleChildScrollView(
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(fontSize: fontSize, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
/// 两行垂直布局:
|
||||
/// 标题+按钮
|
||||
/// 第二行:多行输入框或多行文本展示
|
||||
static Widget twoRowButtonTitleText({
|
||||
required String label, // 第一行标题
|
||||
required bool isEditable, // 是否可编辑
|
||||
required String text, // 显示内容或提示
|
||||
TextEditingController? controller, // 第二行编辑控制器
|
||||
required VoidCallback? onTap, // 第一行点击回调
|
||||
required String hintText,
|
||||
double fontSize = 15, // 字体大小
|
||||
double row2Height = 80, // 第二行高度
|
||||
}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 第一行:可点击区域或纯文本标题
|
||||
InkWell(
|
||||
onTap: isEditable ? onTap : null,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(fontSize: fontSize, fontWeight: FontWeight.bold),
|
||||
), // 显示标题
|
||||
const SizedBox(width: 8),
|
||||
CustomButton(text: "选择其他", height:30, padding: EdgeInsets.symmetric(vertical: 2, horizontal: 5), backgroundColor: Colors.green, onPressed: onTap,)
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// 第二行:多行输入或展示
|
||||
Container(
|
||||
height: row2Height,
|
||||
padding: const EdgeInsets.all(8),
|
||||
|
||||
child: isEditable
|
||||
? TextField(
|
||||
controller: controller,
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
expands: true,
|
||||
style: TextStyle(fontSize: fontSize),
|
||||
decoration: InputDecoration(
|
||||
hintText: hintText
|
||||
),
|
||||
)
|
||||
: SingleChildScrollView(
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(fontSize: fontSize, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/item_list_widget.dart';
|
||||
import '../../../../../my_appbar.dart';
|
||||
enum EditUserType {
|
||||
analyze,
|
||||
confirm,
|
||||
guardian,
|
||||
confess,
|
||||
acceptconfess,
|
||||
workstart,
|
||||
workend,
|
||||
leader,
|
||||
audit,
|
||||
approve,
|
||||
monitor,
|
||||
accept,
|
||||
}
|
||||
class HotworkApplyDetail extends StatefulWidget {
|
||||
const HotworkApplyDetail({
|
||||
super.key,
|
||||
required this.HOTWORK_ID,
|
||||
required this.flow,
|
||||
});
|
||||
|
||||
final String HOTWORK_ID;
|
||||
final String flow;
|
||||
|
||||
@override
|
||||
State<HotworkApplyDetail> createState() => _HotworkApplyDetailState();
|
||||
}
|
||||
|
||||
class _HotworkApplyDetailState extends State<HotworkApplyDetail> {
|
||||
final bool isEditable = true;
|
||||
|
||||
Widget _defaultDetail() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
ItemListWidget.singleLineTitleText(
|
||||
label: '申请单位:',
|
||||
isEditable: false,
|
||||
text: '1111',
|
||||
),
|
||||
Divider(),
|
||||
ItemListWidget.singleLineTitleText(
|
||||
label: '申请人:',
|
||||
isEditable: false,
|
||||
text: '1111',
|
||||
),
|
||||
Divider(),
|
||||
ItemListWidget.multiLineTitleTextField(
|
||||
label: '作业内容:',
|
||||
isEditable: isEditable,
|
||||
text: '1111',
|
||||
),
|
||||
Divider(),
|
||||
ItemListWidget.singleLineTitleText(
|
||||
label: '动火地点及动火部位:',
|
||||
isEditable: isEditable,
|
||||
text: '1111',
|
||||
),
|
||||
Divider(),
|
||||
ItemListWidget.selectableLineTitleTextField(
|
||||
label: '动火作业级别',
|
||||
isEditable: isEditable,
|
||||
onTap: () {},
|
||||
text: '',
|
||||
),
|
||||
Divider(),
|
||||
ItemListWidget.singleLineTitleText(
|
||||
label: '动火方式:',
|
||||
isEditable: isEditable,
|
||||
text: '1111',
|
||||
),
|
||||
Divider(),
|
||||
ItemListWidget.twoRowSelectableTitleText(
|
||||
label: '动火人及证书编号:',
|
||||
isEditable: isEditable,
|
||||
text: '1111',
|
||||
),
|
||||
Divider(),
|
||||
ItemListWidget.twoRowButtonTitleText(
|
||||
label: '关联的其他特殊作业及安全作业票编号',
|
||||
isEditable: isEditable,
|
||||
text: '1111',
|
||||
hintText: '请输入关联的其他特殊作业及安全作业票编号',
|
||||
onTap: () {},
|
||||
),
|
||||
Divider(),
|
||||
ItemListWidget.twoRowButtonTitleText(
|
||||
label: '风险辨识结果',
|
||||
isEditable: isEditable,
|
||||
text: '1111',
|
||||
hintText: '请输入风险辨识结果',
|
||||
onTap: () {},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
Widget _card(Widget child) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
Widget _chooseItem(String unit, String person,EditUserType type) {
|
||||
return Column(
|
||||
children: [
|
||||
ItemListWidget.selectableLineTitleTextField(label: unit, isEditable: isEditable, text: '', onTap: () {
|
||||
chooseUnitHandle(type);
|
||||
}),
|
||||
Divider(),
|
||||
ItemListWidget.selectableLineTitleTextField(label: person, isEditable: isEditable, text: '', onTap: () {
|
||||
choosePersonHandle(type);
|
||||
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
/// 弹出单位
|
||||
void chooseUnitHandle(EditUserType type) {
|
||||
|
||||
}
|
||||
/// 弹出单位对应的人员列表
|
||||
void choosePersonHandle(EditUserType type) {
|
||||
|
||||
}
|
||||
@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: 15,),
|
||||
_card(_defaultDetail()),
|
||||
SizedBox(height: 15,),
|
||||
_card(_chooseItem('分析单位', '分析单位负责人', EditUserType.analyze)),
|
||||
SizedBox(height: 15,),
|
||||
_card(_chooseItem('监护人单位', '监护人', EditUserType.guardian)),
|
||||
SizedBox(height: 15,),
|
||||
_card(_chooseItem('安全交底人单位', '安全交底人', EditUserType.confess)),
|
||||
SizedBox(height: 15,),
|
||||
_card(_chooseItem('接受交底人单位', '接受交底人', EditUserType.acceptconfess)),
|
||||
SizedBox(height: 15,),
|
||||
_card(_chooseItem('作业负责人单位', '作业负责人', EditUserType.confirm)),
|
||||
SizedBox(height: 15,),
|
||||
_card(_chooseItem('安全管理部门', '所在单位负责人', EditUserType.leader)),
|
||||
SizedBox(height: 15,),
|
||||
_card(_chooseItem('动火审批单位', '动火审批负责人', EditUserType.approve)),
|
||||
SizedBox(height: 15,),
|
||||
_card(_chooseItem('动火前在岗部门', '动火前在岗班长', EditUserType.monitor)),
|
||||
SizedBox(height: 15,),
|
||||
_card(_chooseItem('作业开始负责人单位', '作业开始负责人', EditUserType.workstart)),
|
||||
SizedBox(height: 15,),
|
||||
|
||||
_card(
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
_chooseItem('作业开始负责人单位', '作业开始负责人', EditUserType.workend),
|
||||
Divider(),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(width: 12,),
|
||||
Text('友情提示:负责填写作业实际开始时间', style: TextStyle(color: Colors.red),),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5,),
|
||||
],
|
||||
)
|
||||
),
|
||||
SizedBox(height: 15,),
|
||||
_card(
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
_chooseItem('作业结束负责人单位', '作业结束负责人', EditUserType.workend),
|
||||
Divider(),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(width: 12,),
|
||||
Text('友情提示:负责填写作业实际结束时间', style: TextStyle(color: Colors.red),),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5,),
|
||||
],
|
||||
)
|
||||
),
|
||||
SizedBox(height: 15,),
|
||||
_card(_chooseItem('验收部门', '验收部门负责人', EditUserType.accept)),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,617 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/dh_Wrok/dh_work_detai/hotwork_apply_detail.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'package:qhd_prevention/tools/tools.dart';
|
||||
import '../../../../../customWidget/bottom_picker.dart';
|
||||
import '../../../../../customWidget/custom_button.dart';
|
||||
import '../../../../../customWidget/search_bar_widget.dart';
|
||||
import '../../../../../http/ApiService.dart';
|
||||
|
||||
class DhWorkListPage extends StatefulWidget {
|
||||
final String flow;
|
||||
|
||||
const DhWorkListPage({Key? key, required this.flow}) : super(key: key);
|
||||
|
||||
@override
|
||||
_DhWorkListPageState createState() => _DhWorkListPageState();
|
||||
}
|
||||
|
||||
class _DhWorkListPageState extends State<DhWorkListPage> {
|
||||
// Data and state variables
|
||||
List<dynamic> list = [];
|
||||
int currentPage = 1;
|
||||
int rows = 10;
|
||||
int totalPage = 1;
|
||||
bool isLoading = false;
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
|
||||
List<Map<String, dynamic>> stepList = [];
|
||||
int sindex = 0;
|
||||
String searchKeywords = '';
|
||||
|
||||
List<Map<String, dynamic>> flowList = [];
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_fetchSteps();
|
||||
_fetchData();
|
||||
_scrollController.addListener(_onScroll);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onScroll() {
|
||||
if (_scrollController.position.pixels >=
|
||||
_scrollController.position.maxScrollExtent &&
|
||||
!isLoading) {
|
||||
if (currentPage < totalPage) {
|
||||
currentPage++;
|
||||
_fetchData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _fetchSteps() async {
|
||||
try {
|
||||
final response = await ApiService.dhHotGetTaskSetps(1);
|
||||
setState(() {
|
||||
stepList = [
|
||||
{'STEP_NAME': '全部', 'STEP_ID': ''},
|
||||
...response['list'] ?? [],
|
||||
];
|
||||
});
|
||||
} catch (e) {
|
||||
print('Error fetching steps: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _fetchData() async {
|
||||
if (isLoading) return;
|
||||
setState(() => isLoading = true);
|
||||
|
||||
try {
|
||||
final data = {
|
||||
'CREATOR':
|
||||
widget.flow == '提交申请' ? SessionService.instance.loginUserId : '',
|
||||
'GASCHECK':
|
||||
widget.flow == '气体检测' ? SessionService.instance.loginUserId : '',
|
||||
'STEP_NAME':
|
||||
(widget.flow == '提交申请' || widget.flow == '气体检测') ? '' : widget.flow,
|
||||
'STEP_ID': sindex > 0 ? stepList[sindex]['STEP_ID'] : '',
|
||||
'KEYWORDS': searchKeywords,
|
||||
'WORK_STATE': '0',
|
||||
};
|
||||
final url = '/app/hotwork/list?showCount=-1¤tPage=$currentPage';
|
||||
final response = await ApiService.hotCheckWorkCount(data, url);
|
||||
|
||||
setState(() {
|
||||
if (currentPage == 1) {
|
||||
list = response['varList'];
|
||||
} else {
|
||||
list.addAll(response['varList']);
|
||||
}
|
||||
Map<String, dynamic> page = response['page'];
|
||||
totalPage = page['totalPage'] ?? 1;
|
||||
isLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
print('Error fetching data: $e');
|
||||
setState(() => isLoading = false);
|
||||
}
|
||||
}
|
||||
|
||||
void _search() {
|
||||
currentPage = 1;
|
||||
list.clear();
|
||||
_fetchData();
|
||||
}
|
||||
/// 申请
|
||||
void _handleApply() {
|
||||
// 处理申请按钮点击逻辑
|
||||
Navigator.pushNamed(context, '/hotwork-apply-detail');
|
||||
}
|
||||
/// 打开流程图
|
||||
Future<void> _openFlowDrawer(String hotworkId) async {
|
||||
try {
|
||||
final response = await ApiService.dhGetFlowList(hotworkId);
|
||||
final List<dynamic>? newFlow = response['flowList'];
|
||||
if (newFlow == null || newFlow.isEmpty) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('暂无流程图数据')));
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() {
|
||||
flowList = List<Map<String, dynamic>>.from(newFlow);
|
||||
});
|
||||
Future.microtask(() {
|
||||
_scaffoldKey.currentState?.openEndDrawer();
|
||||
});
|
||||
} catch (e) {
|
||||
print('Error fetching flow data: $e');
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('获取流程图失败: $e')));
|
||||
}
|
||||
}
|
||||
|
||||
void _handleDelete(String hotworkId) async {
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder:
|
||||
(context) => AlertDialog(
|
||||
title: Text('确认删除'),
|
||||
content: Text('确定要删除这条申请?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: Text('取消'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
child: Text('确定', style: TextStyle(color: Colors.red)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
if (confirmed == true) {
|
||||
try {
|
||||
await ApiService.hotworkDelete(hotworkId);
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('删除成功')));
|
||||
_search(); // 刷新列表
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('删除失败: $e')));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _goToDetail(Map<String, dynamic> item) {
|
||||
final Map<String, dynamic> data = {'HOTWORK_ID': item['HOTWORK_ID'], 'flow': widget.flow};
|
||||
String routeName = '';
|
||||
switch (widget.flow) {
|
||||
case '提交申请':
|
||||
pushPage(HotworkApplyDetail(HOTWORK_ID: item['HOTWORK_ID'], flow: widget.flow), context);
|
||||
break;
|
||||
case '气体检测':
|
||||
routeName = '/gas-list';
|
||||
break;
|
||||
case '设置安全措施确认人':
|
||||
routeName = '/hotwork-measures-detail';
|
||||
break;
|
||||
case '安全措施确认':
|
||||
routeName = '/hotwork-measures-confirm-detail';
|
||||
break;
|
||||
case '监护人签字':
|
||||
routeName = '/hotwork-guardian-detail';
|
||||
break;
|
||||
case '安全交底人签字':
|
||||
routeName = '/hotwork-confess-detail';
|
||||
break;
|
||||
case '接受交底人签字':
|
||||
routeName = '/hotwork-acceptconfess-detail';
|
||||
break;
|
||||
case '作业负责人签字':
|
||||
routeName = '/hotwork-confirm-detail';
|
||||
break;
|
||||
case '所在单位签字':
|
||||
routeName = '/hotwork-leader-detail';
|
||||
break;
|
||||
case '安全管理部门签字':
|
||||
routeName = '/hotwork-audit-detail';
|
||||
break;
|
||||
case '审批人签字':
|
||||
routeName = '/hotwork-approve-detail';
|
||||
break;
|
||||
case '当班班长验票':
|
||||
routeName = '/hotwork-monitor-detail';
|
||||
break;
|
||||
case '开始作业':
|
||||
routeName = '/hotwork-startwork-detail';
|
||||
break;
|
||||
case '结束作业':
|
||||
routeName = '/hotwork-endwork-detail';
|
||||
break;
|
||||
case '验收签字':
|
||||
routeName = '/hotwork-accept-detail';
|
||||
break;
|
||||
default:
|
||||
routeName = '/hotwork-detail';
|
||||
}
|
||||
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
routeName,
|
||||
arguments: {'HOTWORK_ID': item['HOTWORK_ID'], 'flow': widget.flow},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFlowStepItem({
|
||||
required Map<String, dynamic> item,
|
||||
required bool isFirst,
|
||||
required bool isLast,
|
||||
required int status, // 1 = 完成, 0 = 进行中, -1 = 未到达
|
||||
}) {
|
||||
// 依据状态设色
|
||||
final Color dotColor =
|
||||
status == 1 ? Colors.green : (status == 0 ? Colors.blue : Colors.grey);
|
||||
final Color textColor =
|
||||
status == 1
|
||||
? Colors.green
|
||||
: (status == 0 ? Colors.blue : Colors.black);
|
||||
|
||||
return ListTile(
|
||||
visualDensity: VisualDensity(vertical: -4),
|
||||
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
leading: Container(
|
||||
width: 24,
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
// 上方线段或占位
|
||||
isFirst
|
||||
? SizedBox(height: 6 + 5)
|
||||
: Expanded(child: Container(width: 1, color: Colors.grey[300])),
|
||||
// 圆点
|
||||
CircleAvatar(radius: 6, backgroundColor: dotColor),
|
||||
// 下方线段或占位
|
||||
isLast
|
||||
? SizedBox(height: 6 + 5)
|
||||
: Expanded(child: Container(width: 1, color: Colors.grey[300])),
|
||||
],
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
item['STEP_NAME'] ?? '',
|
||||
style: TextStyle(color: textColor, fontSize: 15),
|
||||
),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (item['SIGN_USER'] != null)
|
||||
Text(
|
||||
item['SIGN_USER'],
|
||||
style: TextStyle(color: textColor, fontSize: 13),
|
||||
),
|
||||
if (item['FINISHED_SIGN_USER'] != null)
|
||||
Text(
|
||||
item['FINISHED_SIGN_USER'],
|
||||
style: TextStyle(color: textColor, fontSize: 13),
|
||||
),
|
||||
if (item['ACT_USER_NAME'] != null)
|
||||
Text(
|
||||
item['ACT_USER_NAME'],
|
||||
style: TextStyle(color: textColor, fontSize: 13),
|
||||
),
|
||||
if (item['ACT_TIME'] != null)
|
||||
Text(
|
||||
item['ACT_TIME'],
|
||||
style: TextStyle(color: textColor, fontSize: 13),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildListItem(Map<String, dynamic> item) {
|
||||
return Card(
|
||||
color: Colors.white,
|
||||
margin: const EdgeInsets.all(8.0),
|
||||
child: InkWell(
|
||||
onTap: () => _goToDetail(item),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("编号: ${item['CHECK_NO'] ?? ''}", style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),),
|
||||
Text("作业级别: ${item['WORK_LEVEL']}", style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("申请人: ${item['APPLY_USER_NAME']}"),
|
||||
Text("分析人: ${item['ANALYZE_USER_NAME']}"),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("监护人: ${item['GUARDIAN_USER_NAME']}"),
|
||||
Text("批准人: ${item['APPROVE_USER_NAME']}"),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
if (item['CONFESS_USER_NAME'] != null)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("安全交底人: ${item['CONFESS_USER_NAME']}"),
|
||||
Text("接受交底人: ${item['ACCEPT_CONFESS_USER_NAME']}"),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
if (item['CONFIRM_USER_NAME'] != null)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("作业负责人: ${item['CONFIRM_USER_NAME']}"),
|
||||
Text("动火点负责人: ${item['LEADER_USER_NAME']}"),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
if (item['AUDIT_USER_NAME'] != null)
|
||||
Text("安全管理部门负责人: ${item['AUDIT_USER_NAME']}"),
|
||||
const SizedBox(height: 8),
|
||||
if (item['MONITOR_USER_NAME'] != null)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("动火前在岗班长: ${item['MONITOR_USER_NAME']}"),
|
||||
Text("验收部门负责人: ${item['ACCEPT_USER_NAME']}"),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"审核状态: ${_getStatusText(item)}",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// if (item['STEP_ID'] < 1)
|
||||
// IconButton(
|
||||
// icon: Icon(Icons.delete, color: Colors.red),
|
||||
// onPressed: () => _handleDelete(item['HOTWORK_ID']),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(children: [
|
||||
CustomButton(
|
||||
text: '查看流程图',
|
||||
height: 35,
|
||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||
margin: EdgeInsets.only(left: 0),
|
||||
backgroundColor: Colors.blue,
|
||||
onPressed: () => _openFlowDrawer(item['HOTWORK_ID']),
|
||||
),
|
||||
SizedBox(width: 1,)
|
||||
],)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _getStatusText(Map<String, dynamic> item) {
|
||||
// 安全取出 STEP_ID 和 STATUS
|
||||
final int stepId = (item['STEP_ID'] is int) ? item['STEP_ID'] as int : 0;
|
||||
final int status = (item['STATUS'] is int) ? item['STATUS'] as int : 0;
|
||||
|
||||
if (stepId == 0) {
|
||||
return '暂存';
|
||||
} else if (status == -2) {
|
||||
return '气体检测打回';
|
||||
} else if (stepId != -1) {
|
||||
return item['NEXT_STEP_NAME'] ?? '';
|
||||
} else {
|
||||
return '${item['STEP_NAME'] ?? ''}打回';
|
||||
}
|
||||
}
|
||||
|
||||
// 新添加的方法:显示底部选择器
|
||||
Future<void> _showStepPicker() async {
|
||||
if (stepList.isEmpty) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('正在加载步骤数据,请稍后...')));
|
||||
await _fetchSteps();
|
||||
if (stepList.isEmpty) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('无法加载步骤数据')));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 创建选项列表
|
||||
final options = stepList.map((e) => e['STEP_NAME'] as String).toList();
|
||||
|
||||
// 显示底部选择器
|
||||
final choice = await BottomPicker.show<String>(
|
||||
context,
|
||||
items: options,
|
||||
itemBuilder: (item) => Text(item, textAlign: TextAlign.center),
|
||||
initialIndex: sindex,
|
||||
);
|
||||
|
||||
if (choice != null) {
|
||||
// 找到选择的索引
|
||||
final newIndex = options.indexOf(choice);
|
||||
if (newIndex != -1) {
|
||||
setState(() {
|
||||
sindex = newIndex;
|
||||
});
|
||||
_search();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 添加这个方法
|
||||
Widget _buildListContent() {
|
||||
if (isLoading && list.isEmpty) {
|
||||
// 初始加载时显示居中的加载指示器
|
||||
return Center(child: CircularProgressIndicator());
|
||||
} else if (list.isEmpty) {
|
||||
// 没有数据
|
||||
return Center(child: Text('暂无数据'));
|
||||
} else {
|
||||
// 有数据或加载更多
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
|
||||
controller: _scrollController,
|
||||
itemCount: list.length + (isLoading ? 1 : 0),
|
||||
itemBuilder: (context, index) {
|
||||
if (index >= list.length) {
|
||||
// 加载更多时在列表底部显示加载指示器
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
);
|
||||
}
|
||||
return _buildListItem(list[index]);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final int lastDoneIndex = flowList.lastIndexWhere((e) => e['STATUS'] == 1);
|
||||
|
||||
return Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: MyAppbar(
|
||||
title: '动火作业${widget.flow}',
|
||||
actions: [
|
||||
if (widget.flow == '提交申请')
|
||||
TextButton(
|
||||
onPressed: _handleApply,
|
||||
child: const Text(
|
||||
'申请',
|
||||
style: TextStyle(color: Colors.white, fontSize: 17),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
endDrawer: Drawer(
|
||||
child: SafeArea(
|
||||
child:
|
||||
flowList.isEmpty
|
||||
? Center(child: Text('暂无流程图数据'))
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
itemCount: flowList.length + 1, // +1 用来放标题
|
||||
itemBuilder: (context, i) {
|
||||
if (i == 0) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 8,
|
||||
),
|
||||
child: Text(
|
||||
'查看流程图',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
final idx = i - 1;
|
||||
final item = flowList[idx];
|
||||
final bool isFirst = idx == 0;
|
||||
final bool isLast = idx == flowList.length - 1;
|
||||
|
||||
// 根据 lastDoneIndex 自动计算“进行中”
|
||||
final int status;
|
||||
if (idx <= lastDoneIndex) {
|
||||
status = 1; // 已完成
|
||||
} else if (idx == lastDoneIndex + 1) {
|
||||
status = 0; // 进行中
|
||||
} else {
|
||||
status = -1; // 未到达
|
||||
}
|
||||
|
||||
return _buildFlowStepItem(
|
||||
item: item,
|
||||
isFirst: isFirst,
|
||||
isLast: isLast,
|
||||
status: status,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
body: Column(
|
||||
children: [
|
||||
// Filter bar
|
||||
Container(
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
// 底部弹窗选择器
|
||||
SizedBox(
|
||||
width: 65,
|
||||
child: TextButton(
|
||||
onPressed: _showStepPicker,
|
||||
style: TextButton.styleFrom(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 12,
|
||||
horizontal: 5,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'筛选',
|
||||
style: TextStyle(color: Colors.black87, fontSize: 16),
|
||||
),
|
||||
Icon(Icons.arrow_drop_down, color: Colors.grey),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: SearchBarWidget(
|
||||
showResetButton: false,
|
||||
|
||||
hintText: "请输入关键字",
|
||||
// isClickableOnly: true,
|
||||
onSearch: (text) {
|
||||
_search();
|
||||
},
|
||||
controller: _searchController,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
// List
|
||||
Expanded(child: _buildListContent()),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||
import 'package:qhd_prevention/http/ApiService.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/dh_Wrok/dh_work_list_page.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_icon_grid.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'package:qhd_prevention/tools/tools.dart';
|
||||
|
||||
|
||||
class WorkTabDhList extends StatefulWidget {
|
||||
const WorkTabDhList({super.key});
|
||||
|
||||
@override
|
||||
State<WorkTabDhList> createState() => _WorkTabDhListState();
|
||||
}
|
||||
|
||||
class _WorkTabDhListState extends State<WorkTabDhList> {
|
||||
late List<Map<String, dynamic>> buttonInfos = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_getData();
|
||||
}
|
||||
Future<void> _getData() async {
|
||||
final data = await ApiService.specialcheckWorkCount('hotwork');
|
||||
setState(() {
|
||||
final eight_work_count = data['count'] ?? {};
|
||||
buttonInfos = [
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-1.png",
|
||||
"title": "动火作业\n申请",
|
||||
"unreadCount": eight_work_count['CREATE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-zl-8.png",
|
||||
"title": "气体分析",
|
||||
"unreadCount": eight_work_count['ANALYZE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "设置安全\n措施确认人",
|
||||
"unreadCount": eight_work_count['MEASURES_SET'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "安全措施确认",
|
||||
"unreadCount": eight_work_count['MEASURES_CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-zl-9.png",
|
||||
"title": "监护人\n意见",
|
||||
"unreadCount": eight_work_count['GUARDIAN'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-807.png",
|
||||
"title": "安全交底人\n意见",
|
||||
"unreadCount": eight_work_count['CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-4.png",
|
||||
"title": "接受交底人\n意见",
|
||||
"unreadCount": eight_work_count['ACCEPT_CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业负责人\n意见",
|
||||
"unreadCount": eight_work_count['CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-907.png",
|
||||
"title": "所在单位\n意见",
|
||||
"unreadCount": eight_work_count['LEADER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-901.png",
|
||||
"title": "安全管理部门\n意见",
|
||||
"unreadCount": eight_work_count['AUDIT'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-901.png",
|
||||
"title": "动火审批人\n意见",
|
||||
"unreadCount": eight_work_count['APPROVE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-jh-1.png",
|
||||
"title": "当班班长验票",
|
||||
"unreadCount": eight_work_count['MONITOR'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-aq-1.png",
|
||||
"title": "开始作业时间",
|
||||
"unreadCount": eight_work_count['WORK_START'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "结束作业时间",
|
||||
"unreadCount": eight_work_count['WORK_END'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "验收归档",
|
||||
"unreadCount": eight_work_count['ACCEPT'] ?? '0',
|
||||
},
|
||||
|
||||
];
|
||||
});
|
||||
}
|
||||
void _handleItemPressed(int index) {
|
||||
// 根据索引执行不同的导航逻辑
|
||||
String title = '';
|
||||
switch (index) {
|
||||
case 0: title = '提交申请'; break;
|
||||
case 1: title = '气体检测'; break;
|
||||
case 2: title = '设置安全措施确认人'; break;
|
||||
case 3: title = '安全措施确认'; break;
|
||||
case 4: title = '监护人签字'; break;
|
||||
case 5: title = '安全交底人签字'; break;
|
||||
case 6: title = '接受交底人签字'; break;
|
||||
case 7: title = '作业负责人签字'; break;
|
||||
case 8: title = '所在单位签字'; break;
|
||||
case 9: title = '安全管理部门签字'; break;
|
||||
case 10: title = '审批人签字'; break;
|
||||
case 11: title = '当班班长验票'; break;
|
||||
case 12: title = '开始作业'; break;
|
||||
case 13: title = '结束作业'; break;
|
||||
case 14: title = '验收签字'; break;
|
||||
|
||||
default:
|
||||
print("按钮 $index 被点击");
|
||||
}
|
||||
pushPage(DhWorkListPage(flow: title), context);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: MyAppbar(title: '动火作业'),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
ListItemFactory.createBuildSimpleSection('动火作业审批管理'),
|
||||
WorkTabIconGrid(
|
||||
buttonInfos: buttonInfos,
|
||||
onItemPressed: _handleItemPressed,
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||
import 'package:qhd_prevention/http/ApiService.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/dh_Wrok/dh_work_list_page.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_icon_grid.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'package:qhd_prevention/tools/tools.dart';
|
||||
|
||||
|
||||
class WorkTabDlList extends StatefulWidget {
|
||||
const WorkTabDlList({super.key});
|
||||
|
||||
@override
|
||||
State<WorkTabDlList> createState() => _WorkTabDlListState();
|
||||
}
|
||||
|
||||
class _WorkTabDlListState extends State<WorkTabDlList> {
|
||||
late List<Map<String, dynamic>> buttonInfos = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_getData();
|
||||
}
|
||||
Future<void> _getData() async {
|
||||
final data = await ApiService.specialcheckWorkCount('highwork');
|
||||
setState(() {
|
||||
final eight_work_count = data['count'] ?? {};
|
||||
buttonInfos = [
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-1.png",
|
||||
"title": "高处作业\n申请",
|
||||
"unreadCount": eight_work_count['CREATE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "设置安全\n措施确认人",
|
||||
"unreadCount": eight_work_count['MEASURES_SET'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "安全措施确认",
|
||||
"unreadCount": eight_work_count['MEASURES_CONFIRM'] ?? '0',
|
||||
},
|
||||
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-zl-9.png",
|
||||
"title": "监护人\n意见",
|
||||
"unreadCount": eight_work_count['GUARDIAN'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-807.png",
|
||||
"title": "安全交底人\n意见",
|
||||
"unreadCount": eight_work_count['CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-4.png",
|
||||
"title": "接受交底人\n意见",
|
||||
"unreadCount": eight_work_count['ACCEPT_CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业人\n意见",
|
||||
"unreadCount": eight_work_count['WORK_USER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业负责人\n意见",
|
||||
"unreadCount": eight_work_count['CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-907.png",
|
||||
"title": "所在单位\n意见",
|
||||
"unreadCount": eight_work_count['LEADER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-901.png",
|
||||
"title": "审核部门\n意见",
|
||||
"unreadCount": eight_work_count['REVIEWER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-901.png",
|
||||
"title": "审批部门\n意见",
|
||||
"unreadCount": eight_work_count['APPROVE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-aq-1.png",
|
||||
"title": "开始作业时间",
|
||||
"unreadCount": eight_work_count['WORK_START'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "结束作业时间",
|
||||
"unreadCount": eight_work_count['WORK_END'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "验收归档",
|
||||
"unreadCount": eight_work_count['ACCEPT'] ?? '0',
|
||||
},
|
||||
|
||||
];
|
||||
});
|
||||
}
|
||||
void _handleItemPressed(int index) {
|
||||
// 根据索引执行不同的导航逻辑
|
||||
String title = '';
|
||||
switch (index) {
|
||||
case 0: title = '提交申请'; break;
|
||||
case 1: title = '设置安全措施确认人'; break;
|
||||
case 2: title = '安全措施确认'; break;
|
||||
case 3: title = '监护人签字'; break;
|
||||
case 4: title = '安全交底人签字'; break;
|
||||
case 5: title = '接受交底人签字'; break;
|
||||
case 6: title = '作业人签字'; break;
|
||||
case 7: title = '作业负责人签字'; break;
|
||||
case 8: title = '所在单位签字'; break;
|
||||
case 9: title = '审核人签字'; break;
|
||||
case 10: title = '审批人签字'; break;
|
||||
case 11: title = '开始作业'; break;
|
||||
case 12: title = '结束作业'; break;
|
||||
case 13: title = '验收签字'; break;
|
||||
default:
|
||||
print("按钮 $index 被点击");
|
||||
}
|
||||
pushPage(DhWorkListPage(flow: title), context);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: MyAppbar(title: '高处作业'),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
ListItemFactory.createBuildSimpleSection('高处作业审批管理'),
|
||||
WorkTabIconGrid(
|
||||
buttonInfos: buttonInfos,
|
||||
onItemPressed: _handleItemPressed,
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||
import 'package:qhd_prevention/http/ApiService.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/dh_Wrok/dh_work_list_page.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'package:qhd_prevention/tools/tools.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_icon_grid.dart';
|
||||
|
||||
|
||||
class WorkTabDtList extends StatefulWidget {
|
||||
const WorkTabDtList({super.key});
|
||||
|
||||
@override
|
||||
State<WorkTabDtList> createState() => _WorkTabDtListState();
|
||||
}
|
||||
|
||||
class _WorkTabDtListState extends State<WorkTabDtList> {
|
||||
late List<Map<String, dynamic>> buttonInfos = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_getData();
|
||||
}
|
||||
Future<void> _getData() async {
|
||||
final data = await ApiService.specialcheckWorkCount('breakground');
|
||||
setState(() {
|
||||
final eight_work_count = data['count'] ?? {};
|
||||
buttonInfos = [
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-1.png",
|
||||
"title": "动土作业\n申请",
|
||||
"unreadCount": eight_work_count['CREATE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业人\n意见",
|
||||
"unreadCount": eight_work_count['WORK_USER'] ?? '0',
|
||||
},
|
||||
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "设置安全\n措施确认人",
|
||||
"unreadCount": eight_work_count['MEASURES_SET'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "安全措施确认",
|
||||
"unreadCount": eight_work_count['MEASURES_CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-zl-9.png",
|
||||
"title": "监护人\n意见",
|
||||
"unreadCount": eight_work_count['GUARDIAN'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-807.png",
|
||||
"title": "安全交底人\n意见",
|
||||
"unreadCount": eight_work_count['CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-4.png",
|
||||
"title": "接受交底人\n意见",
|
||||
"unreadCount": eight_work_count['ACCEPT_CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业负责人\n意见",
|
||||
"unreadCount": eight_work_count['CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-907.png",
|
||||
"title": "所在单位\n意见",
|
||||
"unreadCount": eight_work_count['LEADER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-901.png",
|
||||
"title": "有关水、电、\n汽、工艺、设\n备、消防安全等部门意见",
|
||||
"unreadCount": eight_work_count['SAFETY'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-901.png",
|
||||
"title": "审批部门\n意见",
|
||||
"unreadCount": eight_work_count['APPROVE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-aq-1.png",
|
||||
"title": "开始作业时间",
|
||||
"unreadCount": eight_work_count['WORK_START'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "结束作业时间",
|
||||
"unreadCount": eight_work_count['WORK_END'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "验收归档",
|
||||
"unreadCount": eight_work_count['ACCEPT'] ?? '0',
|
||||
},
|
||||
|
||||
];
|
||||
});
|
||||
}
|
||||
void _handleItemPressed(int index) {
|
||||
// 根据索引执行不同的导航逻辑
|
||||
String title = '';
|
||||
switch (index) {
|
||||
case 0: title = '提交申请'; break;
|
||||
case 1: title = '作业人签字'; break;
|
||||
case 2: title = '设置安全措施确认人'; break;
|
||||
case 3: title = '安全措施确认'; break;
|
||||
case 4: title = '监护人签字'; break;
|
||||
case 5: title = '安全交底人签字'; break;
|
||||
case 6: title = '接受交底人签字'; break;
|
||||
case 7: title = '作业负责人签字'; break;
|
||||
case 8: title = '所在单位签字'; break;
|
||||
case 9: title = '有关水、电、汽、工艺、设备、消防安全等部门'; break;
|
||||
case 10: title = '审批人签字'; break;
|
||||
case 11: title = '开始作业'; break;
|
||||
case 12: title = '结束作业'; break;
|
||||
case 13: title = '验收签字'; break;
|
||||
|
||||
default:
|
||||
print("按钮 $index 被点击");
|
||||
}
|
||||
pushPage(DhWorkListPage(flow: title), context);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: MyAppbar(title: '动土作业'),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
ListItemFactory.createBuildSimpleSection('动土作业审批管理'),
|
||||
WorkTabIconGrid(
|
||||
buttonInfos: buttonInfos,
|
||||
onItemPressed: _handleItemPressed,
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||
import 'package:qhd_prevention/http/ApiService.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/dh_Wrok/dh_work_list_page.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'package:qhd_prevention/tools/tools.dart';
|
||||
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_icon_grid.dart';
|
||||
|
||||
class WorkTabDzList extends StatefulWidget {
|
||||
const WorkTabDzList({super.key});
|
||||
|
||||
@override
|
||||
State<WorkTabDzList> createState() => _WorkTabDzListState();
|
||||
}
|
||||
|
||||
class _WorkTabDzListState extends State<WorkTabDzList> {
|
||||
late List<Map<String, dynamic>> buttonInfos = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_getData();
|
||||
}
|
||||
Future<void> _getData() async {
|
||||
final data = await ApiService.specialcheckWorkCount('hoisting');
|
||||
setState(() {
|
||||
final eight_work_count = data['count'] ?? {};
|
||||
buttonInfos = [
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-1.png",
|
||||
"title": "吊装作业\n申请",
|
||||
"unreadCount": eight_work_count['CREATE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "司索人\n意见",
|
||||
"unreadCount": eight_work_count['SISUO'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "设置安全",
|
||||
"unreadCount": eight_work_count['MEASURES_SET'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "安全措施确认",
|
||||
"unreadCount": eight_work_count['MEASURES_CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-zl-9.png",
|
||||
"title": "监护人\n意见",
|
||||
"unreadCount": eight_work_count['GUARDIAN'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-807.png",
|
||||
"title": "安全交底人\n意见",
|
||||
"unreadCount": eight_work_count['CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-4.png",
|
||||
"title": "接受交底人\n意见",
|
||||
"unreadCount": eight_work_count['ACCEPT_CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业人\n意见",
|
||||
"unreadCount": eight_work_count['WORK_USER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业负责人\n意见",
|
||||
"unreadCount": eight_work_count['CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "吊装指挥人\n意见",
|
||||
"unreadCount": eight_work_count['HOISTING_CONDUCTOR'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-907.png",
|
||||
"title": "所在单位\n意见",
|
||||
"unreadCount": eight_work_count['LEADER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-901.png",
|
||||
"title": "审核部门\n意见",
|
||||
"unreadCount": eight_work_count['REVIEWER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-901.png",
|
||||
"title": "审批部门\n意见",
|
||||
"unreadCount": eight_work_count['APPROVE'] ?? '0',
|
||||
},
|
||||
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-aq-1.png",
|
||||
"title": "开始作业时间",
|
||||
"unreadCount": eight_work_count['WORK_START'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "结束作业时间",
|
||||
"unreadCount": eight_work_count['WORK_END'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "验收归档",
|
||||
"unreadCount": eight_work_count['ACCEPT'] ?? '0',
|
||||
},
|
||||
|
||||
];
|
||||
});
|
||||
}
|
||||
void _handleItemPressed(int index) {
|
||||
// 根据索引执行不同的导航逻辑
|
||||
String title = '';
|
||||
switch (index) {
|
||||
case 0: title = '提交申请'; break;
|
||||
case 1: title = '司索人签字'; break;
|
||||
case 2: title = '设置安全措施确认人'; break;
|
||||
case 3: title = '安全措施确认'; break;
|
||||
case 4: title = '监护人签字'; break;
|
||||
case 5: title = '安全交底人签字'; break;
|
||||
case 6: title = '接受交底人签字'; break;
|
||||
case 7: title = '作业人签字'; break;
|
||||
case 8: title = '作业负责人签字'; break;
|
||||
case 9: title = '吊装指挥人签字'; break;
|
||||
case 10: title = '所在单位签字'; break;
|
||||
case 11: title = '审核人签字'; break;
|
||||
case 12: title = '审批人签字'; break;
|
||||
case 13: title = '开始作业'; break;
|
||||
case 14: title = '结束作业'; break;
|
||||
case 15: title = '验收签字'; break;
|
||||
|
||||
default:
|
||||
print("按钮 $index 被点击");
|
||||
}
|
||||
pushPage(DhWorkListPage(flow: title), context);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: MyAppbar(title: '吊装作业'),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
ListItemFactory.createBuildSimpleSection('吊装作业审批管理'),
|
||||
WorkTabIconGrid(
|
||||
buttonInfos: buttonInfos,
|
||||
onItemPressed: _handleItemPressed,
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||
import 'package:qhd_prevention/http/ApiService.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/dh_Wrok/dh_work_list_page.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'package:qhd_prevention/tools/tools.dart';
|
||||
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_icon_grid.dart';
|
||||
|
||||
class WorkTabGcList extends StatefulWidget {
|
||||
const WorkTabGcList({super.key});
|
||||
|
||||
@override
|
||||
State<WorkTabGcList> createState() => _WorkTabGcListState();
|
||||
}
|
||||
|
||||
class _WorkTabGcListState extends State<WorkTabGcList> {
|
||||
late List<Map<String, dynamic>> buttonInfos = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_getData();
|
||||
}
|
||||
Future<void> _getData() async {
|
||||
final data = await ApiService.specialcheckWorkCount('highwork');
|
||||
setState(() {
|
||||
final eight_work_count = data['count'] ?? {};
|
||||
buttonInfos = [
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-1.png",
|
||||
"title": "高处作业\n申请",
|
||||
"unreadCount": eight_work_count['CREATE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "设置安全\n措施确认人",
|
||||
"unreadCount": eight_work_count['MEASURES_SET'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "安全措施确认",
|
||||
"unreadCount": eight_work_count['MEASURES_CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-zl-9.png",
|
||||
"title": "监护人\n意见",
|
||||
"unreadCount": eight_work_count['GUARDIAN'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-807.png",
|
||||
"title": "安全交底人\n意见",
|
||||
"unreadCount": eight_work_count['CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-4.png",
|
||||
"title": "接受交底人\n意见",
|
||||
"unreadCount": eight_work_count['ACCEPT_CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业人\n意见",
|
||||
"unreadCount": eight_work_count['WORK_USER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业负责人\n意见",
|
||||
"unreadCount": eight_work_count['CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-907.png",
|
||||
"title": "所在单位\n意见",
|
||||
"unreadCount": eight_work_count['LEADER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-901.png",
|
||||
"title": "审核部门\n意见",
|
||||
"unreadCount": eight_work_count['REVIEWER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-901.png",
|
||||
"title": "审批部门\n意见",
|
||||
"unreadCount": eight_work_count['APPROVE'] ?? '0',
|
||||
},
|
||||
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-aq-1.png",
|
||||
"title": "开始作业时间",
|
||||
"unreadCount": eight_work_count['WORK_START'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "结束作业时间",
|
||||
"unreadCount": eight_work_count['WORK_END'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "验收归档",
|
||||
"unreadCount": eight_work_count['ACCEPT'] ?? '0',
|
||||
},
|
||||
|
||||
];
|
||||
});
|
||||
}
|
||||
void _handleItemPressed(int index) {
|
||||
// 根据索引执行不同的导航逻辑
|
||||
String title = '';
|
||||
switch (index) {
|
||||
case 0: title = '提交申请'; break;
|
||||
case 1: title = '设置安全措施确认人'; break;
|
||||
case 2: title = '安全措施确认'; break;
|
||||
case 3: title = '监护人签字'; break;
|
||||
case 4: title = '安全交底人签字'; break;
|
||||
case 5: title = '接受交底人签字'; break;
|
||||
case 6: title = '作业人签字'; break;
|
||||
case 7: title = '作业负责人签字'; break;
|
||||
case 8: title = '所在单位签字'; break;
|
||||
case 9: title = '审核人签字'; break;
|
||||
case 10: title = '审批人签字'; break;
|
||||
case 11: title = '开始作业'; break;
|
||||
case 12: title = '结束作业'; break;
|
||||
case 13: title = '验收签字'; break;
|
||||
|
||||
default:
|
||||
print("按钮 $index 被点击");
|
||||
}
|
||||
pushPage(DhWorkListPage(flow: title), context);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: MyAppbar(title: '高处作业'),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
ListItemFactory.createBuildSimpleSection('高处作业审批管理'),
|
||||
WorkTabIconGrid(
|
||||
buttonInfos: buttonInfos,
|
||||
onItemPressed: _handleItemPressed,
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
/// 网格布局组件
|
||||
class WorkTabIconGrid extends StatelessWidget {
|
||||
final List<Map<String, dynamic>> buttonInfos;
|
||||
final ValueChanged<int> onItemPressed;
|
||||
final double leftSpace;
|
||||
|
||||
const WorkTabIconGrid({
|
||||
super.key,
|
||||
required this.buttonInfos,
|
||||
required this.onItemPressed,
|
||||
this.leftSpace = 0,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final double screenW = MediaQuery.of(context).size.width;
|
||||
final double itemW = (screenW - 2 * leftSpace) / 4;
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 10, horizontal: leftSpace),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: buttonInfos.length <= 4
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: buttonInfos.asMap().entries.map((entry) {
|
||||
final index = entry.key;
|
||||
final info = entry.value;
|
||||
return _buildIconButton(
|
||||
context: context,
|
||||
iconPath: info['icon'] as String,
|
||||
label: info['title'] as String,
|
||||
unreadCount: int.tryParse(info['unreadCount'].toString()) ?? 0,
|
||||
onPressed: () => onItemPressed(index),
|
||||
width: itemW,
|
||||
);
|
||||
}).toList(),
|
||||
)
|
||||
: Wrap(
|
||||
spacing: 0,
|
||||
runSpacing: 16,
|
||||
alignment: WrapAlignment.start,
|
||||
children: buttonInfos.asMap().entries.map((entry) {
|
||||
final index = entry.key;
|
||||
final info = entry.value;
|
||||
return _buildIconButton(
|
||||
context: context,
|
||||
iconPath: info['icon'] as String,
|
||||
label: info['title'] as String,
|
||||
unreadCount: int.tryParse(info['unreadCount'].toString()) ?? 0,
|
||||
onPressed: () => onItemPressed(index),
|
||||
width: itemW,
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildIconButton({
|
||||
required BuildContext context,
|
||||
required String iconPath,
|
||||
required String label,
|
||||
required VoidCallback onPressed,
|
||||
required double width,
|
||||
int unreadCount = 0,
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: onPressed,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(iconPath, width: 30, height: 30),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(fontSize: 13),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (unreadCount > 0)
|
||||
Positioned(
|
||||
right: width / 4 - 10,
|
||||
top: -5,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 4,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 16,
|
||||
minHeight: 16,
|
||||
),
|
||||
child: Text(
|
||||
unreadCount > 99 ? '99+' : '$unreadCount',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 10,
|
||||
height: 1,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/http/ApiService.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_dh_list.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_dl_list.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_dt_list.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_dz_list.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_gc_list.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_icon_grid.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_lsyd_list.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_mbcd_list.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_sxkj_list.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'package:qhd_prevention/tools/tools.dart';
|
||||
|
||||
class WorkTabListPage extends StatefulWidget {
|
||||
const WorkTabListPage({super.key});
|
||||
|
||||
@override
|
||||
State<WorkTabListPage> createState() => _WorkTabListPageState();
|
||||
}
|
||||
|
||||
class _WorkTabListPageState extends State<WorkTabListPage> {
|
||||
late List<Map<String, dynamic>> buttonInfos = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_getData();
|
||||
}
|
||||
Future<void> _getData() async {
|
||||
final data = await ApiService.specialCheckWork();
|
||||
setState(() {
|
||||
final eight_work_count = data['count'] ?? {};
|
||||
buttonInfos = [
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-807.png",
|
||||
"title": "动火作业",
|
||||
"unreadCount": eight_work_count['HOTWORK_COUNT'],
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-803.png",
|
||||
"title": "高处作业",
|
||||
"unreadCount": eight_work_count['HIGHWORK_COUNT'],
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-806.png",
|
||||
"title": "受限空间\n安全作业",
|
||||
"unreadCount": eight_work_count['CONFINEDSPACE_COUNT'],
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-804.png",
|
||||
"title": "吊装作业",
|
||||
"unreadCount": eight_work_count['HOISTING_COUNT'],
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-802.png",
|
||||
"title": "动土作业",
|
||||
"unreadCount": eight_work_count['BREAKGROUND_COUNT'],
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-805.png",
|
||||
"title": "临时用电作业",
|
||||
"unreadCount": eight_work_count['ELECTRICITY_COUNT'],
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/open-circuit.png",
|
||||
"title": "断路作业",
|
||||
"unreadCount": eight_work_count['OPEN_CIRCUIT_COUNT'],
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-801.png",
|
||||
"title": "盲板抽堵作业",
|
||||
"unreadCount": eight_work_count['BLIND_BOARD_COUNT'],
|
||||
}
|
||||
];
|
||||
});
|
||||
}
|
||||
void _handleItemPressed(int index) {
|
||||
switch (index) {
|
||||
case 0:pushPage(WorkTabDhList(), context); break;
|
||||
case 1:pushPage(WorkTabGcList(), context); break;
|
||||
case 2:pushPage(WorkTabSxkjList(), context); break;
|
||||
case 3:pushPage(WorkTabDzList(), context); break;
|
||||
case 4:pushPage(WorkTabDtList(), context); break;
|
||||
case 5:pushPage(WorkTabLsydList(), context); break;
|
||||
case 6:pushPage(WorkTabDlList(), context); break;
|
||||
case 7:pushPage(WorkTabMbcdList(), context); break;
|
||||
|
||||
}
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: MyAppbar(title: '特殊作业'),
|
||||
body: SafeArea(
|
||||
child: WorkTabIconGrid(
|
||||
buttonInfos: buttonInfos,
|
||||
onItemPressed: _handleItemPressed,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||
import 'package:qhd_prevention/http/ApiService.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/dh_Wrok/dh_work_list_page.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'package:qhd_prevention/tools/tools.dart';
|
||||
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_icon_grid.dart';
|
||||
|
||||
class WorkTabLsydList extends StatefulWidget {
|
||||
const WorkTabLsydList({super.key});
|
||||
|
||||
@override
|
||||
State<WorkTabLsydList> createState() => _WorkTabLsydListState();
|
||||
}
|
||||
|
||||
class _WorkTabLsydListState extends State<WorkTabLsydList> {
|
||||
late List<Map<String, dynamic>> buttonInfos = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_getData();
|
||||
}
|
||||
Future<void> _getData() async {
|
||||
final data = await ApiService.specialcheckWorkCount('electricity');
|
||||
setState(() {
|
||||
final eight_work_count = data['count'] ?? {};
|
||||
buttonInfos = [
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-1.png",
|
||||
"title": "临时用电\n申请",
|
||||
"unreadCount": eight_work_count['CREATE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-zl-8.png",
|
||||
"title": "气体分析",
|
||||
"unreadCount": eight_work_count['ANALYZE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "设置安全\n措施确认人",
|
||||
"unreadCount": eight_work_count['MEASURES_SET'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "安全措施确认",
|
||||
"unreadCount": eight_work_count['MEASURES_CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-4.png",
|
||||
"title": "用电人意见",
|
||||
"unreadCount": eight_work_count['GUARDIAN'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-807.png",
|
||||
"title": "安全交底人\n意见",
|
||||
"unreadCount": eight_work_count['CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-4.png",
|
||||
"title": "接受交底人\n意见",
|
||||
"unreadCount": eight_work_count['ACCEPT_CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业人\n意见",
|
||||
"unreadCount": eight_work_count['WORK_USER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业负责人\n意见",
|
||||
"unreadCount": eight_work_count['CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-907.png",
|
||||
"title": "用电单位\n意见",
|
||||
"unreadCount": eight_work_count['LEADER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-907.png",
|
||||
"title": "配送电单位\n意见",
|
||||
"unreadCount": eight_work_count['REVIEWER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-aq-1.png",
|
||||
"title": "开始作业时间",
|
||||
"unreadCount": eight_work_count['WORK_START'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "结束作业时间",
|
||||
"unreadCount": eight_work_count['WORK_END'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "验收归档",
|
||||
"unreadCount": eight_work_count['ACCEPT'] ?? '0',
|
||||
},
|
||||
|
||||
];
|
||||
});
|
||||
}
|
||||
void _handleItemPressed(int index) {
|
||||
// 根据索引执行不同的导航逻辑
|
||||
String title = '';
|
||||
switch (index) {
|
||||
case 0: title = '提交申请'; break;
|
||||
case 1: title = '气体检测'; break;
|
||||
case 2: title = '设置安全措施确认人'; break;
|
||||
case 3: title = '安全措施确认'; break;
|
||||
case 4: title = '监护人签字'; break;
|
||||
case 5: title = '用电人签字'; break;
|
||||
case 6: title = '安全交底人签字'; break;
|
||||
case 7: title = '接受交底人签字'; break;
|
||||
case 8: title = '作业人签字'; break;
|
||||
case 9: title = '作业负责人签字'; break;
|
||||
case 10: title = '用电单位签字'; break;
|
||||
case 11: title = '配送电单位签字'; break;
|
||||
case 12: title = '开始作业'; break;
|
||||
case 13: title = '结束作业'; break;
|
||||
case 14: title = '验收签字'; break;
|
||||
|
||||
default:
|
||||
print("按钮 $index 被点击");
|
||||
}
|
||||
pushPage(DhWorkListPage(flow: title), context);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: MyAppbar(title: '临时用电'),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
ListItemFactory.createBuildSimpleSection('临时用电审批管理'),
|
||||
WorkTabIconGrid(
|
||||
buttonInfos: buttonInfos,
|
||||
onItemPressed: _handleItemPressed,
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||
import 'package:qhd_prevention/http/ApiService.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/dh_Wrok/dh_work_list_page.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'package:qhd_prevention/tools/tools.dart';
|
||||
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_icon_grid.dart';
|
||||
|
||||
class WorkTabMbcdList extends StatefulWidget {
|
||||
const WorkTabMbcdList({super.key});
|
||||
|
||||
@override
|
||||
State<WorkTabMbcdList> createState() => _WorkTabMbcdListState();
|
||||
}
|
||||
|
||||
class _WorkTabMbcdListState extends State<WorkTabMbcdList> {
|
||||
late List<Map<String, dynamic>> buttonInfos = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_getData();
|
||||
}
|
||||
Future<void> _getData() async {
|
||||
final data = await ApiService.specialcheckWorkCount('blindboard');
|
||||
setState(() {
|
||||
final eight_work_count = data['count'] ?? {};
|
||||
buttonInfos = [
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-1.png",
|
||||
"title": "盲板作业\n申请",
|
||||
"unreadCount": eight_work_count['CREATE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "车间人员\n签字",
|
||||
"unreadCount": eight_work_count['WORKSHOP'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "设置安全\n措施确认人",
|
||||
"unreadCount": eight_work_count['MEASURES_SET'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "安全措施确认",
|
||||
"unreadCount": eight_work_count['MEASURES_CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-zl-9.png",
|
||||
"title": "监护人\n意见",
|
||||
"unreadCount": eight_work_count['GUARDIAN'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-807.png",
|
||||
"title": "安全交底人\n意见",
|
||||
"unreadCount": eight_work_count['CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-4.png",
|
||||
"title": "接受交底人\n意见",
|
||||
"unreadCount": eight_work_count['ACCEPT_CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业人\n意见",
|
||||
"unreadCount": eight_work_count['WORK_USER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业负责人\n意见",
|
||||
"unreadCount": eight_work_count['CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-907.png",
|
||||
"title": "所在单位\n意见",
|
||||
"unreadCount": eight_work_count['LEADER'] ?? '0',
|
||||
},
|
||||
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-aq-1.png",
|
||||
"title": "开始作业时间",
|
||||
"unreadCount": eight_work_count['WORK_START'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "验收归档",
|
||||
"unreadCount": eight_work_count['ACCEPT'] ?? '0',
|
||||
},
|
||||
|
||||
];
|
||||
});
|
||||
}
|
||||
void _handleItemPressed(int index) {
|
||||
// 根据索引执行不同的导航逻辑
|
||||
String title = '';
|
||||
switch (index) {
|
||||
case 0: title = '提交申请'; break;
|
||||
case 1: title = '车间人员签字'; break;
|
||||
case 2: title = '设置安全措施确认人'; break;
|
||||
case 3: title = '安全措施确认'; break;
|
||||
case 4: title = '监护人签字'; break;
|
||||
case 5: title = '安全交底人签字'; break;
|
||||
case 6: title = '接受交底人签字'; break;
|
||||
case 7: title = '作业人签字'; break;
|
||||
case 8: title = '作业负责人签字'; break;
|
||||
case 9: title = '所在单位签字'; break;
|
||||
case 10: title = '开始作业'; break;
|
||||
case 11: title = '验收签字'; break;
|
||||
|
||||
default:
|
||||
print("按钮 $index 被点击");
|
||||
}
|
||||
pushPage(DhWorkListPage(flow: title), context);
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: MyAppbar(title: '盲板作业'),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
ListItemFactory.createBuildSimpleSection('盲板作业审批管理'),
|
||||
WorkTabIconGrid(
|
||||
buttonInfos: buttonInfos,
|
||||
onItemPressed: _handleItemPressed,
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,189 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||
import 'package:qhd_prevention/http/ApiService.dart';
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/dh_Wrok/dh_work_list_page.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import 'package:qhd_prevention/tools/tools.dart';
|
||||
|
||||
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_icon_grid.dart';
|
||||
|
||||
class WorkTabSxkjList extends StatefulWidget {
|
||||
const WorkTabSxkjList({super.key});
|
||||
|
||||
@override
|
||||
State<WorkTabSxkjList> createState() => _WorkTabSxkjListState();
|
||||
}
|
||||
|
||||
class _WorkTabSxkjListState extends State<WorkTabSxkjList> {
|
||||
late List<Map<String, dynamic>> topButtonInfos = [];
|
||||
late List<Map<String, dynamic>> buttonInfos = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_getData();
|
||||
}
|
||||
|
||||
Future<void> _getData() async {
|
||||
final data = await ApiService.specialcheckWorkCount('confinedspace');
|
||||
setState(() {
|
||||
final eight_work_count = data['count'] ?? {};
|
||||
topButtonInfos = [
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-pc-1.png",
|
||||
"title": "受限空间作业\n台账管理",
|
||||
"unreadCount": '0',
|
||||
},
|
||||
|
||||
];
|
||||
buttonInfos = [
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-1.png",
|
||||
"title": "受限空间\n申请",
|
||||
"unreadCount": eight_work_count['CREATE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-zl-8.png",
|
||||
"title": "气体分析",
|
||||
"unreadCount": eight_work_count['ANALYZE'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "设置安全\n措施确认人",
|
||||
"unreadCount": eight_work_count['MEASURES_SET'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yh-1.png",
|
||||
"title": "安全措施确认",
|
||||
"unreadCount": eight_work_count['MEASURES_CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-zl-9.png",
|
||||
"title": "监护人\n意见",
|
||||
"unreadCount": eight_work_count['GUARDIAN'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-807.png",
|
||||
"title": "安全交底人\n意见",
|
||||
"unreadCount": eight_work_count['CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-4.png",
|
||||
"title": "接受交底人\n意见",
|
||||
"unreadCount": eight_work_count['ACCEPT_CONFESS'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业人\n意见",
|
||||
"unreadCount": eight_work_count['WORK_USER'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-yxkj-2.png",
|
||||
"title": "作业负责人\n意见",
|
||||
"unreadCount": eight_work_count['CONFIRM'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-907.png",
|
||||
"title": "所在单位\n意见",
|
||||
"unreadCount": eight_work_count['LEADER'] ?? '0',
|
||||
},
|
||||
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-aq-1.png",
|
||||
"title": "开始作业时间",
|
||||
"unreadCount": eight_work_count['WORK_START'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "结束作业时间",
|
||||
"unreadCount": eight_work_count['WORK_END'] ?? '0',
|
||||
},
|
||||
{
|
||||
"icon": "assets/icon-apps/icon-js-1.png",
|
||||
"title": "验收归档",
|
||||
"unreadCount": eight_work_count['ACCEPT'] ?? '0',
|
||||
},
|
||||
];
|
||||
});
|
||||
}
|
||||
void _handleTopItem(int index) {
|
||||
|
||||
}
|
||||
void _handleItemPressed(int index) {
|
||||
// 根据索引执行不同的导航逻辑
|
||||
String title = '';
|
||||
switch (index) {
|
||||
case 0:
|
||||
title = '提交申请';
|
||||
break;
|
||||
case 1:
|
||||
title = '气体检测';
|
||||
break;
|
||||
case 2:
|
||||
title = '设置安全措施确认人';
|
||||
break;
|
||||
case 3:
|
||||
title = '安全措施确认';
|
||||
break;
|
||||
case 4:
|
||||
title = '监护人签字';
|
||||
break;
|
||||
case 5:
|
||||
title = '安全交底人签字';
|
||||
break;
|
||||
case 6:
|
||||
title = '接受交底人签字';
|
||||
break;
|
||||
case 7:
|
||||
title = '作业人签字';
|
||||
break;
|
||||
case 8:
|
||||
title = '作业负责人签字';
|
||||
break;
|
||||
|
||||
case 9:
|
||||
title = '所在单位签字';
|
||||
break;
|
||||
case 10:
|
||||
title = '开始作业';
|
||||
break;
|
||||
case 11:
|
||||
title = '结束作业';
|
||||
break;
|
||||
case 12:
|
||||
title = '验收签字';
|
||||
break;
|
||||
|
||||
default:
|
||||
print("按钮 $index 被点击");
|
||||
}
|
||||
pushPage(DhWorkListPage(flow: title), context);
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: MyAppbar(title: '受限空间'),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
ListItemFactory.createBuildSimpleSection('受限空间作业台账'),
|
||||
WorkTabIconGrid(
|
||||
buttonInfos: topButtonInfos,
|
||||
onItemPressed: _handleTopItem,
|
||||
),
|
||||
SizedBox(height: 10,),
|
||||
|
||||
ListItemFactory.createBuildSimpleSection('受限空间审批管理'),
|
||||
WorkTabIconGrid(
|
||||
buttonInfos: buttonInfos,
|
||||
onItemPressed: _handleItemPressed,
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:qhd_prevention/pages/home/scan_page.dart';
|
||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||
import '../customWidget/nfc_test_page.dart';
|
||||
import '../http/ApiService.dart';
|
||||
import 'home/home_page.dart';
|
||||
import 'app/application_page.dart';
|
||||
import 'mine/mine_page.dart';
|
||||
|
|
@ -16,95 +18,151 @@ class MainPage extends StatefulWidget {
|
|||
class _MainPageState extends State<MainPage> {
|
||||
int _currentIndex = 0;
|
||||
|
||||
// 页面列表
|
||||
/// 应用中心未读数
|
||||
int _appBadge = 0;
|
||||
/// 通知公告未读数
|
||||
int _notifBadge = 0;
|
||||
|
||||
final List<Widget> _pages = const [
|
||||
HomePage(),
|
||||
ApplicationPage(),
|
||||
NotifPage(),
|
||||
MinePage(),
|
||||
];
|
||||
|
||||
// 页面标题
|
||||
final List<String> _titles = ['首页', '应用中心', '通知公告', '我的'];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadBadges();
|
||||
}
|
||||
|
||||
Future<void> _loadBadges() async {
|
||||
try {
|
||||
// 并发请求两个接口
|
||||
final results = await Future.wait([
|
||||
ApiService.getWork(),
|
||||
ApiService.getNotifRedPoint(),
|
||||
]);
|
||||
|
||||
final workJson = results[0];
|
||||
final notifJson = results[1];
|
||||
|
||||
setState(() {
|
||||
final hidCount = workJson['hidCount'] ?? {};
|
||||
final dys = hidCount['dys'] ?? 0;
|
||||
final dzg = hidCount['dzg'] ?? 0;
|
||||
|
||||
_appBadge = (dys as int) + (dzg as int);
|
||||
_notifBadge = notifJson['count'] as int? ?? 0;
|
||||
});
|
||||
} catch (e) {
|
||||
print('拉取未读数失败:$e');
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildIconWithBadge({
|
||||
required Widget icon,
|
||||
required int badgeCount,
|
||||
}) {
|
||||
if (badgeCount <= 0) return icon;
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
icon,
|
||||
Positioned(
|
||||
right: -12,
|
||||
top: -4,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 1),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
constraints: BoxConstraints(minWidth: 16, minHeight: 16),
|
||||
child: Center(
|
||||
child: Text(
|
||||
badgeCount > 99 ? '99+' : '$badgeCount',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 11,
|
||||
height: 1,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar:
|
||||
_currentIndex == 1
|
||||
? null
|
||||
: MyAppbar(
|
||||
title: _currentIndex == 0 ? "泰盛安全首页" : _titles[_currentIndex],
|
||||
backgroundColor: Colors.blue,
|
||||
isBack: false,
|
||||
actions: [
|
||||
if (_currentIndex == 0)
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => ScanPage()),
|
||||
);
|
||||
},
|
||||
icon: Image.asset(
|
||||
"assets/images/scan.png",
|
||||
width: 20,
|
||||
height: 20,
|
||||
),
|
||||
),
|
||||
],
|
||||
appBar: _currentIndex == 1
|
||||
? null
|
||||
: MyAppbar(
|
||||
title: _currentIndex == 0 ? "泰盛安全首页" : _titles[_currentIndex],
|
||||
backgroundColor: Colors.blue,
|
||||
isBack: false,
|
||||
actions: [
|
||||
if (_currentIndex == 0)
|
||||
IconButton(
|
||||
onPressed: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => NfcTestPage()),
|
||||
),
|
||||
icon: Image.asset("assets/images/ai_img.png", width: 20, height: 20),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => ScanPage()),
|
||||
),
|
||||
icon: Image.asset("assets/images/scan.png", width: 20, height: 20),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
body: _pages[_currentIndex],
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
currentIndex: _currentIndex,
|
||||
type: BottomNavigationBarType.fixed,
|
||||
// 保证超过3个图标不压缩
|
||||
selectedItemColor: Colors.blue,
|
||||
unselectedItemColor: Colors.grey,
|
||||
onTap: (index) => setState(() => _currentIndex = index),
|
||||
onTap: (i) => setState(() => _currentIndex = i),
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
icon: Image.asset(
|
||||
'assets/tabbar/basics.png',
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
activeIcon: Image.asset(
|
||||
'assets/tabbar/basics_cur.png',
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
icon: Image.asset('assets/tabbar/basics.png', width: 24, height: 24),
|
||||
activeIcon: Image.asset('assets/tabbar/basics_cur.png', width: 24, height: 24),
|
||||
label: '首页',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Image.asset(
|
||||
'assets/tabbar/application.png',
|
||||
width: 24,
|
||||
height: 24,
|
||||
icon: _buildIconWithBadge(
|
||||
icon: Image.asset('assets/tabbar/application.png', width: 24, height: 24),
|
||||
badgeCount: _appBadge,
|
||||
),
|
||||
activeIcon: Image.asset(
|
||||
'assets/tabbar/application_cur.png',
|
||||
width: 24,
|
||||
height: 24,
|
||||
activeIcon: _buildIconWithBadge(
|
||||
icon: Image.asset('assets/tabbar/application_cur.png', width: 24, height: 24),
|
||||
badgeCount: _appBadge,
|
||||
),
|
||||
label: '应用',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Image.asset('assets/tabbar/works.png', width: 24, height: 24),
|
||||
activeIcon: Image.asset(
|
||||
'assets/tabbar/works_cur.png',
|
||||
width: 24,
|
||||
height: 24,
|
||||
icon: _buildIconWithBadge(
|
||||
icon: Image.asset('assets/tabbar/works.png', width: 24, height: 24),
|
||||
badgeCount: _notifBadge,
|
||||
),
|
||||
activeIcon: _buildIconWithBadge(
|
||||
icon: Image.asset('assets/tabbar/works_cur.png', width: 24, height: 24),
|
||||
badgeCount: _notifBadge,
|
||||
),
|
||||
label: '通知',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Image.asset('assets/tabbar/my.png', width: 24, height: 24),
|
||||
activeIcon: Image.asset(
|
||||
'assets/tabbar/my_cur.png',
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
activeIcon: Image.asset('assets/tabbar/my_cur.png', width: 24, height: 24),
|
||||
label: '我的',
|
||||
),
|
||||
],
|
||||
|
|
@ -112,3 +170,4 @@ class _MainPageState extends State<MainPage> {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:ffi';
|
||||
import 'dart:ui';
|
||||
|
||||
Color h_backGroundColor() => Color(0xFFF1F1F1);
|
||||
Color h_backGroundColor() => Color(0xFFF5F7FA);
|
||||
List<Color> riskLevelTextColors() {
|
||||
return [Color(0xFFE54D42),Color(0xFFF37B1D),Color(0xFFF9BD08),Color(0xFF3281FF)];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ dependencies:
|
|||
flutter_html: ^3.0.0
|
||||
#pdf、word查看
|
||||
pdfx: ^2.9.2
|
||||
# nfc相关
|
||||
nfc_manager: ^4.0.2
|
||||
nfc_manager_ndef: ^1.0.1
|
||||
#定位
|
||||
geolocator: ^10.0.0
|
||||
#打开外部预览app
|
||||
|
|
|
|||
Loading…
Reference in New Issue