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

update:更新

上级 cbc336af
...@@ -4,35 +4,23 @@ ...@@ -4,35 +4,23 @@
* *
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @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 data = args && args.data ? args.data : this.getData() || {};
const event = args && args.event ? args.event : {}; const event = args && args.event ? args.event : {};
const result = await this.executeCtrlLogic(eventName, data, event); let result: boolean = true;
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> {
<#if ctrl.getPSControlLogics?? && ctrl.getPSControlLogics()??> <#if ctrl.getPSControlLogics?? && ctrl.getPSControlLogics()??>
<#list ctrl.getPSControlLogics() as logic> <#list ctrl.getPSControlLogics() as logic>
<#if logic.getLogicType() != 'APPVIEWLOGIC' && logic.getTriggerType() == 'CTRLEVENT'> <#if logic.getLogicType() != 'APPVIEWLOGIC' && logic.getTriggerType() == 'CTRLEVENT'>
if ('${logic.getEventNames()?lower_case}'.indexOf(eventName) !== -1) { 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> </#if>
</#list> </#list>
</#if> </#if>
if (!result) {
return false;
}
this.$emit(eventName, data, event);
return true; return true;
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册