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

update:更新

上级 b3deef13
<#macro initControlEvents ctrl view>
/**
* 处理部件事件
*
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public async handleCtrlEvents(eventName: string, args: any = {}): Promise<boolean> {
const actionData = {
data: this.getData() || {},
context: Util.deepCopy(this.context),
viewparams: Util.deepCopy(this.viewparams),
xData: this
}
let result: boolean = true;
Object.assign(actionData, args);
<#if ctrl.getPSControlLogics?? && ctrl.getPSControlLogics()??>
<#list ctrl.getPSControlLogics() as logic>
<#if logic.getLogicType() != 'APPVIEWLOGIC' && logic.getLogicType() != 'APPVIEWENGINE' && logic.getTriggerType() == 'CTRLEVENT'>
if ('${logic.getEventNames()?lower_case}'.indexOf(eventName) !== -1) {
result = await this.execute_${logic.name}_ctrl_logic(actionData) && result;
}
</#if>
</#list>
</#if>
if (!result) {
return false;
}
this.$emit(eventName, actionData);
return true;
}
<#if ctrl.getPSControlLogics?? && ctrl.getPSControlLogics()??>
<#list ctrl.getPSControlLogics() as logic>
<#if logic.getLogicType() != 'APPVIEWLOGIC' && logic.getLogicType() != 'APPVIEWENGINE' && logic.getTriggerType() == 'CTRLEVENT'>
/**
* 部件逻辑 -- ${logic.name}
*
* @param {string} eventName 部件事件名称
* @param {any[]} data 数据
* @param {*} event 源事件对象
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public async execute_${logic.name}_ctrl_logic(actionData: any): Promise<boolean> {
<#-- 实体处理逻辑 -->
<#if logic.getLogicType() == 'DEUILOGIC'>
<#if logic.getPSAppDEUILogic?? && logic.getPSAppDEUILogic()??>
try {
const uiService = await window.uiServiceRegister.getService('${logic.getPSAppDEUILogic().getPSAppDataEntity().getCodeName()?lower_case}');
if (uiService) {
const { data, context, viewparams } = actionData;
const result = await uiService.executeUILogic(
'${logic.getPSAppDEUILogic().codeName}',
data,
context,
viewparams,
actionData.event ? actionData.event : {},
this,
this,
context.srfparentdename ? context.srfparentdename : ''
);
if (result && result.hasOwnProperty('srfret') && (result.srfret === 'false' || result.srfret === false)) {
return false;
}
}
} catch (error: any) {
}
</#if>
<#elseif logic.getLogicType() == 'SCRIPT'>
console.log('暂未支持 SCRIPT 类型');
<#elseif logic.getLogicType() == 'PFPLUGIN'>
console.log('暂未支持 PFPLUGIN 类型');
<#else>
console.log('暂未支持 ${logic.getLogicType()} 类型');
</#if>
return true;
}
</#if>
</#list>
</#if>
</#macro>
<#macro initControlEvents ctrl view>
/**
* 处理部件事件
*
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public async handleCtrlEvents(eventName: string, args: any = {}): Promise<boolean> {
const actionData = {
data: this.getData() || {},
context: Util.deepCopy(this.context),
viewparams: Util.deepCopy(this.viewparams),
xData: this
}
let result: boolean = true;
Object.assign(actionData, args);
<#if ctrl.getPSControlLogics?? && ctrl.getPSControlLogics()??>
<#list ctrl.getPSControlLogics() as logic>
<#if logic.getLogicType() != 'APPVIEWLOGIC' && logic.getLogicType() != 'APPVIEWENGINE' && logic.getTriggerType() == 'CTRLEVENT'>
if ('${logic.getEventNames()?lower_case}'.indexOf(eventName) !== -1) {
result = await this.execute_${logic.name}_ctrl_logic(actionData) && result;
}
</#if>
</#list>
</#if>
if (!result) {
return false;
}
this.$emit(eventName, actionData);
return true;
}
<#if ctrl.getPSControlLogics?? && ctrl.getPSControlLogics()??>
<#list ctrl.getPSControlLogics() as logic>
<#if logic.getLogicType() != 'APPVIEWLOGIC' && logic.getLogicType() != 'APPVIEWENGINE' && logic.getTriggerType() == 'CTRLEVENT'>
/**
* 部件逻辑 -- ${logic.name}
*
* @param {string} eventName 部件事件名称
* @param {any[]} data 数据
* @param {*} event 源事件对象
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public async execute_${logic.name}_ctrl_logic(actionData: any): Promise<boolean> {
<#-- 实体处理逻辑 -->
<#if logic.getLogicType() == 'DEUILOGIC'>
<#if logic.getPSAppDEUILogic?? && logic.getPSAppDEUILogic()??>
try {
const uiService = await window.uiServiceRegister.getService('${logic.getPSAppDEUILogic().getPSAppDataEntity().getCodeName()?lower_case}');
if (uiService) {
const { data, context, viewparams } = actionData;
const result = await uiService.executeUILogic(
'${logic.getPSAppDEUILogic().codeName}',
data,
context,
viewparams,
actionData.event ? actionData.event : {},
this,
this,
context.srfparentdename ? context.srfparentdename : ''
);
if (result && result.hasOwnProperty('srfret') && (result.srfret === 'false' || result.srfret === false)) {
return false;
}
}
} catch (error: any) {
}
</#if>
<#elseif logic.getLogicType() == 'SCRIPT'>
console.log('暂未支持 SCRIPT 类型');
<#elseif logic.getLogicType() == 'PFPLUGIN'>
console.log('暂未支持 PFPLUGIN 类型');
<#else>
console.log('暂未支持 ${logic.getLogicType()} 类型');
</#if>
return true;
}
</#if>
</#list>
</#if>
</#macro>
......@@ -262,7 +262,7 @@ ${P.getLogicCode(uiAction, "LOGIC.vue").code}
}
}
<#ibizinclude>
./@MACRO/CONTROL-LOGIC.ftl
./@MACRO/CONTROL-LOGIC-EVENT.ftl
</#ibizinclude>
<#-- START: 部件事件 -->
<@initControlEvents ctrl view/>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册