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

优化甘特视图加载逻辑

上级 2e285c42
...@@ -363,7 +363,6 @@ GanttElastic, ...@@ -363,7 +363,6 @@ GanttElastic,
*/ */
public created() { public created() {
this.locale = this.$i18n.locale; this.locale = this.$i18n.locale;
this.load();
if(AppCenterService && AppCenterService.getMessageCenter()){ if(AppCenterService && AppCenterService.getMessageCenter()){
this.appStateEvent = AppCenterService.getMessageCenter().subscribe(({ name, action, data }) =>{ this.appStateEvent = AppCenterService.getMessageCenter().subscribe(({ name, action, data }) =>{
if(!Object.is(name,"${ctrl.getPSAppDataEntity().getCodeName()}")){ if(!Object.is(name,"${ctrl.getPSAppDataEntity().getCodeName()}")){
...@@ -374,6 +373,14 @@ GanttElastic, ...@@ -374,6 +373,14 @@ GanttElastic,
} }
}) })
} }
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('load', action)) {
this.load(data);
}
});
} }
/** /**
...@@ -408,6 +415,9 @@ GanttElastic, ...@@ -408,6 +415,9 @@ GanttElastic,
if(this.appStateEvent){ if(this.appStateEvent){
this.appStateEvent.unsubscribe(); this.appStateEvent.unsubscribe();
} }
if(this.viewStateEvent){
this.viewStateEvent.unsubscribe();
}
<#if destroyed_block??> <#if destroyed_block??>
${destroyed_block} ${destroyed_block}
</#if> </#if>
......
<#assign mounted_block>
if(this.isLoadDefault){
this.viewState.next({ tag:'gantt', action: 'load', data: this.viewparams });
}
</#assign>
<#assign self_content>
/**
* 视图默认加载
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public isLoadDefault:boolean = <#if view.isLoadDefault?? && !view.isLoadDefault()>false<#else>true</#if>;
</#assign>
<#ibizinclude> <#ibizinclude>
../@MACRO/LAYOUTPANEL_VIEW.template.ftl ../@MACRO/LAYOUTPANEL_VIEW.template.ftl
</#ibizinclude> </#ibizinclude>
......
<#assign mounted_block>
if(this.isLoadDefault){
this.viewState.next({ tag:'gantt', action: 'load', data: this.viewparams });
}
</#assign>
<#assign self_content>
/**
* 视图默认加载
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public isLoadDefault:boolean = <#if view.isLoadDefault?? && !view.isLoadDefault()>false<#else>true</#if>;
</#assign>
<#ibizinclude> <#ibizinclude>
../@MACRO/LAYOUTPANEL_VIEW.template.ftl ../@MACRO/LAYOUTPANEL_VIEW.template.ftl
</#ibizinclude> </#ibizinclude>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册