提交 7a22041f 编写于 作者: Mosher's avatar Mosher

update:更新

上级 cbc336af
......@@ -4,38 +4,26 @@
*
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public handleCtrlEvents(eventName: string, args: any = {}): Promise<boolean> {
public async handleCtrlEvents(eventName: string, args: any = {}): Promise<boolean> {
const data = args && args.data ? args.data : this.getData() || {};
const event = args && args.event ? args.event : {};
const result = await this.executeCtrlLogic(eventName, data, event);
if (result && result.hasOwnProperty('srfret') && (result.srfret === 'false' || result.srfret === false)) {
return false;
}
this.$emit(eventName, data, event);
return true;
}
/**
* 执行部件逻辑(由部件触发)
*
* @param {string} eventName 部件事件名称
* @param {any[]} data 数据
* @param {*} event 源事件对象
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public async executeCtrlLogic(eventName: string, data: any[], event?: any): Promise<boolean> {
let result: boolean = true;
<#if ctrl.getPSControlLogics?? && ctrl.getPSControlLogics()??>
<#list ctrl.getPSControlLogics() as logic>
<#if logic.getLogicType() != 'APPVIEWLOGIC' && logic.getTriggerType() == 'CTRLEVENT'>
if ('${logic.getEventNames()?lower_case}'.indexOf(eventName) !== -1) {
return await this.execute_${logic.name}_ctrl_logic(data, event);
result = await this.execute_${logic.name}_ctrl_logic(data, event);
}
</#if>
</#list>
</#if>
if (!result) {
return false;
}
this.$emit(eventName, data, event);
return true;
}
<#if ctrl.getPSControlLogics?? && ctrl.getPSControlLogics()??>
<#list ctrl.getPSControlLogics() as logic>
<#if logic.getLogicType() != 'APPVIEWLOGIC' && logic.getTriggerType() == 'CTRLEVENT'>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册