From bebea4a8b5c80ff7562bfb47d8f3069a975eebf0 Mon Sep 17 00:00:00 2001
From: LiJinHuan <lijinhuan@prec-tech.com>
Date: 星期五, 07 七月 2023 09:58:06 +0800
Subject: [PATCH] 调拨新建默认优化

---
 force-app/main/default/lwc/lexTransferApplyNew/lexTransferApplyNew.js |   44 ++++++++++++++++++++++++--------------------
 1 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/force-app/main/default/lwc/lexTransferApplyNew/lexTransferApplyNew.js b/force-app/main/default/lwc/lexTransferApplyNew/lexTransferApplyNew.js
index 36be97d..c050950 100644
--- a/force-app/main/default/lwc/lexTransferApplyNew/lexTransferApplyNew.js
+++ b/force-app/main/default/lwc/lexTransferApplyNew/lexTransferApplyNew.js
@@ -3,7 +3,7 @@
  * @Author: [lijinhuan]
  * @Date: 2023-07-03 15:55:28
  * @LastEditors: [lijinhuan]
- * @LastEditTime: 2023-07-06 18:05:15
+ * @LastEditTime: 2023-07-07 09:50:38
  */
 import { LightningElement,wire } from 'lwc';
 import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
@@ -14,27 +14,31 @@
     getStateParameters(currentPageReference) {
         if (currentPageReference) {
             const urlValue = currentPageReference.state.recordTypeId;
+            console.log('****urlValue****',urlValue);
+            let str = `${urlValue}`;
+            this.recordTypeId = str;
+            console.log('****str****',str);
+            let defaultFieldValues = {};
+            defaultFieldValues['Name'] = '*';
+            let states = 
+                {
+                    nooverride: '1',
+                    navigationLocation: 'LIST_VIEW',
+                    backgroundContext: '/lightning/o/TransferApply__c/list?filterName=Recent&0.source=alohaHeader',
+                    defaultFieldValues: encodeDefaultFieldValues(defaultFieldValues),
+                };
             if (urlValue) {
-                let str = `${urlValue}`;
-                this.recordTypeId = str;
-                let defaultFieldValues = {};
-                defaultFieldValues['Name'] = '*';
-                this[NavigationMixin.Navigate]({
-                    type: 'standard__objectPage',
-                    attributes: {
-                        objectApiName: 'TransferApply__c',
-                        actionName: 'new'
-                    },
-                    state: {
-                        nooverride: '1',
-                        defaultFieldValues: encodeDefaultFieldValues(defaultFieldValues),
-                        recordTypeId: this.recordTypeId,
-                        useRecordTypeCheck: 1,
-                        navigationLocation: 'LIST_VIEW',
-                        backgroundContext: '/lightning/o/TransferApply__c/list?filterName=Recent&0.source=alohaHeader'
-                    }
-                });
+                states['recordTypeId'] =  this.recordTypeId;
+                states['useRecordTypeCheck'] =  1;
             }
+            this[NavigationMixin.Navigate]({
+                type: 'standard__objectPage',
+                attributes: {
+                    objectApiName: 'TransferApply__c',
+                    actionName: 'new'
+                },
+                state: states
+            });
         }
        
     }

--
Gitblit v1.9.1