Browse Source

fixed: 0018851: 【web客户端】居民列表下的筛选窗口中,打开时间控件,选择时间开始时间或结束时间后,在控件上点击取消,控件会置灰

loki.wu 10 months ago
parent
commit
b3e59611bf
1 changed files with 11 additions and 4 deletions
  1. 11 4
      lib/pages/patient/list/view.dart

+ 11 - 4
lib/pages/patient/list/view.dart

@@ -113,7 +113,9 @@ class PatientListPage extends GetView<PatientListController> {
                           readOnly: true,
                           controller: TextEditingController(
                             text: DateFormat('yyyy-MM-dd').format(
-                              controller.state.startTime.value!.toLocal(),
+                              (controller.state.startTime.value ??
+                                      DateTime.now())
+                                  .toLocal(),
                             ),
                           ),
                           radius: 4,
@@ -137,7 +139,9 @@ class PatientListPage extends GetView<PatientListController> {
                                 initialValue: controller.state.startTime.value,
                               ).show();
                             }
-                            controller.state.startTime.value = result;
+                            if (result != null) {
+                              controller.state.startTime.value = result;
+                            }
                           },
                         ),
                       ),
@@ -151,7 +155,8 @@ class PatientListPage extends GetView<PatientListController> {
                           readOnly: true,
                           controller: TextEditingController(
                             text: DateFormat('yyyy-MM-dd').format(
-                              controller.state.endTime.value!.toLocal(),
+                              (controller.state.endTime.value ?? DateTime.now())
+                                  .toLocal(),
                             ),
                           ),
                           radius: 4,
@@ -174,7 +179,9 @@ class PatientListPage extends GetView<PatientListController> {
                                 initialValue: controller.state.endTime.value,
                               ).show();
                             }
-                            controller.state.endTime.value = result;
+                            if (result != null) {
+                              controller.state.endTime.value = result;
+                            }
                           },
                         ),
                       ),