【问题标题】:When launching icCube report how can I get the user name启动icCube报告时如何获取用户名
【发布时间】:2017-08-08 13:39:42
【问题描述】:

在ic3Report.html文件中,是否可以在回调函数中获取用户名?

var options = {
        root: "ic3-report/app/",
        rootLocal: "ic3-report/app-local/",
        rootVersion: "_IC3_ROOT_VERSION_",
        callback: function () {
            $('#intro').remove();
            window.ic3application = ic3.startReport(
                    {
                        <!-- ic3-start-report-options (DO NOT REMOVE - USED TO GENERATE FILES) -->
                    });
           // get user name here !
        }

    };

【问题讨论】:

    标签: iccube-reporting


    【解决方案1】:

    为了收集当前用户信息,您应该设置 GVI 配置。可以通过适当的方法完成:

    var options = {
        root: "ic3-report/app/",
        rootLocal: "ic3-report/app-local/",
        rootVersion: "_IC3_ROOT_VERSION_",
        callback: function () {
            $('#intro').remove();
            var ic3reporting = new ic3.Reporting(
                        {
                            noticesLevel: ic3.NoticeLevel.INFO,
                            dsSettings: {
                                url: GVI_URL
                            }
                        });
            ic3reporting.setupGVIConfiguration(function () {
                var userName = ic3reporting.userName();
            })
        }
    };
    

    之后,用户信息将在上下文中可用。有关详细信息,请参阅上面的代码。

    更新

    更强大的解决方案是将代码添加到不会被新版本的报告覆盖的本地文件中。您可以在 Admin > Common JS 配置中使用 ic3bootstrapLocal 功能。

    function ic3bootstrapLocal(options) {  
       var ic3reporting = new ic3.Reporting({
           noticesLevel: ic3.NoticeLevel.INFO,
        });
    
       ic3reporting.setupGVIConfiguration(function(){
          ic3reporting.userName()
          options.callback && options.callback();     
       });        
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多