Browse Source

新增三个报告所需翻译参数

loki.wu 2 years ago
parent
commit
0d8319b4ec

+ 10 - 8
lib/main.dart

@@ -58,7 +58,6 @@ class _MyHomePageState extends State<MyHomePage> {
   String _petStr = '';
   String _testStr = '';
   String _reportInfoStr = '';
-  final bool _isInit = false;
 
   @override
   initState() {
@@ -122,6 +121,9 @@ class _MyHomePageState extends State<MyHomePage> {
                 reportDate: DateTime.now(),
                 jsonStr: _jsonStr,
                 onSelect: onSelect,
+                revoke: '撤销',
+                selectEntry: '选择词条',
+                selectImageHint: '请点击此处后选择图片',
               ),
             ),
           const SizedBox(width: 40),
@@ -161,20 +163,20 @@ class _MyHomePageState extends State<MyHomePage> {
                 MaterialButton(
                     child: const Text('testAI'),
                     onPressed: () {
-                      ReportInfo.instance
-                          .reload('test', DateTime.now(), _aiJson, onSelect);
+                      ReportInfo.instance.reload('test', DateTime.now(),
+                          _aiJson, onSelect, '撤销', '选择词条', '请点击此处后选择图片');
                     }),
                 MaterialButton(
                     child: const Text('testDefault'),
                     onPressed: () {
-                      ReportInfo.instance.reload(
-                          'default', DateTime.now(), _jsonStr, onSelect);
+                      ReportInfo.instance.reload('default', DateTime.now(),
+                          _jsonStr, onSelect, '撤销', '选择词条', '请点击此处后选择图片');
                     }),
                 MaterialButton(
                     child: const Text('testPet'),
                     onPressed: () {
-                      ReportInfo.instance
-                          .reload('pet', DateTime.now(), _petStr, onSelect);
+                      ReportInfo.instance.reload('pet', DateTime.now(), _petStr,
+                          onSelect, '撤销', '选择词条', '请点击此处后选择图片');
                     }),
                 MaterialButton(
                     child: const Text('onClose'),
@@ -190,7 +192,7 @@ class _MyHomePageState extends State<MyHomePage> {
                     child: const Text('testCustomTemplate'),
                     onPressed: () {
                       ReportInfo.instance.reload('testCustomTemplate',
-                          DateTime.now(), _testStr, onSelect);
+                          DateTime.now(), _testStr, onSelect, '撤销', '选择词条', '');
                     }),
                 MaterialButton(
                     child: const Text('testInfo'),

+ 4 - 4
lib/pages/components/input_image.dart

@@ -25,7 +25,7 @@ class _FInputImageState extends State<FInputImage> {
   bool _hasImageBorder = false;
   String _imageUrl = '';
 
-  Widget _child = const FText('请点击此处后选择图片');
+  Widget _child = FText(ReportInfo.instance.selectImageHint);
 
   @override
   initState() {
@@ -108,7 +108,7 @@ class _FInputImageState extends State<FInputImage> {
               _child = _getChild();
             } else {
               _imageUrl = '';
-              _child = const FText('请点击此处后选择图片');
+              _child = FText(ReportInfo.instance.selectImageHint);
             }
           });
         }
@@ -121,7 +121,7 @@ class _FInputImageState extends State<FInputImage> {
             _child = _getChild();
           } else {
             _imageUrl = '';
-            _child = const FText('请点击此处后选择图片');
+            _child = FText(ReportInfo.instance.selectImageHint);
           }
         });
       });
@@ -139,6 +139,6 @@ class _FInputImageState extends State<FInputImage> {
         width: PtToPxConverter.ptToPx(widget.inputImage.imageWidth!),
       );
     }
-    return const FText('请点击此处后选择图片');
+    return FText(ReportInfo.instance.selectImageHint);
   }
 }

+ 2 - 2
lib/pages/components/input_imageList.dart

@@ -28,7 +28,7 @@ class _FInputImageListState extends State<FInputImageList> {
   List<String> _images = [];
   double _height = 0.0;
 
-  FWidget _child = const FText('请点击此处后选择图片');
+  FWidget _child = FText(ReportInfo.instance.selectImageHint);
 
   @override
   initState() {
@@ -122,7 +122,7 @@ class _FInputImageListState extends State<FInputImageList> {
       _height = PtToPxConverter.ptToPx(inputImageList!.imageHeight!) + 9;
     }
 
-    return const FText('请点击此处后选择图片');
+    return FText(ReportInfo.instance.selectImageHint);
   }
 
   void _addSelectImageListening() {

+ 2 - 2
lib/pages/components/input_text.dart

@@ -96,7 +96,7 @@ class _FInputTextState extends State<FInputText> {
                   ReportInfo.instance.onDiagnosticTap
                       .emit(this, _inputTextInfo!.tag!.name ?? '');
                 },
-                child: const FText('选择词条'),
+                child: FText(ReportInfo.instance.selectEntry),
               ),
               const FSizedBox(width: 10),
               FElevatedButton(
@@ -105,7 +105,7 @@ class _FInputTextState extends State<FInputText> {
                     _inputTextInfo!.text = '';
                   });
                 },
-                child: const FText('撤销'),
+                child: FText(ReportInfo.instance.revoke),
               ),
               const FSizedBox(width: 5),
             ],

+ 18 - 5
lib/report_edit.dart

@@ -18,6 +18,9 @@ class FReportEditPage extends StatefulWidget implements FWidget {
     required this.jsonStr,
     required this.reportDate,
     required this.onSelect,
+    required this.selectEntry,
+    required this.revoke,
+    required this.selectImageHint,
     this.patinentAge,
     this.patinentName,
     this.patinentSex,
@@ -33,6 +36,9 @@ class FReportEditPage extends StatefulWidget implements FWidget {
   final String? patinentId;
   final String? patinentSex;
   final String? patinentAge;
+  final String selectEntry;
+  final String revoke;
+  final String selectImageHint;
   final DateTime reportDate;
   final bool isReload;
 
@@ -135,11 +141,18 @@ class _FReportEditPageState extends State<FReportEditPage> {
     setState(() {
       final template = ReportTemplateDocument.fromJson(reportMap);
       _reportTemplate = template;
-      ReportInfo.instance.init(_reportTemplate, reportDate, reporter,
-          patientName: widget.patinentName,
-          patientAge: widget.patinentAge,
-          patientSex: widget.patinentSex,
-          patinentId: widget.patinentId);
+      ReportInfo.instance.init(
+        _reportTemplate,
+        reportDate,
+        reporter,
+        patientName: widget.patinentName,
+        patientAge: widget.patinentAge,
+        patientSex: widget.patinentSex,
+        patinentId: widget.patinentId,
+        revoke: widget.revoke,
+        selectEntry: widget.selectEntry,
+        selectImageHint: widget.selectImageHint,
+      );
       _initPage();
     });
     if (args != null) {

+ 16 - 1
lib/report_info/report_base_info.dart

@@ -47,7 +47,7 @@ class ReportBaseInfo {
   //报告页大小
   RTPageSize? pageSize;
 
-//报告者
+  //报告者
   String? reporter;
 
   //报告病人名
@@ -77,6 +77,15 @@ class ReportBaseInfo {
   ///关闭页面,释放监听
   FEventHandler onClose = FEventHandler();
 
+  ///撤销
+  String revoke = '';
+
+  ///选择词条
+  String selectEntry = '';
+
+  ///选择图像提示文字
+  String selectImageHint = '';
+
   ///初始化ReportInfo
   void init(
     ReportTemplateDocument reportTemplate,
@@ -86,11 +95,17 @@ class ReportBaseInfo {
     String? patinentId,
     String? patientAge,
     String? patientSex,
+    required String revoke,
+    required String selectEntry,
+    required String selectImageHint,
   }) {
     try {
       headers = [];
       blocks = [];
       footers = [];
+      this.revoke = revoke;
+      this.selectEntry = selectEntry;
+      this.selectImageHint = selectImageHint;
       this.reportTemplate = reportTemplate;
       this.reportDate = reportDate;
       this.reporter = reporter;

+ 12 - 2
lib/report_info/report_info.dart

@@ -137,9 +137,19 @@ class ReportInfo extends ReportBaseInfo {
   }
 
   ///重新渲染UI&重构reportInfo
-  void reload(String reporter, DateTime reportDate, String jsonStr,
-      FEventHandler<String> onSelect) {
+  void reload(
+    String reporter,
+    DateTime reportDate,
+    String jsonStr,
+    FEventHandler<String> onSelect,
+    String revoke,
+    String selectEntry,
+    String selectImageHint,
+  ) {
     _reportInfo = null;
+    this.revoke = revoke;
+    this.selectEntry = selectEntry;
+    this.selectImageHint = selectImageHint;
     onReload.emit(
         this, ReportEventArgs(reportDate, reporter, jsonStr, onSelect));
   }