buli
2023-04-26 d6a096fadfe9c8f261f56a827cfceed663c36b8b
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import {
    LightningElement,
    wire,
    api
} from 'lwc';
import {
    CurrentPageReference
} from "lightning/navigation";
import {
    CloseActionScreenEvent
} from 'lightning/actions';
import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
import {
    ShowToastEvent
} from 'lightning/platformShowToastEvent';
 
export default class LexCustomNewCopy2 extends LightningElement {
    @api recordId;
    str;
    IsLoading = true;
    Id;
    notRenewC;
    Name;
 
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
        if (currentPageReference) {
            const urlValue = currentPageReference.state.recordId;
            if (urlValue) {
                let str = `${urlValue}`;
                this.recordId = str;
            }
        }
    }
 
    connectedCallback() {
        console.log(this.recordId);
        init({
            recordId: this.recordId
        }).then(result => {
            console.log(result);
            if (result != null) {
                this.IsLoading = false;
                this.Id = result.Id;
                this.notRenewC = result.notRenewC;
                this.Name = result.Name;
 
                this.CustomNewCopy2();
                this.dispatchEvent(new CloseActionScreenEvent());
            }
        }).catch(error => {
            console.log(error);
        }).finally(() => {
 
        });
    }
 
    // 继续新服务合同
    CustomNewCopy2() {
        if (this.notRenewC) {
            this.ShowToastEvent("请联系服务商品部!", "error");
            // alert("请联系服务商品部!");
        } else {
            window.open("/" + this.Id + "/e?clone=1&Name=&00N10000002Dx5D=&00N10000002Dx5S=%e5%bc%95%e5%90%88%e4%b8%ad&00NO00000010sDc=&CF00NO00000010hyI=&CF00NO00000010hyI_lkid=&CF00NO00000010hyX=&CF00NO00000010hyX_lkid=&CF00NO00000010hyN=&CF00NO00000010hyN_lkid=&RecordType=01210000000gTYq&00N10000002pmOp=&00N10000006gZDd=&00N10000006gZDe=&00NO00000010hy4=&00N10000002Dx4j=&00N10000002Dx4m=&00N10000002Dx4w=&00N10000002Dx4k=&00N10000002Dx5J=&00N10000002Dx5M=&00N10000002Dx4i=&00N10000002Dx4h=&00N10000002Dx5K=&00N10000003OXdT=&00N100000048zfn=&00N10000002FMsq=&00N10000003OlGF=&00N10000002Dx4r=&00N100000047AY1=&00N100000047AYB=&00N100000047AY6=&00N10000003PCeB=&00N10000005HBNe=&00N10000006plAl=&00N10000002Dx5C=&retURL=%2F" + this.Id + "&saveURL=%2Fapex/SaveMaintenanceByCopy?mid=" + this.Id + "&CF00N100000048Paw=" + this.Name + "&CF00N100000048Paw_lkid=" + this.Id, "_blank");
        }
    }
 
    // 弹窗
    ShowToastEvent(msg, type) {
        const event = new ShowToastEvent({
            title: '',
            message: msg,
            variant: type
        });
        this.dispatchEvent(event);
    }
}