Browse Source

uk 修复bug

glglove 2 days ago
parent
commit
4f4584258f

+ 1 - 1
packages/cpt_uk/lib/modules/attendance/security_registration/item_security_registration.dart

@@ -57,7 +57,7 @@ class SecurityRegistrationItem extends StatelessWidget {
                 fontSize: 14,
                 marginLeft: 5,
                 marginRight: 5,
-                textDecoration: TextDecoration.underline,
+                // textDecoration: TextDecoration.underline,
                 decorationColor: ColorConstants.textYellowFFBB1B,
                 // 可选,设置下划线的颜色
                 decorationThickness: 2.0,

+ 21 - 1
packages/cpt_uk/lib/modules/job/labour_request_add/labour_request_add_controller.dart

@@ -92,6 +92,14 @@ class LabourRequestAddController extends GetxController with DioCancelableMixin
       int? challenge25Index = state.labReqOption?.challenge25List?.indexWhere((e) => e.checked == "checked") ?? -1;
       if (challenge25Index != -1) {
         state.selectedChallenge25Id = state.labReqOption?.challenge25List?[challenge25Index].value.toString();
+      }else {
+        // 将 state.labReqOption?.challenge25List 的 value 为 0 的 修改为 checked
+        state.labReqOption?.challenge25List?.forEach((e) {
+          if (e.value == 0) {
+            e.checked = "checked";
+            state.selectedChallenge25Id = e.value.toString();
+          }
+        });
       }
 
 
@@ -500,6 +508,7 @@ class LabourRequestAddController extends GetxController with DioCancelableMixin
     final result = await _ukLabourRepository.fetchLabourRequestShowTemplateData(templateId);
     if (result.isSuccess) {
       state.showTemplateData = result.data;
+
       if (state.showTemplateData != null) {
         // 回显 证书、vehicle
         if((state.showTemplateData?.certificate??'').isNotEmpty){
@@ -526,10 +535,21 @@ class LabourRequestAddController extends GetxController with DioCancelableMixin
             }
           });
 
-
           Log.d("切换模板后, 需要回显的vehicle列表: ${state.selectedVehicleList}");
           Log.d("切换模板后, 证书的回显 vehicleList: ${state.labReqOption?.vehicleList}");
 
+          // 回显chanllege25
+          state.selectedChallenge25Id = state.showTemplateData?.challenge25.toString();
+          state.labReqOption?.challenge25List?.forEach((e)=> {
+            if(state.selectedChallenge25Id == e.value.toString()){
+              e.checked = 'checked'
+            }else {
+              e.checked = ''
+            }
+          });
+          Log.d("切换模板后, 需要回显的challenge25列表: ${state.challenge25List}");
+          Log.d("切换模板后, 证书的回显 vehicleList: ${state.labReqOption?.challenge25List}");
+
         }
         // 更新
         update();

+ 7 - 0
packages/cpt_uk/lib/modules/job/template_add/template_add_controller.dart

@@ -78,6 +78,7 @@ class TemplateAddController extends GetxController with DioCancelableMixin {
     //处理数据
     if (result.isSuccess) {
       UkJobTemplateDetailBySelectTitleEntity? resultData = result.data;
+      Log.d("切换标题后 获取的数据 ${resultData}");
       // var templateNameController = state.formData['template_name']!['controller'];
       var clientNameController = state.formData['client_name']!['controller'];
       var descController = state.formData['desc']!['controller'];
@@ -103,6 +104,8 @@ class TemplateAddController extends GetxController with DioCancelableMixin {
         state.indexOptionEntity?.certificateList?.forEach((cerItem) {
           if (jobCertificateList.contains(cerItem.value)) {
             cerItem.checked = "checked";
+          }else {
+            cerItem.checked = "";
           }
         });
       }
@@ -115,6 +118,8 @@ class TemplateAddController extends GetxController with DioCancelableMixin {
         state.indexOptionEntity?.challenge25List?.forEach((challenge25Item) {
           if (state.selectedChallenge25Id == challenge25Item.value?.toString()) {
             challenge25Item.checked = "checked";
+          }else {
+            challenge25Item.checked = "";
           }
         });
       }
@@ -131,6 +136,8 @@ class TemplateAddController extends GetxController with DioCancelableMixin {
         state.indexOptionEntity?.vehicleList?.forEach((vechicleItem) {
           if (jobVechicleList.contains(vechicleItem.value)) {
             vechicleItem.checked = "checked";
+          }else {
+            vechicleItem.checked = "";
           }
         });
       }

+ 12 - 1
packages/cpt_uk/lib/modules/review/labour_review_edit/labour_review_edit_controller.dart

@@ -306,10 +306,21 @@ class LabourReviewEditController extends GetxController with DioCancelableMixin
             }
           });
 
-
           Log.d("切换模板后, 需要回显的vehicle列表: ${state.selectedVehicleList}");
           Log.d("切换模板后, 证书的回显 vehicleList: ${state.labReqOption?.vehicleList}");
 
+          // 回显chanllege25
+          state.selectedChallenge25Id = state.showTemplateData?.challenge25.toString();
+          state.labReqOption?.challenge25List?.forEach((e)=> {
+            if(state.selectedChallenge25Id == e.value.toString()){
+              e.checked = 'checked'
+            }else {
+              e.checked = ''
+            }
+          });
+          Log.d("切换模板后, 需要回显的challenge25列表: ${state.challenge25List}");
+          Log.d("切换模板后, 证书的回显 vehicleList: ${state.labReqOption?.challenge25List}");
+
         }
         // 更新
         update();

+ 4 - 0
packages/cs_domain/lib/entity/response/uk_lab_req_show_template_entity.dart

@@ -33,6 +33,10 @@ class UkLabReqShowTemplateEntity {
 	int? templateId;
 	@JSONField(name: "job_title_id")
 	int? jobTitleId;
+	@JSONField(name: "client_name")
+	String? clientName;
+	@JSONField(name: "challenge_25")
+	int? challenge25;
 
 	UkLabReqShowTemplateEntity();
 

+ 15 - 1
packages/cs_domain/lib/generated/json/uk_lab_req_show_template_entity.g.dart

@@ -76,6 +76,14 @@ UkLabReqShowTemplateEntity $UkLabReqShowTemplateEntityFromJson(
   if (jobTitleId != null) {
     ukLabReqShowTemplateEntity.jobTitleId = jobTitleId;
   }
+  final String? clientName = jsonConvert.convert<String>(json['client_name']);
+  if (clientName != null) {
+    ukLabReqShowTemplateEntity.clientName = clientName;
+  }
+  final int? challenge25 = jsonConvert.convert<int>(json['challenge_25']);
+  if (challenge25 != null) {
+    ukLabReqShowTemplateEntity.challenge25 = challenge25;
+  }
   return ukLabReqShowTemplateEntity;
 }
 
@@ -100,6 +108,8 @@ Map<String, dynamic> $UkLabReqShowTemplateEntityToJson(
   data['deleted_at'] = entity.deletedAt;
   data['template_id'] = entity.templateId;
   data['job_title_id'] = entity.jobTitleId;
+  data['client_name'] = entity.clientName;
+  data['challenge_25'] = entity.challenge25;
   return data;
 }
 
@@ -123,6 +133,8 @@ extension UkLabReqShowTemplateEntityExtension on UkLabReqShowTemplateEntity {
     dynamic deletedAt,
     int? templateId,
     int? jobTitleId,
+    String? clientName,
+    int? challenge25,
   }) {
     return UkLabReqShowTemplateEntity()
       ..id = id ?? this.id
@@ -142,6 +154,8 @@ extension UkLabReqShowTemplateEntityExtension on UkLabReqShowTemplateEntity {
       ..updatedAt = updatedAt ?? this.updatedAt
       ..deletedAt = deletedAt ?? this.deletedAt
       ..templateId = templateId ?? this.templateId
-      ..jobTitleId = jobTitleId ?? this.jobTitleId;
+      ..jobTitleId = jobTitleId ?? this.jobTitleId
+      ..clientName = clientName ?? this.clientName
+      ..challenge25 = challenge25 ?? this.challenge25;
   }
 }

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

@@ -75,6 +75,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;
 }
 
@@ -89,6 +93,7 @@ Map<String, dynamic> $UkLabourRequestPreselectAddstaffListRowsToJson(
   data['profile_picture'] = entity.profilePicture;
   data['status'] = entity.status;
   data['apply_state'] = entity.applyState;
+  data['isSelected'] = entity.isSelected;
   return data;
 }
 
@@ -102,6 +107,7 @@ extension UkLabourRequestPreselectAddstaffListRowsExtension on UkLabourRequestPr
     String? profilePicture,
     int? status,
     int? applyState,
+    bool? isSelected,
   }) {
     return UkLabourRequestPreselectAddstaffListRows()
       ..id = id ?? this.id
@@ -111,6 +117,7 @@ extension UkLabourRequestPreselectAddstaffListRowsExtension on UkLabourRequestPr
       ..nric = nric ?? this.nric
       ..profilePicture = profilePicture ?? this.profilePicture
       ..status = status ?? this.status
-      ..applyState = applyState ?? this.applyState;
+      ..applyState = applyState ?? this.applyState
+      ..isSelected = isSelected ?? this.isSelected;
   }
 }

+ 1 - 0
packages/cs_domain/lib/repository/uk_labour_repository.dart

@@ -145,6 +145,7 @@ class UkLabourRepository extends GetxService {
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
+
       var data = UkLabReqShowTemplateEntity.fromJson(json!);
       //重新赋值data或list
       return result.convert<UkLabReqShowTemplateEntity>(data: data);