提交 6bebfed6 编写于 作者: tony001's avatar tony001

适配分页导航面板主状态逻辑

上级 4f5824c8
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
${ctrl.render.code} ${ctrl.render.code}
<#else> <#else>
<div class='tabviewpanel<#if ctrl.getPSSysCss()??><#assign singleCss = ctrl.getPSSysCss()> ${singleCss.getCssName()}</#if>' style="height:100%;"> <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"> <tabs :value="activiedTabViewPanel" :animated="false" class='tabexppanel' name='${ctrl.getCodeName()?lower_case}' @on-click="tabPanelClick">
<#list ctrl.getPSControls() as tabviewpanel> <#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>' v-if="computedAuthorizedPanel('${tabviewpanel.name}')" <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="authResourceObject['${tabviewpanel.name}'].visabled"
:label="(h) =>{ :label="(h) =>{
return h('div', [ return h('div', [
<#if tabviewpanel.getPSSysImage()??> <#if tabviewpanel.getPSSysImage()??>
...@@ -58,6 +58,14 @@ import { Environment } from '@/environments/environment'; ...@@ -58,6 +58,14 @@ import { Environment } from '@/environments/environment';
*/ */
public appAuthService: ${appde.getCodeName()}AuthService = new ${appde.getCodeName()}AuthService(); public appAuthService: ${appde.getCodeName()}AuthService = new ${appde.getCodeName()}AuthService();
/**
* 界面UI服务对象
*
* @type {${srfclassname('${appde.getCodeName()}')}UIService}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public appUIService:${srfclassname('${appde.getCodeName()}')}UIService = new ${srfclassname('${appde.getCodeName()}')}UIService(this.$store);
/** /**
* 是否初始化 * 是否初始化
* *
...@@ -137,39 +145,45 @@ import { Environment } from '@/environments/environment'; ...@@ -137,39 +145,45 @@ import { Environment } from '@/environments/environment';
public activiedTabViewPanel: string = '<#list ctrl.getPSControls() as tabviewpanel><#if tabviewpanel_index==0>${tabviewpanel.name}</#if></#list>'; public activiedTabViewPanel: string = '<#list ctrl.getPSControls() as tabviewpanel><#if tabviewpanel_index==0>${tabviewpanel.name}</#if></#list>';
/** /**
* 计算激活分页面板 * 计算分页面板权限
* *
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public computedActiviedPanel(){ public computedAuthPanel(data:any){
if(this.$store.getters['authresource/getEnablePermissionValid']){ if(!data || Object.keys(data) === 0){
if(Object.keys(this.authResourceObject).length >0){ return;
let targetResult:Array<any> = []; }
Object.keys(this.authResourceObject).forEach((item:any) =>{ if(this.authResourceObject && Object.keys(this.authResourceObject).length >0){
if(this.computedAuthorizedPanel(item)) Object.keys(this.authResourceObject).forEach((key:string) =>{
targetResult.push(item); if(this.authResourceObject[key] && this.authResourceObject[key]['dataaccaction']){
}) let tempUIAction:any = Util.deepCopy(this.authResourceObject[key]);
if(targetResult.length >0){ let result: any[] = ViewTool.calcActionItemAuthState(data,[tempUIAction],this.appUIService);
this.activiedTabViewPanel = targetResult[0]; this.authResourceObject[key].visabled = this.computedPanelWithResource(key,tempUIAction.visabled);
this.tabPanelClick(targetResult[0]); this.authResourceObject[key].disabled = this.computedPanelWithResource(key,tempUIAction.disabled);
}
})
const keys:any = Object.keys(this.authResourceObject);
for(let i=0;i<keys.length;i++){
if(this.authResourceObject[keys[i]].visabled){
this.tabPanelClick(keys[i]);
return;
} }
} }
} }
} }
/** /**
* 计算分页面板是否显示 * 合入统一资源权限
* *
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public computedAuthorizedPanel(name:string){ public computedPanelWithResource(name:string,mainState:boolean){
if(!this.$store.getters['authresource/getEnablePermissionValid']) if(!this.$store.getters['authresource/getEnablePermissionValid'])
return true; return mainState === false?false:true;
if(!this.authResourceObject[name]) if(!this.authResourceObject[name])
return true; return mainState === false?false:true;
return this.appAuthService.getResourcePermission(this.authResourceObject[name]); const resouceAuth:boolean = this.appAuthService.getResourcePermission(this.authResourceObject[name]['resourcetag']);
return !resouceAuth?false:mainState?true:false;
} }
/** /**
...@@ -184,7 +198,6 @@ import { Environment } from '@/environments/environment'; ...@@ -184,7 +198,6 @@ import { Environment } from '@/environments/environment';
/** /**
* vue 生命周期 * vue 生命周期
* *
* @returns
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public created() { public created() {
...@@ -204,14 +217,13 @@ import { Environment } from '@/environments/environment'; ...@@ -204,14 +217,13 @@ import { Environment } from '@/environments/environment';
Object.assign(this.context,{srfparentdename:'${appDataEntity.getCodeName()}',srfparentkey:this.context.${appDataEntity.getCodeName()?lower_case}}) Object.assign(this.context,{srfparentdename:'${appDataEntity.getCodeName()}',srfparentkey:this.context.${appDataEntity.getCodeName()?lower_case}})
} }
</#if> </#if>
this.computedActiviedPanel();
if (this.viewState) { if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => { this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) { if (!Object.is(tag, this.name)) {
return; return;
} }
if(Object.is(action,'loadmodel')){ if(Object.is(action,'loadmodel')){
this.computedAuthPanel(data);
}else{ }else{
this.action = action; this.action = action;
this.viewState.next({ tag: this.activiedTabViewPanel, action: action, data: data }); this.viewState.next({ tag: this.activiedTabViewPanel, action: action, data: data });
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
return; return;
} }
const { data: _data } = response; const { data: _data } = response;
this.viewState.next({ tag: 'tabexppanel', action: 'loadmodel', data: _data});
if (_data.${appDataEntity.getMajorPSAppDEField().getCodeName()?lower_case}) { if (_data.${appDataEntity.getMajorPSAppDEField().getCodeName()?lower_case}) {
Object.assign(this.model, { dataInfo: _data.${appDataEntity.getMajorPSAppDEField().getCodeName()?lower_case} }); Object.assign(this.model, { dataInfo: _data.${appDataEntity.getMajorPSAppDEField().getCodeName()?lower_case} });
if(this.$tabPageExp){ if(this.$tabPageExp){
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册