1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
 * @Description: 新建调拨重写 No. 默认* 
 * @Author: [lijinhuan]
 * @Date: 2023-07-03 15:55:28
 * @LastEditors: [lijinhuan]
 * @LastEditTime: 2023-07-07 09:50:38
 */
import { LightningElement,wire } from 'lwc';
import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
export default class LexTransferApplyNew extends NavigationMixin(LightningElement) {
    recordTypeId;
    @wire(CurrentPageReference)
    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) {
                states['recordTypeId'] =  this.recordTypeId;
                states['useRecordTypeCheck'] =  1;
            }
            this[NavigationMixin.Navigate]({
                type: 'standard__objectPage',
                attributes: {
                    objectApiName: 'TransferApply__c',
                    actionName: 'new'
                },
                state: states
            });
        }
       
    }
}