19626
2023-10-07 988f9735377909b6310301e582c15804e004783f
force-app/main/default/pages/ImprovedForecastTimeAno.page
@@ -1,36 +1,64 @@
<apex:page showHeader="false" sidebar="false" id="ImprovedForecastTimeApp" title="预测日期改变">
<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>
        $Lightning.use("c:ImprovedForecastTimeApp", function () {
            $Lightning.createComponent("c:ImprovedForecastTime",
                {},
                "ImprovedForecastTimeApp",
                function (cmp) {
                    console.log('Component created, do something cool here');
                });
        });
        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');
        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);
                    // 检查是否找到了元素
                    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>