From 5ce27d69c427ca16f37ff16d53758d0e877a88f9 Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期三, 31 五月 2023 17:48:34 +0800
Subject: [PATCH] 修改页面以及更改跳转方式

---
 force-app/main/default/lwc/lexCancelReport/lexCancelReport.js |   40 +++++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
index d75559e..2236a21 100644
--- a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
+++ b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
@@ -5,8 +5,10 @@
 import queryForCancelReportButton  from '@salesforce/apex/OpportunityLightingButtonController.queryForCancelReportButton';
 import { updateRecord } from 'lightning/uiRecordApi';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { NavigationMixin } from 'lightning/navigation';
+import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
 import ConSent from '@salesforce/apex/BidAnnouncementController.ConSent';
-export default class LexCancelReport extends LightningElement {
+export default class LexCancelReport extends NavigationMixin(LightningElement) {
     @api recordId;
     stageName;
     sapSendOK;
@@ -21,6 +23,7 @@
     salesManagerDepartmentID;
     salesOwnerBuchang;
     salesOwnerBuchangID;
+    recordTypeId;
     IsLoading = true;
     @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
@@ -55,8 +58,12 @@
             this.salesManagerDepartmentID = result.salesManagerDepartmentID == undefined ? '' : result.salesManagerDepartmentID;
             this.salesOwnerBuchang = result.salesOwnerBuchang == undefined ? '' : result.salesOwnerBuchang;
             this.salesOwnerBuchangID = result.salesOwnerBuchangID == undefined ? '' : result.salesOwnerBuchangID;
+            this.recordTypeId = result.recordTypeId;
             this.cancelReport();
-        })
+        }).catch(error=>{
+            console.log("error");
+            console.log(error);
+        });
     }
     showToast(msg,type) {
         const event = new ShowToastEvent({
@@ -100,17 +107,24 @@
             }
             //XLIU-CG98L5 銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� end
             else {
-            location.href = '/a1U/e?retURL=%2F'+ this.recordId +
-            '&RecordType=01210000000R4hH' +
-            '&CF00N10000004lbGT=' + this.name +
-            '&CF00N10000004lbGT_lkid=' + this.recordId +
-            '&CF00N10000006QShg=' + this.salesAssistantName +
-            '&CF00N10000006QShg_lkid=' + this.salesAssistantID +
-            '&CF00N10000006QShq='+ this.managerName +
-            '&CF00N10000006QShq_lkid=' + this.salesManagerDepartmentID +
-            '&CF00N10000006QShb=' + this.salesOwnerBuchang +
-            '&CF00N10000006QShb_lkid=' + this.salesOwnerBuchangID +
-            '';
+                const defaultValues = encodeDefaultFieldValues({
+                    Opportunity__c: this.recordId, // 鍏宠仈涓昏褰� ID
+                    Sales_assistant__c: this.salesAssistantID,
+                    Manager_sales__c: this.salesManagerDepartmentID,
+                    Buchang_sales__c: this.salesOwnerBuchangID
+                });
+                this[NavigationMixin.Navigate]({
+                    type: 'standard__objectPage',
+                    attributes: {
+                        objectApiName: 'Lost_cancel_report__c',
+                        actionName: 'new'
+                    },
+                    state: {
+                        nooverride: '1',
+                        defaultFieldValues: defaultValues,
+                        recordTypeId: this.recordTypeId,
+                    }
+                });
         }
         this.dispatchEvent(new CloseActionScreenEvent());
         });  

--
Gitblit v1.9.1