|
我自己修改了首页功能树的显示,修改成顶部和左侧,顶部显示的是一级目录,点击一级目录后,左侧显示该目录下的二级三级等等,
当我左侧存在二级目录的时候注销该用户退出后再次登录就会报错,当我没有点击一级目录,则无二级目录的情况下则不会报错这是为什么?
报错如下:
index.js修改功能树如下:
//创建左侧树形菜单
Model.prototype.doCreateLeftFunctionTree = function(event,m){
var context = this.getContext(); //收藏夹相关
var id = this.getContext().data.bizParams.value.currentPersonID; //收藏夹相关
var funcs = FUNC;
$content = $(".sidebar-menu"),
html = [],
me = this;
function printTree(children, isFirst){
if(!children || !children.length) return;
for(var i=0; i<children.length; i++){
var child = children;
var hasChildren = child.$children && child.$children.length > 0;
html.push('<li class="');
if(hasChildren)
html.push(' treeview');
if(child.psmCount > 1)
html.push(' psm');
html.push('">');
html.push('<a ');
if(child.url){
html.push('title="', child.label, '" ');
html.push('pageKey="', child.pageKey, '" ');
}
html.push('>');
if(hasChildren && isFirst){
html.push('<i class="x-functree-icon ' + (child.iconClass||(hasChildren?'fa fa-folder':'fa fa-circle-o')) + '"/>');
}
if(isFirst){
html.push('<span class="title">');
}
html.push(child.label);
if(isFirst){
html.push('</span>');
html.push('<span class="selected"></span>');
}
if(child.psmCount > 1){
html.push('<span class="psm icon-person-stalker pull-right-container"></span>');
}
html.push('</a>');
if(hasChildren){
html.push('<ul class="treeview-menu">');
printTree(child.$children);
html.push('</ul>');
}
html.push('</li>');
}
}
printTree(funcs[m].$children, true);
//Model.prototype.selectQuick(id);
html = html.join('');
$content.append(html);
//设置main的显示名
$content.find('li>.x-portal-showMain>.title').html(this._cfg.main.title);
$('li>a', $content).click(function(){
var el = $(this),pageKey=el.attr('pageKey');
if(pageKey){
$(".func-open", $content).removeClass("func-open");
el.parent().addClass("func-open");
me.showPage(pageKey);
}
});
};
//创建顶部树形菜单
Model.prototype.doCreateTopFunctionTree = function(event){
var context = this.getContext(); //收藏夹相关
var id = this.getContext().data.bizParams.value.currentPersonID; //收藏夹相关
FUNC = event.funcs;
var funcs = event.funcs,
$content = $(".nav_first"),
html = [],
me = this;
function printTree(children, isFirst){
if(!children || !children.length) return;
for(var i=0; i<children.length; i++){
//
var child = children;
var hasChildren = child.$children && child.$children.length > 0;
if(hasChildren){
html.push('<li><a>'+child.label+'</a></li>');
}
}
}
printTree(funcs, true);
html = html.join('');
$content.append(html);
};
Model.prototype.btnEditClick = function(event,i) {
$(".nav_first>li>a").removeClass('choosed');
$(".nav_first>li:eq("+i+")>a").addClass('choosed');
this.clearFuncTree();
this.on('onLoadFunctionTree', this.doCreateLeftFunctionTree(event, i));
}
|
|