From b5992b94ab2bff9a33905bfc3ec0c61fa4047e93 Mon Sep 17 00:00:00 2001 From: hs <873121290@qq.com> Date: Wed, 27 Aug 2025 16:14:50 +0800 Subject: [PATCH] =?UTF-8?q?nfc=E5=B7=A1=E6=A3=80=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Runner.xcodeproj/project.pbxproj | 21 +- ios/Runner/AppDelegate.swift | 130 +- ios/Runner/Info.plist | 171 +- ios/Runner/Runner.entitlements | 9 +- lib/customWidget/custom_button.dart | 76 +- lib/customWidget/photo_picker_row.dart | 18 +- lib/http/ApiService.dart | 2346 ++++++++++------- lib/main.dart | 75 +- .../app/Danger_paicha/quick_report_page.dart | 3 +- lib/pages/home/NFC/home_nfc_add_page.dart | 56 +- .../home/NFC/home_nfc_check_danger_page.dart | 380 ++- lib/pages/home/NFC/home_nfc_check_page.dart | 0 lib/pages/home/NFC/home_nfc_detail_page.dart | 584 ++-- .../home/NFC/nfc_check_danger_detail.dart | 583 ++++ lib/pages/home/NFC/nfc_question_fecebook.dart | 241 ++ lib/pages/home/tap/item_list_widget.dart | 6 +- lib/services/nfc_service.dart | 210 +- lib/tools/tools.dart | 42 +- 18 files changed, 3383 insertions(+), 1568 deletions(-) delete mode 100644 lib/pages/home/NFC/home_nfc_check_page.dart create mode 100644 lib/pages/home/NFC/nfc_check_danger_detail.dart create mode 100644 lib/pages/home/NFC/nfc_question_fecebook.dart diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 6c1ee3d..af9ab3f 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -491,9 +491,11 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 8AKCJ9LW7D; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8AKCJ9LW7D; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -504,6 +506,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.zhuoyun.qhdprevention.qhdPrevention; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "flutter-weihua"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; @@ -682,9 +685,11 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 8AKCJ9LW7D; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8AKCJ9LW7D; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -695,6 +700,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.zhuoyun.qhdprevention.qhdPrevention; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "flutter-weihua"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -710,9 +716,11 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 8AKCJ9LW7D; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8AKCJ9LW7D; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -723,6 +731,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.zhuoyun.qhdprevention.qhdPrevention; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "flutter-weihua"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 764ad24..fb52aaf 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -1,77 +1,77 @@ -import UIKit -import Flutter + import UIKit + import Flutter -@main -@objc class AppDelegate: FlutterAppDelegate { - // 动态方向掩码(默认竖屏) - static var orientationMask: UIInterfaceOrientationMask = .portrait + @main + @objc class AppDelegate: FlutterAppDelegate { + // 动态方向掩码(默认竖屏) + static var orientationMask: UIInterfaceOrientationMask = .portrait - override func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? - ) -> Bool { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { - let controller = window?.rootViewController as! FlutterViewController - let channel = FlutterMethodChannel(name: "app.orientation", - binaryMessenger: controller.binaryMessenger) + let controller = window?.rootViewController as! FlutterViewController + let channel = FlutterMethodChannel(name: "app.orientation", + binaryMessenger: controller.binaryMessenger) - channel.setMethodCallHandler { [weak self] call, result in - guard let self = self else { return } + channel.setMethodCallHandler { [weak self] call, result in + guard let self = self else { return } - if call.method == "setOrientation" { - guard let arg = call.arguments as? String else { - result(FlutterError(code: "BAD_ARGS", message: "need 'landscape' | 'portrait'", details: nil)) - return - } - - // 先更新允许的方向掩码 - if arg == "landscape" { - AppDelegate.orientationMask = .landscape - } else if arg == "portrait" { - AppDelegate.orientationMask = .portrait - } else { - result(FlutterError(code: "BAD_ARGS", message: "unknown arg", details: nil)) - return - } - - - // 再请求实际旋转 - if #available(iOS 16.0, *) { - // 通知顶层 VC:其 supportedInterfaceOrientations 需要刷新 - self.window?.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations() - - if let scene = self.window?.windowScene { - let orientations: UIInterfaceOrientationMask = - (arg == "landscape") ? .landscape : .portrait - do { - try scene.requestGeometryUpdate(.iOS(interfaceOrientations: orientations)) - } catch { - result(FlutterError(code: "GEOMETRY_UPDATE_FAILED", - message: error.localizedDescription, details: nil)) + if call.method == "setOrientation" { + guard let arg = call.arguments as? String else { + result(FlutterError(code: "BAD_ARGS", message: "need 'landscape' | 'portrait'", details: nil)) return } + + // 先更新允许的方向掩码 + if arg == "landscape" { + AppDelegate.orientationMask = .landscape + } else if arg == "portrait" { + AppDelegate.orientationMask = .portrait + } else { + result(FlutterError(code: "BAD_ARGS", message: "unknown arg", details: nil)) + return + } + + + // 再请求实际旋转 + if #available(iOS 16.0, *) { + // 通知顶层 VC:其 supportedInterfaceOrientations 需要刷新 + self.window?.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations() + + if let scene = self.window?.windowScene { + let orientations: UIInterfaceOrientationMask = + (arg == "landscape") ? .landscape : .portrait + do { + try scene.requestGeometryUpdate(.iOS(interfaceOrientations: orientations)) + } catch { + result(FlutterError(code: "GEOMETRY_UPDATE_FAILED", + message: error.localizedDescription, details: nil)) + return + } + } + } else { + let target: UIInterfaceOrientation = + (arg == "landscape") ? .landscapeLeft : .portrait + UIDevice.current.setValue(target.rawValue, forKey: "orientation") + UIViewController.attemptRotationToDeviceOrientation() + } + + result(true) + } else { + result(FlutterMethodNotImplemented) } - } else { - let target: UIInterfaceOrientation = - (arg == "landscape") ? .landscapeLeft : .portrait - UIDevice.current.setValue(target.rawValue, forKey: "orientation") - UIViewController.attemptRotationToDeviceOrientation() } - result(true) - } else { - result(FlutterMethodNotImplemented) + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } + + // 关键:把当前的掩码提供给系统 + override func application(_ application: UIApplication, + supportedInterfaceOrientationsFor window: UIWindow?) + -> UIInterfaceOrientationMask { + return AppDelegate.orientationMask } } - - GeneratedPluginRegistrant.register(with: self) - return super.application(application, didFinishLaunchingWithOptions: launchOptions) - } - - // 关键:把当前的掩码提供给系统 - override func application(_ application: UIApplication, - supportedInterfaceOrientationsFor window: UIWindow?) - -> UIInterfaceOrientationMask { - return AppDelegate.orientationMask - } -} diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 69c07f3..ee7a908 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -1,89 +1,94 @@ - - CADisableMinimumFrameDurationOnPhone - - CFBundleDisplayName + + CADisableMinimumFrameDurationOnPhone + + CFBundleDisplayName ${PRODUCT_NAME} - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - 智守安全 - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + 智守安全 + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + NFCReaderUsageDescription + 需要NFC权限来读取和写入标签 + NSAppTransportSecurity + + NSAllowsArbitraryLoads - NFCReaderUsageDescription - 用于读取 NFC 标签 - UIBackgroundModes - - remote-notification - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - NSBluetoothAlwaysUsageDescription - app需要蓝牙权限连接设备 - NSCameraUsageDescription - app需要相机权限来扫描二维码 - NSContactsUsageDescription - app需要通讯录权限添加好友 - NSHealthShareUsageDescription - app需要读取健康数据 - NSHealthUpdateUsageDescription - app需要写入健康数据 - NSLocalNetworkUsageDescription - app需要发现本地网络设备 - NSLocationAlwaysAndWhenInUseUsageDescription - app需要后台定位以实现持续跟踪 - NSLocationAlwaysUsageDescription - 需要位置权限以提供定位服务 - NSLocationWhenInUseUsageDescription - 需要位置权限以提供定位服务 - NSMicrophoneUsageDescription - app需要麦克风权限进行语音通话 - NSMotionUsageDescription - app需要访问运动数据统计步数 - NSPhotoLibraryAddUsageDescription - app需要保存图片到相册 - NSPhotoLibraryUsageDescription - app需要访问相册以上传图片 - NSUserNotificationsUsageDescription - app需要发送通知提醒重要信息 - UIApplicationSupportsIndirectInputEvents - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIStatusBarHidden - - \ No newline at end of file + NSBluetoothAlwaysUsageDescription + app需要蓝牙权限连接设备 + NSCameraUsageDescription + app需要相机权限来扫描二维码 + NSContactsUsageDescription + app需要通讯录权限添加好友 + NSHealthShareUsageDescription + app需要读取健康数据 + NSHealthUpdateUsageDescription + app需要写入健康数据 + NSLocalNetworkUsageDescription + app需要发现本地网络设备 + NSLocationAlwaysAndWhenInUseUsageDescription + app需要后台定位以实现持续跟踪 + NSLocationAlwaysUsageDescription + 需要位置权限以提供定位服务 + NSLocationWhenInUseUsageDescription + 需要位置权限以提供定位服务 + NSMicrophoneUsageDescription + app需要麦克风权限进行语音通话 + NSMotionUsageDescription + app需要访问运动数据统计步数 + NSPhotoLibraryAddUsageDescription + app需要保存图片到相册 + NSPhotoLibraryUsageDescription + app需要访问相册以上传图片 + NSUserNotificationsUsageDescription + app需要发送通知提醒重要信息 + UIApplicationSupportsIndirectInputEvents + + UIBackgroundModes + + remote-notification + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIStatusBarHidden + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + com.apple.developer.nfc.readersession.formats + + NDEF + TAG + + + diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements index 2bb4dee..3833536 100644 --- a/ios/Runner/Runner.entitlements +++ b/ios/Runner/Runner.entitlements @@ -3,8 +3,11 @@ com.apple.developer.nfc.readersession.formats - - TAG - + + NDEF + TAG + + + diff --git a/lib/customWidget/custom_button.dart b/lib/customWidget/custom_button.dart index dc85dea..39d5b41 100644 --- a/lib/customWidget/custom_button.dart +++ b/lib/customWidget/custom_button.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; - -/// 自定义默认按钮 +/// 自定义默认按钮(支持不可点击/禁用状态) class CustomButton extends StatelessWidget { final String text; // 按钮文字 final Color backgroundColor; // 按钮背景色 @@ -11,6 +10,16 @@ class CustomButton extends StatelessWidget { final double? height; // 按钮高度 final TextStyle? textStyle; // 文字样式 + /// 新增:是否可点击(true 可点,false 禁用) + /// 注意:如果 onPressed 为 null,也会被视为不可点击 + final bool enabled; + + /// 新增:禁用时的背景色(可选) + final Color? disabledBackgroundColor; + + /// 新增:禁用时的文字颜色(可选) + final Color? disabledTextColor; + const CustomButton({ super.key, required this.text, @@ -21,27 +30,56 @@ class CustomButton extends StatelessWidget { this.margin, this.height, this.textStyle, + this.enabled = true, + this.disabledBackgroundColor, + this.disabledTextColor, }); @override Widget build(BuildContext context) { - return GestureDetector( - onTap: onPressed, - child: Container( - height: height ?? 45, // 默认高度45 - padding: padding ?? const EdgeInsets.all(8), // 默认内边距 - margin: margin ?? const EdgeInsets.symmetric(horizontal: 5), // 默认外边距 - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(borderRadius), - color: backgroundColor, - ), - child: Center( - child: Text( - text, - style: textStyle ?? const TextStyle( - color: Colors.white, - fontSize: 15, - fontWeight: FontWeight.bold, + // 如果 enabled 为 false 或 onPressed 为 null,则视为不可点击 + final bool isEnabled = enabled && onPressed != null; + + // 计算展示用背景色与文字样式 + final Color bgColor = isEnabled + ? backgroundColor + : (disabledBackgroundColor ?? Colors.grey.shade400); + + TextStyle finalTextStyle; + if (textStyle != null) { + finalTextStyle = isEnabled + ? textStyle! + : textStyle!.copyWith( + color: disabledTextColor ?? textStyle!.color?.withOpacity(0.8) ?? Colors.white70, + ); + } else { + finalTextStyle = TextStyle( + color: isEnabled ? Colors.white : (disabledTextColor ?? Colors.white70), + fontSize: 15, + fontWeight: FontWeight.bold, + ); + } + + // 点击拦截器 + 视觉反馈(禁用时降低不透明度) + return Opacity( + opacity: isEnabled ? 1.0 : 0.65, + child: AbsorbPointer( + absorbing: !isEnabled, + child: GestureDetector( + onTap: isEnabled ? onPressed : null, + child: Container( + height: height ?? 45, // 默认高度45 + padding: padding ?? const EdgeInsets.all(8), // 默认内边距 + margin: margin ?? const EdgeInsets.symmetric(horizontal: 5), // 默认外边距 + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(borderRadius), + color: bgColor, + ), + child: Center( + child: Text( + text, + style: finalTextStyle, + ), ), ), ), diff --git a/lib/customWidget/photo_picker_row.dart b/lib/customWidget/photo_picker_row.dart index 04a2f0d..da6bba1 100644 --- a/lib/customWidget/photo_picker_row.dart +++ b/lib/customWidget/photo_picker_row.dart @@ -20,6 +20,8 @@ class MediaPickerRow extends StatefulWidget { final ValueChanged? onMediaRemoved; final ValueChanged? onMediaTapped; // 新增:媒体点击回调 final bool isEdit; // 新增:控制编辑状态 + final bool isCamera; // 新增:只能拍照 + const MediaPickerRow({ Key? key, @@ -31,6 +33,7 @@ class MediaPickerRow extends StatefulWidget { this.onMediaRemoved, this.onMediaTapped, // 新增 this.isEdit = true, // 默认可编辑 + this.isCamera = false, }) : super(key: key); @override @@ -53,7 +56,16 @@ class _MediaPickerGridState extends State { ); }); } + Future _cameraAction() async { + XFile? picked = await _picker.pickImage(source: ImageSource.camera); + if (picked != null) { + final path = picked.path; + setState(() => _mediaPaths.add(path)); + widget.onChanged(_mediaPaths.map((p) => File(p)).toList()); + widget.onMediaAdded?.call(path); + } + } Future _showPickerOptions() async { if (!widget.isEdit) return; // 不可编辑时直接返回 @@ -237,7 +249,7 @@ class _MediaPickerGridState extends State { // 显示添加按钮 else if (showAddButton) { return GestureDetector( - onTap: _showPickerOptions, + onTap: widget.isCamera?_cameraAction:_showPickerOptions, child: Container( decoration: BoxDecoration( border: Border.all(color: Colors.black12), @@ -273,6 +285,8 @@ class RepairedPhotoSection extends StatefulWidget { final bool isRequired; final bool isShowNum; final bool isEdit; // 新增:控制编辑状态 + final bool isCamera; // 新增:只能拍照 + const RepairedPhotoSection({ Key? key, @@ -290,6 +304,7 @@ class RepairedPhotoSection extends StatefulWidget { this.isRequired = false, this.isShowNum = true, this.isEdit = true, // 默认可编辑 + this.isCamera = false, }) : super(key: key); @override @@ -331,6 +346,7 @@ class _RepairedPhotoSectionState extends State { maxCount: widget.maxCount, mediaType: widget.mediaType, initialMediaPaths: _mediaPaths, + isCamera: widget.isCamera, onChanged: (files) { final newPaths = files.map((f) => f.path).toList(); setState(() { diff --git a/lib/http/ApiService.dart b/lib/http/ApiService.dart index a0e7cc7..95c3ecd 100644 --- a/lib/http/ApiService.dart +++ b/lib/http/ApiService.dart @@ -37,8 +37,8 @@ class ApiService { 'https://pm.qhdsafety.com/zy-projectManage'; /// NFC巡检接口 - static const String baseNFCPath = - "http://192.168.0.37:8099/api/app/"; + static const String baseNFCPath = "http://192.168.0.37:8099/api/app"; + // /// 人脸识别服务 // static const String baseFacePath = // "https://qaaqwh.qhdsafety.com/whb_stu_face/"; @@ -57,7 +57,6 @@ class ApiService { // static const String projectManagerUrl = // 'https://pm.qhdsafety.com/zy-projectManage'; - /// RSA 公钥 static const publicKey = ''' -----BEGIN PUBLIC KEY----- @@ -68,9 +67,6 @@ U6Hzm1ninpWeE+awIDAQAB -----END PUBLIC KEY----- '''; - - - /// 登录验证接口 static Future> loginCheck(String keydataVal) { return HttpManager().request( @@ -112,6 +108,7 @@ U6Hzm1ninpWeE+awIDAQAB data: {'USER_ID': SessionService.instance.loginUserId}, ); } + /// 通知红点数量 static Future> getNotifRedPoint() { return HttpManager().request( @@ -141,6 +138,7 @@ U6Hzm1ninpWeE+awIDAQAB }, ); } + /// 排查数据(部门) static Future> getDeptData() { return HttpManager().request( @@ -157,6 +155,7 @@ U6Hzm1ninpWeE+awIDAQAB }, ); } + /// 排查数据(监管) static Future> getSuperviseDeptData() { return HttpManager().request( @@ -173,6 +172,7 @@ U6Hzm1ninpWeE+awIDAQAB }, ); } + /// 安全检查 static Future> getSafetyEnvironmentalInspectionCount() { return HttpManager().request( @@ -197,51 +197,48 @@ U6Hzm1ninpWeE+awIDAQAB data: {}, ); } + /// 校验安全承诺 static Future> checkSafeCorppromise() async { return HttpManager().request( basePath, '/app/corppromise/ISSIGN_II', method: Method.post, - data: { - 'USER_ID': SessionService.instance.loginUserId, - }, + data: {'USER_ID': SessionService.instance.loginUserId}, ); } + /// 安全承诺详情 static Future> safeCorppromiseDetail() async { return HttpManager().request( basePath, '/app/corppromise/promise_II', method: Method.post, - data: { - 'USER_ID': SessionService.instance.loginUserId, - }, + data: {'USER_ID': SessionService.instance.loginUserId}, ); } + // /// 安全承诺提交 - static Future> submitCorppromiseSign(String imagePath, Map data) async { + static Future> submitCorppromiseSign( + String imagePath, + Map data, + ) async { final file = File(imagePath); if (!await file.exists()) { throw ApiException('file_not_found', '图片不存在:$imagePath'); } final fileName = file.path.split(Platform.pathSeparator).last; return HttpManager().uploadFaceImage( - baseUrl: basePath, - path: '/app/corppromise/editpeople_II', - fromData: { - ...data, - 'CORPINFO_ID': SessionService.instance.corpinfoId, - 'FFILE': await MultipartFile.fromFile( - file.path, - filename: fileName - ), - } + baseUrl: basePath, + path: '/app/corppromise/editpeople_II', + fromData: { + ...data, + 'CORPINFO_ID': SessionService.instance.corpinfoId, + 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), + }, ); - } - /// 检查记录详情地图信息 static Future> getRecordMapInfo(String CHECKRECORD_ID) { return HttpManager().request( @@ -251,12 +248,11 @@ U6Hzm1ninpWeE+awIDAQAB data: { 'USER_ID': SessionService.instance.loginUserId, 'CORPINFO_ID': SessionService.instance.corpinfoId, - 'CHECKRECORD_ID': CHECKRECORD_ID + 'CHECKRECORD_ID': CHECKRECORD_ID, }, ); } - /// 月隐患 1 月隐患,2年隐患 static Future> getDanger(int type) { return HttpManager().request( @@ -295,6 +291,7 @@ U6Hzm1ninpWeE+awIDAQAB }, ); } + /// 获取清单数量 static Future> getListData() { return HttpManager().request( @@ -311,6 +308,7 @@ U6Hzm1ninpWeE+awIDAQAB }, ); } + /// 获取滚动隐患 static Future> getHiddenRoll() { return HttpManager().request( @@ -324,18 +322,7 @@ U6Hzm1ninpWeE+awIDAQAB ); } - static Future> getIsRest() { - return HttpManager().request( - basePath, - '/app/hidden/getHiddenByCorp', - method: Method.post, - data: { - 'CORPINFO_ID': SessionService.instance.corpinfoId, - 'USER_ID': SessionService.instance.loginUserId, - }, - ); - } -/// TODO -------------–-------------------- 首页学习园地 -------------–-------------------- + /// TODO -------------–-------------------- 首页学习园地 -------------–-------------------- /// 我的任务列表 static Future> getStudyList(int page) { return HttpManager().request( @@ -345,13 +332,17 @@ U6Hzm1ninpWeE+awIDAQAB data: { 'CORPINFO_ID': SessionService.instance.corpinfoId, 'USER_ID': SessionService.instance.loginUserId, - 'showCount':10, - 'currentPage':page + 'showCount': 10, + 'currentPage': page, }, ); } + /// 课程列表 - static Future> getClassList(String classId, String POST_ID) { + static Future> getClassList( + String classId, + String POST_ID, + ) { return HttpManager().request( basePath, '/app/edu/stagestudentrelation/getClassCurriculum', @@ -359,33 +350,49 @@ U6Hzm1ninpWeE+awIDAQAB data: { 'CORPINFO_ID': SessionService.instance.corpinfoId, 'USER_ID': SessionService.instance.loginUserId, - 'showCount':9999, - 'currentPage':1, - 'CLASS_ID' : classId, - 'POST_ID' : POST_ID + 'showCount': 9999, + 'currentPage': 1, + 'CLASS_ID': classId, + 'POST_ID': POST_ID, }, ); } + /// 学习详情视频列表 - static Future> getStudyDetailList(String CLASS_ID, String CLASSCURRICULUM_ID, String STUDENT_ID) { - print(CLASS_ID + '---' + CLASSCURRICULUM_ID + '---' + STUDENT_ID+ '---' + SessionService.instance.corpinfoId! + '---' + SessionService.instance.loginUserId!); + static Future> getStudyDetailList( + String CLASS_ID, + String CLASSCURRICULUM_ID, + String STUDENT_ID, + ) { + print( + CLASS_ID + + '---' + + CLASSCURRICULUM_ID + + '---' + + STUDENT_ID + + '---' + + SessionService.instance.corpinfoId! + + '---' + + SessionService.instance.loginUserId!, + ); return HttpManager().request( basePath, '/app/edu/stagestudentrelation/getMyTask', method: Method.post, data: { 'CLASSCURRICULUM_ID': CLASSCURRICULUM_ID, - 'CLASS_ID' : CLASS_ID, - 'STUDENT_ID':STUDENT_ID, + 'CLASS_ID': CLASS_ID, + 'STUDENT_ID': STUDENT_ID, 'CORPINFO_ID': SessionService.instance.corpinfoId, 'USER_ID': SessionService.instance.loginUserId, - }, ); } /// 获取视频信息 - static Future> fnGetVideoPlayInfo(String VIDEOCOURSEWARE_ID) { + static Future> fnGetVideoPlayInfo( + String VIDEOCOURSEWARE_ID, + ) { return HttpManager().request( basePath, '/app/edu/audioOrVideo/getVideoPlayInfoApp', @@ -394,38 +401,38 @@ U6Hzm1ninpWeE+awIDAQAB 'VIDEOCOURSEWARE_ID': VIDEOCOURSEWARE_ID, 'CORPINFO_ID': SessionService.instance.corpinfoId, 'USER_ID': SessionService.instance.loginUserId, - }, ); } + static Future> fnSetUserFaceTime(int FACE_TIME) { return HttpManager().request( baseFacePath, '/app/user/setUserFaceTime', method: Method.post, data: { - 'loading':false, + 'loading': false, 'FACE_TIME': FACE_TIME, 'CORPINFO_ID': SessionService.instance.corpinfoId, 'USER_ID': SessionService.instance.loginUserId, - }, ); } + static Future> fnGetUserFaceTime(int FACE_TIME) { return HttpManager().request( baseFacePath, '/app/user/getUserFaceTime', method: Method.post, data: { - 'loading':false, + 'loading': false, 'FACE_TIME': FACE_TIME, 'CORPINFO_ID': SessionService.instance.corpinfoId, 'USER_ID': SessionService.instance.loginUserId, - }, ); } + /// 清除人脸时间 static Future> fnClearUserFaceTime() { return HttpManager().request( @@ -433,31 +440,45 @@ U6Hzm1ninpWeE+awIDAQAB '/app/user/clearUserFaceTime', method: Method.post, data: { - 'loading':false, + 'loading': false, 'CORPINFO_ID': SessionService.instance.corpinfoId, 'USER_ID': SessionService.instance.loginUserId, }, ); } - static Future> fnGetVideoPlayProgress(String VIDEOCOURSEWARE_ID, String CURRICULUM_ID, String CLASS_ID, String STUDENT_ID) { + static Future> fnGetVideoPlayProgress( + String VIDEOCOURSEWARE_ID, + String CURRICULUM_ID, + String CLASS_ID, + String STUDENT_ID, + ) { return HttpManager().request( basePath, '/app/edu/coursestudyvideorecord/getVideoProgress', method: Method.post, data: { 'VIDEOCOURSEWARE_ID': VIDEOCOURSEWARE_ID, - 'CURRICULUM_ID' : CURRICULUM_ID, - 'CLASS_ID':CLASS_ID, - 'STUDENT_ID':STUDENT_ID, + 'CURRICULUM_ID': CURRICULUM_ID, + 'CLASS_ID': CLASS_ID, + 'STUDENT_ID': STUDENT_ID, 'CORPINFO_ID': SessionService.instance.corpinfoId, 'USER_ID': SessionService.instance.loginUserId, - }, ); } + /// 上报播放进度或结束 - static Future> fnSubmitPlayTime(String VIDEOCOURSEWARE_ID, String CURRICULUM_ID,String IS_END,int RESOURCETIME,String CHAPTER_ID,String STUDENT_ID,String CLASSCURRICULUM_ID, String CLASS_ID) { + static Future> fnSubmitPlayTime( + String VIDEOCOURSEWARE_ID, + String CURRICULUM_ID, + String IS_END, + int RESOURCETIME, + String CHAPTER_ID, + String STUDENT_ID, + String CLASSCURRICULUM_ID, + String CLASS_ID, + ) { return HttpManager().request( basePath, '/app/edu/coursestudyvideorecord/save', @@ -467,7 +488,7 @@ U6Hzm1ninpWeE+awIDAQAB 'CURRICULUM_ID': CURRICULUM_ID, 'CHAPTER_ID': CHAPTER_ID, 'RESOURCETIME': RESOURCETIME, - 'IS_END':IS_END, + 'IS_END': IS_END, 'CLASS_ID': CLASS_ID, 'CLASSCURRICULUM_ID': CLASSCURRICULUM_ID, 'STUDENT_ID': STUDENT_ID, @@ -475,12 +496,15 @@ U6Hzm1ninpWeE+awIDAQAB 'USER_NAME': SessionService.instance.username, 'CORPINFO_ID': SessionService.instance.corpinfoId, 'USER_ID': SessionService.instance.loginUserId, - }, ); } + /// 人脸比对上传接口 - static Future> getUserFace(String imagePath, String studentId) async { + static Future> getUserFace( + String imagePath, + String studentId, + ) async { final file = File(imagePath); if (!await file.exists()) { throw ApiException('file_not_found', '图片不存在:$imagePath'); @@ -491,27 +515,28 @@ U6Hzm1ninpWeE+awIDAQAB baseUrl: baseFacePath, path: '/app/user/compareFaceForH5V2', fromData: { - 'USER_ID' : SessionService.instance.loginUserId, - 'STUDENT_ID' : studentId, - 'CORPINFO_ID' : SessionService.instance.corpinfoId, - 'FFILE' : await MultipartFile.fromFile( - file.path, - filename: fileName - ) + 'USER_ID': SessionService.instance.loginUserId, + 'STUDENT_ID': studentId, + 'CORPINFO_ID': SessionService.instance.corpinfoId, + 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), }, - ); } + /// 签名上传 - static Future> signUpdate(String signBase64, String CLASS_ID, String STAGESTUDENTRELATION_ID) { + static Future> signUpdate( + String signBase64, + String CLASS_ID, + String STAGESTUDENTRELATION_ID, + ) { return HttpManager().request( basePath, '/app/edu/stagestudentrelation/sign', method: Method.post, data: { - 'FFILE':signBase64, - 'STUDYSTATE':1, - 'CLASS_ID' : CLASS_ID, + 'FFILE': signBase64, + 'STUDYSTATE': 1, + 'CLASS_ID': CLASS_ID, 'STAGESTUDENTRELATION_ID': STAGESTUDENTRELATION_ID, 'OPERATOR': SessionService.instance.username, 'USER_ID': SessionService.instance.loginUserId, @@ -520,77 +545,78 @@ U6Hzm1ninpWeE+awIDAQAB } /// 视频练习 - static Future> questionListByVideo(String VIDEOCOURSEWARE_ID) { + static Future> questionListByVideo( + String VIDEOCOURSEWARE_ID, + ) { return HttpManager().request( basePath, '/app/edu/question/listAllByVideo', method: Method.post, - data: { - 'VIDEOCOURSEWARE_ID':VIDEOCOURSEWARE_ID, - }, + data: {'VIDEOCOURSEWARE_ID': VIDEOCOURSEWARE_ID}, ); } /// 成绩查询 - static Future> pageTaskScoreByUser(int showCount, int currentPage) { + static Future> pageTaskScoreByUser( + int showCount, + int currentPage, + ) { return HttpManager().request( basePath, '/app/edu/stagestudentrelation/pageTaskScoreByUser', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, "showCount": showCount, - "currentPage": currentPage + "currentPage": currentPage, }, ); } /// 考试详情 - static Future> getExamRecordByStuId(String STUDENT_ID, String CLASS_ID) { + static Future> getExamRecordByStuId( + String STUDENT_ID, + String CLASS_ID, + ) { return HttpManager().request( basePath, '/app/edu/stageexam/getExamRecordByStuId', method: Method.post, - data: { - "STUDENT_ID":STUDENT_ID, - "CLASS_ID": CLASS_ID, - }, + data: {"STUDENT_ID": STUDENT_ID, "CLASS_ID": CLASS_ID}, ); } + /// 开始考试 static Future> getStartExam(Map data) { return HttpManager().request( basePath, '/app/edu/stageexam/getExam', method: Method.post, - data: { - ...data - }, + data: {...data}, ); } + /// 开始加强考试 static Future> getStartStrengthenExam(Map data) { return HttpManager().request( basePath, '/app/edu/stageexam/getStrengthenExam', method: Method.post, - data: { - ...data - }, + data: {...data}, ); } + /// 加强学习视频 static Future> getListStrengthenVideo(Map data) { return HttpManager().request( basePath, '/app/edu/stagestudentrelation/listStrengthenVideo', method: Method.post, - data: { - ...data - }, + data: {...data}, ); } + /// 考试提交 static Future> submitExam(Map data) { return HttpManager().request( @@ -598,40 +624,44 @@ U6Hzm1ninpWeE+awIDAQAB '/app/edu/stageexam/submit', method: Method.post, data: { - "USERNAME": SessionService.instance.loginUser?["USERNAME"]??"", - "USER_ID":SessionService.instance.loginUserId, - ...data + "USERNAME": SessionService.instance.loginUser?["USERNAME"] ?? "", + "USER_ID": SessionService.instance.loginUserId, + ...data, }, ); } ///TODO -------------–-------------------- 首页特殊作业 -------------–-------------------- /// 作业区域校验 - static Future> checkSpecialWorkIsInPls(String ELECTRONIC_FENCE_AREA_ID, String LONGITUDE, String LATITUDE) { + static Future> checkSpecialWorkIsInPls( + String ELECTRONIC_FENCE_AREA_ID, + String LONGITUDE, + String LATITUDE, + ) { return HttpManager().request( basePath, '/app/eightwork/isInPls', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - "ELECTRONIC_FENCE_AREA_ID":ELECTRONIC_FENCE_AREA_ID, - "LONGITUDE" :LONGITUDE, - "LATITUDE" : LATITUDE, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + "ELECTRONIC_FENCE_AREA_ID": ELECTRONIC_FENCE_AREA_ID, + "LONGITUDE": LONGITUDE, + "LATITUDE": LATITUDE, }, ); } + /// 特殊作业 static Future> specialCheckWork() { return HttpManager().request( basePath, '/app/eightwork/checkWork', method: Method.post, - data: { - "USER_ID":SessionService.instance.loginUserId, - }, + data: {"USER_ID": SessionService.instance.loginUserId}, ); } + /// 特殊作业分类二级 static Future> specialcheckWorkCount(String path) { return HttpManager().request( @@ -640,35 +670,39 @@ U6Hzm1ninpWeE+awIDAQAB method: Method.post, data: { "tm": DateTime.now().millisecondsSinceEpoch, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } + /// 筛选数据 static Future> searchGetTaskSetps(int task_id) { return HttpManager().request( basePath, '/app/eightwork/getTaskSetps', method: Method.post, - data: { - "TASK_ID": task_id, - }, + data: {"TASK_ID": task_id}, ); } + /// 特殊作业筛选列表 - static Future> specialCheckListWorkCount(Map data, String url) { + static Future> specialCheckListWorkCount( + Map data, + String url, + ) { return HttpManager().request( basePath, url, method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - ...data + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + ...data, }, ); } + /// 动火删除 static Future> hotworkDelete(String hotworkId) { return HttpManager().request( @@ -676,28 +710,33 @@ U6Hzm1ninpWeE+awIDAQAB '/app/hotwork/delete', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - "HOTWORK_ID":hotworkId + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + "HOTWORK_ID": hotworkId, }, ); } + /// 八项作业流程图 - static Future> workGetFlowList(String workType,String hotworkId) { + static Future> workGetFlowList( + String workType, + String hotworkId, + ) { // 根据 workType 生成对应的字段名,比如 'hotwork' -> 'HOTWORK_ID' final idKey = '${workType.toUpperCase()}_ID'; return HttpManager().request( basePath, '/app/${workType}/getFlowList', method: Method.post, - data: { - idKey :hotworkId - }, + data: {idKey: hotworkId}, ); } /// 作业详情 - static Future> getHomeworkFindById(String workType, String hotworkId) { + static Future> getHomeworkFindById( + String workType, + String hotworkId, + ) { // 根据 workType 生成对应的字段名,比如 'hotwork' -> 'HOTWORK_ID' final idKey = '${workType.toUpperCase()}_ID'; return HttpManager().request( @@ -705,25 +744,28 @@ U6Hzm1ninpWeE+awIDAQAB '/app/${workType}/findById', method: Method.post, data: { - idKey:hotworkId, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + idKey: hotworkId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } + /// 提交作业 static Future> submitHomework(String url, Map data) { return HttpManager().request( basePath, url, method: Method.post, - data: { - ...data - }, + data: {...data}, ); } + /// 气体分析详情列表 - static Future> workGasList(String workType,String workId) { + static Future> workGasList( + String workType, + String workId, + ) { // 根据 workType 生成对应的字段名,比如 'hotwork' -> 'HOTWORK_ID' final idKey = '${workType.toUpperCase()}_ID'; return HttpManager().request( @@ -731,15 +773,19 @@ U6Hzm1ninpWeE+awIDAQAB '/app/${workType}/gas/list', method: Method.post, data: { - idKey:workId, + idKey: workId, "tm": DateTime.now().millisecondsSinceEpoch, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } + /// 气体分析详情列表删除 - static Future> workGasDelete(String workType,String workGasId) { + static Future> workGasDelete( + String workType, + String workGasId, + ) { // 根据 workType 生成对应的字段名,比如 'hotwork' -> 'HOTWORK_ID' final idKey = '${workType.toUpperCase()}GAS_ID'; return HttpManager().request( @@ -747,55 +793,64 @@ U6Hzm1ninpWeE+awIDAQAB '/app/$workType/gas/delete', method: Method.post, data: { - idKey:workGasId, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + idKey: workGasId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } + /// 所有签名列表 - static Future> listSignFinished(String workType,String hotworkId) { + static Future> listSignFinished( + String workType, + String hotworkId, + ) { // 根据 workType 生成对应的字段名,比如 'hotwork' -> 'HOTWORK_ID' final idKey = '${workType.toUpperCase()}_ID'; return HttpManager().request( basePath, '/app/${workType}/listSignFinished', method: Method.post, - data: { - idKey :hotworkId, - }, + data: {idKey: hotworkId}, ); } + /// 安全防护措施 - static Future> listSignFinishMeasures(String workType,String workId, - ) { + static Future> listSignFinishMeasures( + String workType, + String workId, + ) { // 根据 workType 生成对应的字段名,比如 'hotwork' -> 'HOTWORK_ID' final idKey = '${workType.toUpperCase()}_ID'; return HttpManager().request( basePath, '/app/$workType/listSignFinishMeasures', method: Method.post, - data: { - idKey: workId, - }, + data: {idKey: workId}, ); } /// 所有安全防护措施 - static Future> listSignFinishAllMeasures(String workType) { + static Future> listSignFinishAllMeasures( + String workType, + ) { final String tm = DateTime.now().millisecondsSinceEpoch.toString(); return HttpManager().request( basePath, '/app/$workType/listAllMeasures?tm=$tm', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } + /// 安全措施确认 - static Future> listSignSureAllMeasures(String workType,String homeWorkId) { + static Future> listSignSureAllMeasures( + String workType, + String homeWorkId, + ) { final String tm = DateTime.now().millisecondsSinceEpoch.toString(); // 根据 workType 生成对应的字段名,比如 'hotwork' -> 'HOTWORK_ID' final idKey = '${workType.toUpperCase()}_ID'; @@ -804,9 +859,9 @@ U6Hzm1ninpWeE+awIDAQAB '/app/$workType/listAllMeasuresForSign?tm=$tm', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, + "CORPINFO_ID": SessionService.instance.corpinfoId, idKey: homeWorkId, - "CONFIRM_ID":SessionService.instance.loginUserId, + "CONFIRM_ID": SessionService.instance.loginUserId, }, ); } @@ -817,22 +872,20 @@ U6Hzm1ninpWeE+awIDAQAB basePath, '/app/eightwork/startingList', method: Method.post, - data: { - ...data - }, + data: {...data}, ); } + /// 风险辨识结果 风险列表 static Future> getEightWorkInfo(Map data) { return HttpManager().request( basePath, '/app/eightwork/getInfo', method: Method.post, - data: { - ...data - }, + data: {...data}, ); } + /// 动火人及证书编号 static Future> getHotWorkNameList() { return HttpManager().request( @@ -841,50 +894,48 @@ U6Hzm1ninpWeE+awIDAQAB method: Method.post, data: { "tm": DateTime.now().millisecondsSinceEpoch, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } + /// 获取是摄像头列表 static Future> getVideomanagerList() { return HttpManager().request( basePath, '/app/videomanager/listAll', method: Method.post, - data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - }, + data: {"CORPINFO_ID": SessionService.instance.corpinfoId}, ); } + /// 获取承包商列表 static Future> getUnitListAll() { return HttpManager().request( basePath, - '/app/units/listAll', + '/app/units/listAll', method: Method.post, - data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - }, + data: {"CORPINFO_ID": SessionService.instance.corpinfoId}, ); } + /// 获取作业区域列表 static Future> getWorkAreaList() { return HttpManager().request( basePath, '/app/electronicFence/listTree', method: Method.post, - data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - }, + data: {"CORPINFO_ID": SessionService.instance.corpinfoId}, ); } /// 保存或作废气体检测 - static Future> saveGasTest(String workType, - Map formData, - List filePaths, - ) async { + static Future> saveGasTest( + String workType, + Map formData, + List filePaths, + ) async { // 复制一份 formData final data = Map.from(formData); @@ -902,12 +953,13 @@ U6Hzm1ninpWeE+awIDAQAB fromData: data, ); } + /// 保存安全措施确认 - static Future> saveSafeFunctionSure ( - String workType, - Map formData, - List filePaths, - ) async { + static Future> saveSafeFunctionSure( + String workType, + Map formData, + List filePaths, + ) async { // 复制一份 formData final data = Map.from(formData); @@ -927,11 +979,9 @@ U6Hzm1ninpWeE+awIDAQAB } /// 上传图片或视频 - static Future> uploadSaveFile ( - String filePath, - ) async { + static Future> uploadSaveFile(String filePath) async { final Map data = { - "CORPINFO_ID":SessionService.instance.corpinfoId, + "CORPINFO_ID": SessionService.instance.corpinfoId, }; // 把文件路径填成 MultipartFile final path = filePath; @@ -945,24 +995,24 @@ U6Hzm1ninpWeE+awIDAQAB fromData: data, ); } + ///删除图片 static Future> deleteSaveFile(String FILE_PATH) { return HttpManager().request( basePath, '/app/eightwork/deleteFile', method: Method.post, - data: { - "FILE_PATH": FILE_PATH, - }, + data: {"FILE_PATH": FILE_PATH}, ); } + /// 安全措施个项保存 - static Future> saveDangerousOptionsFile ( - List filePaths, - ) async { + static Future> saveDangerousOptionsFile( + List filePaths, + ) async { // 复制一份 formData final Map data = { - "CORPINFO_ID":SessionService.instance.corpinfoId, + "CORPINFO_ID": SessionService.instance.corpinfoId, }; // 把文件路径填成 MultipartFile for (var i = 0; i < filePaths.length; i++) { @@ -983,18 +1033,21 @@ U6Hzm1ninpWeE+awIDAQAB } /// 受限空间台账信息 - static Future> getLimitspaceMsssage(String LIMITSPACE_ID) { + static Future> getLimitspaceMsssage( + String LIMITSPACE_ID, + ) { return HttpManager().request( basePath, '/app/limitspace/goEdit', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - 'LIMITSPACE_ID' : LIMITSPACE_ID, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + 'LIMITSPACE_ID': LIMITSPACE_ID, }, ); } + /// 受限空间名称列表 static Future> getLimitspaceNameList() { final String tm = DateTime.now().millisecondsSinceEpoch.toString(); @@ -1003,24 +1056,28 @@ U6Hzm1ninpWeE+awIDAQAB '/app/limitspace/listAllSpace?tm=${tm}', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } + /// 受限空间气体分析详情 - static Future> getConfinedspacegaswh(String CONFINEDSPACE_ID) { + static Future> getConfinedspacegaswh( + String CONFINEDSPACE_ID, + ) { return HttpManager().request( basePath, '/app/confinedspacegaswh/goEdit', method: Method.post, data: { - "CONFINEDSPACE_ID" : CONFINEDSPACE_ID, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "CONFINEDSPACE_ID": CONFINEDSPACE_ID, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } + /// 受限空间气体提交 static Future> submitSpaceGas(String url, Map data) { return HttpManager().request( @@ -1028,9 +1085,9 @@ U6Hzm1ninpWeE+awIDAQAB url, method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - ...data + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + ...data, }, ); } @@ -1042,11 +1099,12 @@ U6Hzm1ninpWeE+awIDAQAB '/app/keyprojectcheck/keyProjectCount', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "loginUserId":SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "loginUserId": SessionService.instance.loginUserId, }, ); } + /// 重点工程筛选列表 static Future> getKeyProjectList(Map data, String url) { return HttpManager().request( @@ -1054,34 +1112,38 @@ U6Hzm1ninpWeE+awIDAQAB url, method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "UserId":SessionService.instance.loginUserId, - ...data + "CORPINFO_ID": SessionService.instance.corpinfoId, + "UserId": SessionService.instance.loginUserId, + ...data, }, ); } + /// 重点工程详情 - static Future> getKeyProjectDeatail(String OUTSOURCED_ID) { + static Future> getKeyProjectDeatail( + String OUTSOURCED_ID, + ) { return HttpManager().request( basePath, '/app/keyProjects/getOutsourced', method: Method.post, - data: { - "OUTSOURCED_ID":OUTSOURCED_ID, - - }, + data: {"OUTSOURCED_ID": OUTSOURCED_ID}, ); } + /// 工程开始结束 - static Future> sureKeyProjectState(String OUTSOURCED_ID, String State) { + static Future> sureKeyProjectState( + String OUTSOURCED_ID, + String State, + ) { return HttpManager().request( basePath, '/app/keyProjects/updateState', method: Method.post, data: { - "OUTSOURCED_ID":OUTSOURCED_ID, - 'OPERATOR' : SessionService.instance.loginUserId, - 'STATE':State + "OUTSOURCED_ID": OUTSOURCED_ID, + 'OPERATOR': SessionService.instance.loginUserId, + 'STATE': State, }, ); } @@ -1093,25 +1155,30 @@ U6Hzm1ninpWeE+awIDAQAB url, method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "UserId":SessionService.instance.loginUserId, - ...data + "CORPINFO_ID": SessionService.instance.corpinfoId, + "UserId": SessionService.instance.loginUserId, + ...data, }, ); } + /// 安全检查记录 - static Future> getSafeCheckReciordList(Map data, String url) { + static Future> getSafeCheckReciordList( + Map data, + String url, + ) { return HttpManager().request( basePath, url, method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "UserId":SessionService.instance.loginUserId, - ...data + "CORPINFO_ID": SessionService.instance.corpinfoId, + "UserId": SessionService.instance.loginUserId, + ...data, }, ); } + /// 安全检查发起 static Future> addSafeCheckRecord(String OUTSOURCED_ID) { return HttpManager().request( @@ -1119,35 +1186,41 @@ U6Hzm1ninpWeE+awIDAQAB '/app/keyProjects/goEdit', method: Method.post, data: { - "OUTSOURCED_ID":OUTSOURCED_ID, - "tm":DateTime.now().millisecondsSinceEpoch.toString(), + "OUTSOURCED_ID": OUTSOURCED_ID, + "tm": DateTime.now().millisecondsSinceEpoch.toString(), }, ); } + /// 安全检查 - static Future> getSafeCheckGoEdit(String KEYPROJECTCHECK_ID) { + static Future> getSafeCheckGoEdit( + String KEYPROJECTCHECK_ID, + ) { return HttpManager().request( basePath, '/app/keyprojectcheck/goEdit', method: Method.post, - data: { - "KEYPROJECTCHECK_ID":KEYPROJECTCHECK_ID, - }, + data: {"KEYPROJECTCHECK_ID": KEYPROJECTCHECK_ID}, ); } + /// 安全检查单位现场负责人列表 - static Future> getSafeCheckPersonList(String UNITS_ID, String NOMAIN) { + static Future> getSafeCheckPersonList( + String UNITS_ID, + String NOMAIN, + ) { return HttpManager().request( basePath, '/app/keyProjects/listAllPersonnel', method: Method.post, data: { - "UNITS_ID":UNITS_ID, - 'NOMAIN':NOMAIN, - "tm":DateTime.now().millisecondsSinceEpoch.toString(), + "UNITS_ID": UNITS_ID, + 'NOMAIN': NOMAIN, + "tm": DateTime.now().millisecondsSinceEpoch.toString(), }, ); } + /// 安全检查检查类型 static Future> getSafeCheckTypeList() { return HttpManager().request( @@ -1155,103 +1228,114 @@ U6Hzm1ninpWeE+awIDAQAB '/dictionaries/listSelectTreeByTkiTree?tm=${DateTime.now().millisecondsSinceEpoch.toString()}', method: Method.post, data: { - "DICTIONARIES_ID":'60e6481d96e44a5390ff5c347c4d1ffe', - "tm":DateTime.now().millisecondsSinceEpoch.toString(), + "DICTIONARIES_ID": '60e6481d96e44a5390ff5c347c4d1ffe', + "tm": DateTime.now().millisecondsSinceEpoch.toString(), }, ); } + /// 安全检查被检查单位 - static Future> getSafeCheckToUnitList(String OUTSOURCED_ID) { + static Future> getSafeCheckToUnitList( + String OUTSOURCED_ID, + ) { return HttpManager().request( basePath, '/app/keyProjects/listAllUnits', method: Method.post, data: { "CORPINFO_ID": SessionService.instance.corpinfoId, - "OUTSOURCED_ID":OUTSOURCED_ID, + "OUTSOURCED_ID": OUTSOURCED_ID, }, ); } + /// 安全检查发起提交 static Future> safeCheckPunishSubmit(Map data) { return HttpManager().request( basePath, '/app/keyprojectpunish/add', method: Method.post, - data: { - ...data - }, + data: {...data}, ); } + /// 安全检查发起提交 static Future> safeKeyprojectCheckSubmit(Map data) { return HttpManager().request( basePath, '/app/keyprojectcheck/add', method: Method.post, - data: { - ...data - }, + data: {...data}, ); } + /// 重点工程隐患管理列表 - static Future> getKeyprojectDangerList(String url, Map data) { + static Future> getKeyprojectDangerList( + String url, + Map data, + ) { return HttpManager().request( basePath, url, method: Method.post, - data: { - ...data - }, + data: {...data}, ); } + /// 重点工程隐患详情 - static Future> getKeyprojectDangerFindHidden(String HIDDEN_ID, String OUTSOURCED_ID) { + static Future> getKeyprojectDangerFindHidden( + String HIDDEN_ID, + String OUTSOURCED_ID, + ) { return HttpManager().request( basePath, '/app/keyprojectcheck/findHidden', method: Method.post, - data: { - 'HIDDEN_ID':HIDDEN_ID, - 'OUTSOURCED_ID':OUTSOURCED_ID - }, + data: {'HIDDEN_ID': HIDDEN_ID, 'OUTSOURCED_ID': OUTSOURCED_ID}, ); } + /// 重点工程隐患验收 - static Future> checkKeyprojectDanger(String HIDDEN_ID, Map data) { + static Future> checkKeyprojectDanger( + String HIDDEN_ID, + Map data, + ) { return HttpManager().request( basePath, '/app/keyprojectcheck/check', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "CREATOR":SessionService.instance.loginUserId, - "OPERATOR":SessionService.instance.loginUserId, - 'HIDDEN_ID':HIDDEN_ID, - ...data + "CORPINFO_ID": SessionService.instance.corpinfoId, + "CREATOR": SessionService.instance.loginUserId, + "OPERATOR": SessionService.instance.loginUserId, + 'HIDDEN_ID': HIDDEN_ID, + ...data, }, ); } /// 上传图片 - static Future> addNormalImgFiles(String imagePath, Map data) async { + static Future> addNormalImgFiles( + String imagePath, + Map data, + ) async { final file = File(imagePath); if (!await file.exists()) { throw ApiException('file_not_found', '图片不存在:$imagePath'); } final fileName = file.path.split(Platform.pathSeparator).last; return HttpManager().uploadFaceImage( - baseUrl: basePath, - path: '/app/imgfiles/add', - fromData: { - ...data, - 'FFILE': await MultipartFile.fromFile( - file.path, - filename: fileName - ), - } + baseUrl: basePath, + path: '/app/imgfiles/add', + fromData: { + ...data, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), + }, ); } + /// 重点工程处罚 static Future> keyprojectpunishAdd(Map data) { return HttpManager().request( @@ -1259,23 +1343,27 @@ U6Hzm1ninpWeE+awIDAQAB '/app/keyprojectpunish/add', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "CREATOR":SessionService.instance.loginUserId, - "OPERATOR":SessionService.instance.loginUserId, - ...data + "CORPINFO_ID": SessionService.instance.corpinfoId, + "CREATOR": SessionService.instance.loginUserId, + "OPERATOR": SessionService.instance.loginUserId, + ...data, }, ); } + /// 重点工程处罚修改隐患 - static Future> keyprojectPunishEdit(Map data, String ISPUNISH) { + static Future> keyprojectPunishEdit( + Map data, + String ISPUNISH, + ) { return HttpManager().request( basePath, '/app/keyprojectcheck/editHiddenIspunish', method: Method.post, data: { - "ISPUNISH":ISPUNISH, - "PUNISH_PERSON":SessionService.instance.loginUserId, - ...data + "ISPUNISH": ISPUNISH, + "PUNISH_PERSON": SessionService.instance.loginUserId, + ...data, }, ); } @@ -1287,7 +1375,7 @@ U6Hzm1ninpWeE+awIDAQAB '/app/safetyenvironmental/countCheck', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, + "CORPINFO_ID": SessionService.instance.corpinfoId, 'INSPECTION_USER_ID': SessionService.instance.loginUserId, 'INSPECTED_SITEUSER_ID': SessionService.instance.loginUserId, 'INSPECTION_ORIGINATOR_ID': SessionService.instance.loginUserId, @@ -1295,168 +1383,173 @@ U6Hzm1ninpWeE+awIDAQAB }, ); } + /// 安全检查流程图 static Future> safeCheckFlowList(String ID) { return HttpManager().request( basePath, '/app/safetyenvironmental/showFlowChart', method: Method.post, - data: { - 'ID' :ID - }, + data: {'ID': ID}, ); } + /// 所以安全检查列表 - static Future> getSafeCheckSearchList(Map data, String url) { + static Future> getSafeCheckSearchList( + Map data, + String url, + ) { return HttpManager().request( basePath, url, method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "loginUserId":SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "loginUserId": SessionService.instance.loginUserId, 'tm': DateTime.now().millisecondsSinceEpoch.toString(), - 'roleLevel' : SessionService.instance.loginUser?['roleLevel'] ?? '', - 'supDeparIds' : SessionService.instance.loginUser?['supDeparIds'] ?? '', + 'roleLevel': SessionService.instance.loginUser?['roleLevel'] ?? '', + 'supDeparIds': SessionService.instance.loginUser?['supDeparIds'] ?? '', - ...data + ...data, }, ); } + // 安全检查列表详情 - static Future> getSafeCheckStartGoEdit(String INSPECTION_ID) { + static Future> getSafeCheckStartGoEdit( + String INSPECTION_ID, + ) { return HttpManager().request( basePath, '/app/safetyenvironmental/goEdit', method: Method.post, - data: { - "INSPECTION_ID":INSPECTION_ID, - }, + data: {"INSPECTION_ID": INSPECTION_ID}, ); } + // 安全检查确认列表 - static Future> getSafeCheckSureList(String INSPECTION_ID) { + static Future> getSafeCheckSureList( + String INSPECTION_ID, + ) { return HttpManager().request( basePath, '/app/safetyenvironmental/goShow', method: Method.post, - data: { - "INSPECTION_ID":INSPECTION_ID, - }, + data: {"INSPECTION_ID": INSPECTION_ID}, ); } + // 安全检查操作 static Future> SafeCheckStartGoEditMsg( - String imagePath, - String msg, - Map data - ) async { - - Map formData = { - ...data, - }; + String imagePath, + String msg, + Map data, + ) async { + Map formData = {...data}; if (imagePath.isNotEmpty) { final file = File(imagePath); if (!await file.exists()) { throw ApiException('file_not_found', '图片不存在:$imagePath'); } final fileName = file.path.split(Platform.pathSeparator).last; - formData['FFILE'] = - await MultipartFile.fromFile(file.path, filename: fileName); + formData['FFILE'] = await MultipartFile.fromFile( + file.path, + filename: fileName, + ); return HttpManager().uploadFaceImage( baseUrl: basePath, path: '/app/safetyenvironmental/$msg', fromData: formData, ); - }else { + } else { return HttpManager().request( basePath, '/app/safetyenvironmental/$msg', data: formData, ); } - } + // 安全检查核实 - static Future> getSafePersonCheck(Map formData, String imagePath) async { + static Future> getSafePersonCheck( + Map formData, + String imagePath, + ) async { final file = File(imagePath); if (!await file.exists()) { throw ApiException('file_not_found', '图片不存在:$imagePath'); } - final fileName = file.path - .split(Platform.pathSeparator) - .last; + final fileName = file.path.split(Platform.pathSeparator).last; return HttpManager().uploadFaceImage( - baseUrl: basePath, - path: '/app/safetyenvironmentalinspector/verify', - fromData: { - ...formData, - 'FFILE': await MultipartFile.fromFile( - file.path, - filename: fileName - ), - } + baseUrl: basePath, + path: '/app/safetyenvironmentalinspector/verify', + fromData: { + ...formData, + 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), + }, ); } + // 安全检查确认 - static Future> getSafePersonSignSure(Map formData, String imagePath) async { + static Future> getSafePersonSignSure( + Map formData, + String imagePath, + ) async { final file = File(imagePath); if (!await file.exists()) { throw ApiException('file_not_found', '图片不存在:$imagePath'); } - final fileName = file.path - .split(Platform.pathSeparator) - .last; + final fileName = file.path.split(Platform.pathSeparator).last; return HttpManager().uploadFaceImage( - baseUrl: basePath, - path: '/app/safetyenvironmentalexplain/add', - fromData: { - ...formData, - 'FFILE': await MultipartFile.fromFile( - file.path, - filename: fileName - ), - } + baseUrl: basePath, + path: '/app/safetyenvironmentalexplain/add', + fromData: { + ...formData, + 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), + }, ); } + // 安全检查隐患指派列表 - static Future> getSafeCheckDangerList(String INSPECTION_ID) { + static Future> getSafeCheckDangerList( + String INSPECTION_ID, + ) { return HttpManager().request( basePath, '/app/hidden/listForSafetyEnvironmental', method: Method.post, data: { - "INSPECTION_ID":INSPECTION_ID, + "INSPECTION_ID": INSPECTION_ID, 'INSPECTION_STATUS': '3-7', 'tm': DateTime.now().millisecondsSinceEpoch.toString(), - 'KEYWORDS' : '' + 'KEYWORDS': '', }, ); } + // 安全检查申辩不成立理由提交 - static Future> safeCheckDefendSubmit(Map formData, String imagePath) async { + static Future> safeCheckDefendSubmit( + Map formData, + String imagePath, + ) async { final file = File(imagePath); if (!await file.exists()) { throw ApiException('file_not_found', '图片不存在:$imagePath'); } - final fileName = file.path - .split(Platform.pathSeparator) - .last; + final fileName = file.path.split(Platform.pathSeparator).last; return HttpManager().uploadFaceImage( - baseUrl: basePath, - path: '/app/safetyenvironmental/explain', - fromData: { - ...formData, - 'FFILE': await MultipartFile.fromFile( - file.path, - filename: fileName - ), - } + baseUrl: basePath, + path: '/app/safetyenvironmental/explain', + fromData: { + ...formData, + 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), + }, ); } + // 安全检查隐患指派 static Future> safeCheckDangerConfirm(Map data) { return HttpManager().request( @@ -1465,75 +1558,76 @@ U6Hzm1ninpWeE+awIDAQAB method: Method.post, data: { ...data, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - "OPERATOR" :SessionService.instance.loginUserId, - "NAME":SessionService.instance.loginUser?["USERNAME"]??"", - "USERNAME": SessionService.instance.loginUser?["USERNAME"]??"", - + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + "OPERATOR": SessionService.instance.loginUserId, + "NAME": SessionService.instance.loginUser?["USERNAME"] ?? "", + "USERNAME": SessionService.instance.loginUser?["USERNAME"] ?? "", }, ); } + // 安全检查申辩记录 - static Future> safeCheckDefendRecordList(String INSPECTION_ID) { + static Future> safeCheckDefendRecordList( + String INSPECTION_ID, + ) { return HttpManager().request( basePath, '/app/safetyenvironmental/getExplain', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "INSPECTION_ORIGINATOR_ID":SessionService.instance.loginUserId, - "INSPECTION_ID" :INSPECTION_ID, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "INSPECTION_ORIGINATOR_ID": SessionService.instance.loginUserId, + "INSPECTION_ID": INSPECTION_ID, 'tm': DateTime.now().millisecondsSinceEpoch.toString(), }, ); } - - - ///TODO -------------–-------------------- 我的 -------------–-------------------- /// 问题反馈 - static Future> setFeedBack(String backTitle,String backContent,String backType,String imgPaths) { + static Future> setFeedBack( + String backTitle, + String backContent, + String backType, + String imgPaths, + ) { return HttpManager().request( basePath, '/app/feedback/add', method: Method.post, data: { - "FEEDBACK_TITLE":backTitle, - "FEEDBACK_CONTENT":backContent, - "FEEDBACK_TYPE":backType, - "FEEDBACK_IMG" :imgPaths, - "loginUserId":SessionService.instance.loginUserId, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "FEEDBACK_TITLE": backTitle, + "FEEDBACK_CONTENT": backContent, + "FEEDBACK_TYPE": backType, + "FEEDBACK_IMG": imgPaths, + "loginUserId": SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } + /// 更新签字信息 - static Future> refreshSignInfo(String imagePath) async{ + static Future> refreshSignInfo(String imagePath) async { final file = File(imagePath); if (!await file.exists()) { - throw ApiException('file_not_found', '图片不存在:$imagePath'); + throw ApiException('file_not_found', '图片不存在:$imagePath'); } final fileName = file.path.split(Platform.pathSeparator).last; return HttpManager().uploadFaceImage( - baseUrl: basePath, - path: '/app/user/updateUserSign', - fromData: { - 'CORPINFO_ID': SessionService.instance.corpinfoId, - 'USER_ID': SessionService.instance.loginUserId, - 'FFILE': await MultipartFile.fromFile( - file.path, - filename: fileName - ), - } + baseUrl: basePath, + path: '/app/user/updateUserSign', + fromData: { + 'CORPINFO_ID': SessionService.instance.corpinfoId, + 'USER_ID': SessionService.instance.loginUserId, + 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), + }, ); } - /// 问题反馈图片 static Future> reloadFeedBack(String imagePath) async { final file = File(imagePath); @@ -1543,41 +1637,39 @@ U6Hzm1ninpWeE+awIDAQAB final fileName = file.path.split(Platform.pathSeparator).last; return HttpManager().uploadFaceImage( - baseUrl: basePath, - path: '/app/feedback/upload', - fromData: { - "corpUserId":"", - 'CORPINFO_ID': SessionService.instance.corpinfoId, - 'USER_ID': SessionService.instance.loginUserId, - 'FFILE': await MultipartFile.fromFile( - file.path, - filename: fileName - ), - } + baseUrl: basePath, + path: '/app/feedback/upload', + fromData: { + "corpUserId": "", + 'CORPINFO_ID': SessionService.instance.corpinfoId, + 'USER_ID': SessionService.instance.loginUserId, + 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), + }, ); } /// 隐患整改图片上传 - static Future> addImgFiles(String imagePath,String type,String id) async { + static Future> addImgFiles( + String imagePath, + String type, + String id, + ) async { final file = File(imagePath); if (!await file.exists()) { throw ApiException('file_not_found', '图片不存在:$imagePath'); } final fileName = file.path.split(Platform.pathSeparator).last; return HttpManager().uploadFaceImage( - baseUrl: basePath, - path: '/app/imgfiles/add', - fromData: { - 'FOREIGN_KEY': id, - 'TYPE': type, - "corpUserId":"", - 'CORPINFO_ID': SessionService.instance.corpinfoId, - 'USER_ID': SessionService.instance.loginUserId, - 'FFILE': await MultipartFile.fromFile( - file.path, - filename: fileName - ), - } + baseUrl: basePath, + path: '/app/imgfiles/add', + fromData: { + 'FOREIGN_KEY': id, + 'TYPE': type, + "corpUserId": "", + 'CORPINFO_ID': SessionService.instance.corpinfoId, + 'USER_ID': SessionService.instance.loginUserId, + 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), + }, ); } @@ -1589,88 +1681,97 @@ U6Hzm1ninpWeE+awIDAQAB } final fileName = file.path.split(Platform.pathSeparator).last; return HttpManager().uploadFaceImage( - baseUrl: basePath, - path: '/app/hidden/identifyImg', - fromData: { - 'CORPINFO_ID': SessionService.instance.corpinfoId, - 'USER_ID': SessionService.instance.loginUserId, - 'FFILE': await MultipartFile.fromFile( - file.path, - filename: fileName - ), - } + baseUrl: basePath, + path: '/app/hidden/identifyImg', + fromData: { + 'CORPINFO_ID': SessionService.instance.corpinfoId, + 'USER_ID': SessionService.instance.loginUserId, + 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), + }, ); } - /// 修改密码 - static Future> changePassWord(String oldPwd,String confirmPwd) { + static Future> changePassWord( + String oldPwd, + String confirmPwd, + ) { return HttpManager().request( basePath, '/app/user/editUserPwd', method: Method.post, data: { - "USERNAME": SessionService.instance.loginUser?["USERNAME"]??"", + "USERNAME": SessionService.instance.loginUser?["USERNAME"] ?? "", "PASSWORD": oldPwd, "NOWPASSWORD": confirmPwd, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } /// 获取离岗管理列表 - static Future> getDutyManagement(int showCount, int currentPage) { + static Future> getDutyManagement( + int showCount, + int currentPage, + ) { return HttpManager().request( basePath, '/app/offduty/list?showCount=$showCount¤tPage=$currentPage', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, // ISMAIN:loginUser.ISMAIN, // ISSUPERVISE:loginUser.ISSUPERVISE, - "DEPARTMENT_ID":SessionService.instance.deptId, - "TYPE": 'edit' + "DEPARTMENT_ID": SessionService.instance.deptId, + "TYPE": 'edit', }, ); } /// 通知列表 - static Future> getNotifList(String showCount, String currentPage,String keyWord) { + static Future> getNotifList( + String showCount, + String currentPage, + String keyWord, + ) { return HttpManager().request( basePath, '/app/notice/list', method: Method.post, data: { - "showCount" : showCount, - "currentPage" : currentPage, - "KEYWORDS":keyWord, - "corpinfoId" :SessionService.instance.corpinfoId, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "showCount": showCount, + "currentPage": currentPage, + "KEYWORDS": keyWord, + "corpinfoId": SessionService.instance.corpinfoId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } /// 通知列表-企业 - static Future> getNotifEnterprise(String showCount, String currentPage,String keyWord) { + static Future> getNotifEnterprise( + String showCount, + String currentPage, + String keyWord, + ) { return HttpManager().request( basePath, '/app/notice/listForCp', method: Method.post, data: { - "showCount" : showCount, - "currentPage" : currentPage, - "KEYWORDS":keyWord, - "loginUserId" :SessionService.instance.loginUserId, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "showCount": showCount, + "currentPage": currentPage, + "KEYWORDS": keyWord, + "loginUserId": SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } - /// 通知详情 static Future> getNotifDetail(String id) { return HttpManager().request( @@ -1678,12 +1779,12 @@ U6Hzm1ninpWeE+awIDAQAB '/app/notice/goEdit', method: Method.post, data: { - "NOTICECORPUSERID_ID":id, - "loginUserId":SessionService.instance.loginUserId, - "corpinfoId":SessionService.instance.corpinfoId, - "ISMAIN":"0", - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "NOTICECORPUSERID_ID": id, + "loginUserId": SessionService.instance.loginUserId, + "corpinfoId": SessionService.instance.corpinfoId, + "ISMAIN": "0", + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } @@ -1695,17 +1796,21 @@ U6Hzm1ninpWeE+awIDAQAB '/app/notice/goEditForPc', method: Method.post, data: { - "NOTICECORPUSERID_ID":id, - "loginUserId":SessionService.instance.loginUserId, - "corpinfoId":SessionService.instance.corpinfoId, - "ISMAIN":"0", - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "NOTICECORPUSERID_ID": id, + "loginUserId": SessionService.instance.loginUserId, + "corpinfoId": SessionService.instance.corpinfoId, + "ISMAIN": "0", + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } + /// 更新人脸信息 - static Future> reloadMyFace(String imagePath, String studentId) async { + static Future> reloadMyFace( + String imagePath, + String studentId, + ) async { final file = File(imagePath); if (!await file.exists()) { throw ApiException('file_not_found', '图片不存在:$imagePath'); @@ -1713,16 +1818,13 @@ U6Hzm1ninpWeE+awIDAQAB final fileName = file.path.split(Platform.pathSeparator).last; return HttpManager().uploadFaceImage( - baseUrl: basePath, - path: '/app/user/editUserFaceV2', - fromData: { - 'CORPINFO_ID': SessionService.instance.corpinfoId, - 'USER_ID': SessionService.instance.loginUserId, - 'FFILE': await MultipartFile.fromFile( - file.path, - filename: fileName - ), - } + baseUrl: basePath, + path: '/app/user/editUserFaceV2', + fromData: { + 'CORPINFO_ID': SessionService.instance.corpinfoId, + 'USER_ID': SessionService.instance.loginUserId, + 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), + }, ); } @@ -1732,15 +1834,16 @@ U6Hzm1ninpWeE+awIDAQAB basePath, '/app/notice/delete', method: Method.post, - data: { - "NOTICECORPUSERID_ID":id, - }, + data: {"NOTICECORPUSERID_ID": id}, ); } /// 获取AI预警列表 - static Future> getAiAlarmList(String showCount, String currentPage,String keyWord) { - + static Future> getAiAlarmList( + String showCount, + String currentPage, + String keyWord, + ) { return HttpManager().request( basePath, '/app/aiwarning/list?showCount=$showCount¤tPage=$currentPage', @@ -1748,21 +1851,24 @@ U6Hzm1ninpWeE+awIDAQAB data: { "tm": DateTime.now().millisecondsSinceEpoch, "KEYWORDS": keyWord, //关键字模糊查询 - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } - /// 离岗申请 - static Future> submitApplicationLeaving(String startTime, String endTime,String text) { + static Future> submitApplicationLeaving( + String startTime, + String endTime, + String text, + ) { return HttpManager().request( basePath, '/app/offduty/add', method: Method.post, data: { - "OFFDUTY_ID":"", + "OFFDUTY_ID": "", "STARTTIME": startTime, "ENDTIME": endTime, "DESCR": text, @@ -1776,66 +1882,82 @@ U6Hzm1ninpWeE+awIDAQAB } /// 离岗审批 - static Future> dutyApproval(String type, String text,String itemNum) { + static Future> dutyApproval( + String type, + String text, + String itemNum, + ) { return HttpManager().request( basePath, '/app/offduty/review', method: Method.post, data: { - "OFFDUTY_ID":itemNum, - "REVIEW_STATUS":type, - "REVIEW_DESC":text, - "OPERATOR":SessionService.instance.loginUserId + "OFFDUTY_ID": itemNum, + "REVIEW_STATUS": type, + "REVIEW_DESC": text, + "OPERATOR": SessionService.instance.loginUserId, }, ); } /// 离岗取消 - static Future> dutyReturned(String type, String text,String itemNum) { + static Future> dutyReturned( + String type, + String text, + String itemNum, + ) { return HttpManager().request( basePath, '/app/offduty/cancel', method: Method.post, data: { - "OFFDUTY_ID":itemNum, - "REVIEW_STATUS":type, - "REVIEW_DESC":text, - "OPERATOR":SessionService.instance.loginUserId + "OFFDUTY_ID": itemNum, + "REVIEW_STATUS": type, + "REVIEW_DESC": text, + "OPERATOR": SessionService.instance.loginUserId, }, ); } - /// 获取离岗记录列表 - static Future> getDepartureRecordList(int showCount, int currentPage) { - + static Future> getDepartureRecordList( + int showCount, + int currentPage, + ) { return HttpManager().request( basePath, '/app/offduty/list?showCount=$showCount¤tPage=$currentPage', method: Method.post, data: { "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - "ISMAIN":0, - "ISSUPERVISE":0, + "USER_ID": SessionService.instance.loginUserId, + "ISMAIN": 0, + "ISSUPERVISE": 0, "DEPARTMENT_ID": SessionService.instance.corpinfoId, - "TYPE": 'show' + "TYPE": 'show', }, ); } - - /// 获取隐患治理列表 - static Future> getHiddenTreatmentList(int type, int currentPage, - String startDate,String endDate,String level,String riskStandard,String state, - String departmentId,String correctiveDepartment,String isIndex,String keyWord) { + static Future> getHiddenTreatmentList( + int type, + int currentPage, + String startDate, + String endDate, + String level, + String riskStandard, + String state, + String departmentId, + String correctiveDepartment, + String isIndex, + String keyWord, + ) { return HttpManager().request( basePath, '/app/hidden/listRiskStandard', method: Method.post, data: { - //隐患记录 "STARTTIME": startDate, "ENDTIME": endDate, @@ -1907,13 +2029,15 @@ U6Hzm1ninpWeE+awIDAQAB } /// 获取部门负责人列表 - static Future> getListTreePersonList(String DEPARTMENT_ID) { + static Future> getListTreePersonList( + String DEPARTMENT_ID, + ) { return HttpManager().request( basePath, '/app/sys/listUser', method: Method.post, data: { - "tm":DateTime.now().millisecondsSinceEpoch.toString(), + "tm": DateTime.now().millisecondsSinceEpoch.toString(), "DEPARTMENT_ID": DEPARTMENT_ID, "CORPINFO_ID": SessionService.instance.corpinfoId, "USER_ID": SessionService.instance.loginUserId, @@ -1921,7 +2045,6 @@ U6Hzm1ninpWeE+awIDAQAB ); } - /// 获取隐患记录详情 static Future> getDangerDetail(String id) { return HttpManager().request( @@ -1963,7 +2086,6 @@ U6Hzm1ninpWeE+awIDAQAB ); } - /// 获取本日工作提醒 static Future> getAnPai() { return HttpManager().request( @@ -1971,10 +2093,10 @@ U6Hzm1ninpWeE+awIDAQAB '/app/listmanager/checkListIndex', method: Method.post, data: { - "tm":DateTime.now().millisecondsSinceEpoch.toString(), - "DEPARTMENT_ID":SessionService.instance.corpinfoId, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "tm": DateTime.now().millisecondsSinceEpoch.toString(), + "DEPARTMENT_ID": SessionService.instance.corpinfoId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } @@ -1987,35 +2109,45 @@ U6Hzm1ninpWeE+awIDAQAB method: Method.post, data: { "CDATA": data, - "USERNAME": SessionService.instance.loginUser?["USERNAME"]??"", - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "USERNAME": SessionService.instance.loginUser?["USERNAME"] ?? "", + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } /// 增加本日日程安排 - static Future> addRiCheng(String data,String title, String content,String id,String urlPath) { + static Future> addRiCheng( + String data, + String title, + String content, + String id, + String urlPath, + ) { return HttpManager().request( basePath, '/app/schedule/$urlPath', method: Method.post, data: { "CDATA": data, - "USERNAME":SessionService.instance.loginUser?["USERNAME"]??"", - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "USERNAME": SessionService.instance.loginUser?["USERNAME"] ?? "", + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, "SCHEDULE_ID": id, "TITLE": title, - "FHDESC":content, + "FHDESC": content, }, ); } - /// 获取风险分布列表 - static Future> getRiskRecordList(int currentPage, - String riskId,String dept,String level,String keyWord) { + static Future> getRiskRecordList( + int currentPage, + String riskId, + String dept, + String level, + String keyWord, + ) { return HttpManager().request( basePath, '/app/riskpoint/list?showCount=-1¤tPage=$currentPage', @@ -2040,25 +2172,28 @@ U6Hzm1ninpWeE+awIDAQAB method: Method.post, data: { "CHECK_IDENTIFICATION_ID": id, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } /// 获取风险分布详情提交坐标 - static Future> addCoordinate(String id,String longitude,String latitude) { + static Future> addCoordinate( + String id, + String longitude, + String latitude, + ) { return HttpManager().request( basePath, '/app/riskpoint/editLonAndLat', method: Method.post, data: { "IDENTIFICATIONPARTS_ID": id, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - "LONGITUDE" : longitude, - "LATITUDE" : latitude, - + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + "LONGITUDE": longitude, + "LATITUDE": latitude, }, ); } @@ -2083,9 +2218,9 @@ U6Hzm1ninpWeE+awIDAQAB '/app/mfolderStipulate/appListTree', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - "KEYWORDS":keyWord, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + "KEYWORDS": keyWord, "SHARE": "yes", }, ); @@ -2098,17 +2233,20 @@ U6Hzm1ninpWeE+awIDAQAB '/app/mfolderStipulate/listByParentId', method: Method.post, data: { - "PARENT_ID":id, - "TYPE":2, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "PARENT_ID": id, + "TYPE": 2, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } - /// 提交隐患整改 - static Future> rectificationSubmission(String id,String buMenId,String renYuanId) { + static Future> rectificationSubmission( + String id, + String buMenId, + String renYuanId, + ) { return HttpManager().request( basePath, '/app/hidden/editRec', @@ -2124,7 +2262,11 @@ U6Hzm1ninpWeE+awIDAQAB } /// 提交隐患整改 - static Future> rectificationSubmissionTwo(String id,String buMenId,String renYuanId) { + static Future> rectificationSubmissionTwo( + String id, + String buMenId, + String renYuanId, + ) { return HttpManager().request( basePath, '/app/customHidden/editRec', @@ -2139,14 +2281,25 @@ U6Hzm1ninpWeE+awIDAQAB ); } - /// 提交隐患整改 static Future> normalRectificationSubmission( - String dataTime,String miaoShu,String acceptedPrepareType,String acceptedPlanType, - String id,String caertTime,String listName, - String standard,String method,String fund,String person, - String workTime,String time,String work,String other,String json) { - + String dataTime, + String miaoShu, + String acceptedPrepareType, + String acceptedPlanType, + String id, + String caertTime, + String listName, + String standard, + String method, + String fund, + String person, + String workTime, + String time, + String work, + String other, + String json, + ) { // print("============>"+ dataTime+ miaoShu+ acceptedPrepareType+ acceptedPlanType+ // id+ caertTime+ listName+ standard+ method+ fund+ person+ // workTime+ time+ work+ other+ json); @@ -2156,7 +2309,6 @@ U6Hzm1ninpWeE+awIDAQAB '/app/hidden/rectify', method: Method.post, data: { - "RECTIFICATIONTIME": dataTime, "RECTIFYDESCR": miaoShu, "HAVESCHEME": acceptedPrepareType, @@ -2183,11 +2335,23 @@ U6Hzm1ninpWeE+awIDAQAB /// 提交隐患整改 static Future> normalRectificationSubmissionTwo( - String dataTime,String miaoShu,String acceptedPrepareType,String acceptedPlanType, - String id,String caertTime,String listName, - String standard,String method,String fund,String person, - String workTime,String time,String work,String other,String json) { - + String dataTime, + String miaoShu, + String acceptedPrepareType, + String acceptedPlanType, + String id, + String caertTime, + String listName, + String standard, + String method, + String fund, + String person, + String workTime, + String time, + String work, + String other, + String json, + ) { // print("============>"+ dataTime+ miaoShu+ acceptedPrepareType+ acceptedPlanType+ // id+ caertTime+ listName+ standard+ method+ fund+ person+ // workTime+ time+ work+ other+ json); @@ -2197,7 +2361,6 @@ U6Hzm1ninpWeE+awIDAQAB '/app/customHidden/rectify', method: Method.post, data: { - "RECTIFICATIONTIME": dataTime, "RECTIFYDESCR": miaoShu, "HAVESCHEME": acceptedPrepareType, @@ -2222,7 +2385,6 @@ U6Hzm1ninpWeE+awIDAQAB ); } - /// 获取隐患级别 static Future> getHazardLevel() { return HttpManager().request( @@ -2239,15 +2401,30 @@ U6Hzm1ninpWeE+awIDAQAB /// 上传隐患快报 static Future> addRiskListCheckApp( - String hazardDescription,String partDescription,String latitude,String longitude, - String dangerDetail,String dataTime,String type,String responsibleId, - String yinHuanTypeIds,String hazardLeve,String buMenId,String buMenPDId, - String yinHuanTypeNames,String hiddenType1,String hiddenType2,String hiddenType3,) { + String hazardDescription, + String partDescription, + String latitude, + String longitude, + String dangerDetail, + String dataTime, + String type, + String responsibleId, + String yinHuanTypeIds, + String hazardLeve, + String buMenId, + String buMenPDId, + String yinHuanTypeNames, + String hiddenType1, + String hiddenType2, + String hiddenType3, + Map data, + ) { return HttpManager().request( basePath, '/app/hidden/riskListCheckAppAdd', method: Method.post, data: { + ...data, "HIDDEN_ID": "", "SOURCE": '1', "HIDDENDESCR": hazardDescription, @@ -2261,15 +2438,15 @@ U6Hzm1ninpWeE+awIDAQAB "RECTIFICATIONOR": responsibleId, "HIDDENTYPE": yinHuanTypeIds, - "HIDDENLEVEL":hazardLeve, + "HIDDENLEVEL": hazardLeve, "RECTIFICATIONDEPT": buMenId, - "HIDDENFINDDEPT": buMenPDId.isNotEmpty?buMenPDId:buMenId, + "HIDDENFINDDEPT": buMenPDId.isNotEmpty ? buMenPDId : buMenId, "CREATOR": SessionService.instance.loginUserId, "HIDDENTYPE_NAME": yinHuanTypeNames, - "HIDDENTYPE1": hiddenType1 , - "HIDDENTYPE2": hiddenType2 , - "HIDDENTYPE3": hiddenType3 , + "HIDDENTYPE1": hiddenType1, + "HIDDENTYPE2": hiddenType2, + "HIDDENTYPE3": hiddenType3, "CORPINFO_ID": SessionService.instance.corpinfoId, "USER_ID": SessionService.instance.loginUserId, }, @@ -2277,27 +2454,40 @@ U6Hzm1ninpWeE+awIDAQAB } /// 提交隐患验收接口 - static Future> addHazardAcceptance(String type,String miaoshu,String dataTime,String id) { + static Future> addHazardAcceptance( + String type, + String miaoshu, + String dataTime, + String id, + ) { return HttpManager().request( basePath, '/app/hidden/riskListCheckInspection', method: Method.post, - data: { - "ISQUALIFIED": type, - "CHECKDESCR": miaoshu, - "CHECK_TIME": dataTime, - "HIDDEN_ID": id, - "CHECKOR": SessionService.instance.loginUserId, - "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, - }, + data: { + "ISQUALIFIED": type, + "CHECKDESCR": miaoshu, + "CHECK_TIME": dataTime, + "HIDDEN_ID": id, + "CHECKOR": SessionService.instance.loginUserId, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, ); } /// 隐患检查列表 static Future> getHazardInspectionRecordList( - int currentPage,String keyWord,String id,String dept, - String starDate,String endDate,String periodId,String userName,String typeId,) { + int currentPage, + String keyWord, + String id, + String dept, + String starDate, + String endDate, + String periodId, + String userName, + String typeId, + ) { return HttpManager().request( basePath, '/app/listmanager/recordList?showCount=-1¤tPage=$currentPage', @@ -2310,7 +2500,7 @@ U6Hzm1ninpWeE+awIDAQAB "PERIOD": periodId, "USERNAME": userName, "TYPE": typeId, - "tm": DateTime.now().millisecondsSinceEpoch.toString(), + "tm": DateTime.now().millisecondsSinceEpoch.toString(), "KEYWORDS": keyWord, //关键字模糊查询 "CORPINFO_ID": SessionService.instance.corpinfoId, "USER_ID": SessionService.instance.loginUserId, @@ -2320,8 +2510,16 @@ U6Hzm1ninpWeE+awIDAQAB /// 标准排查列表 static Future> getStandardInvestigationRecordList( - int currentPage,String keyWord,String id,String dept, - String starDate,String endDate,String periodId,String userName,String typeId,) { + int currentPage, + String keyWord, + String id, + String dept, + String starDate, + String endDate, + String periodId, + String userName, + String typeId, + ) { return HttpManager().request( basePath, '/app/hiddenDangerCheckStandardCustom/recordList?showCount=-1¤tPage=$currentPage', @@ -2334,7 +2532,7 @@ U6Hzm1ninpWeE+awIDAQAB "PERIOD": periodId, "USERNAME": userName, "TYPE": typeId, - "tm": DateTime.now().millisecondsSinceEpoch.toString(), + "tm": DateTime.now().millisecondsSinceEpoch.toString(), "KEYWORDS": keyWord, //关键字模糊查询 "CORPINFO_ID": SessionService.instance.corpinfoId, "USER_ID": SessionService.instance.loginUserId, @@ -2351,7 +2549,7 @@ U6Hzm1ninpWeE+awIDAQAB data: { "DICTIONARIES_ID": '4a3d0d99b0ea4e268c11dd0b18866917', "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } @@ -2365,13 +2563,16 @@ U6Hzm1ninpWeE+awIDAQAB data: { "DICTIONARIES_ID": 'f60cf0e8315b4993b6d6049dd29f2ba5', "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } /// 获取检查记录列表 - static Future> getCheckRecordListOne(String id,String keyword) { + static Future> getCheckRecordListOne( + String id, + String keyword, + ) { return HttpManager().request( basePath, '/app/checkrecord/list', @@ -2380,13 +2581,16 @@ U6Hzm1ninpWeE+awIDAQAB "LISTMANAGER_ID": id, "KEYWORDS": keyword, "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } /// 获取检查记录列表 - static Future> getCheckRecordList(String id,String keyword) { + static Future> getCheckRecordList( + String id, + String keyword, + ) { return HttpManager().request( basePath, '/app/customCheckRecord/list', @@ -2395,7 +2599,7 @@ U6Hzm1ninpWeE+awIDAQAB "CUSTOM_ID": id, "KEYWORDS": keyword, "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } @@ -2409,7 +2613,7 @@ U6Hzm1ninpWeE+awIDAQAB data: { "CHECKRECORD_ID": id, "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } @@ -2423,12 +2627,11 @@ U6Hzm1ninpWeE+awIDAQAB data: { "CHECKRECORD_ID": id, "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } - /// 获取检查记录详情 static Future> getInspectRecordsDetail(String id) { return HttpManager().request( @@ -2438,7 +2641,7 @@ U6Hzm1ninpWeE+awIDAQAB data: { "CHECKRECORD_ID": id, "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } @@ -2452,7 +2655,7 @@ U6Hzm1ninpWeE+awIDAQAB data: { "CHECKRECORD_ID": id, "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } @@ -2467,15 +2670,16 @@ U6Hzm1ninpWeE+awIDAQAB "FOREIGN_KEY": id, "TYPE": 14, "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } - - /// 获取标准排查列表 - static Future> getStandardInvestigationList(String id,String keyWord) { + static Future> getStandardInvestigationList( + String id, + String keyWord, + ) { return HttpManager().request( basePath, '/app/hiddenDangerCheckStandardCustom/checkList', @@ -2483,17 +2687,20 @@ U6Hzm1ninpWeE+awIDAQAB data: { "USER_NAME": SessionService.instance.username, "CHECK_DEPARTMENT_ID": id, - "SUB_DEPARTMENT_IDS": keyWord, //选择的部门 - "IS_MAIN":SessionService.instance. loginUser?["ISMAIN"]??"0", + "SUB_DEPARTMENT_IDS": keyWord, //选择的部门 + "IS_MAIN": SessionService.instance.loginUser?["ISMAIN"] ?? "0", "CORPINFO_ID": SessionService.instance.corpinfoId, "USER_ID": SessionService.instance.loginUserId, - "ISSUPERVISE": SessionService.instance. loginUser?["ISSUPERVISE"]??"0", + "ISSUPERVISE": SessionService.instance.loginUser?["ISSUPERVISE"] ?? "0", }, ); } /// 获取隐患排查列表 - static Future> getHazardInvestigationList(String id,String keyWord) { + static Future> getHazardInvestigationList( + String id, + String keyWord, + ) { return HttpManager().request( basePath, '/app/listmanager/checkListV2', @@ -2501,11 +2708,11 @@ U6Hzm1ninpWeE+awIDAQAB data: { "USER_NAME": SessionService.instance.username, "CHECK_DEPARTMENT_ID": id, - "SUB_DEPARTMENT_IDS": keyWord, //选择的部门 - "IS_MAIN":SessionService.instance. loginUser?["ISMAIN"]??"0", + "SUB_DEPARTMENT_IDS": keyWord, //选择的部门 + "IS_MAIN": SessionService.instance.loginUser?["ISMAIN"] ?? "0", "CORPINFO_ID": SessionService.instance.corpinfoId, "USER_ID": SessionService.instance.loginUserId, - "ISSUPERVISE": SessionService.instance. loginUser?["ISSUPERVISE"]??"0", + "ISSUPERVISE": SessionService.instance.loginUser?["ISSUPERVISE"] ?? "0", }, ); } @@ -2520,7 +2727,7 @@ U6Hzm1ninpWeE+awIDAQAB "CUSTOM_ID": id, "USER_NAME": SessionService.instance.username, "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } @@ -2535,7 +2742,7 @@ U6Hzm1ninpWeE+awIDAQAB "LISTMANAGER_ID": id, "USER_NAME": SessionService.instance.username, "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } @@ -2549,9 +2756,9 @@ U6Hzm1ninpWeE+awIDAQAB data: { "ELECTRONIC_FENCE_ID": id, "USER_NAME": SessionService.instance.username, - "PLS_ID":"", + "PLS_ID": "", "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } @@ -2567,12 +2774,11 @@ U6Hzm1ninpWeE+awIDAQAB "CHECK_ITEM": item["CHECK_ITEM"], "USER_NAME": SessionService.instance.username, "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } - /// 获取已上传图片 static Future> getAlreadyUpImages(String id) { return HttpManager().request( @@ -2583,7 +2789,7 @@ U6Hzm1ninpWeE+awIDAQAB "FOREIGN_KEY": id, "TYPE": 14, "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } @@ -2597,38 +2803,51 @@ U6Hzm1ninpWeE+awIDAQAB data: { "IMGFILES_ID": id, "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } - /// 暂存隐患记录 static Future> temporaryStorageOfHidden( - String msg,item,unqualifiedInspectionItemID, - String hazardDescription,String partDescription,String latitude,String longitude, - String dangerDetail,String dataTime,String type,String responsibleId, - String yinHuanTypeIds,String hazardLeve,String buMenId,String buMenPDId, - String yinHuanTypeNames,String hiddenType1,String hiddenType2,String hiddenType3,) { + String msg, + item, + unqualifiedInspectionItemID, + String hazardDescription, + String partDescription, + String latitude, + String longitude, + String dangerDetail, + String dataTime, + String type, + String responsibleId, + String yinHuanTypeIds, + String hazardLeve, + String buMenId, + String buMenPDId, + String yinHuanTypeNames, + String hiddenType1, + String hiddenType2, + String hiddenType3, + ) { print("======>$type"); return HttpManager().request( basePath, '/app/customHidden/$msg', method: Method.post, data: { - "HIDDEN_ID":unqualifiedInspectionItemID, + "HIDDEN_ID": unqualifiedInspectionItemID, - - "CUSTOM_ID": item["CUSTOM_ID"]??"", - "CUSTOM_ITEM_ID": item["CUSTOM_ITEM_ID"]??"", - "RECORDITEM_ID": item["RECORDITEM_ID"]??"", - "CHECK_CATEGORY": item["CHECK_CATEGORY"]??"", - "CHECK_CATEGORY_NAME": item["CHECK_CATEGORY_NAME"]??"", - "CHECK_ITEM": item["CHECK_ITEM"]??"", - "CHECK_ITEM_NAME":item["CHECK_ITEM_NAME"]??"", - "CHECK_CONTENT": item["CHECK_CONTENT"]??"", - "CHECK_STANDARD": item["CHECK_STANDARD"]??"", - "REFERENCE_BASIS":item["REFERENCE_BASIS"] ??"", + "CUSTOM_ID": item["CUSTOM_ID"] ?? "", + "CUSTOM_ITEM_ID": item["CUSTOM_ITEM_ID"] ?? "", + "RECORDITEM_ID": item["RECORDITEM_ID"] ?? "", + "CHECK_CATEGORY": item["CHECK_CATEGORY"] ?? "", + "CHECK_CATEGORY_NAME": item["CHECK_CATEGORY_NAME"] ?? "", + "CHECK_ITEM": item["CHECK_ITEM"] ?? "", + "CHECK_ITEM_NAME": item["CHECK_ITEM_NAME"] ?? "", + "CHECK_CONTENT": item["CHECK_CONTENT"] ?? "", + "CHECK_STANDARD": item["CHECK_STANDARD"] ?? "", + "REFERENCE_BASIS": item["REFERENCE_BASIS"] ?? "", "SOURCE": '2', "STATE": '0', "CLEARIMG": '1', @@ -2644,22 +2863,21 @@ U6Hzm1ninpWeE+awIDAQAB "RECTIFICATIONOR": responsibleId, "HIDDENTYPE": yinHuanTypeIds, - "HIDDENLEVEL":hazardLeve, + "HIDDENLEVEL": hazardLeve, "RECTIFICATIONDEPT": buMenId, - "HIDDENFINDDEPT": buMenPDId.isNotEmpty?buMenPDId:buMenId, + "HIDDENFINDDEPT": buMenPDId.isNotEmpty ? buMenPDId : buMenId, "CREATOR": SessionService.instance.loginUserId, "HIDDENTYPE_NAME": yinHuanTypeNames, - "HIDDENTYPE1": hiddenType1 , - "HIDDENTYPE2": hiddenType2 , - "HIDDENTYPE3": hiddenType3 , + "HIDDENTYPE1": hiddenType1, + "HIDDENTYPE2": hiddenType2, + "HIDDENTYPE3": hiddenType3, "CORPINFO_ID": SessionService.instance.corpinfoId, "USER_ID": SessionService.instance.loginUserId, }, ); } - /// 获取暂存隐患记录 static Future> getTemporaryStorageOfHidden(String id) { return HttpManager().request( @@ -2669,217 +2887,27 @@ U6Hzm1ninpWeE+awIDAQAB data: { "HIDDEN_ID": id, "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "USER_ID": SessionService.instance.loginUserId, }, ); } /// 提交排查项 static Future> submitInvestigationItems( - item,String longitude,String latitude, - String itemsString,String idsString,String checkrecordId,) { + item, + String longitude, + String latitude, + String itemsString, + String idsString, + String checkrecordId, + ) { return HttpManager().request( basePath, '/app/customCheckRecord/add', - method: Method.post, - data: { - "CUSTOM_ID": item["CUSTOM_ID"], - "LIST_NAME": SessionService.instance.listItemNameJson, - "CREATOR": SessionService.instance.username, - "LATITUDE": latitude, - "LONGITUDE": longitude, - "ITEMS": itemsString, - "IDS": idsString, - "CHECKRECORD_ID": checkrecordId, - "tm": DateTime.now().millisecondsSinceEpoch.toString(), - "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, - }, - ); - } - - - /// 获取排查项 - static Future> getCheckInformationList(String id) { - return HttpManager().request( - basePath, - '/app/customHidden/getOtherHidden', method: Method.post, data: { - - "CUSTOM_ID": id, - "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, - }, - ); - } - - - - /// 暂存其他隐患记录 - static Future> checkInformationOneItemData( - String msg,String id,unqualifiedInspectionItemID, - String hazardDescription,String partDescription,String latitude,String longitude, - String dangerDetail,String dataTime,String type,String responsibleId, - String yinHuanTypeIds,String hazardLeve,String buMenId,String buMenPDId, - String yinHuanTypeNames,String hiddenType1,String hiddenType2,String hiddenType3,) { - print("======>$type"); - return HttpManager().request( - basePath, - '/app/customHidden/$msg', - method: Method.post, - data: { - - "HIDDEN_ID":unqualifiedInspectionItemID, - "SOURCE": '3', - "STATE": '0', - - "HIDDENDESCR": hazardDescription, - "HIDDENPART": partDescription, - "LATITUDE": latitude, - "LONGITUDE": longitude, - - "RECTIFYDESCR": dangerDetail, - "RECTIFICATIONDEADLINE": dataTime, - "RECTIFICATIONTYPE": type, - "RECTIFICATIONOR": responsibleId, - - "HIDDENTYPE": yinHuanTypeIds, - "HIDDENLEVEL":hazardLeve, - "RECTIFICATIONDEPT": buMenId, - "HIDDENFINDDEPT": buMenPDId.isNotEmpty?buMenPDId:buMenId, - - "CREATOR": SessionService.instance.loginUserId, - "LISTMANAGER_ID": id, - "HIDDENTYPE_NAME": yinHuanTypeNames, - "HIDDENTYPE1": hiddenType1 , - "HIDDENTYPE2": hiddenType2 , - "HIDDENTYPE3": hiddenType3 , - "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, - }, - ); - } - - - - /// 提交排查项 - static Future> customCheckRecordFinish(String time,String text, - String CHECKRECORD_ID,String id,String json) { - return HttpManager().request( - basePath, - '/app/customCheckRecord/finish', - method: Method.post, - data: { - "CHECK_TIME": time, - "DESCR": text, - "CHECKRECORD_ID": CHECKRECORD_ID, - "CUSTOM_ID": id, - "OTHER": json, - "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, - - - }, - ); - } - - - - /// 获取隐患排查排查项 - static Future> getInvestigationItemsYinHuan(final item) { - return HttpManager().request( - basePath, - '/app/listmanager/goCheck', - method: Method.post, - data: { - "LISTMANAGER_ID": item["LISTMANAGER_ID"], - "IDENTIFICATIONPARTS_ID": item["IDENTIFICATIONPARTS_ID"], - "USER_NAME": SessionService.instance.username, - "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - }, - ); - } - - /// 获取隐患排查暂存隐患记录 - static Future> getYinHuanTemporaryStorageOfHidden(String id) { - return HttpManager().request( - basePath, - '/app/hidden/goRiskListCheckEdit', - method: Method.post, - data: { - "HIDDEN_ID": id, - "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - }, - ); - } - - - /// 暂存隐患排查隐患记录 - static Future> temporaryStorageOfHiddenYinHuan( - String msg,item,unqualifiedInspectionItemID, - String hazardDescription,String partDescription,String latitude,String longitude, - String dangerDetail,String dataTime,String type,String responsibleId, - String yinHuanTypeIds,String hazardLeve,String buMenId,String buMenPDId, - String yinHuanTypeNames,String hiddenType1,String hiddenType2,String hiddenType3,result) { - print("======>$type"); - return HttpManager().request( - basePath, - '/app/hidden/$msg', - method: Method.post, - data: { - "HIDDEN_ID":unqualifiedInspectionItemID, - "SOURCE": '2', - "STATE": '0', - - "HIDDEN_CATEGORY": result["HIDDEN_CATEGORY"] ?? '', - "LISTMANAGER_ID": item["LISTMANAGER_ID"], - "RISKITEM_ID": result["LISTCHECKITEM_ID"], - "CHECK_CONTENT": item["CHECK_CONTENT"]??"", - "RECORDITEM_ID": item["RECORDITEM_ID"]??"", - - "HIDDENDESCR": hazardDescription, - "HIDDENPART": partDescription, - "LATITUDE": latitude, - "LONGITUDE": longitude, - - "RECTIFYDESCR": dangerDetail, - "RECTIFICATIONDEADLINE": dataTime, - "RECTIFICATIONTYPE": type, - "RECTIFICATIONOR": responsibleId, - - "HIDDENTYPE": yinHuanTypeIds, - "HIDDENLEVEL":hazardLeve, - "RECTIFICATIONDEPT": buMenId, - "HIDDENFINDDEPT": buMenPDId.isNotEmpty?buMenPDId:buMenId, - - "CREATOR": SessionService.instance.loginUserId, - "CLEARIMG": '1', - "HIDDENTYPE_NAME": yinHuanTypeNames, - "HIDDENTYPE1": hiddenType1 , - "HIDDENTYPE2": hiddenType2 , - "HIDDENTYPE3": hiddenType3 , - "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, - }, - ); - } - - - /// 提交隐患排查排查项 - static Future> submitInvestigationItemsYinHuan( - item,String longitude,String latitude, - String itemsString,String idsString,String checkrecordId,) { - return HttpManager().request( - basePath, - '/app/checkrecord/add', - method: Method.post, - data: { - // "CUSTOM_ID": item["CUSTOM_ID"], - "LISTMANAGER_ID": item["LISTMANAGER_ID"], - "LIST_NAME": SessionService.instance.listItemNameJson, + "CUSTOM_ID": item["CUSTOM_ID"], + "LIST_NAME": SessionService.instance.listItemNameJson, "CREATOR": SessionService.instance.username, "LATITUDE": latitude, "LONGITUDE": longitude, @@ -2893,76 +2921,49 @@ U6Hzm1ninpWeE+awIDAQAB ); } - - - /// 获取隐患排查项 - static Future> getCheckInformationListYinHuan(String id) { + /// 获取排查项 + static Future> getCheckInformationList(String id) { return HttpManager().request( basePath, - '/app/hidden/getOtherHidden', + '/app/customHidden/getOtherHidden', method: Method.post, data: { - "LISTMANAGER_ID": id, + "CUSTOM_ID": id, "CORPINFO_ID": SessionService.instance.corpinfoId, "USER_ID": SessionService.instance.loginUserId, }, ); } - - /// 提交隐患排查项 - static Future> customCheckRecordFinishYinHuan(String time,String text, - String CHECKRECORD_ID,String id,String json) { - return HttpManager().request( - basePath, - '/app/checkrecord/finish', - method: Method.post, - data: { - "CHECK_TIME": time, - "DESCR": text, - "CHECKRECORD_ID": CHECKRECORD_ID, - "LISTMANAGER_ID": id, - "OTHER": json, - "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID": SessionService.instance.loginUserId, - - - }, - ); - } - - - - /// 获取暂存隐患记录 - static Future> getTemporaryStorageOfHiddenYinHuan(String id) { - return HttpManager().request( - basePath, - '/app/hidden/goEdit', - method: Method.post, - data: { - "HIDDEN_ID": id, - "CORPINFO_ID": SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - }, - ); - } - - /// 暂存其他隐患记录 - static Future> checkInformationOneItemDataYinHuan( - String msg,String id,unqualifiedInspectionItemID, - String hazardDescription,String partDescription,String latitude,String longitude, - String dangerDetail,String dataTime,String type,String responsibleId, - String yinHuanTypeIds,String hazardLeve,String buMenId,String buMenPDId, - String yinHuanTypeNames,String hiddenType1,String hiddenType2,String hiddenType3,) { + static Future> checkInformationOneItemData( + String msg, + String id, + unqualifiedInspectionItemID, + String hazardDescription, + String partDescription, + String latitude, + String longitude, + String dangerDetail, + String dataTime, + String type, + String responsibleId, + String yinHuanTypeIds, + String hazardLeve, + String buMenId, + String buMenPDId, + String yinHuanTypeNames, + String hiddenType1, + String hiddenType2, + String hiddenType3, + ) { print("======>$type"); return HttpManager().request( basePath, - '/app/hidden/$msg', + '/app/customHidden/$msg', method: Method.post, data: { - - "HIDDEN_ID":unqualifiedInspectionItemID, + "HIDDEN_ID": unqualifiedInspectionItemID, "SOURCE": '3', "STATE": '0', @@ -2977,26 +2978,294 @@ U6Hzm1ninpWeE+awIDAQAB "RECTIFICATIONOR": responsibleId, "HIDDENTYPE": yinHuanTypeIds, - "HIDDENLEVEL":hazardLeve, + "HIDDENLEVEL": hazardLeve, "RECTIFICATIONDEPT": buMenId, - "HIDDENFINDDEPT": buMenPDId.isNotEmpty?buMenPDId:buMenId, + "HIDDENFINDDEPT": buMenPDId.isNotEmpty ? buMenPDId : buMenId, "CREATOR": SessionService.instance.loginUserId, "LISTMANAGER_ID": id, "HIDDENTYPE_NAME": yinHuanTypeNames, - "HIDDENTYPE1": hiddenType1 , - "HIDDENTYPE2": hiddenType2 , - "HIDDENTYPE3": hiddenType3 , + "HIDDENTYPE1": hiddenType1, + "HIDDENTYPE2": hiddenType2, + "HIDDENTYPE3": hiddenType3, "CORPINFO_ID": SessionService.instance.corpinfoId, "USER_ID": SessionService.instance.loginUserId, }, ); } + /// 提交排查项 + static Future> customCheckRecordFinish( + String time, + String text, + String CHECKRECORD_ID, + String id, + String json, + ) { + return HttpManager().request( + basePath, + '/app/customCheckRecord/finish', + method: Method.post, + data: { + "CHECK_TIME": time, + "DESCR": text, + "CHECKRECORD_ID": CHECKRECORD_ID, + "CUSTOM_ID": id, + "OTHER": json, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, + ); + } + /// 获取隐患排查排查项 + static Future> getInvestigationItemsYinHuan(final item) { + return HttpManager().request( + basePath, + '/app/listmanager/goCheck', + method: Method.post, + data: { + "LISTMANAGER_ID": item["LISTMANAGER_ID"], + "IDENTIFICATIONPARTS_ID": item["IDENTIFICATIONPARTS_ID"], + "USER_NAME": SessionService.instance.username, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, + ); + } + + /// 获取隐患排查暂存隐患记录 + static Future> getYinHuanTemporaryStorageOfHidden( + String id, + ) { + return HttpManager().request( + basePath, + '/app/hidden/goRiskListCheckEdit', + method: Method.post, + data: { + "HIDDEN_ID": id, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, + ); + } + + /// 暂存隐患排查隐患记录 + static Future> temporaryStorageOfHiddenYinHuan( + String msg, + item, + unqualifiedInspectionItemID, + String hazardDescription, + String partDescription, + String latitude, + String longitude, + String dangerDetail, + String dataTime, + String type, + String responsibleId, + String yinHuanTypeIds, + String hazardLeve, + String buMenId, + String buMenPDId, + String yinHuanTypeNames, + String hiddenType1, + String hiddenType2, + String hiddenType3, + result, + ) { + print("======>$type"); + return HttpManager().request( + basePath, + '/app/hidden/$msg', + method: Method.post, + data: { + "HIDDEN_ID": unqualifiedInspectionItemID, + "SOURCE": '2', + "STATE": '0', + + "HIDDEN_CATEGORY": result["HIDDEN_CATEGORY"] ?? '', + "LISTMANAGER_ID": item["LISTMANAGER_ID"], + "RISKITEM_ID": result["LISTCHECKITEM_ID"], + "CHECK_CONTENT": item["CHECK_CONTENT"] ?? "", + "RECORDITEM_ID": item["RECORDITEM_ID"] ?? "", + + "HIDDENDESCR": hazardDescription, + "HIDDENPART": partDescription, + "LATITUDE": latitude, + "LONGITUDE": longitude, + + "RECTIFYDESCR": dangerDetail, + "RECTIFICATIONDEADLINE": dataTime, + "RECTIFICATIONTYPE": type, + "RECTIFICATIONOR": responsibleId, + + "HIDDENTYPE": yinHuanTypeIds, + "HIDDENLEVEL": hazardLeve, + "RECTIFICATIONDEPT": buMenId, + "HIDDENFINDDEPT": buMenPDId.isNotEmpty ? buMenPDId : buMenId, + + "CREATOR": SessionService.instance.loginUserId, + "CLEARIMG": '1', + "HIDDENTYPE_NAME": yinHuanTypeNames, + "HIDDENTYPE1": hiddenType1, + "HIDDENTYPE2": hiddenType2, + "HIDDENTYPE3": hiddenType3, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, + ); + } + + /// 提交隐患排查排查项 + static Future> submitInvestigationItemsYinHuan( + item, + String longitude, + String latitude, + String itemsString, + String idsString, + String checkrecordId, + ) { + return HttpManager().request( + basePath, + '/app/checkrecord/add', + method: Method.post, + data: { + // "CUSTOM_ID": item["CUSTOM_ID"], + "LISTMANAGER_ID": item["LISTMANAGER_ID"], + "LIST_NAME": SessionService.instance.listItemNameJson, + "CREATOR": SessionService.instance.username, + "LATITUDE": latitude, + "LONGITUDE": longitude, + "ITEMS": itemsString, + "IDS": idsString, + "CHECKRECORD_ID": checkrecordId, + "tm": DateTime.now().millisecondsSinceEpoch.toString(), + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, + ); + } + + /// 获取隐患排查项 + static Future> getCheckInformationListYinHuan( + String id, + ) { + return HttpManager().request( + basePath, + '/app/hidden/getOtherHidden', + method: Method.post, + data: { + "LISTMANAGER_ID": id, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, + ); + } + + /// 提交隐患排查项 + static Future> customCheckRecordFinishYinHuan( + String time, + String text, + String CHECKRECORD_ID, + String id, + String json, + ) { + return HttpManager().request( + basePath, + '/app/checkrecord/finish', + method: Method.post, + data: { + "CHECK_TIME": time, + "DESCR": text, + "CHECKRECORD_ID": CHECKRECORD_ID, + "LISTMANAGER_ID": id, + "OTHER": json, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, + ); + } + + /// 获取暂存隐患记录 + static Future> getTemporaryStorageOfHiddenYinHuan( + String id, + ) { + return HttpManager().request( + basePath, + '/app/hidden/goEdit', + method: Method.post, + data: { + "HIDDEN_ID": id, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, + ); + } + + /// 暂存其他隐患记录 + static Future> checkInformationOneItemDataYinHuan( + String msg, + String id, + unqualifiedInspectionItemID, + String hazardDescription, + String partDescription, + String latitude, + String longitude, + String dangerDetail, + String dataTime, + String type, + String responsibleId, + String yinHuanTypeIds, + String hazardLeve, + String buMenId, + String buMenPDId, + String yinHuanTypeNames, + String hiddenType1, + String hiddenType2, + String hiddenType3, + ) { + print("======>$type"); + return HttpManager().request( + basePath, + '/app/hidden/$msg', + method: Method.post, + data: { + "HIDDEN_ID": unqualifiedInspectionItemID, + "SOURCE": '3', + "STATE": '0', + + "HIDDENDESCR": hazardDescription, + "HIDDENPART": partDescription, + "LATITUDE": latitude, + "LONGITUDE": longitude, + + "RECTIFYDESCR": dangerDetail, + "RECTIFICATIONDEADLINE": dataTime, + "RECTIFICATIONTYPE": type, + "RECTIFICATIONOR": responsibleId, + + "HIDDENTYPE": yinHuanTypeIds, + "HIDDENLEVEL": hazardLeve, + "RECTIFICATIONDEPT": buMenId, + "HIDDENFINDDEPT": buMenPDId.isNotEmpty ? buMenPDId : buMenId, + + "CREATOR": SessionService.instance.loginUserId, + "LISTMANAGER_ID": id, + "HIDDENTYPE_NAME": yinHuanTypeNames, + "HIDDENTYPE1": hiddenType1, + "HIDDENTYPE2": hiddenType2, + "HIDDENTYPE3": hiddenType3, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, + ); + } /// 获取安全例会列表 - static Future> getSafetyMeetingList(int page,int selectedTab) { + static Future> getSafetyMeetingList( + int page, + int selectedTab, + ) { return HttpManager().request( basePath, '/app/safetyMeeting/list?selectType=$selectedTab&showCount=10¤tPage=$page', @@ -3008,8 +3277,6 @@ U6Hzm1ninpWeE+awIDAQAB ); } - - /// 获取安全例会详情 static Future> getSafetyMeetDetail(String id) { return HttpManager().request( @@ -3023,9 +3290,11 @@ U6Hzm1ninpWeE+awIDAQAB ); } - /// 提交安全例会详情 - static Future> setSafetyMeetDetailFeedback(String id,String text) { + static Future> setSafetyMeetDetailFeedback( + String id, + String text, + ) { return HttpManager().request( basePath, '/app/safetyMeeting/confirm', @@ -3039,7 +3308,10 @@ U6Hzm1ninpWeE+awIDAQAB } /// 安全例会详情图片 - static Future> addSafetyMeetDetailFeedBack(String imagePath,String id) async { + static Future> addSafetyMeetDetailFeedBack( + String imagePath, + String id, + ) async { final file = File(imagePath); if (!await file.exists()) { throw ApiException('file_not_found', '图片不存在:$imagePath'); @@ -3047,29 +3319,28 @@ U6Hzm1ninpWeE+awIDAQAB final fileName = file.path.split(Platform.pathSeparator).last; return HttpManager().uploadFaceImage( - baseUrl: basePath, - path: '/app/safetyMeeting/upload', - fromData: { - 'FOREIGN_KEY': id, - 'CORPINFO_ID': SessionService.instance.corpinfoId, - "TYPE":"106", - 'FFILE': await MultipartFile.fromFile( - file.path, - filename: fileName - ), - } + baseUrl: basePath, + path: '/app/safetyMeeting/upload', + fromData: { + 'FOREIGN_KEY': id, + 'CORPINFO_ID': SessionService.instance.corpinfoId, + "TYPE": "106", + 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), + }, ); } - /// 获取设备巡检列表 - static Future> getEquipmentInspectionList(int page,int selectedTab) { + static Future> getEquipmentInspectionList( + int page, + int selectedTab, + ) { return HttpManager().request( basePath, '/app/specialequipmentaqxj/list?showCount=100¤tPage=$page', method: Method.post, data: { - "UNCHECK": selectedTab==0?"":"1", + "UNCHECK": selectedTab == 0 ? "" : "1", "tm": DateTime.now().millisecondsSinceEpoch.toString(), "CORPINFO_ID": SessionService.instance.corpinfoId, "USER_ID": SessionService.instance.loginUserId, @@ -3077,14 +3348,11 @@ U6Hzm1ninpWeE+awIDAQAB ); } - - - /// 开始巡检 static Future> startInspection( - Map formData, - List filePaths, - ) async { + Map formData, + List filePaths, + ) async { // 复制一份 formData final data = Map.from(formData); @@ -3103,10 +3371,11 @@ U6Hzm1ninpWeE+awIDAQAB ); } - - /// 设备巡检记录 - static Future> getEquipmentDetailList(String id,int selectedTab) { + static Future> getEquipmentDetailList( + String id, + int selectedTab, + ) { return HttpManager().request( basePath, '/app/specialequipmentaqxj/listByEquipment', @@ -3136,13 +3405,16 @@ U6Hzm1ninpWeE+awIDAQAB } /// 获取公司安全承诺列表 - static Future> getCompanySafetyCommitmentList(int page,String keyWord,String id) { + static Future> getCompanySafetyCommitmentList( + int page, + String keyWord, + String id, + ) { return HttpManager().request( basePath, '/app/commitmentcompany/list?showCount=-1¤tPage=$page', method: Method.post, data: { - "DEPARTMENT_ID": id, "tm": DateTime.now().millisecondsSinceEpoch.toString(), "KEYWORDS": keyWord, //关键字模糊查询 @@ -3153,13 +3425,16 @@ U6Hzm1ninpWeE+awIDAQAB } /// 获取车间安全承诺列表 - static Future> getWorkshopSafetyCommitmentList(int page,String keyWord,String id) { + static Future> getWorkshopSafetyCommitmentList( + int page, + String keyWord, + String id, + ) { return HttpManager().request( basePath, '/app/commitmentworkshop/list?showCount=-1¤tPage=$page', method: Method.post, data: { - "DEPARTMENT_ID": id, "tm": DateTime.now().millisecondsSinceEpoch.toString(), "KEYWORDS": keyWord, //关键字模糊查询 @@ -3168,39 +3443,42 @@ U6Hzm1ninpWeE+awIDAQAB }, ); } + /// 其他承诺 - static Future> getWorkshopSafetyOtherCommitmen(String PROMISE_ID, String PROMISEPEOPLE_ID) { + static Future> getWorkshopSafetyOtherCommitmen( + String PROMISE_ID, + String PROMISEPEOPLE_ID, + ) { return HttpManager().request( basePath, '/app/corppromise/goEdit_II', method: Method.post, - data: { - - "PROMISE_ID": PROMISE_ID, - "PROMISEPEOPLE_ID": PROMISEPEOPLE_ID, - - }, + data: {"PROMISE_ID": PROMISE_ID, "PROMISEPEOPLE_ID": PROMISEPEOPLE_ID}, ); } - static Future> getWorkshopSafetyOthercorppromise(String PROMISEPEOPLE_ID) { + + static Future> getWorkshopSafetyOthercorppromise( + String PROMISEPEOPLE_ID, + ) { return HttpManager().request( basePath, '/app/corppromise/editIsRead_II', method: Method.post, - data: { - "PROMISEPEOPLE_ID": PROMISEPEOPLE_ID, - }, + data: {"PROMISEPEOPLE_ID": PROMISEPEOPLE_ID}, ); } /// 获取班组安全承诺列表 - static Future> getTeamSafetyCommitmentList(int page,String keyWord,String id) { + static Future> getTeamSafetyCommitmentList( + int page, + String keyWord, + String id, + ) { return HttpManager().request( basePath, '/app/commitment/team/list?showCount=-1¤tPage=$page', method: Method.post, data: { - "DEPARTMENT_ID": id, "tm": DateTime.now().millisecondsSinceEpoch.toString(), "KEYWORDS": keyWord, //关键字模糊查询 @@ -3210,9 +3488,10 @@ U6Hzm1ninpWeE+awIDAQAB ); } - /// 获取公司安全承诺列表-验证申请 - static Future> getCompanySafetyCommitmentPermission(String id) { + static Future> getCompanySafetyCommitmentPermission( + String id, + ) { return HttpManager().request( basePath, '/app/commitmentcompany/check', @@ -3226,7 +3505,9 @@ U6Hzm1ninpWeE+awIDAQAB } /// 获取车间安全承诺列表-验证申请 - static Future> getWorkshopSafetyCommitmentPermission(String id) { + static Future> getWorkshopSafetyCommitmentPermission( + String id, + ) { return HttpManager().request( basePath, '/app/commitmentworkshop/check', @@ -3240,7 +3521,9 @@ U6Hzm1ninpWeE+awIDAQAB } /// 获取班组安全承诺列表-验证申请 - static Future> getTeamSafetyCommitmentPermission(String id) { + static Future> getTeamSafetyCommitmentPermission( + String id, + ) { return HttpManager().request( basePath, '/app/commitment/team/check', @@ -3253,22 +3536,21 @@ U6Hzm1ninpWeE+awIDAQAB ); } - /// 公司安全承诺-提交 static Future> upCompanySafetyCommitmentApply( - Map formData, - List filePaths, - ) async { + Map formData, + List filePaths, + ) async { // 复制一份 formData final data = Map.from(formData); // 把文件路径填成 MultipartFile // for (var i = 0; i < filePaths.length; i++) { - final path = filePaths[0]; - data['FFILE'] = await MultipartFile.fromFile( - path, - filename: path.split(Platform.pathSeparator).last, - ); + final path = filePaths[0]; + data['FFILE'] = await MultipartFile.fromFile( + path, + filename: path.split(Platform.pathSeparator).last, + ); // } return HttpManager().uploadFaceImage( baseUrl: basePath, @@ -3279,9 +3561,9 @@ U6Hzm1ninpWeE+awIDAQAB /// 获取车间安全承诺列表-提交 static Future> upWorkshopSafetyCommitmentApply( - Map formData, - List filePaths, - ) async { + Map formData, + List filePaths, + ) async { // 复制一份 formData final data = Map.from(formData); @@ -3300,12 +3582,11 @@ U6Hzm1ninpWeE+awIDAQAB ); } - /// 获取班组安全承诺列表-提交 static Future> upTeamSafetyCommitmentApply( - Map formData, - List filePaths, - ) async { + Map formData, + List filePaths, + ) async { // 复制一份 formData final data = Map.from(formData); @@ -3324,10 +3605,10 @@ U6Hzm1ninpWeE+awIDAQAB ); } - - /// 获取公司安全承诺列表-详情 - static Future> getCompanySafetyCommitmentDetail(String id) { + static Future> getCompanySafetyCommitmentDetail( + String id, + ) { return HttpManager().request( basePath, '/app/commitmentcompany/goEdit', @@ -3339,8 +3620,11 @@ U6Hzm1ninpWeE+awIDAQAB }, ); } + /// 获取车间安全承诺列表-详情 - static Future> getWorkshopSafetyCommitmentDetail(String id) { + static Future> getWorkshopSafetyCommitmentDetail( + String id, + ) { return HttpManager().request( basePath, '/app/commitmentworkshop/goEdit', @@ -3367,7 +3651,6 @@ U6Hzm1ninpWeE+awIDAQAB ); } - /// 获取其他行业承诺-我的承诺列表 static Future> getMyOtherCommitmentsList() { return HttpManager().request( @@ -3396,7 +3679,6 @@ U6Hzm1ninpWeE+awIDAQAB ); } - /// 获取头像 static Future> getUserHeadPhoto(String phone) { return HttpManager().request( @@ -3404,40 +3686,40 @@ U6Hzm1ninpWeE+awIDAQAB '/app/user/getUserPhoto', method: Method.post, data: { - "USERNAME": SessionService.instance.loginUser?["USERNAME"]??"", - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, + "USERNAME": SessionService.instance.loginUser?["USERNAME"] ?? "", + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } -///TODO -------------–-------------------- NFC巡检 -------------–-------------------- + ///TODO -------------–-------------------- NFC巡检 -------------–-------------------- /// 管道区域 static Future> getNfcPipeLineAreaList() { return HttpManager().request( baseNFCPath, '/pipelineInspection/getPipelineAreaListAll', method: Method.post, - data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - 'STATUS':'0' - }, + data: {"CORPINFO_ID": SessionService.instance.corpinfoId, 'STATUS': '0'}, ); } /// 管道设备列表 - static Future> getNfcEquipmentPipelineListAll(String PIPELINE_AREA_ID) { + static Future> getNfcEquipmentPipelineListAll( + String PIPELINE_AREA_ID, + ) { return HttpManager().request( baseNFCPath, '/pipelineInspection/getEquipmentPipelineListAll', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - 'STATUS':'0', - 'PIPELINE_AREA_ID':PIPELINE_AREA_ID + "CORPINFO_ID": SessionService.instance.corpinfoId, + 'STATUS': '0', + 'PIPELINE_AREA_ID': PIPELINE_AREA_ID, }, ); } + ///NFC标签入库 static Future> nfcTagAdd(Map data) { return HttpManager().request( @@ -3446,39 +3728,121 @@ U6Hzm1ninpWeE+awIDAQAB method: Method.post, data: { ...data, - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } + ///NFC任务列表 - static Future> nfcTaskList(int showCount, int currentPage) { + static Future> nfcTaskList( + int showCount, + int currentPage, + ) { return HttpManager().request( baseNFCPath, '/pipelineInspection/getPatrolTaskList?showCount=$showCount¤tPage=$currentPage', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - "STATUS": '0' + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + "STATUS": '0', }, ); } + ///NFC任务详情 - static Future> nfcTaskDetailList(int showCount, int currentPage, String PATROL_TASK_ID) { + static Future> nfcTaskDetailList( + int showCount, + int currentPage, + Map data, + ) { return HttpManager().request( baseNFCPath, '/pipelineInspection/getPatrolTaskDetailList?showCount=$showCount¤tPage=$currentPage', method: Method.post, data: { - "CORPINFO_ID":SessionService.instance.corpinfoId, - "USER_ID":SessionService.instance.loginUserId, - "PATROL_TASK_ID":PATROL_TASK_ID + ...data, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, }, ); } -} + static Future> nfcWriteCheck(String NFC_CODE) { + return HttpManager().request( + baseNFCPath, + '/pipelineInspection/nfcTagCheck', + method: Method.post, + data: { + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + 'NFC_CODE': NFC_CODE, + }, + ); + } + /// NFC问题反馈详情 + static Future> getNfcFeedBackDetail( + Map data, + ) async { + return HttpManager().request( + baseNFCPath, + '/pipelineInspection/goEditNfcExceptionRecord', + method: Method.post, + data: { + ...data, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, + ); + } + /// NFC问题反馈 + static Future> nfcFeedBack( + Map data, + ) async { + return HttpManager().request( + baseNFCPath, + '/pipelineInspection/nfcExceptionRecordAdd', + method: Method.post, + data: { + ...data, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, + ); + } + // 检查项提交 + static Future> nfcChekSubmit( + Map data, + ) async { + return HttpManager().request( + baseNFCPath, + '/pipelineInspection/patrolRecordDetailSaveOrUpdate', + method: Method.post, + data: { + ...data, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, + ); + } + /// nfc隐患记录 + static Future> nfcDangerRecord( + Map data, + ) async { + return HttpManager().request( + baseNFCPath, + '/pipelineInspection/goEditPatrolRecordDetailHidden', + method: Method.post, + data: { + ...data, + "CORPINFO_ID": SessionService.instance.corpinfoId, + "USER_ID": SessionService.instance.loginUserId, + }, + ); + } + // goEditPatrolTaskDetail + +} diff --git a/lib/main.dart b/lib/main.dart index a229a43..fa21135 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,5 @@ +// main.dart +import 'dart:async'; import 'package:flutter/material.dart'; import 'package:qhd_prevention/pages/badge_manager.dart'; import 'package:qhd_prevention/services/auth_service.dart'; @@ -8,6 +10,7 @@ import './pages/main_tab.dart'; import 'package:intl/date_symbol_data_local.dart'; import 'http/HttpManager.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter/services.dart'; // for TextInput.hide // 全局导航键 final GlobalKey navigatorKey = GlobalKey(); @@ -28,6 +31,36 @@ class GlobalMessage { } } +/// 全局 helper:在弹窗前取消焦点并尽量隐藏键盘,避免弹窗后键盘自动弹起 +Future showDialogAfterUnfocus(BuildContext context, Widget dialog) async { + // 取消焦点并尝试隐藏键盘 + FocusScope.of(context).unfocus(); + try { + await SystemChannels.textInput.invokeMethod('TextInput.hide'); + } catch (_) {} + // 给系统一点时间,避免竞态(100-200ms 足够) + await Future.delayed(const Duration(milliseconds: 150)); + return showDialog(context: context, builder: (_) => dialog); +} + +/// 同理:在展示底部模态前确保键盘隐藏 +Future showModalBottomSheetAfterUnfocus({ + required BuildContext context, + required WidgetBuilder builder, + bool isScrollControlled = false, +}) async { + FocusScope.of(context).unfocus(); + try { + await SystemChannels.textInput.invokeMethod('TextInput.hide'); + } catch (_) {} + await Future.delayed(const Duration(milliseconds: 150)); + return showModalBottomSheet( + context: context, + isScrollControlled: isScrollControlled, + builder: builder, + ); +} + void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -70,8 +103,6 @@ void main() async { // 如果本地标记已登录,进一步验证 token 是否有效 try { isLoggedIn = await AuthService.isLoggedIn(); - // 这里建议 AuthService.isLoggedIn() 内部实际请求一次用户信息接口 - // 如果失败,就返回 false } catch (e) { isLoggedIn = false; } @@ -80,6 +111,7 @@ void main() async { runApp(MyApp(isLoggedIn: isLoggedIn)); } +/// MyApp:恢复为 Stateless(无需监听 viewInsets) class MyApp extends StatelessWidget { final bool isLoggedIn; @@ -90,13 +122,15 @@ class MyApp extends StatelessWidget { return MaterialApp( title: '', navigatorKey: navigatorKey, + // 在路由变化时统一取消焦点(防止 push/pop 时焦点回到 TextField) + navigatorObservers: [KeyboardUnfocusNavigatorObserver()], builder: (context, child) { return EasyLoading.init( builder: (context, widget) { return GestureDetector( behavior: HitTestBehavior.translucent, onTap: () { - // FocusScope.of(context).unfocus(); + // 全局点击空白处取消焦点(隐藏键盘) FocusHelper.clearFocus(context); }, child: widget, @@ -136,3 +170,38 @@ class MyApp extends StatelessWidget { ); } } + +/// NavigatorObserver:在 push/pop/remove/replace 等路由变化时统一取消焦点 +class KeyboardUnfocusNavigatorObserver extends NavigatorObserver { + void _unfocus() { + try { + FocusManager.instance.primaryFocus?.unfocus(); + } catch (e) { + debugPrint('NavigatorObserver unfocus error: $e'); + } + } + + @override + void didPush(Route route, Route? previousRoute) { + _unfocus(); + super.didPush(route, previousRoute); + } + + @override + void didPop(Route route, Route? previousRoute) { + _unfocus(); + super.didPop(route, previousRoute); + } + + @override + void didRemove(Route route, Route? previousRoute) { + _unfocus(); + super.didRemove(route, previousRoute); + } + + @override + void didReplace({Route? newRoute, Route? oldRoute}) { + _unfocus(); + super.didReplace(newRoute: newRoute, oldRoute: oldRoute); + } +} diff --git a/lib/pages/app/Danger_paicha/quick_report_page.dart b/lib/pages/app/Danger_paicha/quick_report_page.dart index 983a0d2..4e14132 100644 --- a/lib/pages/app/Danger_paicha/quick_report_page.dart +++ b/lib/pages/app/Danger_paicha/quick_report_page.dart @@ -526,11 +526,12 @@ class _QuickReportPageState extends State { String latitude=position.latitude.toString(); try { + Map data = {}; final result = await ApiService.addRiskListCheckApp( hazardDescription, partDescription, latitude, longitude, dangerDetail, dataTime, type, responsibleId, yinHuanTypeIds, hazardLeve, buMenId, buMenPDId, - yinHuanTypeNames, hiddenType1, hiddenType2, hiddenType3,); + yinHuanTypeNames, hiddenType1, hiddenType2, hiddenType3,data); if (result['result'] == 'success') { String hiddenId = result['pd']['HIDDEN_ID'] ; diff --git a/lib/pages/home/NFC/home_nfc_add_page.dart b/lib/pages/home/NFC/home_nfc_add_page.dart index 76a1dc5..fa240af 100644 --- a/lib/pages/home/NFC/home_nfc_add_page.dart +++ b/lib/pages/home/NFC/home_nfc_add_page.dart @@ -124,25 +124,51 @@ class _HomeNfcAddPageState extends State { ); if (confirmed) { LoadingDialogHelper.show(message: '等待手机靠近NFC标签'); - await NfcService.instance.writeText( - mapToCompactJson({'PIPELINE_AREA_ID':pd['PIPELINE_AREA_ID'],'EQUIPMENT_PIPELINE_ID':pd['EQUIPMENT_PIPELINE_ID']}), - timeout: Duration(seconds: 12), - onComplete: (ok, msg) async{ - if (ok) { - pd['NFC_CODE'] = msg; - final result = await ApiService.nfcTagAdd(pd); - if (result['result'] == 'success') { - ToastUtil.showSuccess(context, '写入成功'); - Navigator.pop(context); - }else{ - ToastUtil.showError(context, '写入失败,请重试'); - } - } - LoadingDialogHelper.hide(); + NfcService.instance.startScanOnceWithCallback( + onResult: (uid, parsedText, rawMsg) async { + final result = await ApiService.nfcWriteCheck(uid); + if (result['result'] == 'success') { + _writeNFCInfoRequest(); + }else{ + ToastUtil.showError(context, result['result'] ?? ''); + } + LoadingDialogHelper.hide(); }, + onError: (err) { + ToastUtil.showNormal(context, '$err'); + LoadingDialogHelper.hide(); + + }, + timeout: Duration(seconds: 12), ); } } + + Future _writeNFCInfoRequest() async{ + await NfcService.instance.writeText( + mapToCompactJson({'PIPELINE_AREA_ID':pd['PIPELINE_AREA_ID'],'EQUIPMENT_PIPELINE_ID':pd['EQUIPMENT_PIPELINE_ID']}), + timeout: Duration(seconds: 12), + onComplete: (ok, msg) async{ + if (ok) { + pd['NFC_CODE'] = msg; + final result = await ApiService.nfcTagAdd(pd); + if (result['result'] == 'success') { + ToastUtil.showSuccess(context, '写入成功'); + Navigator.pop(context); + }else{ + ToastUtil.showError(context, '写入失败,请重试'); + } + }else{ + ToastUtil.showError(context, '$msg'); + + } + LoadingDialogHelper.hide(); + }, + ); + LoadingDialogHelper.hide(); + + } + String mapToCompactJson(Map map) { // 使用 jsonEncode 转换 String jsonStr = jsonEncode(map); diff --git a/lib/pages/home/NFC/home_nfc_check_danger_page.dart b/lib/pages/home/NFC/home_nfc_check_danger_page.dart index 7be7bcc..ed54414 100644 --- a/lib/pages/home/NFC/home_nfc_check_danger_page.dart +++ b/lib/pages/home/NFC/home_nfc_check_danger_page.dart @@ -1,17 +1,207 @@ import 'package:flutter/material.dart'; +import 'package:qhd_prevention/customWidget/custom_button.dart'; +import 'package:qhd_prevention/customWidget/toast_util.dart'; +import 'package:qhd_prevention/http/ApiService.dart'; +import 'package:qhd_prevention/pages/home/NFC/home_nfc_detail_page.dart'; +import 'package:qhd_prevention/pages/home/NFC/nfc_check_danger_detail.dart'; +import 'package:qhd_prevention/pages/home/tap/item_list_widget.dart'; import 'package:qhd_prevention/pages/my_appbar.dart'; +import 'package:qhd_prevention/tools/tools.dart'; + +/// OptionData 模型 +class OptionData { + final String value; + final String label; + final IconData icon; + final Color color; + + const OptionData({ + required this.value, + required this.label, + required this.icon, + required this.color, + }); + + @override + bool operator ==(Object other) => + identical(this, other) || + other is OptionData && + runtimeType == other.runtimeType && + value == other.value && + label == other.label && + icon == other.icon && + color == other.color; + + @override + int get hashCode => + value.hashCode ^ label.hashCode ^ icon.hashCode ^ color.hashCode; +} class HomeNfcCheckDangerPage extends StatefulWidget { - const HomeNfcCheckDangerPage({super.key}); + const HomeNfcCheckDangerPage({ + super.key, + required this.info, + required this.facebookImages, + required this.isNfcError + }); + + final Map info; + final List facebookImages; + // nfc异常上报 + final bool isNfcError; @override State createState() => _HomeNfcCheckDangerPageState(); } class _HomeNfcCheckDangerPageState extends State { + late Map pd = {}; + OptionData? selectType; // 初始为 null(未选择) + final List _options = const [ + OptionData( + value: "option1", + label: "合格", + icon: Icons.check_circle_rounded, + color: Colors.green, + ), + OptionData( + value: "option2", + label: "不合格", + icon: Icons.check_circle_rounded, + color: Colors.green, + ), + OptionData( + value: "option3", + label: "不涉及", + icon: Icons.check_circle_rounded, + color: Colors.green, + ), + ]; + @override + void initState() { + // TODO: implement initState + super.initState(); + final bool unchecked = widget.info['INSPECTED_FLAG'] == '0'; + if (!unchecked) { // 已经巡检过 + for (OptionData data in _options) { + if (data.label == widget.info['INSPECTION_RESULT']) { + selectType = data; + } + } + } + if (selectType != null && selectType?.label == '不合格') { // 不合格的话要获取上传过的隐患记录 + _getCheckRecord(); + } - Widget _pendingTopCard(Map item) { + } + Future _getCheckRecord() async{ + Map data = {'PATROL_RECORD_DETAIL_ID': widget.info['PATROL_RECORD_DETAIL_ID']}; + final result = await ApiService.nfcDangerRecord(data); + if (result['result'] == 'success') { + setState(() { + pd = result['pd']; + }); + + } + + } + Future _submit() async { + // 保护:如果未选择任何选项就不提交 + if (selectType == null) { + // 可选:提示用户选择 + ToastUtil.showNormal(context, '请先选择检查结果'); + return; + } + Map data = { + ...widget.info, + 'INSPECTION_RESULT': selectType?.label ?? '', + 'TYPE': '0', // 记录类型(0-正常检查记录 1-超期未检查记录) + }; + LoadingDialogHelper.show(); + // 如果选中的是不合格,需要特殊处理 + if (selectType?.label == '不合格') { + List imgList = pd['imgList'] ?? []; + List _videos = pd['videoList'] ?? []; + List zgImgList = pd['gzImageList'] ?? []; + for (int i = 0; i < imgList.length; i++) { + await _reloadFeedBack(imgList[i], '3'); + } + for (int i = 0; i < _videos.length; i++) { + await _reloadFeedBack(_videos[i], '3'); + } + for (int i = 0; i < zgImgList.length; i++) { + await _reloadFeedBack(zgImgList[i], '4'); + } + data = {...data,...pd}; + + } + + if (widget.facebookImages.isNotEmpty) { + // 手动上报 nfc 异常图片(按顺序上传) + final List uploaded = []; + for (int i = 0; i < widget.facebookImages.length; i++) { + String imagePath = await _reloadFeedBack(widget.facebookImages[i], '30'); + if (imagePath.isNotEmpty) { + uploaded.add(imagePath); + } + } + if (uploaded.isNotEmpty) { + data['PHOTO_URL'] = uploaded.join(','); + } + } + data['CHECK_CONTENT'] = widget.info['INSPECTION_CONTENT']; + final result = await ApiService.nfcChekSubmit(data); + LoadingDialogHelper.hide(); + if (result['result'] == 'success') { + if (widget.isNfcError) { // 如果手动检查上传nfc异常,多退一个路由 + Navigator.of(context).pop(); + + } + Navigator.of(context).pop(); + + } else { + // 可选:根据返回显示错误 + ToastUtil.showNormal(context, result['result']?.toString() ?? '提交失败'); + } + } + + Future _reloadFeedBack(String imagePath, String type) async { + try { + Map data = { + 'TYPE': type, + 'FOREIGN_KEY': widget.info['EQUIPMENT_PIPELINE_ID'], + }; + final raw = await ApiService.addNormalImgFiles(imagePath, data); + if (raw['result'] == 'success') { + Map pd = raw['pd']; + return pd['FILEPATH'] ?? ""; + } else { + return ""; + } + } catch (e) { + // 出错时可以 Toast 或者在页面上显示错误状态 + debugPrint('加载首页数据失败:$e'); + return ""; + } + } + + void _pushDangerDetail() async { + // pushPage 可能返回 pd,保持原逻辑:等待详情页返回新的 pd + final result = await pushPage>( + NfcCheckDangerDetail(info: pd), + context, + ); + if (result != null && result.isNotEmpty) { + setState(() { + // 将选中项设置为“不合格” + selectType = _options[1]; + pd = result; + }); + } + } + + Widget _pendingTopCard(Map item) { return SizedBox( height: 180, child: Stack( @@ -32,7 +222,7 @@ class _HomeNfcCheckDangerPageState extends State { top: 12, left: 12, child: Text( - item['title']!, + item['TASK_NAME']?.toString() ?? '', style: const TextStyle( color: Colors.black87, fontSize: 18, @@ -52,7 +242,7 @@ class _HomeNfcCheckDangerPageState extends State { ), child: Center( child: Text( - item['status']!, + item['PATROL_TYPE_NAME'] ?? '', style: const TextStyle(color: Colors.white, fontSize: 14), ), ), @@ -66,11 +256,11 @@ class _HomeNfcCheckDangerPageState extends State { top: 50, // 盖住图片底部 child: Container( margin: const EdgeInsets.symmetric(horizontal: 0), - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.all(5), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), - boxShadow: [ + boxShadow: const [ BoxShadow( color: Colors.black12, blurRadius: 4, @@ -86,32 +276,126 @@ class _HomeNfcCheckDangerPageState extends State { ); } - /// 构建信息网格 - Widget _buildInfoGrid(Map item) { - return Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('负责部门:${item['department']}'), - const SizedBox(height: 8), - Text('负责人:${item['owner']}'), - const SizedBox(height: 8), - Text('UN件类型:${item['unType']}'), - ], - ), + // 构建单选按钮(现在 option 为 OptionData) + Widget _buildOptionButton({ + required BuildContext context, + required OptionData option, + required double screenWidth, + required dynamic item, + VoidCallback? onImageTap, + }) { + final String value = option.value; + final String label = option.label; + final icon = option.icon; + final color = option.color; + final bool isSelected = selectType?.value == option.value; + final buttonWidth = (screenWidth - 60) / 3 - 10; // 计算按钮宽度 + + return GestureDetector( + onTap: () { + setState(() { + if (value != "option2") { + selectType = option; + } else { + // 选择“不合格”需要进入详情页面 + _pushDangerDetail(); + } + }); + }, + behavior: HitTestBehavior.opaque, + child: Container( + width: buttonWidth, + padding: const EdgeInsets.symmetric(vertical: 12), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 30, + width: 90, + child: Row( + children: [ + Icon(icon, color: isSelected ? color : Colors.grey, size: 30), + const SizedBox(width: 8), + Flexible( + child: Text( + label, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14, + fontWeight: + isSelected ? FontWeight.bold : FontWeight.normal, + color: isSelected ? color : Colors.grey[600], + ), + ), + ), + ], + ), + ), + const SizedBox(width: 6), + if ((value == "option1" && item["REFERENCE_BASIS"] == "option1") || + (value == "option2" && + item["REFERENCE_BASIS"] == "option2" && + item.containsKey("ids") && + item["ids"].toString().isNotEmpty)) + GestureDetector( + onTap: () { + if (onImageTap != null) { + onImageTap(); + } + }, + behavior: HitTestBehavior.opaque, + child: Transform.translate( + offset: const Offset(0, -6), + child: Image.asset( + "assets/images/gantan-blue.png", + width: 15, + height: 15, + ), + ), + ), + ], ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text('巡检周期:${item['cycle']}'), - const SizedBox(height: 8), - Text('已巡点位:${item['points']}'), - Text('涉及管道区域:${item['department']}') - ], - ), + ), + ); + } + + /// 构建信息网格 + Widget _buildInfoGrid(Map item) { + final screenWidth = MediaQuery.of(context).size.width; + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ItemListWidget.singleLineTitleText( + label: '检查项:', + isEditable: false, + text: item['EQUIPMENT_NAME'] ?? '', + ), + ItemListWidget.singleLineTitleText( + label: '检查内容:', + isEditable: false, + text: item['INSPECTION_CONTENT'] ?? '', + ), + const SizedBox(height: 8), + // 单选按钮组 + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: _options.map((option) { + return _buildOptionButton( + context: context, + option: option, + screenWidth: screenWidth, + item: item, + onImageTap: () { + if (item["REFERENCE_BASIS"] == "option1") { + // _getAlreadyUpImages(item); + } else if (item["REFERENCE_BASIS"] == "option2") { + // _goUnqualifiedPage(item); + } + }, + ); + }).toList(), ), ], ); @@ -119,18 +403,28 @@ class _HomeNfcCheckDangerPageState extends State { @override Widget build(BuildContext context) { + final bool canSubmit = selectType != null; // 只有选中后才可以提交 + return Scaffold( - appBar: MyAppbar(title: '检查项'), - body: SafeArea( - child: Padding( - padding: EdgeInsets.all(16), - child: Column( - children: [ - _pendingTopCard({}), - ] - ) - ) - ) + appBar: MyAppbar(title: '检查项'), + body: SafeArea( + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + _pendingTopCard(widget.info), + const Spacer(), + CustomButton( + enabled: canSubmit, + text: '提交', + backgroundColor: Colors.blue, + onPressed: canSubmit ? _submit : null, + ), + ], + ), + ), + ), ); } -} \ No newline at end of file +} diff --git a/lib/pages/home/NFC/home_nfc_check_page.dart b/lib/pages/home/NFC/home_nfc_check_page.dart deleted file mode 100644 index e69de29..0000000 diff --git a/lib/pages/home/NFC/home_nfc_detail_page.dart b/lib/pages/home/NFC/home_nfc_detail_page.dart index 2367a6a..600aaef 100644 --- a/lib/pages/home/NFC/home_nfc_detail_page.dart +++ b/lib/pages/home/NFC/home_nfc_detail_page.dart @@ -2,24 +2,32 @@ import 'dart:async'; import 'dart:convert'; import 'package:flutter/material.dart'; +import 'package:qhd_prevention/customWidget/custom_alert_dialog.dart'; +import 'package:qhd_prevention/customWidget/custom_button.dart'; +import 'package:qhd_prevention/customWidget/toast_util.dart'; import 'package:qhd_prevention/http/ApiService.dart'; +import 'package:qhd_prevention/pages/home/NFC/home_nfc_check_danger_page.dart'; +import 'package:qhd_prevention/pages/home/NFC/nfc_question_fecebook.dart'; import 'package:qhd_prevention/pages/home/tap/item_list_widget.dart'; import 'package:qhd_prevention/pages/my_appbar.dart'; +import 'package:qhd_prevention/services/nfc_service.dart'; import 'package:qhd_prevention/tools/tools.dart'; class HomeNfcDetailPage extends StatefulWidget { const HomeNfcDetailPage({super.key, required this.info}); - final Map info; + final Map info; @override State createState() => _HomeNfcDetailPageState(); } class _HomeNfcDetailPageState extends State { - List items = []; + List items = []; int currentPage = 1; final int pageSize = 10; + late var _total = 0; + late var _totalResult = 0; bool isLoading = false; // 当前请求中 bool hasMore = true; // 是否还有更多数据 @@ -61,11 +69,15 @@ class _HomeNfcDetailPageState extends State { } try { - // 调用后端 API:我保持你原来的签名 ApiService.nfcTaskDetailList(pageSize, page) + Map data = { + "PATROL_TASK_ID": widget.info['PATROL_TASK_ID'] ?? '', + "PERIOD_START_TIME": widget.info['PERIOD_START_TIME'] ?? '', + "PERIOD_END_TIME": widget.info['PERIOD_END_TIME'] ?? '', + }; final result = await ApiService.nfcTaskDetailList( pageSize, currentPage, - widget.info['PATROL_TASK_ID'] ?? '', + data, ); if (result == null) { @@ -74,35 +86,20 @@ class _HomeNfcDetailPageState extends State { } printLongString(jsonEncode(result)); if (result['result'] == 'success') { - // 兼容常见返回字段,尽量从 data / rows / list 里取 final dynamic rawList = result['varList']; - - List fetched = []; - if (rawList is List) { - fetched = - rawList.map((e) { - if (e is ProgressItem) return e; - if (e is Map) return ProgressItem.fromJson(e); - return ProgressItem( - status: '未查', - location: e?.toString() ?? '', - code: '', - checkTime: null, - ); - }).toList(); - } - setState(() { + Map page = result['page']; + _totalResult = page['totalResult'] as int; + _total = result['checkedCount'] as int; if (refresh) { - items = fetched; + items = rawList; } else { - items.addAll(fetched); + items.addAll(rawList); } // 如果本次返回少于 pageSize 则说明没有更多 - if (fetched.length < pageSize) { + if (rawList.length < pageSize) { hasMore = false; } else { - // 成功拿到一页,页码自增 currentPage++; } }); @@ -126,23 +123,74 @@ class _HomeNfcDetailPageState extends State { ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(msg))); } - Future _startCheckItem(ProgressItem item, int index) async { - // TODO: 根据业务替换为真实逻辑(例如跳转到检查页面或调用写 NFC) - // 这里示例:将当前项标记为已查并设置检查时间(仅本地更新) - final now = DateTime.now(); - setState(() { - items[index] = items[index].copyWith( - status: '已查', - checkTime: - '${now.year}-${_two(now.month)}-${_two(now.day)} ${_two(now.hour)}:${_two(now.minute)}', - ); - }); + Future _startCheckItem(Map item, int index) async { + final confirmed = await CustomAlertDialog.showConfirm( + context, + title: '温馨提示', + content: '请将手机贴近设备标签', + cancelText: '', + confirmText: '我知道了', + barrierDismissible: false, + ); + if (confirmed) { + LoadingDialogHelper.show(message: '等待设备靠近设备NFC标签'); + NfcService.instance.startScanOnceWithCallback( + onResult: (uid, parsedText, rawMsg) async { + _getNFCForUid(uid, parsedText); + }, + onError: (err) { - // 额外:你可能需要调用后端接口上报检查结果 - // await ApiService.reportCheck(items[index].code, ...); + ToastUtil.showError(context, '$err'); + LoadingDialogHelper.hide(); + }, + timeout: Duration(seconds: 12), + ); + } } - String _two(int v) => v.toString().padLeft(2, '0'); + Future _getNFCForUid(String uid, String parsedText) async { + if (uid.isEmpty || parsedText.isEmpty) { + ToastUtil.showError(context, 'NFC设备标签数据为空'); + LoadingDialogHelper.hide(); + + return; + } + Map result = {}; + // mapToCompactJson({'PIPELINE_AREA_ID':pd['PIPELINE_AREA_ID'],'EQUIPMENT_PIPELINE_ID':pd['EQUIPMENT_PIPELINE_ID']}), + for (Map item in items) { + if (parsedText.isNotEmpty && item['NFC_CODE'] == uid) { + try{ + Map parsedData = jsonDecode(parsedText); + if (parsedData['PIPELINE_AREA_ID'] == item['PIPELINE_AREA_ID'] && + parsedData['EQUIPMENT_PIPELINE_ID'] == item['EQUIPMENT_PIPELINE_ID']) { + result = item; + } + LoadingDialogHelper.hide(); + + }catch(e){ + LoadingDialogHelper.hide(); + + ToastUtil.showError(context, 'NFC设备数据错误'); + } + + } + } + if (result.isEmpty) { + LoadingDialogHelper.hide(); + + ToastUtil.showError(context, 'NFC设备不在当前任务中'); + return; + } + LoadingDialogHelper.hide(); + + Map data = {...result, ...widget.info, "NFC_CODE": uid, 'MANUAL_CONFIRMATION': '0', + }; + await pushPage( + HomeNfcCheckDangerPage(info: data, facebookImages: [], isNfcError: false,), + context, + ); + _getTaskDetail(refresh: true); + } @override void dispose() { @@ -150,7 +198,7 @@ class _HomeNfcDetailPageState extends State { super.dispose(); } - Widget _pendingTopCard(Map item) { + Widget _pendingTopCard(Map item) { return SizedBox( height: 180, child: Stack( @@ -232,45 +280,43 @@ class _HomeNfcDetailPageState extends State { } /// 构建信息网格 - Widget _buildInfoGrid(Map item) { - return Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // const SizedBox(height: 8), - ItemListWidget.singleLineTitleText( - label: '负责部门', - isEditable: false, - text: item['DEPARTMENT_NAME'] ?? '', - ), - ItemListWidget.singleLineTitleText( - label: '负责人', - isEditable: false, - text: item['USER_NAME'] ?? '', - ), - ItemListWidget.singleLineTitleText( - label: '涉及管道区域:', - isEditable: false, - text: item['PIPELINE_AREAS_NAMES'] ?? '', - ), - ItemListWidget.singleLineTitleText( - label: '巡检周期', - isEditable: false, - text: item['PATROL_PERIOD_NAME'] ?? '', - ), - ItemListWidget.singleLineTitleText( - label: '任务时间', - isEditable: false, - text: item['OPERATTIME'] ?? '', - ), - ], - ), + Widget _buildInfoGrid(Map item) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // const SizedBox(height: 8), + ItemListWidget.singleLineTitleText( + label: '负责部门', + isEditable: false, + text: item['DEPARTMENT_NAME'] ?? '', + ), + ItemListWidget.singleLineTitleText( + label: '负责人', + isEditable: false, + text: item['USER_NAME'] ?? '', + ), + ItemListWidget.singleLineTitleText( + label: '涉及管道区域:', + isEditable: false, + text: item['PIPELINE_AREAS_NAMES'] ?? '', + ), + ItemListWidget.singleLineTitleText( + label: '巡检周期', + isEditable: false, + text: item['PATROL_PERIOD_NAME'] ?? '', + ), + ItemListWidget.singleLineTitleText( + label: '任务时间', + isEditable: false, + text: item['OPERATTIME'] ?? '', + ), + ], ); } Widget _buildListItem(BuildContext context, int idx) { final item = items[idx]; - final bool unchecked = item.status == '未查'; + final bool unchecked = item['INSPECTED_FLAG'] == '0'; return Container( height: 100, @@ -294,7 +340,7 @@ class _HomeNfcDetailPageState extends State { Positioned( top: 2, child: Text( - item.status, + unchecked ? '未查' : '已查', style: const TextStyle(color: Colors.white, fontSize: 14), ), ), @@ -309,51 +355,97 @@ class _HomeNfcDetailPageState extends State { // 中间详情 Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - item.location, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, + child: GestureDetector( + onTap: (){ + if (!unchecked) { + Map data = {...item, ...widget.info, "NFC_CODE": item['PIPELINE_AREA_ID'], 'MANUAL_CONFIRMATION': '0', + }; + pushPage( + HomeNfcCheckDangerPage(info: data, facebookImages: [], isNfcError: false,), + context, + ); + } + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + item['PIPELINE_AREA_NAME'] ?? '', + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + ), + maxLines: 1, // 最多一行 + overflow: TextOverflow.ellipsis, // 超出省略号 ), - maxLines: 1, // 最多一行 - overflow: TextOverflow.ellipsis, // 超出省略号 - ), - const SizedBox(height: 4), - Text('NFC编码:${item.code}'), - const SizedBox(height: 6), - unchecked - ? InkWell( - onTap: () => _startCheckItem(item, idx), - child: Container( - height: 35, - alignment: Alignment.center, - padding: const EdgeInsets.symmetric(vertical: 1), - decoration: BoxDecoration( - gradient: const LinearGradient( - colors: [Color(0xFFFFA726), Color(0xFFFF7043)], + const SizedBox(height: 4), + Text('NFC编码:${item['NFC_CODE'] ?? ''}'), + const SizedBox(height: 6), + unchecked + ? Row( + spacing: 10, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: InkWell( + onTap: () => _startCheckItem(item, idx), + child: Container( + height: 35, + // width: 120, + alignment: Alignment.center, + padding: const EdgeInsets.symmetric(vertical: 1), + decoration: BoxDecoration( + gradient: const LinearGradient( + colors: [ + Color(0xFFFFA726), + Color(0xFFFF7043), + ], + ), + borderRadius: BorderRadius.circular(5), + ), + child: const Text( + 'NFC检查', + style: TextStyle( + color: Colors.white, + fontSize: 15, + ), + ), ), - borderRadius: BorderRadius.circular(5), - ), - child: const Text( - '开始检查', - style: TextStyle(color: Colors.white, fontSize: 14), ), ), - ) - : Text( - '检查时间:${item.checkTime ?? ''}', - style: const TextStyle(fontSize: 14), - textAlign: TextAlign.center, - ), - ], - ), + CustomButton( + onPressed: () { + pushPage( + NfcQuestionFecebook( + info: item, + taskInfo: widget.info, + ), + context, + ); + }, + text: '手动检查', + height: 35, + textStyle: TextStyle( + color: Colors.white, + fontSize: 15, + ), + backgroundColor: Colors.blue, + ), + ], + ) + : Text( + '检查时间:${item['PATROL_TIME'] ?? ''}', + style: const TextStyle(fontSize: 14), + textAlign: TextAlign.center, + ), + ], + ), + ) ), // 右侧箭头 const SizedBox(width: 8), + if (!unchecked) const Icon(Icons.chevron_right, color: Colors.grey), ], ), @@ -371,6 +463,7 @@ class _HomeNfcDetailPageState extends State { children: [ _pendingTopCard(widget.info), const SizedBox(height: 60), + Expanded( child: Container( decoration: BoxDecoration( @@ -384,61 +477,133 @@ class _HomeNfcDetailPageState extends State { ), ], ), - child: RefreshIndicator( - onRefresh: () => _getTaskDetail(refresh: true), - child: - firstLoad && isLoading - ? const Center( - child: Padding( - padding: EdgeInsets.all(16.0), - child: CircularProgressIndicator(), + // 白色容器内部:统计行 + 列表(统计行放在列表顶部) + child: Column( + children: [ + // 统计行(放在容器顶部,作为视觉上的头部) + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 10, + ), + child: Builder( + builder: (context) { + return Container( + width: double.infinity, + padding: const EdgeInsets.symmetric( + horizontal: 5, + vertical: 8, ), - ) - : items.isEmpty - ? ListView( - controller: _scrollController, - physics: const AlwaysScrollableScrollPhysics(), - children: [ - const SizedBox(height: 80), - Center( - child: Text(isLoading ? '加载中...' : '暂无数据'), - ), - ], - ) - : ListView.builder( - controller: _scrollController, - physics: const AlwaysScrollableScrollPhysics(), - itemCount: items.length + 1, // 多一个用于加载状态/底部提示 - itemBuilder: (ctx, idx) { - if (idx < items.length) { - return _buildListItem(ctx, idx); - } else { - // 底部加载/没有更多提示 - if (hasMore) { - // 触发加载(以防没有触发) - if (!isLoading) { - // 预防性触发下一页 - // _getTaskDetail(); // 不在此直接调用,scroll listener 会负责 - } - return const Padding( - padding: EdgeInsets.symmetric( - vertical: 12, + + child: Row( + children: [ + Text( + '已查点位 $_total / $_totalResult ', + style: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + ), + ), + const Spacer(), + if (isLoading) + const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator( + strokeWidth: 2, ), - child: Center( - child: CircularProgressIndicator(), + ) + else + GestureDetector( + onTap: + () => _getTaskDetail(refresh: true), + child: Row( + children: const [ + Icon( + Icons.refresh, + size: 16, + color: Colors.grey, + ), + SizedBox(width: 4), + Text( + '刷新', + style: TextStyle( + fontSize: 12, + color: Colors.grey, + ), + ), + ], ), - ); - } else { - return const Padding( - padding: EdgeInsets.symmetric( - vertical: 12, + ), + ], + ), + ); + }, + ), + ), + + // 列表区域(占用剩余空间) + Expanded( + child: RefreshIndicator( + onRefresh: () => _getTaskDetail(refresh: true), + child: + firstLoad && isLoading + ? const Center( + child: Padding( + padding: EdgeInsets.all(16.0), + child: CircularProgressIndicator(), + ), + ) + : items.isEmpty + ? ListView( + // 保持可下拉刷新 + controller: _scrollController, + physics: + const AlwaysScrollableScrollPhysics(), + children: [ + const SizedBox(height: 40), + Center( + child: Text( + isLoading ? '加载中...' : '暂无数据', + ), ), - child: Center(child: Text('没有更多了')), - ); - } - } - }, - ), + ], + ) + : ListView.builder( + controller: _scrollController, + physics: + const AlwaysScrollableScrollPhysics(), + itemCount: + items.length + 1, // 多一个用于加载状态/底部提示 + itemBuilder: (ctx, idx) { + if (idx < items.length) { + return _buildListItem(ctx, idx); + } else { + // 底部加载/没有更多提示 + if (hasMore) { + return const Padding( + padding: EdgeInsets.symmetric( + vertical: 12, + ), + child: Center( + child: + CircularProgressIndicator(), + ), + ); + } else { + return const Padding( + padding: EdgeInsets.symmetric( + vertical: 12, + ), + child: Center(child: Text('没有更多了')), + ); + } + } + }, + ), + ), + ), + ], ), ), ), @@ -449,96 +614,3 @@ class _HomeNfcDetailPageState extends State { ); } } - -/// 单条进度数据模型 -class ProgressItem { - final String status; // “未查” 或 “已查” - final String location; // 地点 - final String code; // 编码 - final String? checkTime; // 检查时间(已查时有值) - - ProgressItem({ - required this.status, - required this.location, - required this.code, - this.checkTime, - }); - - ProgressItem copyWith({ - String? status, - String? location, - String? code, - String? checkTime, - }) { - return ProgressItem( - status: status ?? this.status, - location: location ?? this.location, - code: code ?? this.code, - checkTime: checkTime ?? this.checkTime, - ); - } - - /// 宽容解析后端返回(根据常见字段名) - factory ProgressItem.fromJson(Map json) { - String status = - (json['status'] ?? - json['STATUS'] ?? - (json['checked'] == true ? '已查' : null) ?? - (json['is_checked'] == 1 ? '已查' : null) ?? - json['state'] ?? - json['check_status']) - ?.toString() ?? - ''; - - if (status.isEmpty) { - // 有些 API 用 0/1 表示 - final s = json['status'] ?? json['STATUS'] ?? json['check_status']; - if (s is num) { - status = (s == 0) ? '未查' : '已查'; - } else if (s is String && (s == '0' || s == '1')) { - status = (s == '0') ? '未查' : '已查'; - } - } - if (status.isEmpty) status = '未查'; - - final location = - (json['location'] ?? - json['LOCATION'] ?? - json['point_name'] ?? - json['address'] ?? - json['point'] ?? - '') - .toString(); - final code = - (json['code'] ?? - json['CODE'] ?? - json['nfcCode'] ?? - json['nfc_code'] ?? - json['NFC_CODE'] ?? - json['id'] ?? - '') - .toString(); - final checkTime = - (json['checkTime'] ?? - json['CHECK_TIME'] ?? - json['checked_at'] ?? - json['check_time'] ?? - json['inspect_time'] ?? - null) - ?.toString(); - - return ProgressItem( - status: status, - location: location, - code: code, - checkTime: checkTime, - ); - } - - Map toJson() => { - 'status': status, - 'location': location, - 'code': code, - 'checkTime': checkTime, - }; -} diff --git a/lib/pages/home/NFC/nfc_check_danger_detail.dart b/lib/pages/home/NFC/nfc_check_danger_detail.dart new file mode 100644 index 0000000..5bbafda --- /dev/null +++ b/lib/pages/home/NFC/nfc_check_danger_detail.dart @@ -0,0 +1,583 @@ +import 'dart:convert'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:intl/intl.dart'; +import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart'; +import 'package:qhd_prevention/customWidget/bottom_picker.dart'; +import 'package:qhd_prevention/customWidget/bottom_picker_two.dart'; +import 'package:qhd_prevention/customWidget/custom_button.dart'; +import 'package:qhd_prevention/customWidget/date_picker_dialog.dart'; +import 'package:qhd_prevention/customWidget/department_person_picker.dart'; +import 'package:qhd_prevention/customWidget/department_picker.dart'; +import 'package:qhd_prevention/customWidget/department_picker_hidden_type.dart'; +import 'package:qhd_prevention/customWidget/department_picker_two.dart'; +import 'package:qhd_prevention/customWidget/toast_util.dart'; +import 'package:qhd_prevention/pages/home/tap/item_list_widget.dart'; +import 'package:qhd_prevention/pages/my_appbar.dart'; +import 'package:qhd_prevention/tools/tools.dart'; +import '../../../customWidget/photo_picker_row.dart'; +import '../../../http/ApiService.dart'; + +class NfcCheckDangerDetail extends StatefulWidget { + const NfcCheckDangerDetail({super.key, required this.info}); + + final Map info; + + @override + State createState() => _NfcCheckDangerDetailState(); +} + +class _NfcCheckDangerDetailState extends State { + late Map pd = {}; + + //隐患级别 + late List _hazardLeveLlist = []; + late List _hiddenTypeList = []; + late bool _isDanger = false; //true 1 false 2 + + // 存储各单位的人员列表 + Map _personCache = {}; + + // 隐患图片 + late List imgList = []; + late List _videos = []; + + // 整改图片 + late List zgImgList = []; + + @override + void initState() { + // TODO: implement initState + super.initState(); + pd = widget.info; + if (pd.isNotEmpty) { + imgList = pd['imgList'] ?? []; + _videos = pd['videoList'] ?? []; + zgImgList = pd['gzImageList'] ?? []; + + } + _getHazardLevel(); + } + + Future _getHazardLevel() async { + final resultLevel = await ApiService.getHiddenLevelsListTwo(); + List levelList = resultLevel['list'] as List; + String parentId = ''; + for (var item in levelList) { + if ((item['BIANMA'] as String).contains( + SessionService.instance.loginUser?["PROVINCE"] ?? '', + )) { + parentId = item['DICTIONARIES_ID']; + break; + } + } + final result = await ApiService.getHiddenTypeList(parentId); + final nodes = result['zTreeNodes'] as String; + SessionService.instance.departmentHiddenTypeJsonStr = nodes; + setState(() { + _hiddenTypeList = json.decode(nodes) as List; + }); + + try { + final result = await ApiService.getHazardLevel(); + if (result['result'] == 'success') { + final List newList = result['list'] ?? []; + setState(() { + _hazardLeveLlist = newList; + }); + } + } catch (e) { + print('Error fetching data: $e'); + } + } + + Future _pickHazardType() async { + showModalBottomSheet( + context: context, + isScrollControlled: true, + barrierColor: Colors.black54, + backgroundColor: Colors.transparent, + builder: + (_) => DepartmentPickerHiddenType( + onSelected: (result) { + try { + final Map m = Map.from(result); + final ids = List.from(m['id'] ?? []); + final names = List.from(m['name'] ?? []); + setState(() { + pd['HIDDENTYPE'] = ids; + pd['HIDDENTYPE_NAME'] = names.join('/'); + }); + FocusHelper.clearFocus(context); + } catch (_) {} + }, + ), + ); + } + + Future chooseDangerLevel() async { + FocusScope.of(context).unfocus(); + WidgetsBinding.instance.addPostFrameCallback((_) async { + Map _hazardLeve = {}; + String choice = await BottomPickerTwo.show( + context, + items: _hazardLeveLlist, + itemBuilder: (item) => Text(item["NAME"], textAlign: TextAlign.center), + initialIndex: 0, + ); + if (choice != null) { + for (int i = 0; i < _hazardLeveLlist.length; i++) { + if (choice == _hazardLeveLlist[i]["NAME"]) { + _hazardLeve = _hazardLeveLlist[i]; + } + } + setState(() { + pd['HIDDENLEVELNAME'] = _hazardLeve["NAME"]; + pd['HIDDENLEVEL'] = _hazardLeve["BIANMA"]; + }); + } + }); + + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppbar(title: "隐患登记"), + body: Column( + children: [ + // 详情滚动区域 + _pageDetail(), + ], + ), + ); + } + + /// 弹出单位选择 + void chooseUnitHandle(String typeStr) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + barrierColor: Colors.black54, + backgroundColor: Colors.transparent, + builder: + (_) => DepartmentPicker( + onSelected: (id, name) async { + setState(() { + pd['RECTIFICATIONDEPT'] = id; + pd['RECTIFICATIONDEPTNAME'] = name; + }); + FocusHelper.clearFocus(context); + _getPersonListForUnitId(typeStr); + }, + ), + ).then((_) {}); + } + + Future _getPersonListForUnitId(String typeStr) async { + String unitId = pd['RECTIFICATIONDEPT'] ?? ''; + // 拉取该单位的人员列表并缓存 + final result = await ApiService.getListTreePersonList(unitId); + setState(() { + _personCache[typeStr] = List>.from( + result['userList'] as List, + ); + }); + FocusHelper.clearFocus(context); + } + + /// 弹出人员选择,需先选择单位 + void choosePersonHandle(String typeStr) async { + final personList = _personCache[typeStr]; + if (!FormUtils.hasValue(_personCache, typeStr)) { + ToastUtil.showNormal(context, '请先选择单位'); + return; + } + + DepartmentPersonPicker.show( + context, + personsData: personList!, + onSelectedWithIndex: (userId, name, index) { + setState(() { + pd['RECTIFICATIONOR'] = userId; + pd['RECTIFICATIONORNAME'] = name; + }); + FocusHelper.clearFocus(context); + }, + ).then((_) {}); + } + + Widget _buildSectionContainer({required Widget child}) { + return Container( + margin: const EdgeInsets.only(top: 10), + color: Colors.white, + padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10), + child: child, + ); + } + + Widget _pageDetail() { + return Expanded( + child: SingleChildScrollView( + padding: const EdgeInsets.only(bottom: 20), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 8), + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ItemListWidget.itemContainer( + horizontal: 5, + Column( + children: [ + RepairedPhotoSection( + title: "隐患照片", + maxCount: 4, + initialMediaPaths: imgList, + mediaType: MediaType.image, + isShowAI: true, + onMediaAdded: (localPath) { + imgList.add(localPath); + }, + onMediaRemoved: (localPath) { + imgList.remove(localPath); + }, + onChanged: (v) {}, + onAiIdentify: () { + // AI 识别逻辑 + if (imgList.isEmpty) { + ToastUtil.showNormal(context, "请先上传一张图片"); + return; + } + if (imgList.length > 1) { + ToastUtil.showNormal(context, "识别暂时只能上传一张图片"); + return; + } + _identifyImg(imgList[0]); + }, + ), + RepairedPhotoSection( + title: "隐患视频", + maxCount: 1, + mediaType: MediaType.video, + onChanged: (v) {}, + onMediaRemoved: (localPath) { + _videos = [localPath]; + }, + onMediaAdded: (localPath) { + _videos = []; + }, + onAiIdentify: () { + // AI 视频识别逻辑 + }, + ), + ], + ), + ), + + ItemListWidget.multiLineTitleTextField( + label: '隐患描述', + isEditable: true, + isRequired: false, + text: pd['HIDDENDESCR'] ?? '', + hintText: '请对隐患进行详细描述(必填项)', + onChanged: (v) { + setState(() { + pd['HIDDENDESCR'] = v; + }); + }, + ), + const Divider(), + + ItemListWidget.multiLineTitleTextField( + label: '隐患部位', + isEditable: true, + isRequired: false, + // controller: TextEditingController(text: pd['HIDDENPART'] ?? ''), + text: pd['HIDDENPART'] ?? '', + hintText: '请对隐患部位进行详细描述(必填项)', + onChanged: (v) { + setState(() { + pd['HIDDENPART'] = v; + }); + }, + ), + const Divider(), + + ItemListWidget.selectableLineTitleTextRightButton( + label: '隐患级别', + isRequired: false, + isEditable: true, + text: pd['HIDDENLEVELNAME'] ?? '', + onTap: chooseDangerLevel, + ), + const Divider(), + ItemListWidget.selectableLineTitleTextRightButton( + label: '隐患类型', + isEditable: true, + isRequired: false, + text: pd['HIDDENTYPE_NAME'] ?? '', + onTap: _pickHazardType, + ), + const Divider(), + + ListItemFactory.createYesNoSection( + title: "是否立即整改", + horizontalPadding: 0, + verticalPadding: 0, + yesLabel: "是", + noLabel: "否", + groupValue: _isDanger, + + onChanged: (val) { + setState(() { + _isDanger = val; + }); + }, + ), + const Divider(), + if (_isDanger) + Column( + children: [ + ItemListWidget.multiLineTitleTextField( + label: '整改描述', + isEditable: true, + isRequired: false, + text: pd['RECTIFYDESCR'] ?? '', + hintText: '请对隐患进行详细描述(必填项)', + onChanged: (v) { + setState(() { + pd['RECTIFYDESCR'] = v; + + }); + }, + ), + const Divider(), + RepairedPhotoSection( + horizontalPadding: 12, + title: "整改后图片", + maxCount: 4, + initialMediaPaths: zgImgList, + mediaType: MediaType.image, + isShowAI: false, + + onMediaAdded: (localPath) { + zgImgList.add(localPath); + }, + onMediaRemoved: (localPath) { + zgImgList.remove(localPath); + }, + onChanged: (v) {}, + onAiIdentify: () {}, + ), + ], + ), + if (!_isDanger) + Column( + children: [ + ItemListWidget.selectableLineTitleTextRightButton( + label: '整改责任部门', + isEditable: true, + isRequired: false, + text: pd['RECTIFICATIONDEPTNAME'] ?? '', + onTap: () { + chooseUnitHandle('key'); + }, + ), + const Divider(), + ItemListWidget.selectableLineTitleTextRightButton( + label: '整改责任人', + isEditable: true, + isRequired: false, + text: pd['RECTIFICATIONORNAME'] ?? '', + onTap: () { + choosePersonHandle('key'); + }, + ), + const Divider(), + ItemListWidget.selectableLineTitleTextRightButton( + label: '整改期限', + isEditable: true, + isRequired: false, + text: pd['RECTIFICATIONDEADLINE'] ?? '', + onTap: () { + showDialog( + context: context, + builder: + (_) => HDatePickerDialog( + initialDate: DateTime.now(), + onCancel: () => Navigator.of(context).pop(), + onConfirm: (selected) { + Navigator.of(context).pop(); + setState(() { + pd['RECTIFICATIONDEADLINE'] = DateFormat( + 'yyyy-MM-dd', + ).format(selected); + }); + }, + ), + ); + }, + ), + const Divider(), + ], + ), + + SizedBox(height: 30), + CustomButton( + onPressed: () { + _riskListCheckAppAdd(); + }, + text: "确定", + backgroundColor: Colors.blue, + ), + SizedBox(height: 30), + ], + ), + ), + ), + ); + } + + Future _riskListCheckAppAdd() async { + if (imgList.isEmpty) { + ToastUtil.showNormal(context, '请上传隐患图片'); + return; + } + final textRules = >[ + {'value': pd['HIDDENDESCR'] ?? '', 'message': '请填隐患描述'}, + {'value': pd['HIDDENPART'] ?? '', 'message': '请填隐患部位'}, + {'value': pd['HIDDENLEVEL'] ?? '', 'message': '请选择隐患级别'}, + {'value': pd['HIDDENTYPE_NAME'] ?? '', 'message': '请选择隐患类型'}, + ]; + for (Map rule in textRules) { + String value = rule['value']; + if (value.isEmpty) { + ToastUtil.showNormal(context, rule['message']); + return; + } + } + if (_isDanger) { + if (!FormUtils.hasValue(pd, 'RECTIFYDESCR')) { + ToastUtil.showNormal(context, '请填整改描述'); + return; + } + if (zgImgList.isEmpty) { + ToastUtil.showNormal(context, '请上传整改后图片'); + return; + } + } else { + if (!FormUtils.hasValue(pd, 'RECTIFICATIONDEPT')) { + ToastUtil.showNormal(context, '请选择整改部门'); + return; + } + if (!FormUtils.hasValue(pd, 'RECTIFICATIONOR')) { + ToastUtil.showNormal(context, '请选择整改人'); + return; + } + if (!FormUtils.hasValue(pd, 'RECTIFICATIONDEADLINE')) { + ToastUtil.showNormal(context, '请选择整改期限'); + return; + } + } + List HIDDENTYPE = pd['HIDDENTYPE'] ?? []; + pd['RECTIFICATIONTYPE'] = _isDanger ? '1' : '2'; + pd['CREATOR'] = SessionService.instance.loginUserId; + pd['SOURCE'] = '6'; + pd['HIDDENTYPE1'] = HIDDENTYPE.length > 0 ? HIDDENTYPE[0] : ""; + pd['HIDDENTYPE2'] = HIDDENTYPE.length > 1 ? HIDDENTYPE[1] : ""; + pd['HIDDENTYPE3'] = HIDDENTYPE.length > 2 ? HIDDENTYPE[2] : ""; + + pd['imgList'] = imgList; + pd['videoList'] = _videos; + pd['gzImageList'] = zgImgList; + + Navigator.pop(context, pd); + } + + Future _identifyImg(String imagePath) async { + try { + LoadingDialogHelper.show(); + final raw = await ApiService.identifyImg(imagePath); + if (raw['result'] == 'success') { + final dynamic parsedRes = raw; + final aiHiddens = parsedRes['aiHiddens']; + + String hiddenDescr = ''; + String rectificationSuggestions = ''; + String legalBasis = ''; + + if (aiHiddens is List) { + for (var item in aiHiddens) { + dynamic obj = item; + if (item is String) { + try { + obj = json.decode(item); + } catch (e) { + // 解析失败跳过 + continue; + } + } + + if (obj is Map) { + hiddenDescr += (obj['hiddenDescr']?.toString() ?? '') + ';'; + rectificationSuggestions += + (obj['rectificationSuggestions']?.toString() ?? '') + ';'; + legalBasis += (obj['legalBasis']?.toString() ?? '') + ';'; + } + } + } + + // 将结果赋回(如果 pd 是 Map) + setState(() { + pd['HIDDENDESCR'] = hiddenDescr; + pd['LEGALBASIS'] = legalBasis; + pd['RECTIFYDESCR'] = rectificationSuggestions; + }); + LoadingDialogHelper.hide(); + } else { + ToastUtil.showNormal(context, "识别失败"); + LoadingDialogHelper.hide(); + // _showMessage('反馈提交失败'); + // return ""; + } + } catch (e) { + // 出错时可以 Toast 或者在页面上显示错误状态 + print('加载首页数据失败:$e'); + // return ""; + LoadingDialogHelper.hide(); + } + } + + Future _determinePosition() async { + bool serviceEnabled; + LocationPermission permission; + + // 检查定位服务是否启用 + serviceEnabled = await Geolocator.isLocationServiceEnabled(); + if (!serviceEnabled) { + return Future.error('Location services are disabled.'); + } + + // 获取权限 + permission = await Geolocator.checkPermission(); + if (permission == LocationPermission.denied) { + permission = await Geolocator.requestPermission(); + if (permission == LocationPermission.denied) { + return Future.error('Location permissions are denied'); + } + } + + if (permission == LocationPermission.deniedForever) { + return Future.error( + 'Location permissions are permanently denied, we cannot request permissions.', + ); + } + + // 获取当前位置 + return await Geolocator.getCurrentPosition( + desiredAccuracy: LocationAccuracy.high, + ); + } +} diff --git a/lib/pages/home/NFC/nfc_question_fecebook.dart b/lib/pages/home/NFC/nfc_question_fecebook.dart new file mode 100644 index 0000000..c0980e9 --- /dev/null +++ b/lib/pages/home/NFC/nfc_question_fecebook.dart @@ -0,0 +1,241 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:qhd_prevention/customWidget/photo_picker_row.dart'; +import 'package:qhd_prevention/customWidget/toast_util.dart'; +import 'package:qhd_prevention/http/ApiService.dart'; +import 'package:qhd_prevention/pages/home/NFC/home_nfc_check_danger_page.dart'; +import 'package:qhd_prevention/pages/my_appbar.dart'; +import 'package:qhd_prevention/tools/tools.dart'; + +// feedback_type.dart +enum NfcFeedbackType { + readError('读取失败', 0), + nfcBld('标签损坏', 1), + nfcLose('标签丢失', 2); + + final String typeName; + final int type; + + const NfcFeedbackType(this.typeName, this.type); +} + +class NfcQuestionFecebook extends StatefulWidget { + const NfcQuestionFecebook({super.key, required this.info,required this.taskInfo}); + + final Map taskInfo; + final Map info; + + @override + State createState() => _NfcQuestionFecebookState(); +} + +class _NfcQuestionFecebookState extends State { + final _formKey = GlobalKey(); + final TextEditingController _descriptionController = TextEditingController(); + final FocusNode _descriptionFocus = FocusNode(); // <- 新增 + + // 反馈类型 + NfcFeedbackType? _selectedType = NfcFeedbackType.readError; + + // 上传的图片 + List _images = []; + + @override + void initState() { + // TODO: implement initState + super.initState(); + _getFacebookDetail(); + } + + Future _getFacebookDetail() async { + final result = await ApiService.getNfcFeedBackDetail({}); + try{ + if (result['result'] == 'success') { + + } + }catch(e) {} + } + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppbar(title: "NFC异常上报"), + body: Container( + color: Colors.white, + child: Form( + key: _formKey, + child: SingleChildScrollView( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // 问题描述 + const Text( + '详细问题', + style: TextStyle(fontWeight: FontWeight.bold), + ), + const SizedBox(height: 8), + TextFormField( + controller: _descriptionController, + focusNode: _descriptionFocus, + autofocus: false, + maxLines: 5, + decoration: const InputDecoration( + hintText: '请补充详细问题...', + border: OutlineInputBorder(), + contentPadding: EdgeInsets.all(10), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return '请补充详细问题'; + } + return null; + }, + ), + const SizedBox(height: 24), + + // 反馈类型 + const Text( + '反馈类型', + style: TextStyle(fontWeight: FontWeight.bold), + ), + const SizedBox(height: 8), + Wrap( + spacing: 16, + children: + NfcFeedbackType.values.map((type) { + return ChoiceChip( + label: Text(type.typeName), + selected: _selectedType == type, + onSelected: (selected) { + setState(() { + if (selected) { + _selectedType = type; + } + }); + }, + ); + }).toList(), + ), + + // 图片上传 + const SizedBox(height: 16), + + RepairedPhotoSection( + horizontalPadding: 0, + title: "请提供相关问题照片", + maxCount: 4, + mediaType: MediaType.image, + isCamera: true, + onChanged: (files) { + // 上传 files 到服务器 + _images.clear(); + for (int i = 0; i < files.length; i++) { + _images.add(files[i].path); + } + }, + onAiIdentify: () {}, + ), + const SizedBox(height: 40), + + // 提交按钮 + SizedBox( + width: double.infinity, + child: ElevatedButton( + onPressed: _submitFeedback, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.blue, + padding: const EdgeInsets.symmetric(vertical: 16), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + child: const Text( + '下一步', + style: TextStyle(fontSize: 18, color: Colors.white), + ), + ), + ), + ], + ), + ), + ), + ), + ); + } + + // 提交反馈 + Future _submitFeedback() async { + final text = _descriptionController.text.trim(); + + if (text.isEmpty) { + _showMessage('请填写问题'); + return; + } + + if (_images.isEmpty) { + _showMessage('请上传图片'); + return; + } + Map data = { + ...widget.info, + ...widget.taskInfo, + 'EXCEPTION_TYPE': _selectedType?.type, + 'MANUAL_CONFIRMATION': '1', + // 'PHOTO_URL': imagePaths, + 'DESCRIPTION': text, + }; + + pushPage(HomeNfcCheckDangerPage(info: data, facebookImages: _images, isNfcError: true,), context); + + // String imagePaths = ""; + // for (int i = 0; i < _images.length; i++) { + // String imagePath = await _reloadFeedBack(_images[i]); + // + // if (0 == i) { + // imagePaths = imagePath; + // } else { + // imagePaths = "$imagePaths,$imagePath"; + // } + // } + // + // _setFeedBack(text, imagePaths); + } + @override + void dispose() { + _descriptionController.dispose(); + super.dispose(); + } + + + Future _setFeedBack(String text, String imagePaths) async { + try { + Map data = { + "PATROL_TASK_ID":widget.taskInfo['PATROL_TASK_ID']?? '', + "PIPELINE_AREA_ID" :widget.taskInfo['PIPELINE_AREA_ID']?? '', + "EQUIPMENT_PIPELINE_ID" :widget.info['EQUIPMENT_PIPELINE_ID']?? '', + "PATROL_RECORD_ID" :widget.info['EQUIPMENT_PIPELINE_ID'] ?? '', + "PATROL_RECORD_DETAIL_ID" :widget.info['PATROL_RECORD_DETAIL_ID']?? '', + + "NFC_CODE" :widget.info['PIPELINE_AREA_ID'], + 'EXCEPTION_TYPE': _selectedType?.type, + 'PHOTO_URL': imagePaths, + 'DESCRIPTION': text, + }; + + final raw = await ApiService.nfcFeedBack(data); + + if (raw['result'] == 'success') { + _showMessage('提交成功'); + } else { + _showMessage('提交失败'); + } + } catch (e) { + // 出错时可以 Toast 或者在页面上显示错误状态 + print('加载首页数据失败:$e'); + } + } + + void _showMessage(String msg) { + ToastUtil.showNormal(context, msg); + } +} diff --git a/lib/pages/home/tap/item_list_widget.dart b/lib/pages/home/tap/item_list_widget.dart index 57e1a49..d9ed4b8 100644 --- a/lib/pages/home/tap/item_list_widget.dart +++ b/lib/pages/home/tap/item_list_widget.dart @@ -120,8 +120,9 @@ class ItemListWidget { Expanded( child: isEditable - ? TextField( + ? TextFormField( autofocus: false, + initialValue: text, controller: controller, keyboardType: TextInputType.multiline, maxLines: null, @@ -131,9 +132,10 @@ class ItemListWidget { textAlignVertical: TextAlignVertical.top, style: TextStyle(fontSize: fontSize), decoration: InputDecoration( + hintText: hintText, // 去掉 TextField 默认内边距 - //contentPadding: EdgeInsets.zero, + contentPadding: EdgeInsets.zero, border: InputBorder.none, ), ) diff --git a/lib/services/nfc_service.dart b/lib/services/nfc_service.dart index 6e8d90a..d7c6578 100644 --- a/lib/services/nfc_service.dart +++ b/lib/services/nfc_service.dart @@ -24,6 +24,7 @@ import 'package:nfc_manager_ndef/nfc_manager_ndef.dart'; /// 注:iOS 必须在真机测试,并在 Xcode 中打开 NFC 权限;Android 需设备支持 NFC。 class NfcService { NfcService._internal(); + static final NfcService instance = NfcService._internal(); /// 是否正在进行 NFC 会话(扫描或写入) @@ -31,6 +32,7 @@ class NfcService { /// 日志广播流(方便 UI 订阅) final StreamController _logController = StreamController.broadcast(); + Stream get logs => _logController.stream; /// 检查设备是否支持 NFC @@ -50,7 +52,10 @@ class NfcService { /// bytes -> "AA:BB:CC" 形式的大写十六进制字符串 String _bytesToHex(Uint8List bytes) { - return bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join(':').toUpperCase(); + return bytes + .map((b) => b.toRadixString(16).padLeft(2, '0')) + .join(':') + .toUpperCase(); } /// 递归在 Map/List 中查找第一个可用的字节数组 (List / Uint8List) @@ -101,12 +106,14 @@ class NfcService { if (Platform.isAndroid) { try { final nfcA = NfcAAndroid.from(tag); - if (nfcA != null && nfcA.tag.id != null) return _bytesToHex(Uint8List.fromList(nfcA.tag.id)); + if (nfcA != null && nfcA.tag.id != null) + return _bytesToHex(Uint8List.fromList(nfcA.tag.id)); } catch (_) {} } else if (Platform.isIOS) { try { final mifare = MiFareIos.from(tag); - if (mifare != null && mifare.identifier != null) return _bytesToHex(Uint8List.fromList(mifare.identifier)); + if (mifare != null && mifare.identifier != null) + return _bytesToHex(Uint8List.fromList(mifare.identifier)); } catch (_) {} } } catch (e) { @@ -131,9 +138,10 @@ class NfcService { String _formatMessageToString(dynamic msg) { if (msg == null) return ''; try { - final records = (msg is Map && msg['records'] != null) - ? List.from(msg['records']) - : (msg is dynamic ? (msg.records as List?) : null); + final records = + (msg is Map && msg['records'] != null) + ? List.from(msg['records']) + : (msg is dynamic ? (msg.records as List?) : null); if (records == null || records.isEmpty) return ''; final sb = StringBuffer(); for (var i = 0; i < records.length; i++) { @@ -144,12 +152,16 @@ class NfcService { Uint8List? p; if (r is Map && r['payload'] != null) { final ptmp = r['payload']; - if (ptmp is Uint8List) p = ptmp; - else if (ptmp is List) p = Uint8List.fromList(ptmp); + if (ptmp is Uint8List) + p = ptmp; + else if (ptmp is List) + p = Uint8List.fromList(ptmp); } else { final pr = (r as dynamic).payload; - if (pr is Uint8List) p = pr; - else if (pr is List) p = Uint8List.fromList(pr); + if (pr is Uint8List) + p = pr; + else if (pr is List) + p = Uint8List.fromList(pr); } if (p != null) { final txt = parseTextFromPayload(p); @@ -171,7 +183,8 @@ class NfcService { /// onError(error) - 出错时回调 /// timeout - 超时时间(可选) Future startScanOnceWithCallback({ - required void Function(String uid, String parsedText, dynamic rawMessage) onResult, + required void Function(String uid, String parsedText, dynamic rawMessage) + onResult, void Function(Object error)? onError, Duration? timeout, }) async { @@ -215,8 +228,12 @@ class NfcService { if ((rawMsg.records as List).isNotEmpty) { final first = rawMsg.records.first; final payload = first.payload; - if (payload is Uint8List) parsedText = parseTextFromPayload(payload); - else if (payload is List) parsedText = parseTextFromPayload(Uint8List.fromList(payload)); + if (payload is Uint8List) + parsedText = parseTextFromPayload(payload); + else if (payload is List) + parsedText = parseTextFromPayload( + Uint8List.fromList(payload), + ); } } } else { @@ -226,14 +243,24 @@ class NfcService { // 回退:尝试从 tag map 中嗅探 cachedMessage / records try { if (tag is Map) { - rawMsg = tag['cachedMessage'] ?? tag['ndef']?['cachedMessage'] ?? tag['message']; + rawMsg = + tag['cachedMessage'] ?? + tag['ndef']?['cachedMessage'] ?? + tag['message']; if (rawMsg != null) { - final recs = (rawMsg['records'] ?? (rawMsg as dynamic).records) as dynamic; + final recs = + (rawMsg['records'] ?? (rawMsg as dynamic).records) + as dynamic; if (recs != null && recs is List && recs.isNotEmpty) { final r = recs.first; - final p = (r is Map) ? r['payload'] : (r as dynamic).payload; - if (p is Uint8List) parsedText = parseTextFromPayload(p); - else if (p is List) parsedText = parseTextFromPayload(Uint8List.fromList(p)); + final p = + (r is Map) ? r['payload'] : (r as dynamic).payload; + if (p is Uint8List) + parsedText = parseTextFromPayload(p); + else if (p is List) + parsedText = parseTextFromPayload( + Uint8List.fromList(p), + ); } } } @@ -242,7 +269,9 @@ class NfcService { // 回调结果 onResult(uid, parsedText, rawMsg); - _logController.add('UID: $uid\nmessage: ${_formatMessageToString(rawMsg)}'); + _logController.add( + 'UID: $uid\nmessage: ${_formatMessageToString(rawMsg)}', + ); await stopSession(); } catch (e) { @@ -255,7 +284,6 @@ class NfcService { }, // 尽量多协议尝试以提升兼容性 pollingOptions: {NfcPollingOption.iso14443}, - ); } catch (e) { scanning.value = false; @@ -265,7 +293,9 @@ class NfcService { } /// Future 式读取:解析第一条文本记录并返回字符串(格式:'UID\n文本') - Future readOnceText({Duration timeout = const Duration(seconds: 10)}) async { + Future readOnceText({ + Duration timeout = const Duration(seconds: 10), + }) async { final completer = Completer(); await startScanOnceWithCallback( onResult: (uid, parsedText, rawMsg) { @@ -301,8 +331,14 @@ class NfcService { /// - onComplete: 回调 (ok, err) /// /// 返回 true 表示写入成功(同时 onComplete 也会被触发) - Future writeText(String text, {Duration? timeout, void Function(bool ok, Object? err)? onComplete}) async { + Future writeText( + String text, { + Duration? timeout, + void Function(bool ok, Object? err)? onComplete, + }) async { + debugPrint('writeText called - scanning=${scanning.value}'); final available = await isAvailable(); + debugPrint('writeText: isAvailable=$available'); if (!available) { onComplete?.call(false, 'NFC not available'); return false; @@ -312,6 +348,12 @@ class NfcService { return false; } + try { + await NfcManager.instance.stopSession(); + } catch (e) { + debugPrint('stopSession ignore: $e'); + } + scanning.value = true; Timer? timer; if (timeout != null) { @@ -324,63 +366,85 @@ class NfcService { bool success = false; try { - await NfcManager.instance.startSession(onDiscovered: (dynamic tag) async { - try { - final ndef = Ndef.from(tag); - if (ndef == null) { - onComplete?.call(false, 'Tag 不支持 NDEF'); - await stopSession(); - return; - } + // 修改了 pollingOptions 配置 + final polling = + Platform.isIOS + ? {NfcPollingOption.iso14443} // iOS 使用更具体的配置 + : { + NfcPollingOption.iso14443, + NfcPollingOption.iso15693, + NfcPollingOption.iso18092, + }; - final payload = _buildTextPayload(text, lang: 'en'); - final record = NdefRecord( - typeNameFormat: TypeNameFormat.wellKnown, - type: Uint8List.fromList('T'.codeUnits), - identifier: Uint8List(0), - payload: payload, - ); - final message = NdefMessage(records: [record]); - - await ndef.write(message: message); - - // 取出 UID (优先取 nfca.identifier,如果没有就取顶层 id) - String? uid; - if (Platform.isAndroid) { - try { - final nfcA = NfcAAndroid.from(tag); - if (nfcA != null && nfcA.tag.id != null) { - uid = _bytesToHex(Uint8List.fromList(nfcA.tag.id)); - } - } catch (_) {} - } else if (Platform.isIOS) { - try { - final mifare = MiFareIos.from(tag); - if (mifare != null && mifare.identifier != null) { - uid = _bytesToHex(Uint8List.fromList(mifare.identifier)); - } - } catch (_) {} - } - - success = true; - onComplete?.call(true, uid); // ✅ 把 UID 返回出去 - _logController.add('NFC write success, UID=$uid'); - } catch (e) { - debugPrint('NFC write error: $e'); - onComplete?.call(false, e); - } finally { - await stopSession(); + await NfcManager.instance.startSession( + pollingOptions: polling, + onDiscovered: (dynamic tag) async { timer?.cancel(); - scanning.value = false; - } - }, pollingOptions: {NfcPollingOption.iso14443}); + try { + final ndef = Ndef.from(tag); + if (ndef == null) { + onComplete?.call(false, 'Tag not NDEF'); + await stopSession(); + scanning.value = false; + return; + } - } catch (e) { - scanning.value = false; + // 检查是否可写 + if (Platform.isIOS) { + final miFare = MiFareIos.from(tag); + if (miFare == null) { + onComplete?.call(false, 'Unsupported tag type on iOS'); + await stopSession(); + scanning.value = false; + return; + } + } + + final payload = _buildTextPayload(text, lang: 'en'); + final record = NdefRecord( + typeNameFormat: TypeNameFormat.wellKnown, + type: Uint8List.fromList('T'.codeUnits), + identifier: Uint8List(0), + payload: payload, + ); + final message = NdefMessage(records: [record]); + + await ndef.write(message: message); + // 取出 UID (优先取 nfca.identifier,如果没有就取顶层 id) + String? uid; + if (Platform.isAndroid) { + try { + final nfcA = NfcAAndroid.from(tag); + if (nfcA != null && nfcA.tag.id != null) { + uid = _bytesToHex(Uint8List.fromList(nfcA.tag.id)); + } + } catch (_) {} + } else if (Platform.isIOS) { + try { + final mifare = MiFareIos.from(tag); + if (mifare != null && mifare.identifier != null) { + uid = _bytesToHex(Uint8List.fromList(mifare.identifier)); + } + } catch (_) {} + } + success = true; + onComplete?.call(true, uid); // ✅ 把 UID 返回出去 + } catch (e, st) { + debugPrint('iOS NFC Write Error: $e'); + debugPrint('Stack trace: $st'); + onComplete?.call(false, e); + } finally { + await stopSession(); + scanning.value = false; + } + }, + ); + } catch (e, st) { + debugPrint('startSession exception: $e\n$st'); timer?.cancel(); + scanning.value = false; onComplete?.call(false, e); } - return success; } diff --git a/lib/tools/tools.dart b/lib/tools/tools.dart index a471be0..1262e08 100644 --- a/lib/tools/tools.dart +++ b/lib/tools/tools.dart @@ -1,12 +1,19 @@ import 'dart:math'; +import 'dart:async'; import 'package:flutter/material.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter/services.dart'; int getRandomWithNum(int min, int max) { + if (max < min) { + // 保护性处理:交换或抛错,这里交换 + final tmp = min; + min = max; + max = tmp; + } final random = Random(); - return random.nextInt(max) + min; // 生成随机数 + return random.nextInt(max - min + 1) + min; // 生成 [min, max] 的随机数 } double screenWidth(BuildContext context) { @@ -332,27 +339,48 @@ void presentPage(BuildContext context, Widget page) { MaterialPageRoute(fullscreenDialog: true, builder: (_) => page), ); } - class LoadingDialogHelper { - // 显示加载框 - static void show({String? message}) { + static Timer? _timer; + + /// 显示加载框(带超时,默认 10 秒) + static void show({String? message, Duration timeout = const Duration(seconds: 10)}) { + // 先清理上一个计时器,避免重复 + _timer?.cancel(); + if (message != null) { EasyLoading.show(status: message); } else { EasyLoading.show(); } + + // 设置超时自动隐藏 + _timer = Timer(timeout, () { + // 保护性调用 dismiss(避免访问不存在的 isShow) + try { + EasyLoading.dismiss(); + } catch (e) { + debugPrint('EasyLoading.dismiss error: $e'); + } + _timer?.cancel(); + _timer = null; + }); } - // 隐藏加载框 + /// 隐藏加载框(手动触发) static void hide() { - if (EasyLoading.isShow) { + // 清理计时器 + _timer?.cancel(); + _timer = null; + + try { EasyLoading.dismiss(); + } catch (e) { + debugPrint('EasyLoading.dismiss error: $e'); } } } - /// 将秒数转换为 “HH:MM:SS” 格式 String secondsCount(dynamic seconds) { // 先尝试解析出一个 double 值