Browse Source

1、提交配置项的问题

guanxinyi 4 months ago
parent
commit
d32cbe20fa

+ 33 - 12
lib/lab/pages/lab_image/widgets/image_operate_panel/widgets/measure_config/change_config_settings.dart

@@ -246,12 +246,22 @@ class _DialogPageState extends State<_DialogPage> {
                     if (multiMethodItems.isNotEmpty) {
                       /// 判断是否是组合测量项
                       if (isMultiMethodItems) {
-                        availableOutputs = methodChildItems[selectedTabIndex]
-                                .childItems
-                                ?.firstWhere((element) => element.isWorking)
-                                .calculator
-                                ?.availableOutputs ??
-                            [];
+                        List<ChildItemMetaDTO>? childItems =
+                            methodChildItems[selectedTabIndex].childItems;
+                        if (childItems?.length != 0 && childItems != null) {
+                          availableOutputs = methodChildItems[selectedTabIndex]
+                                  .childItems
+                                  ?.firstWhereOrNull(
+                                      (element) => element.isWorking)
+                                  ?.calculator
+                                  ?.availableOutputs ??
+                              [];
+                        } else {
+                          availableOutputs = methodChildItems[selectedTabIndex]
+                                  .calculator
+                                  ?.availableOutputs ??
+                              [];
+                        }
                       } else {
                         /// 当前选中方法名字
                         if (currentMeasureFName == "") {
@@ -273,12 +283,23 @@ class _DialogPageState extends State<_DialogPage> {
 
                       multiMethodItems = e.childItems ?? [];
                     } else if (methodChildItems.isNotEmpty) {
-                      availableOutputs = methodChildItems[selectedTabIndex]
-                              .childItems
-                              ?.firstWhere((element) => element.isWorking)
-                              .calculator
-                              ?.availableOutputs ??
-                          [];
+                      List<ChildItemMetaDTO>? childItems =
+                          methodChildItems[selectedTabIndex].childItems;
+                      if (childItems?.length != 0 && childItems != null) {
+                        availableOutputs = methodChildItems[selectedTabIndex]
+                                .childItems
+                                ?.firstWhereOrNull(
+                                    (element) => element.isWorking)
+                                ?.calculator
+                                ?.availableOutputs ??
+                            [];
+                      } else {
+                        availableOutputs = methodChildItems[selectedTabIndex]
+                                .calculator
+                                ?.availableOutputs ??
+                            [];
+                      }
+
                       multiMethodItems =
                           methodChildItems[selectedTabIndex].childItems ?? [];
                     } else {