From 0e7e082ef53758af5f8b89a747a00991b87044a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Sun, 4 Jan 2026 14:47:40 +0800 Subject: [PATCH] =?UTF-8?q?fix=20:=20=E6=96=B0=E5=A2=9E=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=97=A0=E6=95=88=EF=BC=8C=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=BC=BA=E5=B0=91=E6=97=B6=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/extensions/datetime_extension.dart | 2 +- .../controllers/problem_form_controller.dart | 20 +++++++++++++++++++ .../presentation/pages/problem_form_page.dart | 4 +++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/app/core/extensions/datetime_extension.dart b/lib/app/core/extensions/datetime_extension.dart index c32cc9c..741e083 100644 --- a/lib/app/core/extensions/datetime_extension.dart +++ b/lib/app/core/extensions/datetime_extension.dart @@ -4,7 +4,7 @@ import 'package:intl/intl.dart'; extension DateTimeFormatting on DateTime { /// 格式化为 'yyyy-MM-dd HH:mm:ss' String toDateTimeString() { - return DateFormat('yyyy-MM-dd HH:mm:ss').format(this); + return DateFormat('yyyy-MM-dd HH:mm:ss').format(toLocal()); } String toDateTimeString2() { diff --git a/lib/app/features/problem/presentation/controllers/problem_form_controller.dart b/lib/app/features/problem/presentation/controllers/problem_form_controller.dart index 44c8199..441ce13 100644 --- a/lib/app/features/problem/presentation/controllers/problem_form_controller.dart +++ b/lib/app/features/problem/presentation/controllers/problem_form_controller.dart @@ -7,6 +7,7 @@ import 'package:path/path.dart' as path; import 'package:permission_handler/permission_handler.dart'; import 'package:path_provider/path_provider.dart'; import 'package:problem_check_system/app/core/models/form_mode.dart'; +import 'package:problem_check_system/app/core/routes/app_routes.dart'; import 'package:problem_check_system/app/features/enterprise/domain/entities/enterprise.dart'; import 'package:problem_check_system/app/features/enterprise/domain/usecases/get_enterprises_usecase.dart'; import 'dart:io'; @@ -324,6 +325,25 @@ class ProblemFormController extends GetxController { } } + /// 导航到新增表单页面 + Future navigateToAddForm() async { + final result = await Get.toNamed( + AppRoutes.enterpriseForm, + arguments: {'mode': FormMode.add}, + ); + if (result == true) { + _fetchEnterprises(); + Get.snackbar( + '成功', + '企业信息已创建', + backgroundColor: Colors.green[600], + colorText: Colors.white, + icon: const Icon(Icons.check_circle, color: Colors.white), + duration: const Duration(seconds: 3), + ); + } + } + // 检查表单是否有更改 bool _hasFormChanges() { if (problem == null) { diff --git a/lib/app/features/problem/presentation/pages/problem_form_page.dart b/lib/app/features/problem/presentation/pages/problem_form_page.dart index 5e2c307..c6289dd 100644 --- a/lib/app/features/problem/presentation/pages/problem_form_page.dart +++ b/lib/app/features/problem/presentation/pages/problem_form_page.dart @@ -512,7 +512,9 @@ class ProblemFormPage extends GetView { ), // 右侧的按钮 ElevatedButton( - onPressed: () {}, + onPressed: () { + controller.navigateToAddForm(); + }, style: ElevatedButton.styleFrom( backgroundColor: const Color(0xFF42A5F5), foregroundColor: Colors.white,