From 492f744d9d84289e27b2ddac9a9b4a2137fd11d6 Mon Sep 17 00:00:00 2001
From: KKbes <1620284052@qq.com>
Date: 星期一, 07 八月 2023 11:25:24 +0800
Subject: [PATCH] slefreview
---
force-app/main/default/lwc/lexCopyPIContarct/lexCopyPIContarct.js | 37 +++++++++++++++++++++++++------------
1 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/force-app/main/default/lwc/lexCopyPIContarct/lexCopyPIContarct.js b/force-app/main/default/lwc/lexCopyPIContarct/lexCopyPIContarct.js
index 9036254..7bed5fa 100644
--- a/force-app/main/default/lwc/lexCopyPIContarct/lexCopyPIContarct.js
+++ b/force-app/main/default/lwc/lexCopyPIContarct/lexCopyPIContarct.js
@@ -2,9 +2,13 @@
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
-export default class lexCopyPIContarct extends LightningElement {
+import { NavigationMixin } from 'lightning/navigation';
+import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+import init2 from '@salesforce/apex/LexAgenceCopyPIController.init2';
+export default class lexCopyPIContarct extends NavigationMixin(LightningElement) {
@api recordId;
IsLoading=true;
+ dateF;
@wire(CurrentPageReference)
getStateParameters(currentPageReference) {
@@ -18,20 +22,29 @@
}
connectedCallback(){
- this.CopyPI().then(result => {
- this.IsLoading=false;
- this.dispatchEvent(new CloseActionScreenEvent());
- }).catch(error => {
- const eventInItError = new ShowToastEvent({
- message:
- error.message,
- variant : 'error'
- });
- this.dispatchEvent(eventInItError);
+ init2({recordId : this.recordId}).then(res=>{
+ this.dateF = res;
+ this.CopyPI().then(result => {
+ this.IsLoading=false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
});
+
}
async CopyPI(){
- window.location.href = '/'+this.recordId+'/e?newclone=1';
+ this[NavigationMixin.Navigate]({
+ type: 'standard__objectPage',
+ attributes: {
+ objectApiName: 'Contact', // 瑕佹柊寤虹殑瀵硅薄API
+ actionName: 'new',
+ },
+ state:{
+ nooverride: '1',
+ defaultFieldValues:this.dateF ,
+ }
+ });
+ console.log(this.dateF);
+ this.dispatchEvent(new CloseActionScreenEvent());
}
}
\ No newline at end of file
--
Gitblit v1.9.1