binxie
2023-07-11 be102ae06e8f986bd9d1a544cd2752e5fa94231a
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
({
    doInit1 : function(component, event, helper) {
        let rid = component.get('v.recordId');
        console.log(rid);
        let pid = window.location.href.replace("https://","").split("/");
        pid = pid[pid.length-1].replace("new?","");
        let jsonobj = {};
        console.log(pid);
        pid.split("&").forEach(function(v){ 
 
            console.log(v);
            let param = v.split("=");
            jsonobj[param[0]] = param[1];
        }); 
        let urlStr = JSON.stringify(jsonobj);
        console.log(urlStr);
        // if (rid) {}
        /*let pid = null;
        if(!rid){
            pid = window.location.href.replace("https://","").split("/")[4];
        }
        let isClone = component.get('v.isClone');
        if(!rid || isClone){
            component.set('v.title',$A.get("$Label.c.New")+'.客户人员');
        }else{
            component.set('v.title',$A.get("$Label.c.Edit")+'.客户人员');
        }
        
        let record_type_id = null;
        let pageref = component.get("v.pageReference")
        if(!record_type_id && pageref){
           record_type_id = pageref.state.recordTypeId
        }
        component.set("v.showSpinner", true);*/
        helper.CallBackAction(component,'init',{
            recordId : rid,
            urlStr : urlStr
            },function(data){
            console.log("data");
            console.log(data);
        });
    },
    doInit : function(component, event, helper) {
        let rid = component.get('v.recordId');
        // console.log(rid);
        let pid = window.location.href.replace("https://","").split("/");
        pid = pid[pid.length-1].replace("new?","");
        let jsonobj = {};
        // console.log(pid);
        pid.split("&").forEach(function(v){ 
 
            // console.log(v);
            let param = v.split("=");
            jsonobj[param[0]] = param[1];
        }); 
        let urlStr = JSON.stringify(jsonobj);
        // console.log(urlStr);
        component.set('v.urlStr',urlStr);
        // create a one-time use instance of the serverEcho action
        // in the server-side controller
        /*var action = component.get("c.init");
        action.setParams({
            recordId : rid,
            urlStr : urlStr
        });
 
        // Create a callback that is executed after 
        // the server-side action returns
        action.setCallback(this, function(response) {
            console.log("response");
            console.log(response);
            // var state = response.getState();
            if (state === "SUCCESS") {
                // Alert the user with the value returned 
                // from the server
                alert("From server: " + response.getReturnValue());
 
                // You would typically fire a event here to trigger 
                // client-side notification that the server-side 
                // action is complete
            }
            else if (state === "INCOMPLETE") {
                // do something
            }
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }
        });
 
        // optionally set storable, abortable, background flag here
 
        // A client-side action could cause multiple events, 
        // which could trigger other events and 
        // other server-side action calls.
        // $A.enqueueAction adds the server-side action to the queue.
        $A.enqueueAction(action);*/
    }
})