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

update:更新

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