All Downloads are FREE. Search and download functionalities are using the official Maven repository.

static.smart-ui.plugins.router.antd.router.js Maven / Gradle / Ivy

There is a newer version: 1.0.4
Show newest version
(function(){
    var router = {
        init:function(options){
            var that = this;
            that.attr = options;
            that.attr.menumap = {};
            that.attr.urlmap = {};
            that.attr.el = document.querySelector(options.iframesDivEl);
            window.addEventListener("resize", function(){
                winSize();
            });
            that.attr.uiHost = options.uiHost;
            that.attr.background = options.background;
            eval("router.attr.vm."+that.attr.openKeysField+"=[]");
            var data = that.attr.menus;
            for(var i=0;i0){
                router.routerPageId(tempPanes[0][that.attr.menuIdField]);
            }
        },
        routerPageUrl:function(url){
            var that = this;
            var menu = that.attr.urlmap[url];
            if(menu){
                that.routerPageId(menu[that.attr.menuIdField]);
            }else{
                utils.$.errorMsg(url+"没有在路由中注册");
            }
        },
        routerPageId:function(id){
            var that = this;
            var panes = eval("router.attr.vm."+that.attr.panesField);
            var has = false;
            for(var i=0;i';
                div.setAttribute('key',id);
                that.attr.el.append(div);
            }
            div.style = "height:100%;width:100%;";
            eval("router.attr.vm."+that.attr.selectKeyField+"=[id]");
            history.pushState({status: 0} ,'' ,'#'+menu[that.attr.menuUrlField]);
            winSize();
            if(that.attr.onRouter){
                that.attr.onRouter();
            }
        }
    };
    function listToTree(list){
        var trees = [];
        if(!list || list.length == 0){
            return trees;
        }
        for(var i=0;i<100;i++){
            var hasIn = true;
            for(var i=0;i0){
                return dgFindPidObject(pid,tempTree.children);
            }
        }
        return null;
    }
    function winSize(){
        if(router.attr.el && router.attr.el.parentElement && router.attr.el.parentElement.clientHeight){
            var ptop = parseInt(router.attr.el.parentElement.style.paddingTop);
            var prevHeight = router.attr.el.previousElementSibling.clientHeight;
            router.attr.el.style.height=(router.attr.el.parentElement.clientHeight-ptop-prevHeight)+"px";
        }
    }
    window.router = router;
})()




© 2015 - 2025 Weber Informatics LLC | Privacy Policy