From 7c7cb195462c2ded7bfe4105959ea36d1dd68ded Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期三, 11 十月 2023 19:26:36 +0800
Subject: [PATCH] 近期修改
---
force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js | 42 +++++++++++++++++++++++++++++++++---------
1 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js b/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js
index 453f9df..3a8a60f 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-04-13 14:39:54
+ * @LastEditTime: 2023-10-10 17:34:10
*/
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
@@ -12,7 +12,9 @@
import init from '@salesforce/apex/OpportunityLightingButtonController.initForCreateEventButton';
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
-export default class LexCreateEvent extends LightningElement {
+import { NavigationMixin } from 'lightning/navigation';
+import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+export default class LexCreateEvent extends NavigationMixin(LightningElement) {
@api recordId;
accountId;
@wire(CurrentPageReference)
@@ -34,6 +36,7 @@
init({
recordId: this.recordId
}).then(result=>{
+ console.log(result);
this.accountId = result.accountId;
this.createEvent();
}).catch(error=>{
@@ -42,16 +45,37 @@
})
}
createEvent(){
- window.open("/00U/e?retURL=%2Fapex%2FVFClosePage&accid=" + this.accountId + "&oid=" + this.recordId, "鏂板缓璁″垝");
+ this[NavigationMixin.Navigate]({
+ type: 'standard__objectPage',
+ attributes: {
+ objectApiName: 'Event',
+ actionName: 'new'
+ },
+ state: {
+ // retURL: '/apex/VFClosePage',
+ accid: this.accountId,
+ oid: this.recordId
+ }
+ });
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