提交 4ebdecf8 编写于 作者: tony001's avatar tony001

首页导航模式 --- fix9

上级 b817af51
......@@ -61,6 +61,15 @@
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof ${srfclassname('${view.name}')}Base
*/
public serviceStateEvent: Subscription | undefined;
/**
* 应用上下文
*
......@@ -83,7 +92,7 @@
* @public
* @memberof ${srfclassname('${view.name}')}Base
*/
public parseViewParam(): void {
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
......@@ -116,6 +125,9 @@
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(inputvalue){
Object.assign(this.context,{'${appde.getCodeName()?lower_case}':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
......@@ -214,7 +226,7 @@
*/
public initNavData(data:any = null){
if(this.viewDefaultUsage){
this.navDataService.addNavData({id:'${srffilepath2(view.getCodeName())}',title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
this.navDataService.addNavData({id:'${srffilepath2(view.getCodeName())}',srfkey:this.context.${appde.getCodeName()?lower_case},title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
......@@ -254,6 +266,16 @@
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
this.serviceStateEvent = this.navDataService.serviceState.subscribe(({ action, data }) => {
if (Object.is(action, 'viewrefresh')) {
this.$nextTick(()=>{
this.parseViewParam(data);
if(this.engine){
this.engine.load();
}
});
}
});
<#if created_block??>${created_block}</#if>
}
......@@ -396,6 +418,9 @@ ${P.getLogicCode(uiAction, "LOGIC.vue").code}
}
})
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
}
</#if>
......
......@@ -10,7 +10,7 @@ import ${srfclassname('${appCounter.getCodeName()}')}CounterService from '@/co
</#if>
</#list>
</#if>
import { Subject } from 'rxjs';
import { Subject,Subscription } from 'rxjs';
<#if view.getPSAppDataEntity?? && view.getPSAppDataEntity()??>
<#assign appde = view.getPSAppDataEntity()/>
import ${srfclassname('${appde.getCodeName()}')}Service from '@/service/${srffilepath2(appde.getCodeName())}/${srffilepath2(appde.getCodeName())}-service';
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册