Bläddra i källkod

添加预选 和 添加员工 location 改为下拉选项筛选

glglove 2 dagar sedan
förälder
incheckning
f2a04301d1

+ 79 - 29
packages/cpt_uk/lib/modules/job/job_applied/widget/applied_add_staff.dart

@@ -243,19 +243,46 @@ class _AppliedAddStaffState extends State<AppliedAddStaff> {
           ],
         ),
         Row(
+          mainAxisAlignment: MainAxisAlignment.start,
+          crossAxisAlignment: CrossAxisAlignment.center,
           children: [
+            // location
+            Expanded(
+              // child: SearchAppBar(
+              //   key: Key("searchLocation"),
+              //   value: controller.searchLocation,
+              //   searchBarHeight: 38,
+              //   searchBarBgColor: Colors.white,
+              //   searchBarBorderRadius: 15,
+              //   searchBarBorder: Border.all(
+              //     color: Color(0XFFC3C3C3), // 设置边框颜色为灰色
+              //     width: 0.5, // 设置边框宽度
+              //   ),
+              //   textHintColor: Color(0XFFAFB3B7),
+              //   textColor: ColorConstants.black33,
+              //   textFontSize: 12.0,
+              //   showSearchIcon: false,
+              //   margin: EdgeInsets.only(right: 5),
+              //   onSearch: (searchLocation) {
+              //     controller.searchLocationInputSearch(searchLocation);
+              //   },
+              //   hintText: "Location".tr,
+              //   controller: controller.searchLocationController,
+              // ),
+              child: Container(child: _buildLocationSelectWidget(controller)).marginOnly(right: 5),
+            ),
             Expanded(
               child: SearchAppBar(
                   key: Key("keyword"),
                   value: controller.keyword,
                   searchBarHeight: 38,
-                  searchBarBgColor: Colors.white,
+                  searchBarBgColor: Color(0xFF4DCFF6).withOpacity(0.2),
                   searchBarBorderRadius: 15,
-                  searchBarBorder: Border.all(
-                    color: Color(0XFFC3C3C3), // 设置边框颜色为灰色
-                    width: 0.5, // 设置边框宽度
-                  ),
-                  textHintColor: Color(0XFFAFB3B7),
+                  // searchBarBorder: Border.all(
+                  //   color: Color(0XFFC3C3C3), // 设置边框颜色为灰色
+                  //   width: 0.5, // 设置边框宽度
+                  // ),
+                  textHintColor: ColorConstants.textGrayAECAE5,
                   textColor: ColorConstants.black33,
                   textFontSize: 12.0,
                   showSearchIcon: false,
@@ -267,29 +294,6 @@ class _AppliedAddStaffState extends State<AppliedAddStaff> {
                   controller: controller.searchController,
               ),
             ),
-            Expanded(
-              child: SearchAppBar(
-                key: Key("searchLocation"),
-                value: controller.searchLocation,
-                searchBarHeight: 38,
-                searchBarBgColor: Colors.white,
-                searchBarBorderRadius: 15,
-                searchBarBorder: Border.all(
-                  color: Color(0XFFC3C3C3), // 设置边框颜色为灰色
-                  width: 0.5, // 设置边框宽度
-                ),
-                textHintColor: Color(0XFFAFB3B7),
-                textColor: ColorConstants.black33,
-                textFontSize: 12.0,
-                showSearchIcon: false,
-                margin: EdgeInsets.only(right: 5),
-                onSearch: (searchLocation) {
-                  controller.searchLocationInputSearch(searchLocation);
-                },
-                hintText: "Location".tr,
-                controller: controller.searchLocationController,
-              ),
-            ),
             Row(
               mainAxisAlignment: MainAxisAlignment.end,
               crossAxisAlignment: CrossAxisAlignment.center,
@@ -417,6 +421,52 @@ class _AppliedAddStaffState extends State<AppliedAddStaff> {
     );
   }
 
+  // location 下拉选择
+  Widget _buildLocationSelectWidget(AppliedAddStaffController controller) {
+    return Container(
+      child: Row(
+        mainAxisSize: MainAxisSize.max,
+        mainAxisAlignment: MainAxisAlignment.start,
+        crossAxisAlignment: CrossAxisAlignment.center,
+        children: [
+          // 行业
+          // FormRequireText(text: "Industry".tr, isRequired: false,).marginOnly(right: 38),
+          //选择行业
+          Expanded(
+            child: Container(
+              padding: const EdgeInsets.only(left: 5, right: 5),
+              margin: const EdgeInsets.only(top: 5),
+              height: 38,
+              decoration: BoxDecoration(
+                color:  Color(0xFF4DCFF6).withOpacity(0.2),
+                // border: Border.all(color: Colors.black12.withOpacity(0.05)),
+                borderRadius: const BorderRadius.all(Radius.circular(15)),
+              ),
+              child: Row(
+                mainAxisSize: MainAxisSize.max,
+                crossAxisAlignment: CrossAxisAlignment.center,
+                mainAxisAlignment: MainAxisAlignment.start,
+                children: [
+                  MyTextView(
+                    controller.selectedLocationStr ==null || Utils.isEmpty(controller.selectedLocationStr)? '': controller.selectedLocationStr! ,
+                    hint: "Location".tr,
+                    textHintColor: ColorConstants.textGrayAECAE5,
+                    fontSize: 12,
+                    isFontMedium: true,
+                    textColor: ColorConstants.black33,
+                  ).expanded(),
+                  const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
+                ],
+              ),
+            ).onTap(() {
+              controller.showChooseSearchLocationPicker();
+            }),
+          )
+        ],
+      ),
+    );
+  }
+
   Widget _buildStaffItem(AppliedAddStaffController controller, UkJobListAppliedStaffSearchRows item, VoidCallback clickItemCallback, { VoidCallback? clickFavoriteCallback }) {
     return Stack(
       children: [

+ 57 - 3
packages/cpt_uk/lib/modules/job/job_applied/widget/applied_add_staff_controller.dart

@@ -59,8 +59,10 @@ class AppliedAddStaffController extends GetxController with DioCancelableMixin {
   List<UkJobListAppliedStaffSelectoptionsEntity>? jobTitleOptionEntityList; // 新增时工作标题的数据源
   String? selectedJobTitleStr;  // 选择的工作标题
 
+  List<String> locationOptionList = [];
+  String? selectedLocationStr;  // 选中的location
+
 
-  
   List<UkJobListAppliedStaffSearchRows> datas = [];
 
   //刷新页面状态
@@ -110,6 +112,22 @@ class AppliedAddStaffController extends GetxController with DioCancelableMixin {
         ToastEngine.show(result.errorMsg ?? "Network Load Error".tr);
       }
     }
+
+    if(locationOptionList == null || locationOptionList?.isEmpty == true){
+      // 获取location选项
+      final result = await _jobRepository.fetchAddStaffLocationOptions(cancelToken: cancelToken);
+      if (result.isSuccess) {
+        if (result.list != null) {
+          locationOptionList = result.list!.map((item) => item.toString()).toList();
+        } else {
+          locationOptionList = [];
+        }
+        //刷新
+        update();
+      } else {
+        ToastEngine.show(result.errorMsg ?? "Network Load Error".tr);
+      }
+    }
   }
 
 
@@ -122,7 +140,7 @@ class AppliedAddStaffController extends GetxController with DioCancelableMixin {
     var listResult = await _jobRepository.searchStaffList(
       jobId,
       keyword,
-      searchLocation,
+      selectedLocationStr,
       selectedIndustryId,
       selectedJobTitleId,
       curPage: _curPage,
@@ -173,6 +191,38 @@ class AppliedAddStaffController extends GetxController with DioCancelableMixin {
     }
   }
 
+
+  //选择 location
+  void showChooseSearchLocationPicker(){
+    int selectedLocationIndex;
+    if (locationOptionList == null || locationOptionList?.isEmpty == true) {
+      selectedLocationIndex = 0;
+    } else {
+      selectedLocationIndex = locationOptionList?.indexWhere((e) => e.toString() == selectedJobIndustryStr)?? 0;
+    }
+
+    if (selectedLocationIndex < 0) {
+      selectedLocationIndex = 0;
+    }
+
+    OptionPickerUtil.showCupertinoOptionPicker(
+      items: locationOptionList?.map((e) => e!).toList(growable: false)?? [],
+      initialSelectIndex: selectedLocationIndex,
+      onPickerChanged: (_, index) {
+        String lastSelectedLocationStr = selectedLocationStr?? "";
+        String curSelectedLocationStr = locationOptionList?[index] ?? "";
+        if(lastSelectedLocationStr != curSelectedLocationStr){
+          Log.d("选中的 curSelectedLocationStr  ${curSelectedLocationStr}");
+          selectedLocationStr = curSelectedLocationStr;
+          update();
+          // 掉接口获取数据
+          doSearch();
+        }
+      },
+    );
+  }
+
+
   //选择 industry
   void showChooseIndustryPicker(){
     int selectedIndustryIndex;
@@ -281,8 +331,12 @@ class AppliedAddStaffController extends GetxController with DioCancelableMixin {
     searchLocation = "";
     selectedJobTitleStr = "";
     selectedJobIndustryStr = "";
+    selectedLocationStr = "";
     update();
-    doSearch();
+    // 延时 500ms 后 刷新
+    Future.delayed(Duration(milliseconds: 500), () {
+      doSearch();
+    });
   }
 
   // 打标签

+ 76 - 29
packages/cpt_uk/lib/modules/job/labour_request_preselected_list/widget/preselected_add_staff.dart

@@ -240,18 +240,43 @@ class _PreselectedAddStaffState extends State<PreselectedAddStaff> {
         ),
         Row(
           children: [
+            // location
+            Expanded(
+              // child: SearchAppBar(
+              //   key: Key("searchLocation"),
+              //   value: controller.searchLocation,
+              //   searchBarHeight: 38,
+              //   searchBarBgColor: Colors.white,
+              //   searchBarBorderRadius: 15,
+              //   searchBarBorder: Border.all(
+              //     color: Color(0XFFC3C3C3), // 设置边框颜色为灰色
+              //     width: 0.5, // 设置边框宽度
+              //   ),
+              //   textHintColor: Color(0XFFAFB3B7),
+              //   textColor: ColorConstants.black33,
+              //   textFontSize: 12.0,
+              //   showSearchIcon: false,
+              //   margin: EdgeInsets.only(right: 5),
+              //   onSearch: (searchLocation) {
+              //     controller.searchLocationInputSearch(searchLocation);
+              //   },
+              //   hintText: "Location".tr,
+              //   controller: controller.searchLocationController,
+              // ),
+              child: Container(child: _buildLocationSelectWidget(controller)).marginOnly(right: 5),
+            ),
             Expanded(
               child: SearchAppBar(
                 key: Key("keyword"),
                 value: controller.keyword,
                 searchBarHeight: 38,
-                searchBarBgColor: Colors.white,
+                searchBarBgColor: Color(0xFF4DCFF6).withOpacity(0.2),
                 searchBarBorderRadius: 15,
-                searchBarBorder: Border.all(
-                  color: Color(0XFFC3C3C3), // 设置边框颜色为灰色
-                  width: 0.5, // 设置边框宽度
-                ),
-                textHintColor: Color(0XFFAFB3B7),
+                // searchBarBorder: Border.all(
+                //   color: Color(0XFFC3C3C3), // 设置边框颜色为灰色
+                //   width: 0.5, // 设置边框宽度
+                // ),
+                textHintColor: ColorConstants.textGrayAECAE5,
                 textColor: ColorConstants.black33,
                 textFontSize: 12.0,
                 showSearchIcon: false,
@@ -263,29 +288,6 @@ class _PreselectedAddStaffState extends State<PreselectedAddStaff> {
                 controller: controller.searchController,
               ),
             ),
-            Expanded(
-              child: SearchAppBar(
-                key: Key("searchLocation"),
-                value: controller.searchLocation,
-                searchBarHeight: 38,
-                searchBarBgColor: Colors.white,
-                searchBarBorderRadius: 15,
-                searchBarBorder: Border.all(
-                  color: Color(0XFFC3C3C3), // 设置边框颜色为灰色
-                  width: 0.5, // 设置边框宽度
-                ),
-                textHintColor: Color(0XFFAFB3B7),
-                textColor: ColorConstants.black33,
-                textFontSize: 12.0,
-                showSearchIcon: false,
-                margin: EdgeInsets.only(right: 5),
-                onSearch: (searchLocation) {
-                  controller.searchLocationInputSearch(searchLocation);
-                },
-                hintText: "Location".tr,
-                controller: controller.searchLocationController,
-              ),
-            ),
             Row(
               mainAxisAlignment: MainAxisAlignment.end,
               crossAxisAlignment: CrossAxisAlignment.center,
@@ -412,6 +414,51 @@ class _PreselectedAddStaffState extends State<PreselectedAddStaff> {
       ),
     );
   }
+  // location 下拉选择
+  Widget _buildLocationSelectWidget(PreselectedAddStaffController controller) {
+    return Container(
+      child: Row(
+        mainAxisSize: MainAxisSize.max,
+        mainAxisAlignment: MainAxisAlignment.start,
+        crossAxisAlignment: CrossAxisAlignment.center,
+        children: [
+          // 行业
+          // FormRequireText(text: "Industry".tr, isRequired: false,).marginOnly(right: 38),
+          //选择行业
+          Expanded(
+            child: Container(
+              padding: const EdgeInsets.only(left: 5, right: 5),
+              margin: const EdgeInsets.only(top: 5),
+              height: 38,
+              decoration: BoxDecoration(
+                color:  Color(0xFF4DCFF6).withOpacity(0.2),
+                // border: Border.all(color: Colors.black12.withOpacity(0.05)),
+                borderRadius: const BorderRadius.all(Radius.circular(15)),
+              ),
+              child: Row(
+                mainAxisSize: MainAxisSize.max,
+                crossAxisAlignment: CrossAxisAlignment.center,
+                mainAxisAlignment: MainAxisAlignment.start,
+                children: [
+                  MyTextView(
+                    controller.selectedLocationStr ==null || Utils.isEmpty(controller.selectedLocationStr)? '': controller.selectedLocationStr! ,
+                    hint: "Location".tr,
+                    textHintColor: ColorConstants.textGrayAECAE5,
+                    fontSize: 12,
+                    isFontMedium: true,
+                    textColor: ColorConstants.black33,
+                  ).expanded(),
+                  const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
+                ],
+              ),
+            ).onTap(() {
+              controller.showChooseSearchLocationPicker();
+            }),
+          )
+        ],
+      ),
+    );
+  }
 
 
   Widget _buildStaffItem(PreselectedAddStaffController controller, UkLabourRequestPreselectAddstaffListRows item, VoidCallback callback, { VoidCallback? clickFavoriteCallback }) {

+ 55 - 2
packages/cpt_uk/lib/modules/job/labour_request_preselected_list/widget/preselected_add_staff_controller.dart

@@ -55,6 +55,8 @@ class PreselectedAddStaffController extends GetxController with DioCancelableMix
   List<UkJobListAppliedStaffSelectoptionsEntity>? jobTitleOptionEntityList; // 新增时工作标题的数据源
   String? selectedJobTitleStr;  // 选择的工作标题
 
+  List<String> locationOptionList = [];
+  String? selectedLocationStr;  // 选中的location
 
   List<UkLabourRequestPreselectAddstaffListRows> datas = [];
 
@@ -105,6 +107,22 @@ class PreselectedAddStaffController extends GetxController with DioCancelableMix
         ToastEngine.show(result.errorMsg ?? "Network Load Error".tr);
       }
     }
+
+    if(locationOptionList == null || locationOptionList?.isEmpty == true){
+      // 获取location选项
+      final result = await _jobRepository.fetchAddStaffLocationOptions(cancelToken: cancelToken);
+      if (result.isSuccess) {
+        if (result.list != null) {
+          locationOptionList = result.list!.map((item) => item.toString()).toList();
+        } else {
+          locationOptionList = [];
+        }
+        //刷新
+        update();
+      } else {
+        ToastEngine.show(result.errorMsg ?? "Network Load Error".tr);
+      }
+    }
   }
 
   /// 获取列表数据
@@ -116,7 +134,7 @@ class PreselectedAddStaffController extends GetxController with DioCancelableMix
     // 获取 Staff 列表
     var listResult = await _labourRepository.fetchtPreselectedAddStaffList(
       keyword,
-      searchLocation,
+      selectedLocationStr,
       jobId,
       selectedIndustryId,
       selectedJobTitleId,
@@ -168,6 +186,37 @@ class PreselectedAddStaffController extends GetxController with DioCancelableMix
     }
   }
 
+  //选择 location
+  void showChooseSearchLocationPicker(){
+    int selectedLocationIndex;
+    if (locationOptionList == null || locationOptionList?.isEmpty == true) {
+      selectedLocationIndex = 0;
+    } else {
+      selectedLocationIndex = locationOptionList?.indexWhere((e) => e.toString() == selectedJobIndustryStr)?? 0;
+    }
+
+    if (selectedLocationIndex < 0) {
+      selectedLocationIndex = 0;
+    }
+
+    OptionPickerUtil.showCupertinoOptionPicker(
+      items: locationOptionList?.map((e) => e!).toList(growable: false)?? [],
+      initialSelectIndex: selectedLocationIndex,
+      onPickerChanged: (_, index) {
+        String lastSelectedLocationStr = selectedLocationStr?? "";
+        String curSelectedLocationStr = locationOptionList?[index] ?? "";
+        if(lastSelectedLocationStr != curSelectedLocationStr){
+          Log.d("选中的 curSelectedLocationStr  ${curSelectedLocationStr}");
+          selectedLocationStr = curSelectedLocationStr;
+          update();
+          // 掉接口获取数据
+          doSearch();
+        }
+      },
+    );
+  }
+
+
   //选择 industry
   void showChooseIndustryPicker(){
     int selectedIndustryIndex;
@@ -276,8 +325,12 @@ class PreselectedAddStaffController extends GetxController with DioCancelableMix
     searchLocation = "";
     selectedJobTitleStr = "";
     selectedJobIndustryStr = "";
+    selectedLocationStr = "";
     update();
-    doSearch();
+    // 延时 500ms 后 刷新
+    Future.delayed(Duration(milliseconds: 500), () {
+      doSearch();
+    });
   }
 
 

+ 2 - 0
packages/cs_domain/lib/constants/api_constants.dart

@@ -319,6 +319,8 @@ class ApiConstants {
   // labourrequest-review 批量审核(确认和拒绝)提交
   static const apiLabourRequestReViewBatchSubmitUK = "/index.php/api/v1/hotel/lab-req/review-batch";
 
+  // applied-staff  location 选项
+  static const apiAppliedStaffLocationListUK = "/index.php/api/v1/hotel/prestaff/location";
   // applied 行业列表
   static const apiAppliedStaffIndustryListUK = "/index.php/api/v1/hotel/prestaff/industry";
   // applied - 根据行业id 获取工作标题列表

+ 8 - 1
packages/cs_domain/lib/generated/json/uk_labour_request_preselect_addstaff_list_entity.g.dart

@@ -95,6 +95,10 @@ UkLabourRequestPreselectAddstaffListRows $UkLabourRequestPreselectAddstaffListRo
   if (applyState != null) {
     ukLabourRequestPreselectAddstaffListRows.applyState = applyState;
   }
+  final bool? isSelected = jsonConvert.convert<bool>(json['isSelected']);
+  if (isSelected != null) {
+    ukLabourRequestPreselectAddstaffListRows.isSelected = isSelected;
+  }
   return ukLabourRequestPreselectAddstaffListRows;
 }
 
@@ -114,6 +118,7 @@ Map<String, dynamic> $UkLabourRequestPreselectAddstaffListRowsToJson(
   data['resume'] = entity.resume;
   data['turn_up_rate'] = entity.turnUpRate;
   data['apply_state'] = entity.applyState;
+  data['isSelected'] = entity.isSelected;
   return data;
 }
 
@@ -132,6 +137,7 @@ extension UkLabourRequestPreselectAddstaffListRowsExtension on UkLabourRequestPr
     String? resume,
     String? turnUpRate,
     int? applyState,
+    bool? isSelected,
   }) {
     return UkLabourRequestPreselectAddstaffListRows()
       ..id = id ?? this.id
@@ -146,6 +152,7 @@ extension UkLabourRequestPreselectAddstaffListRowsExtension on UkLabourRequestPr
       ..skillsShort = skillsShort ?? this.skillsShort
       ..resume = resume ?? this.resume
       ..turnUpRate = turnUpRate ?? this.turnUpRate
-      ..applyState = applyState ?? this.applyState;
+      ..applyState = applyState ?? this.applyState
+      ..isSelected = isSelected ?? this.isSelected;
   }
 }

+ 27 - 0
packages/cs_domain/lib/repository/uk_job_repository.dart

@@ -484,6 +484,33 @@ class UKJobRepository extends GetxService {
     return result.convert();
   }
 
+  /// 获取 添加员工 时的 location options
+  Future<HttpResult> fetchAddStaffLocationOptions(
+      {
+        CancelToken? cancelToken,
+      }
+      ) async {
+    //参数
+    Map<String, String> params = {};
+    final result = await httpProvider.requestNetResult(
+      ApiConstants.apiAppliedStaffLocationListUK,
+      params: params,
+      cancelToken: cancelToken,
+    );
+
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final listJson = result.getListJson();
+      // var list = listJson
+      //     ?.map((e) => UkJobListAppliedStaffSelectoptionsEntity.fromJson(e as Map<String, dynamic>))
+      //     .toList();
+      //重新赋值data或list
+      return result.convert(list: listJson);
+    }
+    return result.convert();
+  }
+
   /// 获取 添加员工 时根据 industry id 获取jobtitle options
   Future<HttpResult<UkJobListAppliedStaffSelectoptionsEntity>> fetchAddStaffJobTitleOptions(
     String industryId,