From 3d7c6c96eb1fd9c193623b418038671f4fff6252 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期四, 11 四月 2024 16:58:11 +0800
Subject: [PATCH] 123

---
 force-app/main/default/lwc/lexComplete/lexComplete.js |   42 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/force-app/main/default/lwc/lexComplete/lexComplete.js b/force-app/main/default/lwc/lexComplete/lexComplete.js
index 89131c9..fb737d5 100644
--- a/force-app/main/default/lwc/lexComplete/lexComplete.js
+++ b/force-app/main/default/lwc/lexComplete/lexComplete.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 11:21:30
+ */
 import { LightningElement,wire,track,api} from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -11,6 +19,22 @@
     profileId;
     status;
     IsLoading = true;
+
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
     
     connectedCallback () {
         console.log(this.recordId);
@@ -19,18 +43,14 @@
         }).then(result => {
             console.log(result);
             if (result != null) {
-                this.IsLoading = false;
                 this.status = result.status;
                 this.profileId = result.profileId;
                 this.complete();
-                this.dispatchEvent(new CloseActionScreenEvent());
                 //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
             }
         }).catch(error => {
             console.log("error");
             console.log(error);
-        }).finally(() => {
-            
         });   
         //this.updateRecordView(this.recordId);
     }
@@ -53,18 +73,24 @@
     complete () {
         // 闄嗚儨锛岃儭杩畨锛岀郴缁熺鐞嗗憳浠ュ娌℃湁鏉冮檺
         if (UserInfo_Owner.Id != "00510000004reg2" && UserInfo_Owner.Id != "00510000000gWAE" && this.profileId != "00e10000000Y3o5") {
-            ShowToastEvent("浣犳病鏈夋潈闄�","error");
+            this.showToast("浣犳病鏈夋潈闄�","error");
             return;
         }
         if (this.status == "瀹屾瘯") {
-            ShowToastEvent("宸茬粡瀹屾瘯锛�","error");
+            this.showToast("宸茬粡瀹屾瘯锛�","error");
             return;
         }
         updateForCompleteButton({
             recordId: this.recordId
         }).then(result =>{
-            this.updateRecordView(this.recordId);
-            this.showToast("瀹屾瘯鎴愬姛锛�","success");
+            if(result){
+                this.showToast(result,"error");
+            }else{
+                this.updateRecordView(this.recordId);
+                this.showToast("瀹屾瘯鎴愬姛锛�","success");
+            }
+            this.IsLoading = false;
+            this.dispatchEvent(new CloseActionScreenEvent());
         });
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1