提交 941ec4b1 编写于 作者: KK's avatar KK

zk——应用级数据状态同步(甘特图部件)

上级 a36f8dd2
...@@ -154,6 +154,15 @@ GanttElastic, ...@@ -154,6 +154,15 @@ GanttElastic,
*/ */
public tasks: any[] = []; public tasks: any[] = [];
/**
* 应用状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public appStateEvent: Subscription | undefined;
/** /**
* 监听语言变化 * 监听语言变化
* *
...@@ -345,6 +354,16 @@ GanttElastic, ...@@ -345,6 +354,16 @@ GanttElastic,
public created() { public created() {
this.locale = this.$i18n.locale; this.locale = this.$i18n.locale;
this.load(); this.load();
if(AppCenterService && AppCenterService.getMessageCenter()){
this.appStateEvent = AppCenterService.getMessageCenter().subscribe(({ name, action, data }) =>{
if(!Object.is(name,"${ctrl.getPSAppDataEntity().getCodeName()}")){
return;
}
if(Object.is(action,'appRefresh')){
this.refresh();
}
})
}
} }
/** /**
...@@ -361,6 +380,29 @@ GanttElastic, ...@@ -361,6 +380,29 @@ GanttElastic,
} }
} }
/**
* vue 生命周期
*
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public afterDestroy() {
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
<#if destroyed_block??>
${destroyed_block}
</#if>
}
<#ibizinclude> <#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl ../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
</#ibizinclude> </#ibizinclude>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册