Przeglądaj źródła

添加OT的逻辑与OA的工作列表只能修改部门的逻辑修复

liukai 5 godzin temu
rodzic
commit
ab9a672a9d

+ 23 - 0
packages/cpt_th/lib/modules/job_er/job_list_er/job_list_er_item.dart

@@ -175,6 +175,29 @@ class JobListErItem extends StatelessWidget {
           //   ],
           // ).marginOnly(top: 6),
 
+          //OT的设置
+          Row(
+            mainAxisSize: MainAxisSize.max,
+            crossAxisAlignment: CrossAxisAlignment.center,
+            children: [
+              MyTextView(
+                "${"OT".tr}:",
+                fontSize: 15,
+                textColor: Colors.white,
+                isFontRegular: true,
+                marginRight: 10,
+              ),
+              CupertinoSwitch(
+                value: item.isOt == 2,
+                activeColor: const Color(0XFF03DC9A),
+                trackColor: const Color(0XFFDCDDDD),
+                thumbColor: CupertinoColors.white,
+                onChanged: (value) {
+                },
+              ),
+            ],
+          ).marginOnly(top: 6),
+
           // 状态
           Row(
             mainAxisSize: MainAxisSize.max,

+ 11 - 0
packages/cpt_th/lib/modules/labour/labour_request_add/labour_request_add_controller.dart

@@ -86,6 +86,8 @@ class LabourRequestAddController extends GetxController with DioCancelableMixin
 
         state.attFilePath = state.editDetailEntity?.labReq?.attUrl;
 
+        state.isOTSelected = state.editDetailEntity?.labReq?.isOt == 2; //等于2就是选中状态
+
         update();
       }
     } else {
@@ -228,6 +230,7 @@ class LabourRequestAddController extends GetxController with DioCancelableMixin
         estRevenue: revenue,
         position: position,
         estCost: totalCost,
+        isOT: state.isOTSelected,
         cancelToken: cancelToken,
       );
     } else {
@@ -252,6 +255,7 @@ class LabourRequestAddController extends GetxController with DioCancelableMixin
         position: position,
         estCost: totalCost,
         attUrl: state.attFilePath,
+        isOT: state.isOTSelected,
         cancelToken: cancelToken,
       );
     }
@@ -388,4 +392,11 @@ class LabourRequestAddController extends GetxController with DioCancelableMixin
       }
     }
   }
+
+  //设置OT的Switch控件是否选中
+  void setOTSelected(bool selected) {
+    state.isOTSelected = selected;
+    update();
+  }
+
 }

+ 24 - 0
packages/cpt_th/lib/modules/labour/labour_request_add/labour_request_add_page.dart

@@ -482,6 +482,30 @@ class _LabourRequestAddState extends BaseState<LabourRequestAddPage, LabourReque
                         ],
                       ),
 
+                      //OT的设置
+                      Row(
+                        children: [
+                          MyTextView(
+                            "${"OT".tr}:",
+                            fontSize: 15,
+                            textColor: Colors.white,
+                            isFontRegular: true,
+                            marginRight: 10,
+                          ),
+                          CupertinoSwitch(
+                            value: state.isOTSelected,
+                            activeColor: const Color(0XFF03DC9A),
+                            trackColor: const Color(0XFFDCDDDD),
+                            thumbColor: CupertinoColors.white,
+                            onChanged: state.pageType == 2
+                                ? null
+                                : (value) {
+                                    controller.setOTSelected(value);
+                                  },
+                          ),
+                        ],
+                      ).marginOnly(top: 15),
+
                       //输入Remark
                       MyTextView(
                         "Remark".tr,

+ 2 - 1
packages/cpt_th/lib/modules/labour/labour_request_add/labour_request_add_state.dart

@@ -1,4 +1,3 @@
-import 'package:domain/entity/response/s_g_labour_request_detail_entity.dart';
 import 'package:domain/entity/response/t_h_o_a_labour_detail_entity.dart';
 import 'package:flutter/material.dart';
 import 'package:plugin_basic/basic_export.dart';
@@ -105,4 +104,6 @@ class LabourRequestAddState {
   String? selectedType;
 
   String? attFilePath;
+
+  bool isOTSelected = false;
 }

+ 23 - 0
packages/cpt_th/lib/modules/labour/labour_request_list/labour_request_item.dart

@@ -204,6 +204,29 @@ class LabourRequestItem extends StatelessWidget {
             ],
           ),
 
+          //OT的设置
+          Row(
+            mainAxisSize: MainAxisSize.max,
+            crossAxisAlignment: CrossAxisAlignment.center,
+            children: [
+              MyTextView(
+                "${"OT".tr}:",
+                fontSize: 15,
+                textColor: Colors.white,
+                isFontRegular: true,
+                marginRight: 10,
+              ),
+              CupertinoSwitch(
+                value: item.isOt == 2,
+                activeColor: const Color(0XFF03DC9A),
+                trackColor: const Color(0XFFDCDDDD),
+                thumbColor: CupertinoColors.white,
+                onChanged: (value) {
+                },
+              ),
+            ],
+          ).marginOnly(top: 1,bottom: 4),
+
           // 状态
           Row(
             mainAxisSize: MainAxisSize.max,

+ 22 - 0
packages/cpt_th/lib/modules/labour/labour_review_list/labour_review_item.dart

@@ -176,6 +176,28 @@ class LabourReviewItem extends StatelessWidget {
             ],
           ).marginOnly(top:10),
 
+          //OT的设置
+          Row(
+            mainAxisSize: MainAxisSize.max,
+            crossAxisAlignment: CrossAxisAlignment.center,
+            children: [
+              MyTextView(
+                "${"OT".tr}:",
+                fontSize: 15,
+                textColor: Colors.white,
+                isFontRegular: true,
+                marginRight: 10,
+              ),
+              CupertinoSwitch(
+                value: item.isOt == 2,
+                activeColor: const Color(0XFF03DC9A),
+                trackColor: const Color(0XFFDCDDDD),
+                thumbColor: CupertinoColors.white,
+                onChanged: (value) {
+                },
+              ),
+            ],
+          ).marginOnly(top: 5),
 
           //按钮组
           Visibility(

+ 11 - 0
packages/cpt_th/lib/modules/labour_er/labour_request_er_add/labour_request_er_add_controller.dart

@@ -61,6 +61,8 @@ class LabourRequestERAddController extends GetxController with DioCancelableMixi
         remarkController.text = state.editDetailEntity?.job?.description ?? '';
         eventNameController.text = state.editDetailEntity?.job?.eventName ?? '';
         eventTypeController.text = state.editDetailEntity?.job?.eventType ?? '';
+
+        state.isOTSelected = state.editDetailEntity?.job?.isOt == 2; //2是选中
       } else {
         ToastEngine.show(result.errorMsg ?? "Network Load Error".tr);
       }
@@ -72,6 +74,7 @@ class LabourRequestERAddController extends GetxController with DioCancelableMixi
 
       if (result.isSuccess) {
         state.editDetailEntity = result.data;
+        state.isOTSelected = false;
       } else {
         ToastEngine.show(result.errorMsg ?? "Network Load Error".tr);
       }
@@ -176,6 +179,7 @@ class LabourRequestERAddController extends GetxController with DioCancelableMixi
         eventName: eventName,
         eventType: evenType,
         remark: remark,
+        isOT: state.isOTSelected,
         cancelToken: cancelToken,
       );
     } else {
@@ -194,6 +198,7 @@ class LabourRequestERAddController extends GetxController with DioCancelableMixi
         eventName: eventName,
         eventType: evenType,
         remark: remark,
+        isOT: state.isOTSelected,
         cancelToken: cancelToken,
       );
     }
@@ -308,4 +313,10 @@ class LabourRequestERAddController extends GetxController with DioCancelableMixi
       title: "Repeat End Time".tr,
     );
   }
+
+  //设置OT的Switch控件是否选中
+  void setOTSelected(bool selected) {
+    state.isOTSelected = selected;
+    update();
+  }
 }

+ 50 - 17
packages/cpt_th/lib/modules/labour_er/labour_request_er_add/labour_request_er_add_page.dart

@@ -7,6 +7,7 @@ import 'package:flutter/widgets.dart';
 import 'package:get/get.dart';
 import 'package:plugin_basic/base/base_state.dart';
 import 'package:plugin_basic/base/base_stateful_page.dart';
+import 'package:plugin_basic/service/app_config_service.dart';
 import 'package:plugin_basic/utils/ext_get_nav.dart';
 import 'package:router/path/router_path.dart';
 import 'package:shared/utils/date_time_utils.dart';
@@ -97,7 +98,7 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                         margin: const EdgeInsets.only(top: 10),
                         height: 45,
                         decoration: BoxDecoration(
-                          color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 ? 0.5 : 0.2),
+                          color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 || ConfigService.to.isTHOAType ? 0.5 : 0.2),
                           borderRadius: const BorderRadius.all(Radius.circular(5)),
                         ),
                         child: Row(
@@ -116,7 +117,7 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
 
                             //下拉选图标
                             Visibility(
-                              visible: state.pageType != 2,
+                              visible: state.pageType != 2 && !ConfigService.to.isTHOAType,
                               child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
                             ),
                           ],
@@ -142,7 +143,7 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                               padding: const EdgeInsets.only(left: 16, right: 10),
                               height: 45,
                               decoration: BoxDecoration(
-                                color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 ? 0.5 : 0.2),
+                                color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 || ConfigService.to.isTHOAType ? 0.5 : 0.2),
                                 borderRadius: const BorderRadius.all(Radius.circular(5)),
                               ),
                               child: Row(
@@ -160,14 +161,14 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                                   ).expanded(),
                                   //下拉选图标
                                   Visibility(
-                                    visible: state.pageType != 2,
+                                    visible: state.pageType != 2 && !ConfigService.to.isTHOAType,
                                     child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
                                   ),
                                 ],
                               ),
                             ).onTap(() {
                               FocusScope.of(context).unfocus();
-                              if (state.pageType != 2) controller.pickStartTime();
+                              if (state.pageType != 2 && !ConfigService.to.isTHOAType) controller.pickStartTime();
                             }),
                           ),
 
@@ -178,7 +179,7 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                               margin: const EdgeInsets.only(left: 10),
                               height: 45,
                               decoration: BoxDecoration(
-                                color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 ? 0.5 : 0.2),
+                                color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 || ConfigService.to.isTHOAType ? 0.5 : 0.2),
                                 borderRadius: const BorderRadius.all(Radius.circular(5)),
                               ),
                               child: Row(
@@ -196,14 +197,14 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                                   ).expanded(),
                                   //下拉选图标
                                   Visibility(
-                                    visible: state.pageType != 2,
+                                    visible: state.pageType != 2 && !ConfigService.to.isTHOAType,
                                     child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
                                   ),
                                 ],
                               ),
                             ).onTap(() {
                               FocusScope.of(context).unfocus();
-                              if (state.pageType != 2) controller.pickEndTime();
+                              if (state.pageType != 2 && !ConfigService.to.isTHOAType) controller.pickEndTime();
                             }),
                           ),
                         ],
@@ -348,7 +349,7 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                             margin: const EdgeInsets.only(right: 12),
                             height: 45,
                             decoration: BoxDecoration(
-                              color: const Color(0xFF4DCFF6).withOpacity(0.2),
+                              color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 || ConfigService.to.isTHOAType ? 0.5 : 0.2),
                               borderRadius: const BorderRadius.all(Radius.circular(5)),
                             ),
                             child: Row(
@@ -364,12 +365,15 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                                   textColor: ColorConstants.white,
                                 ).expanded(),
                                 //下拉选图标
-                                const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
+                                Visibility(
+                                  visible: state.pageType != 2 && !ConfigService.to.isTHOAType,
+                                  child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
+                                ),
                               ],
                             ),
                           ).onTap(() {
                             FocusScope.of(context).unfocus();
-                            controller.pickLimitType();
+                            if (state.pageType != 2 && !ConfigService.to.isTHOAType) controller.pickLimitType();
                           }).expanded(flex: 55),
 
                           //输入框-不限制性别
@@ -382,7 +386,8 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                               paddingTop: 0,
                               paddingBottom: 0,
                               height: 45,
-                              fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(0.2),
+                              enabled: state.pageType != 2 && !ConfigService.to.isTHOAType,
+                              fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 || ConfigService.to.isTHOAType ? 0.5 : 0.2),
                               inputFormatters: <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly],
                               textInputType: TextInputType.number,
                               formData: state.formData,
@@ -417,6 +422,7 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                                       paddingRight: 10,
                                       height: 45,
                                       cornerRadius: 0,
+                                      enabled: state.pageType != 2 && !ConfigService.to.isTHOAType,
                                       fillBackgroundColor: Colors.transparent,
                                       inputFormatters: <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly],
                                       textInputType: TextInputType.number,
@@ -429,7 +435,7 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                                   ],
                                 )
                                     .decorated(
-                                      color: const Color(0xFF4DCFF6).withOpacity(0.2),
+                                      color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 || ConfigService.to.isTHOAType ? 0.5 : 0.2),
                                       borderRadius: const BorderRadius.all(Radius.circular(5)),
                                     )
                                     .expanded(),
@@ -452,6 +458,7 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                                       paddingLeft: 10,
                                       paddingRight: 10,
                                       height: 45,
+                                      enabled: state.pageType != 2 && !ConfigService.to.isTHOAType,
                                       cornerRadius: 0,
                                       fillBackgroundColor: Colors.transparent,
                                       inputFormatters: <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly],
@@ -475,6 +482,30 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                         ],
                       ),
 
+                      //OT的设置
+                      Row(
+                        children: [
+                          MyTextView(
+                            "${"OT".tr}:",
+                            fontSize: 15,
+                            textColor: Colors.white,
+                            isFontRegular: true,
+                            marginRight: 10,
+                          ),
+                          CupertinoSwitch(
+                            value: state.isOTSelected,
+                            activeColor: const Color(0XFF03DC9A),
+                            trackColor: const Color(0XFFDCDDDD),
+                            thumbColor: CupertinoColors.white,
+                            onChanged: state.pageType == 2
+                                ? null
+                                : (value) {
+                                    controller.setOTSelected(value);
+                                  },
+                          ),
+                        ],
+                      ).marginOnly(top: 15, bottom: 10),
+
                       //输入类型
                       MyTextView("Event".tr, fontSize: 15, textColor: Colors.white, isFontRegular: true, marginTop: 15, marginBottom: 10),
 
@@ -487,7 +518,8 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                             paddingTop: 0,
                             paddingBottom: 0,
                             height: 45,
-                            fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(0.2),
+                            enabled: state.pageType != 2 && !ConfigService.to.isTHOAType,
+                            fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 || ConfigService.to.isTHOAType ? 0.5 : 0.2),
                             inputFormatters: <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly],
                             textInputType: TextInputType.number,
                             formData: state.formData,
@@ -505,7 +537,8 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                             paddingTop: 0,
                             paddingBottom: 0,
                             height: 45,
-                            fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(0.2),
+                            enabled: state.pageType != 2 && !ConfigService.to.isTHOAType,
+                            fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 || ConfigService.to.isTHOAType ? 0.5 : 0.2),
                             inputFormatters: <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly],
                             textInputType: TextInputType.number,
                             formData: state.formData,
@@ -532,14 +565,14 @@ class _LabourRequestAddState extends BaseState<LabourRequestERAddPage, LabourReq
                           margin: const EdgeInsets.only(top: 10),
                           padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
                           decoration: BoxDecoration(
-                            color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 ? 0.5 : 0.2),
+                            color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 || ConfigService.to.isTHOAType ? 0.5 : 0.2),
                             borderRadius: const BorderRadius.all(Radius.circular(5)),
                           ),
                           child: TextField(
                             cursorColor: ColorConstants.white,
                             cursorWidth: 1.5,
                             autofocus: false,
-                            enabled: state.pageType != 2,
+                            enabled: state.pageType != 2 && !ConfigService.to.isTHOAType,
                             focusNode: state.formData["remark"]!['focusNode'],
                             controller: state.formData["remark"]!['controller'],
                             // 装饰

+ 2 - 0
packages/cpt_th/lib/modules/labour_er/labour_request_er_add/labour_request_er_add_state.dart

@@ -71,4 +71,6 @@ class LabourRequestERAddState {
 
   String? selectOutletId;
   String? selectOutletName;
+
+  bool isOTSelected = false;  //OT的选中
 }

+ 6 - 0
packages/cs_domain/lib/repository/th_er_repository.dart

@@ -92,6 +92,7 @@ class THERRepository extends GetxService {
     String? eventName,
     String? eventType,
     String? remark,
+    bool isOT = false,
     CancelToken? cancelToken,
   }) async {
     Map<String, String> params = {};
@@ -123,6 +124,9 @@ class THERRepository extends GetxService {
     if (!Utils.isEmpty(remark)) {
       params["remark"] = remark!;
     }
+    if (isOT) {
+      params["is_ot"] = "2";
+    }
 
     final result = await httpProvider.requestNetResult(
       ApiConstants.apiERLabourRequestAddSubmitTH,
@@ -279,6 +283,7 @@ class THERRepository extends GetxService {
     String? eventName,
     String? eventType,
     String? remark,
+    bool isOT = false,
     CancelToken? cancelToken,
   }) async {
     Map<String, String> params = {};
@@ -308,6 +313,7 @@ class THERRepository extends GetxService {
     if (!Utils.isEmpty(remark)) {
       params["remark"] = remark!;
     }
+    params["is_ot"] = isOT ? "2" : "1";
 
     final result = await httpProvider.requestNetResult(
       ApiConstants.apiERLabourRequestEditSubmitTH,

+ 7 - 2
packages/cs_domain/lib/repository/th_oa_repository.dart

@@ -247,6 +247,7 @@ class THOARepository extends GetxService {
     String? position,
     String? estCost,
     String? attUrl,
+    bool isOT = false,
     CancelToken? cancelToken,
   }) async {
     //参数
@@ -275,6 +276,9 @@ class THOARepository extends GetxService {
     params['position'] = position ?? "";
     params['est_cost'] = estCost ?? "";
     params['att_url'] = attUrl ?? "";
+    if (isOT) {
+      params['is_ot'] = "2";
+    }
 
     final result = await httpProvider.requestNetResult(
       ApiConstants.apiOALabourRequestAddSubmitTH,
@@ -313,6 +317,7 @@ class THOARepository extends GetxService {
     String? estRevenue,
     String? position,
     String? estCost,
+    bool isOT = false,
     CancelToken? cancelToken,
   }) async {
     //参数
@@ -341,6 +346,7 @@ class THOARepository extends GetxService {
     params['est_revenue'] = estRevenue ?? "";
     params['position'] = position ?? "";
     params['est_cost'] = estCost ?? "";
+    params['is_ot'] = isOT ? "2" : "1";
 
     final result = await httpProvider.requestNetResult(
       isReviewEdit ? ApiConstants.apiOALabourReviewEditSubmitTH : ApiConstants.apiOALabourRequestEditSubmitTH,
@@ -593,7 +599,7 @@ class THOARepository extends GetxService {
     Map<String, String> params = {};
     params['record_ids'] = recordIds ?? "";
     params['type'] = type ?? "";
-    if (Utils.isNotEmpty(auditMark)){
+    if (Utils.isNotEmpty(auditMark)) {
       params['audit_mark'] = auditMark!;
     }
 
@@ -638,5 +644,4 @@ class THOARepository extends GetxService {
     }
     return result.convert();
   }
-
 }