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

优化甘特图和树表格加载逻辑

上级 dbac30dd
...@@ -285,7 +285,23 @@ ...@@ -285,7 +285,23 @@
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public created() { public created() {
this.load(); this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public afterCreated() {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('load', action)) {
this.load(data);
}
});
} }
/** /**
...@@ -334,7 +350,7 @@ ...@@ -334,7 +350,7 @@
* 打开编辑数据 * 打开编辑数据
* *
* @returns * @returns
* @memberof TreeTableBase * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public opendata(args: any) { public opendata(args: any) {
if(this.selections.length === 0) { if(this.selections.length === 0) {
...@@ -355,6 +371,27 @@ ...@@ -355,6 +371,27 @@
</#if> </#if>
} }
/**
* vue 生命周期
*
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
<#ibizinclude> <#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl ../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
</#ibizinclude> </#ibizinclude>
......
...@@ -362,6 +362,15 @@ GanttElastic, ...@@ -362,6 +362,15 @@ GanttElastic,
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public created() { public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public afterCreated() {
this.locale = this.$i18n.locale; this.locale = this.$i18n.locale;
if(AppCenterService && AppCenterService.getMessageCenter()){ if(AppCenterService && AppCenterService.getMessageCenter()){
this.appStateEvent = AppCenterService.getMessageCenter().subscribe(({ name, action, data }) =>{ this.appStateEvent = AppCenterService.getMessageCenter().subscribe(({ name, action, data }) =>{
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册