提交 125f4da0 编写于 作者: tony001's avatar tony001

补充分页面板权限问题

上级 326bbaeb
......@@ -6,7 +6,7 @@
<div class='tabviewpanel<#if ctrl.getPSSysCss()??><#assign singleCss = ctrl.getPSSysCss()> ${singleCss.getCssName()}</#if>' style="height:100%;">
<tabs :value="tabValue" :animated="false" class='tabexppanel' name='${ctrl.getCodeName()?lower_case}' @on-click="tabPanelClick">
<#list ctrl.getPSControls() as tabviewpanel>
<tab-pane :index="${tabviewpanel_index}" name='${tabviewpanel.name}' tab='${ctrl.getCodeName()?lower_case}' class='<#if tabviewpanel.getPSSysCss?? && tabviewpanel.getPSSysCss()??>${tabviewpanel.getPSSysCss().getCssName()}</#if>'
<tab-pane :index="${tabviewpanel_index}" name='${tabviewpanel.name}' tab='${ctrl.getCodeName()?lower_case}' class='<#if tabviewpanel.getPSSysCss?? && tabviewpanel.getPSSysCss()??>${tabviewpanel.getPSSysCss().getCssName()}</#if>' v-if="computedAuthorizedPanel('${tabviewpanel.name}')"
:label="(h) =>{
return h('div', [
<#if tabviewpanel.getPSSysImage()??>
......@@ -43,9 +43,21 @@
</div>
</#if>
</template>
<#assign import_block>
import ${srfclassname('${appde.getCodeName()}')}AuthService from '@/authservice/${srffilepath2(appde.getCodeName())}/${srffilepath2(appde.getCodeName())}-auth-service';
import { Environment } from '@/environments/environment';
</#assign>
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_HEADER-BASE.vue.ftl
</#ibizinclude>
/**
* 实体权限服务对象
*
* @type {${appde.getCodeName()}AuthService}
* @memberof TabExpViewtabexppanelBase
*/
public appAuthService: ${appde.getCodeName()}AuthService = new ${appde.getCodeName()}AuthService();
/**
* 是否初始化
*
......@@ -124,6 +136,42 @@
*/
public activiedTabViewPanel: string = '<#list ctrl.getPSControls() as tabviewpanel><#if tabviewpanel_index==0>${tabviewpanel.name}</#if></#list>';
/**
* 计算激活分页面板
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public computedActiviedPanel(){
if(Environment.enablePermissionValid){
if(Object.keys(this.authResourceObject).length >0){
let targetResult:Array<any> = [];
Object.keys(this.authResourceObject).forEach((item:any) =>{
if(this.computedAuthorizedPanel(item))
targetResult.push(item);
})
if(targetResult.length >0){
this.activiedTabViewPanel = targetResult[0];
this.tabPanelClick(targetResult[0]);
}
}
}
}
/**
* 计算分页面板是否显示
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public computedAuthorizedPanel(name:string){
if(!Environment.enablePermissionValid)
return true;
if(!this.authResourceObject[name])
return true;
return this.appAuthService.getResourcePermission(this.authResourceObject[name]);
}
/**
* 分页视图面板数据变更
*
......@@ -156,6 +204,7 @@
Object.assign(this.context,{srfparentdename:'${appDataEntity.getCodeName()}',srfparentkey:this.context.${appDataEntity.getCodeName()?lower_case}})
}
</#if>
this.computedActiviedPanel();
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册