Browse Source

Merge branch 'master' of http://git.ius.plus/Project-Vital/VitalApp

loki.wu 11 months ago
parent
commit
4b0b5b8f25

+ 9 - 1
lib/managers/template.dart

@@ -1,6 +1,7 @@
 import 'dart:convert';
 
 import 'package:fis_jsonrpc/rpc.dart';
+import 'package:vitalapp/architecture/storage/file_storage_native_and_web.dart';
 import 'package:vitalapp/architecture/storage/text_storage.dart';
 import 'package:vitalapp/managers/interfaces/template.dart';
 import 'package:vitalapp/rpc.dart';
@@ -37,6 +38,12 @@ class TemplateManager implements ITemplateManager {
   @override
   Future<bool?> saveTemplate() async {
     try {
+      ///下载模版之前删除旧模版,保证每次下载的都是新模版
+      FileStorageNativeAndWeb templateDel =
+          FileStorageNativeAndWeb.createInstance("template");
+      var isDeleteSuccess = await templateDel.deleteDirectory("template");
+      logger.i(
+          "TemplateManager saveTemplate is delete template success:${isDeleteSuccess}.");
       Map<String, String> currentTemplateIndex = {};
       SyncSettingRequest syncSettingRequest = SyncSettingRequest();
       var syncSettingsDTO = await syncSetting(syncSettingRequest);
@@ -59,6 +66,7 @@ class TemplateManager implements ITemplateManager {
         fileName: "templateRelation",
         directory: "templateRelation",
       );
+      templateRelation.deleteDirectory();
       await templateRelation.save(jsonEncode(currentTemplateIndex));
       return true;
     } catch (e) {
@@ -79,7 +87,7 @@ class TemplateManager implements ITemplateManager {
       return null;
     }
   }
-  
+
   @override
   Future<String> getTemplateByKey(String key) async {
     var templates = await readTemplateRelation('templateRelation');

+ 1 - 1
lib/pages/check/children_follow_up_record/controller.dart

@@ -272,7 +272,7 @@ class ChildrenFollowUpRecordController extends FControllerBase {
           if (_followUpController.state.followUpTime != null &&
               _followUpController.state.nextFollowUpTime != null &&
               _followUpController.state.followUpTime!
-                  .isBefore(_followUpController.state.nextFollowUpTime!)) {
+                  .isAfter(_followUpController.state.nextFollowUpTime!)) {
             PromptBox.toast('本次随访时间不能晚于下次随访时间');
             return false;
           }

+ 1 - 1
lib/pages/check/follow_up/controller.dart

@@ -76,7 +76,7 @@ class FollowUpController extends GetxController {
     /// 校验本次随访时间不能晚于下次随访时间
     if (state.followUpTime != null &&
         state.nextFollowUpTime != null &&
-        state.followUpTime!.isBefore(state.nextFollowUpTime!)) {
+        state.followUpTime!.isAfter(state.nextFollowUpTime!)) {
       PromptBox.toast('本次随访时间不能晚于下次随访时间');
       return false;
     }

+ 6 - 0
lib/pages/check/widgets/configurable_card.dart

@@ -1698,11 +1698,17 @@ class _ConfigurableFormState extends State<ConfigurableCard> {
       setState(() {});
     }
 
+    void selectRaidoChange(Option e) {
+      formValue[radioKey] = e.value ?? '';
+      setState(() {});
+    }
+
     return FollowUpChildHeightAndWeight(
       options: options,
       currentFormObject: currentFormObject,
       childHeightAndWeightInput: childHeightAndWeightInput,
       formValue: formValue,
+      selectRaidoChange: selectRaidoChange,
       keys: [inputKey, radioKey],
     );
   }

+ 3 - 1
lib/pages/check/widgets/follow_up_configurable/follow_up_child_height_and_weight.dart

@@ -12,11 +12,13 @@ class FollowUpChildHeightAndWeight extends StatelessWidget {
     required this.childHeightAndWeightInput,
     required this.formValue,
     required this.keys,
+    required this.selectRaidoChange,
   });
   final FormObject currentFormObject;
   final List<Option> options;
   final Function childHeightAndWeightInput;
   final Map<String, dynamic> formValue;
+    final Function selectRaidoChange;
   final List<String> keys;
 
   Future<void> commonInput() async {
@@ -56,7 +58,7 @@ class FollowUpChildHeightAndWeight extends StatelessWidget {
                       (e) => Container(
                         padding: const EdgeInsets.all(7),
                         child: InkWell(
-                          // onTap: () => {},
+                          onTap: () => selectRaidoChange(e),
                           borderRadius: BorderRadius.circular(50),
                           child: Ink(
                             decoration: BoxDecoration(