liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
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
<apex:page showHeader="false" sidebar="false" id="ImprovedForecastTimeApp" title="预测日期改变" lightningStylesheets="true">
    <apex:includeLightning />
    <div style="width:100%;height:100%;" id="ImprovedForecastTimeApp" />
    <style>
        .slds-theme_error{
            --lwc-colorBackgroundToastError: #ba0517 !important;
        }
    </style>
    <script>
        
        init();
        function init(){
            var id = getParam('id');
            console.log(id);
            $Lightning.use("c:ImprovedForecastTimeApp", function () {
                $Lightning.createComponent("c:lexImprovedForecastTimeNew",
                    {
                        'recordId': id
                    },
                    "ImprovedForecastTimeApp",
                    function (cmp) {
                        var errorMessageElement = document.getElementById('auraErrorMessage');
 
                    // 检查是否找到了元素
                    if (errorMessageElement) {
                        // 隐藏元素
                        errorMessageElement.style.display = 'none';
                    }
                
                    });
            });
        }
       
 
        // var interval = setInterval(()=>{
        //     var hrefStr = window.location.href;
        //     if (hrefStr.indexOf("Refresh") != -1) {
        //         // var query = window.location.search.substring(1);
        //         // var vars = query.split("&");
        //         // var oppId = '';
        //         // for (var i = 0; i < vars.length; i++) {
        //         //     var pair = vars[i].split("=");
        //         //     if (pair[0] == 'id') {
        //         //         oppId = pair[1];
        //         //     }
        //         // }
        //         // if (oppId != '') {
        //         //     window.open('/'+oppId, '_self');
        //         // }
        //         top.window.close();
        //         clearInterval(interval);
        //     }
        // },1000);
        function getParam(paramName) {
        paramValue = "", isFound = !1;
        if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
            arrSource = decodeURI(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;
            while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++
                }
        return paramValue == "" && (paramValue = null), paramValue;
        }
    </script>
 
</apex:page>