高级配置(开发使用)

编程打开某个域的APP

功能:通过js代码,自动打开GongqiOS内的某个APP,并自动打开某个页面。 场景:定制销售统计看板,点击某个数据后,打开销售APP的某个明细页面以便更好的查看统计数据来源。 范围:以下只适用于打开使用GongqiDesigner开发的应用,打开技术APP请参考:编程打开某个技术APP 代码示例:

代码说明:开发人员需调用GongqiOS前端window对象的openMenu方法,需确定以下几个参数: doMain,要打开的APP所在的域编号,可以在域管理页面查看。 appId,要打开的APP的id号,可以在应用管理里面找到对应APP进行查看。 menuItemId,要打开的页面的菜单id号,目前只能通过开发者工具选取元素,具体见图:{图} pageUrl和win_url的拼接规则:/osweb/${item.doMain}/appCustomClient/index.html?appId=${item.appId}&domain=${item.doMain}&menuItem=${item.AuthorityMenuItemIdScreen}

如果需要执行其他被打开画面的代码逻辑的 支持携带 CommandResult 参数,参数内容为CommandResult对象并需要使用encodeURI加码

   例如代码:
    var commandResult = new CommandResult();//如单纯想打开画面 commandResult非必须
    commandResult.alert("参数");
    let code = encodeURI(JSON.stringify(CommandResult))
    let item = {
      doMain:'Item',
      appId:'gongqi.df.prod',
      AuthorityMenuItemIdScreen:'gongqi.df.prod.50400047',
      icon:'/osweb/appIcons/img/gongqi.df.prod.png',
      name:'',
      code:code
      };
    let win_url = "/osweb/${item.doMain}/appCustomClient/index.html?appId=${item.appId}&domain=${item.doMain}&menuItem=${item.AuthorityMenuItemIdScreen}&CommandResult=${item.code}"

  let data = {
    appId: item.appId,
    id: item.appId,
    doMain: item.doMain,
    pageURL: win_url,
    win_url: win_url,
    icon: item.icon,
    title:item.name
  }
  if(item.doMain){
    try {
      let $window = window.top
      $window.openMenu({item: data})
    } catch (e) {
      console.log(e)
    }

  }else{
      try {
      let $window = window.top
      $window.openCloudMenu({item: data})
    } catch (e) {
      console.log(e)
    }
  }

请使用try catch包裹代码以处理可能出现的异常

如果需要使用 后台java代码实现功能

        CommandResult result = new CommandResult();
        String appId = "gongqi.df.prod";
        String domain = "Item";
        String menuItem = "gongqi.df.prod.50400047";
        String icon = "/osweb/appIcons/img/gongqi.df.prod.png";
        CommandResult commandResult = new CommandResult();
//         commandResult.formCmd("refData", "参数");  或者调用 被打开的 Form 上的某个方法 如 refData
        commandResult.alert("参数");
        String jsonString = JSON.toJSONString(commandResult);
        String url="/osweb/Item/appCustomClient/index.html?appId="+appId+"&domain="+domain+"&menuItem="+menuItem+"&CommandResult="+jsonString;
        String js = "  let data = {\n" + 
                "    appId: '"+appId+"',\n" + 
                "    id: '"+appId+"',\n" + 
                "    doMain: '"+domain+"',\n" + 
                "    pageURL: '"+url+"',\n" +    
                "    win_url: '"+url+"',\n" + 
                "    icon: '"+icon+"',\n" + 
                "    title:null\n" + 
                "  }\n" + 
                "data.win_url = encodeURI(data.win_url);"+
                "  window.top.openMenu({item: data})";
        result.js(js);
        return result;

未来工厂面板设置

功能:通过URL参数 默认加载某面板中的某菜单

URL实例:

/osweb/MIX/appCustomClient/layers/app/gongqi.os.inyApp/dist/index.html#/portal?portalId=9b1a703d-acd6-44ae-9177-0348b86cf573&menuName=数据总览

portalId:面板Id

menuName:菜单名称

results matching ""

    No results matching ""