浏览代码

labourRequest 的状态为 approve 下的时候有些弹窗内容不允许修改和删除

liukai 3 天之前
父节点
当前提交
8b77999bee

+ 18 - 15
packages/cpt_th/lib/modules/job_er/job_list_er/widget/pre_selected_staff.dart

@@ -25,7 +25,7 @@ class PreSelectedStaff extends StatefulWidget {
   String? requestId;
   int jobStatus = 0;
 
-  PreSelectedStaff({ this.jobId, this.requestId,required this.jobStatus});
+  PreSelectedStaff({this.jobId, this.requestId, required this.jobStatus});
 
   @override
   State<PreSelectedStaff> createState() => _AppliedAddStaffState();
@@ -302,20 +302,23 @@ class _AppliedAddStaffState extends State<PreSelectedStaff> {
         ).paddingOnly(left: 19, right: 20, top: 17),
 
         //删除按钮
-        MyButton(
-          onPressed: () {
-            FocusScope.of(context).unfocus();
-            controller.doDeleteAction(item);
-          },
-          text: "Delete".tr,
-          textColor: ColorConstants.white,
-          fontSize: 13,
-          backgroundColor: hexToColor("#DC4462"),
-          radius: 17.25,
-          padding: const EdgeInsets.only(left: 12, right: 12, top: 5, bottom: 5),
-          minWidth: 50,
-          minHeight: 35,
-        ).marginOnly(right: 17, top: 18).alignRight()
+        Visibility(
+          visible: widget.jobStatus != 2,
+          child: MyButton(
+            onPressed: () {
+              FocusScope.of(context).unfocus();
+              controller.doDeleteAction(item);
+            },
+            text: "Delete".tr,
+            textColor: ColorConstants.white,
+            fontSize: 13,
+            backgroundColor: hexToColor("#DC4462"),
+            radius: 17.25,
+            padding: const EdgeInsets.only(left: 12, right: 12, top: 5, bottom: 5),
+            minWidth: 50,
+            minHeight: 35,
+          ).marginOnly(right: 17, top: 18),
+        ).alignRight()
       ],
     );
   }

+ 45 - 36
packages/cpt_th/lib/modules/labour/labour_request_list/dialog/oa_attach_list_dialog.dart

@@ -26,8 +26,9 @@ class OaAttachListDialog extends StatefulWidget {
   String requestId;
   String jobTitle;
   String jobDate;
+  bool canEdit = true;
 
-  OaAttachListDialog({required this.requestId, required this.jobTitle, required this.jobDate});
+  OaAttachListDialog({required this.requestId, required this.jobTitle, required this.jobDate, required this.canEdit});
 
   @override
   State<OaAttachListDialog> createState() => _AppliedAddStaffState();
@@ -85,20 +86,24 @@ class _AppliedAddStaffState extends State<OaAttachListDialog> {
                   }).alignRight(),
                 ],
               ),
-              MyButton(
-                type: ClickType.throttle,
-                milliseconds: 500,
-                onPressed: () {
-                  controller.pickAttFile();
-                },
-                text: "Add File".tr,
-                minHeight: 35,
-                textColor: ColorConstants.white,
-                fontSize: 12,
-                radius: 20,
-                backgroundColor: hexToColor("#FFBB1B"),
-                fontWeight: FontWeight.w500,
-              ).marginOnly(left: 15, right: 15, top: 5),
+
+              Visibility(
+                visible: widget.canEdit,
+                child: MyButton(
+                  type: ClickType.throttle,
+                  milliseconds: 500,
+                  onPressed: () {
+                    controller.pickAttFile();
+                  },
+                  text: "Add File".tr,
+                  minHeight: 35,
+                  textColor: ColorConstants.white,
+                  fontSize: 12,
+                  radius: 20,
+                  backgroundColor: hexToColor("#FFBB1B"),
+                  fontWeight: FontWeight.w500,
+                ).marginOnly(left: 15, right: 15, top: 5),
+              ),
 
               //工作信息
               MyTextView(
@@ -162,14 +167,14 @@ class _AppliedAddStaffState extends State<OaAttachListDialog> {
                     successSliverWidget: [
                       SliverList(
                           delegate: SliverChildBuilderDelegate(
-                                (context, index) {
-                              return _buildStaffItem(controller.datas[index], () {
-                                //删除
-                                controller.doDeleteAction(controller.datas[index].id??"", index);
-                              });
-                            },
-                            childCount: controller.datas.length,
-                          ))
+                        (context, index) {
+                          return _buildStaffItem(controller.datas[index], () {
+                            //删除
+                            controller.doDeleteAction(controller.datas[index].id ?? "", index);
+                          });
+                        },
+                        childCount: controller.datas.length,
+                      ))
                     ],
                   ),
                 ),
@@ -205,23 +210,27 @@ class _AppliedAddStaffState extends State<OaAttachListDialog> {
               textColor: ColorConstants.string2Color("#06A962"),
               fontSize: 12,
               onClick: () {
-                _openFile(item.attUrl??"");
+                _openFile(item.attUrl ?? "");
               },
               marginLeft: 10,
               isFontRegular: true,
             ).expanded(),
-            MyButton(
-              onPressed: () {
-                deleteAction.call();
-              },
-              text: "Delete".tr,
-              textColor: ColorConstants.white,
-              backgroundColor: ColorConstants.redFF4066,
-              radius: 17.25,
-              fontSize: 12,
-              minWidth: 48,
-              minHeight: 30,
-            ).marginOnly(left: 10)
+
+            Visibility(
+              visible: widget.canEdit,
+              child: MyButton(
+                onPressed: () {
+                  deleteAction.call();
+                },
+                text: "Delete".tr,
+                textColor: ColorConstants.white,
+                backgroundColor: ColorConstants.redFF4066,
+                radius: 17.25,
+                fontSize: 12,
+                minWidth: 48,
+                minHeight: 30,
+              ).marginOnly(left: 10),
+            ),
           ],
         ).marginOnly(top: 15),
 

+ 1 - 0
packages/cpt_th/lib/modules/labour/labour_request_list/labour_request_list_controller.dart

@@ -342,6 +342,7 @@ class LabourRequestListController extends GetxController with DioCancelableMixin
         requestId: data.id.toString(),
         jobTitle: data.jobTitle ?? "-",
         jobDate: data.jobDate ?? "-",
+        canEdit: data.status != 2,
       ),
     );
   }

+ 1 - 0
packages/cpt_th/lib/modules/labour/labour_review_list/labour_review_controller.dart

@@ -349,6 +349,7 @@ class LabourReviewController extends GetxController with DioCancelableMixin {
         requestId: data.requestId.toString(),
         jobTitle: data.jobTitle ?? "-",
         jobDate: data.jobDate ?? "-",
+        canEdit: false,
       ),
     );
   }

+ 1 - 1
packages/cs_domain/lib/constants/api_constants.dart

@@ -2,7 +2,7 @@
 
 class ApiConstants {
   //当前服务器环境
-  static const isServerRelease = true;
+  static const isServerRelease = false;
 
   //新加坡的域名
   static const sgBaseUrl = isServerRelease ? 'https://casualabour.com/' : 'http://singapore-dev.casualabour.com';