Browse Source

LabourRequest 的添加 Position 之前有默认的选项,现在没有了,导致index - 1 的问题修复

liukai 3 days ago
parent
commit
bc856e8ed8

+ 3 - 9
packages/cpt_sg/lib/modules/job/job_list_edit/job_list_edit_controller.dart

@@ -147,21 +147,15 @@ class JobListEditController extends GetxController with DioCancelableMixin {
       selectedIndex++;
     }
 
-    List<String> list = ["Position"];
+    List<String> list = [];
     list.addAll(state.editEntity!.positionList.map((e) => e.txt!).toList(growable: false));
 
     OptionPickerUtil.showCupertinoOptionPicker(
       items: list,
       initialSelectIndex: selectedIndex,
       onPickerChanged: (_, index) {
-        if (index == 0) {
-          state.selectPositionId = null;
-          state.selectPositionName = null;
-        } else {
-          state.selectPositionId = state.editEntity!.positionList[index - 1].value!.toString();
-          state.selectPositionName = state.editEntity!.positionList[index - 1].txt!.toString();
-        }
-
+          state.selectPositionId = state.editEntity!.positionList[index].value!.toString();
+          state.selectPositionName = state.editEntity!.positionList[index].txt!.toString();
         update();
       },
     );

+ 1 - 1
packages/cpt_sg/lib/modules/labour/labour_request_add/AgencyNeedNumberWidget.dart

@@ -109,7 +109,7 @@ class AgencyNeedNumberState extends State<AgencyNeedNumberWidget> {
             ).onTap(() {
               FocusScope.of(context).unfocus();
               pickLimitType();
-            }).expanded(flex: 45),
+            }).expanded(flex: 55),
 
             //输入框-不限制性别
             Visibility(

+ 2 - 8
packages/cpt_sg/lib/modules/labour/labour_request_add/labour_request_add_controller.dart

@@ -268,14 +268,8 @@ class LabourRequestAddController extends GetxController with DioCancelableMixin
       items: list,
       initialSelectIndex: selectedIndex,
       onPickerChanged: (_, index) {
-        if (index == 0) {
-          state.selectPositionId = null;
-          state.selectPositionName = null;
-        } else {
-          state.selectPositionId = state.indexEntity!.positionList[index - 1].value!.toString();
-          state.selectPositionName = state.indexEntity!.positionList[index - 1].txt!.toString();
-        }
-
+          state.selectPositionId = state.indexEntity!.positionList[index].value!.toString();
+          state.selectPositionName = state.indexEntity!.positionList[index].txt!.toString();
         update();
       },
     );

+ 2 - 2
packages/cpt_sg/lib/modules/labour/labour_request_edit/labour_request_edit_controller.dart

@@ -245,8 +245,8 @@ class LabourRequestEditController extends GetxController with DioCancelableMixin
       items: list,
       initialSelectIndex: selectedIndex,
       onPickerChanged: (_, index) {
-        state.selectPositionId = state.editDetailEntity!.positionList[index - 1].value!.toString();
-        state.selectPositionName = state.editDetailEntity!.positionList[index - 1].txt!.toString();
+        state.selectPositionId = state.editDetailEntity!.positionList[index].value!.toString();
+        state.selectPositionName = state.editDetailEntity!.positionList[index].txt!.toString();
         update();
       },
     );