提交 6beddc58 编写于 作者: zcdtk's avatar zcdtk

应用菜单脏代码处理

上级 23ce0419
...@@ -210,82 +210,6 @@ import { Environment } from '@/environments/environment'; ...@@ -210,82 +210,6 @@ import { Environment } from '@/environments/environment';
</#if> </#if>
} }
<#if view.isDefaultPage?? && view.isDefaultPage()>
/**
* 处理菜单默认选中项
*
* @private
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
private doMenuSelect(): void {
if (!this.isDefaultPage) {
return;
}
const appFuncs: any[] = this.menuMode.getAppFuncs();
if (this.$route && this.$route.matched && this.$route.matched.length == 2) { // 存在二级路由
const [{ }, matched] = this.$route.matched;
const appfunc: any = appFuncs.find((_appfunc: any) => Object.is(_appfunc.routepath, matched.path) && Object.is(_appfunc.appfuncyype, 'APPVIEW'));
if (appfunc) {
this.computeMenuSelect(this.menus, appfunc.appfunctag);
}
return;
} else if (this.defPSAppView && Object.keys(this.defPSAppView).length > 0) { // 存在默认视图
const appfunc: any = appFuncs.find((_appfunc: any) => Object.is(_appfunc.routepath, this.defPSAppView.routepath) && Object.is(_appfunc.appfuncyype, 'APPVIEW'));
if (appfunc) {
this.computeMenuSelect(this.menus, appfunc.appfunctag);
}
const viewparam: any = {};
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, this.defPSAppView.deResParameters, this.defPSAppView.parameters, [], viewparam);
this.$router.push(path);
return;
}
this.computeMenuSelect(this.menus, '');
let item = this.compute(this.menus, this.defaultActive);
if (Object.keys(item).length === 0) {
return;
}
this.click(item);
}
/**
* 计算菜单选中项
*
* @private
* @param {any[]} items
* @param {string} appfunctag
* @returns {boolean}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
private computeMenuSelect(items: any[], appfunctag: string): boolean {
const appFuncs: any[] = this.menuMode.getAppFuncs();
return items.some((item: any) => {
if (Object.is(appfunctag, '') && !Object.is(item.appfunctag, '')) {
const appfunc = appFuncs.find((_appfunc: any) => Object.is(_appfunc.appfunctag, item.appfunctag));
if (appfunc.routepath) {
this.defaultActive = item.name;
this.setHideSideBar(item);
return true;
}
}
if (Object.is(item.appfunctag, appfunctag)) {
this.setHideSideBar(item);
this.defaultActive = item.name;
return true;
}
if (item.items && item.items.length > 0) {
const state = this.computeMenuSelect(item.items, appfunctag);
if (state) {
this.defaultOpeneds.push(item.name);
return true;
}
}
return false;
});
}
</#if>
/** /**
* 获取菜单项数据 * 获取菜单项数据
* *
...@@ -391,9 +315,6 @@ ${P.getLogicCode(singleFuncs,"LOGIC.vue").code} ...@@ -391,9 +315,6 @@ ${P.getLogicCode(singleFuncs,"LOGIC.vue").code}
if(Environment.enablePermissionValid){ if(Environment.enablePermissionValid){
this.computedEffectiveMenus(this.menus); this.computedEffectiveMenus(this.menus);
} }
<#if view.isDefaultPage?? && view.isDefaultPage()>
<#-- this.doMenuSelect(); -->
</#if>
} }
/** /**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册