From e630bb4c33c166083a427a688c3955421bc75abc Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期五, 24 五月 2024 14:36:27 +0800
Subject: [PATCH] 1

---
 force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js |   41 ++++++++++++++++++++++-------------------
 1 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js b/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js
index b7ccc1f..1eb5caa 100644
--- a/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js
+++ b/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js
@@ -4,7 +4,7 @@
  * @Author: chen jing wu
  * @Date: 2023-04-13 13:50:23
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-06-05 09:13:58
+ * @LastEditTime: 2023-10-18 21:03:42
  */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
@@ -36,6 +36,7 @@
         init({
             recordId: this.recordId
         }).then(result=>{
+            console.log(result);
             this.accountId = result.accountId;
             this.createEvent();
         }).catch(error=>{
@@ -44,27 +45,29 @@
         })
     }
     createEvent(){
-        this[NavigationMixin.Navigate]({
-            type: 'standard__objectPage',
-            attributes: {
-                objectApiName: 'Event',
-                actionName: 'new'
-            },
-            state: {
-                // retURL: '/apex/VFClosePage',
-                accid: this.accountId,
-                oid: this.recordId
-            }
-        });
+        window.open( 
+            "/apex/SimpleEventRegister?retURL=%2Fapex%2FVFClosePage&accid=" 
+            + this.accountId + "&oid=" 
+            + this.recordId + "&source=AccountPCL&save_new=1&sfdc.override=1");
         this.dispatchEvent(new CloseActionScreenEvent());
     }
     showToast(msg,type) {
-        const event = new ShowToastEvent({
-            title: '',
-            message: msg,
-            variant: type
-        });
-        this.dispatchEvent(event);
+        if(type == 'success'){
+            const event = new ShowToastEvent({
+                message: msg,
+                variant: type,
+            });
+            this.dispatchEvent(event);
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }else{
+            const event = new ShowToastEvent({
+                message: msg,
+                variant: type,
+                mode: 'sticky'
+            });
+            this.dispatchEvent(event);
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }   
     }
     updateRecordView(recordId) {
         updateRecord({fields: { Id: recordId }});

--
Gitblit v1.9.1