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

update:更新

上级 a56172c7
...@@ -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.ftl
</#ibizinclude> </#ibizinclude>
<#-- START: 部件事件 --> <#-- START: 部件事件 -->
<@initControlEvents ctrl view/> <@initControlEvents ctrl view/>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
TARGET=PSAPPDEUILOGIC TARGET=PSAPPDEUILOGIC
</#ibiztemplate> </#ibiztemplate>
<#ibizinclude> <#ibizinclude>
../@MACRO/ui-logic-node.txt ../@MACRO/UI-LOGIC-NODE.ftl
</#ibizinclude> </#ibizinclude>
import { UIActionContext } from "@/logic/ui-logic"; import { UIActionContext } from "@/logic/ui-logic";
import { LogicReturnType } from "@/logic/const/logic-return-type"; import { LogicReturnType } from "@/logic/const/logic-return-type";
......
<#-- 获取判断条件 --> <#-- 获取判断条件 -->
<#macro getCond item><#if item.getLogicType() == 'GROUP'><#if item.isNotMode()>!(</#if><#if item.getPSDEUILogicLinkConds()??><#list item.getPSDEUILogicLinkConds() as subLogic><#if subLogic_index gt 0><#if item.getGroupOP() == 'AND'> && </#if><#if item.getGroupOP() == 'OR'> || </#if></#if><@getCond subLogic /></#list></#if><#if item.isNotMode()>)</#if><#elseif item.getLogicType() == 'SINGLE'>Verify.testCond(this.getCondParam(actionContext, '<#if item.getDstLogicParam?? && item.getDstLogicParam()??>${item.getDstLogicParam().codeName}</#if>', '${item.getDstFieldName()?lower_case}'), '${item.getCondOP()}', '${item.getValue()}')</#if></#macro> <#macro getCond item><#if item.getLogicType() == 'GROUP'><#if item.isNotMode()>!(</#if><#if item.getPSDEUILogicLinkConds()??><#list item.getPSDEUILogicLinkConds() as subLogic><#if subLogic_index gt 0><#if item.getGroupOP() == 'AND'> && </#if><#if item.getGroupOP() == 'OR'> || </#if></#if><@getCond subLogic /></#list></#if><#if item.isNotMode()>)</#if><#elseif item.getLogicType() == 'SINGLE'>Verify.testCond(this.getCondParam(actionContext, '<#if item.getDstLogicParam?? && item.getDstLogicParam()??>${item.getDstLogicParam().codeName}</#if>', '${item.getDstFieldName()?lower_case}'), '${item.getCondOP()}', '${item.getValue()}')</#if></#macro>
<#-- START: 计算下一节点 --> <#-- START: 计算下一节点 -->
<#macro computeNextNode logicNode> <#macro computeNextNode logicNode>
<#if logicNode.getPSDEUILogicLinks?? && logicNode.getPSDEUILogicLinks()??> console.log(`已完成执行${logicNode.name}节点,操作参数数据如下:`);
<#list logicNode.getPSDEUILogicLinks() as link> if (actionContext.paramsMap && (actionContext.paramsMap.size > 0)) {
<#if link.getDstPSDEUILogicNode?? && link.getDstPSDEUILogicNode()??> for (let [key, value] of actionContext.paramsMap) {
<#if link.getPSDEUILogicLinkGroupCond?? && link.getPSDEUILogicLinkGroupCond()??> console.log(`${key}:`, Util.deepCopy(value.getReal()));
if (<@getCond link.getPSDEUILogicLinkGroupCond() />) { }
await this.execute_${link.getDstPSDEUILogicNode().codeName?lower_case}_node(actionContext); }
} <#if logicNode.getPSDEUILogicLinks?? && logicNode.getPSDEUILogicLinks()??>
<#else> <#list logicNode.getPSDEUILogicLinks() as link>
await this.execute_${link.getDstPSDEUILogicNode().codeName?lower_case}_node(actionContext); <#if link.getDstPSDEUILogicNode?? && link.getDstPSDEUILogicNode()??>
</#if> <#if link.getPSDEUILogicLinkGroupCond?? && link.getPSDEUILogicLinkGroupCond()??>
</#if> if (<@getCond link.getPSDEUILogicLinkGroupCond() />) {
</#list> console.log(`即将执行${link.getDstPSDEUILogicNode().name}节点`);
</#if> await this.execute_${link.getDstPSDEUILogicNode().codeName?lower_case}_node(actionContext);
</#macro> }
<#-- END: 计算下一节点 --> <#else>
console.log(`即将执行${link.getDstPSDEUILogicNode().name}节点`);
<#-- START: 开始节点 --> await this.execute_${link.getDstPSDEUILogicNode().codeName?lower_case}_node(actionContext);
<#macro beginNode logicNode> </#if>
actionContext.setResult(actionContext.defaultParam.getReal()); </#if>
</#macro> </#list>
<#-- END: 开始节点 --> </#if>
</#macro>
<#-- START: 准备处理参数节点 --> <#-- END: 计算下一节点 -->
<#macro prepareParamNode logicNode>
<#if logicNode.getPSDEUILogicNodeParams?? && logicNode.getPSDEUILogicNodeParams()??> <#-- START: 开始节点 -->
try { <#macro beginNode logicNode>
<#assign index = 0> actionContext.setResult(actionContext.defaultParam.getReal());
<#list logicNode.getPSDEUILogicNodeParams() as param> </#macro>
<#assign index = index + 1> <#-- END: 开始节点 -->
<#if param.getParamAction?? && param.getParamAction()??>
<#if param.getParamAction() == 'SETPARAMVALUE'> <#-- START: 准备处理参数节点 -->
<#if (param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??) || (param.getSrcValueType?? && param.getSrcValueType()??)> <#macro prepareParamNode logicNode>
// 目标数据 <#if logicNode.getPSDEUILogicNodeParams?? && logicNode.getPSDEUILogicNodeParams()??>
const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>'); try {
// 无值类型 <#assign index = 0>
<#if param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'NONEVALUE'> <#list logicNode.getPSDEUILogicNodeParams() as param>
<#if param.getDstFieldName?? && param.getDstFieldName()??> <#assign index = index + 1>
dstParam_${index}.reset('${param.getDstFieldName()?lower_case}'); <#if param.getParamAction?? && param.getParamAction()??>
<#else> <#if param.getParamAction() == 'SETPARAMVALUE'>
dstParam_${index}.bind(undefined); <#if (param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??) || (param.getSrcValueType?? && param.getSrcValueType()??)>
</#if> // 目标数据
<#else> const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>');
<#if param.getSrcValueType?? && param.getSrcValueType()?? && (param.getSrcValueType() == 'SRCDLPARAM' || param.getSrcValueType() == 'WEBCONTEXT' || param.getSrcValueType() == 'VIEWPARAM')> // 无值类型
// 源逻辑参数、网页请求上下文、当前视图参数 <#if param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'NONEVALUE'>
const srcParam_${index} = actionContext.getParam('<#if param.getSrcPSDEUILogicParam?? && param.getSrcPSDEUILogicParam()??>${param.getSrcPSDEUILogicParam().codeName}</#if>'); <#if param.getDstFieldName?? && param.getDstFieldName()??>
const result_${index} = srcParam_${index}.get('<#if param.getSrcFieldName?? && param.getSrcFieldName()??>${param.getSrcFieldName()?lower_case}</#if>') ? srcParam_${index}.get('<#if param.getSrcFieldName?? && param.getSrcFieldName()??>${param.getSrcFieldName()?lower_case}</#if>') : null; dstParam_${index}.reset('${param.getDstFieldName()?lower_case}');
<#elseif param.getSrcValueType?? && param.getSrcValueType()?? && (param.getSrcValueType() == 'APPLICATION' || param.getSrcValueType() == 'SESSION' || param.getSrcValueType() == 'APPDATA' || param.getSrcValueType() == 'DATACONTEXT')> <#else>
// 系统全局对象、用户全局对象、应用上下文、数据上下文 dstParam_${index}.bind(undefined);
const result_${index} = actionContext['<#if param.getSrcFieldName?? && param.getSrcFieldName()??>${param.getSrcFieldName()?lower_case}</#if>']; </#if>
<#elseif param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'ENVPARAM'> <#else>
// 环境参数 <#if param.getSrcValueType?? && param.getSrcValueType()?? && (param.getSrcValueType() == 'SRCDLPARAM' || param.getSrcValueType() == 'WEBCONTEXT' || param.getSrcValueType() == 'VIEWPARAM')>
const result_${index} = Environment['<#if param.getSrcFieldName?? && param.getSrcFieldName()??>${param.getSrcFieldName()}</#if>']; // 源逻辑参数、网页请求上下文、当前视图参数
<#elseif param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'EXPRESSION'> const srcParam_${index} = actionContext.getParam('<#if param.getSrcPSDEUILogicParam?? && param.getSrcPSDEUILogicParam()??>${param.getSrcPSDEUILogicParam().codeName}</#if>');
// 计算式(TODO:平台暂未支持配置计算式) const result_${index} = srcParam_${index}.get('<#if param.getSrcFieldName?? && param.getSrcFieldName()??>${param.getSrcFieldName()?lower_case}</#if>') ? srcParam_${index}.get('<#if param.getSrcFieldName?? && param.getSrcFieldName()??>${param.getSrcFieldName()?lower_case}</#if>') : null;
const result_${index} = ''; <#elseif param.getSrcValueType?? && param.getSrcValueType()?? && (param.getSrcValueType() == 'APPLICATION' || param.getSrcValueType() == 'SESSION' || param.getSrcValueType() == 'APPDATA' || param.getSrcValueType() == 'DATACONTEXT')>
<#elseif param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'SRCVALUE'> // 系统全局对象、用户全局对象、应用上下文、数据上下文
// 直接值 const result_${index} = actionContext['<#if param.getSrcFieldName?? && param.getSrcFieldName()??>${param.getSrcFieldName()?lower_case}</#if>'];
const result_${index} = '<#if param.getSrcValue?? && param.getSrcValue()??>${param.getSrcValue()}</#if>'; <#elseif param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'ENVPARAM'>
<#elseif param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'NULLVALUE'> // 环境参数
// 空值(NULL) const result_${index} = Environment['<#if param.getSrcFieldName?? && param.getSrcFieldName()??>${param.getSrcFieldName()}</#if>'];
const result_${index} = null; <#elseif param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'EXPRESSION'>
<#else> // 计算式(TODO:平台暂未支持配置计算式)
// 未支持类型设置 const result_${index} = '';
const result_${index} = undefined; <#elseif param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'SRCVALUE'>
</#if> // 直接值
<#if param.getDstFieldName?? && param.getDstFieldName()??> const result_${index} = '<#if param.getSrcValue?? && param.getSrcValue()??>${param.getSrcValue()}</#if>';
dstParam_${index}.set('${param.getDstFieldName()?lower_case}', result_${index}); <#elseif param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'NULLVALUE'>
<#else> // 空值(NULL)
dstParam_${index}.bind(result_${index}); const result_${index} = null;
</#if> <#else>
</#if> // 未支持类型设置
<#else> const result_${index} = undefined;
throw new Error(`逻辑参数${param.name}源类型参数或者目标逻辑参数缺失`); </#if>
</#if> <#if param.getDstFieldName?? && param.getDstFieldName()??>
<#elseif param.getParamAction() == 'RESETPARAM'> dstParam_${index}.set('${param.getDstFieldName()?lower_case}', result_${index});
const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>'); <#else>
dstParam_${index}.resetAll(); dstParam_${index}.bind(result_${index});
<#elseif param.getParamAction() == 'COPYPARAM'> </#if>
// 源数据 </#if>
const srcParam_${index}: any = actionContext.getParam('<#if param.getSrcPSDEUILogicParam?? && param.getSrcPSDEUILogicParam()??>${param.getSrcPSDEUILogicParam().codeName}</#if>'); <#else>
// 目标数据 throw new Error(`逻辑参数${param.name}源类型参数或者目标逻辑参数缺失`);
const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>'); </#if>
srcParam_${index}.copyTo(dstParam_${index}); <#elseif param.getParamAction() == 'RESETPARAM'>
<#elseif param.getParamAction() == 'BINDPARAM'> const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>');
// 源数据 dstParam_${index}.resetAll();
const srcParam_${index}: any = actionContext.getParam('<#if param.getSrcPSDEUILogicParam?? && param.getSrcPSDEUILogicParam()??>${param.getSrcPSDEUILogicParam().codeName}</#if>'); <#elseif param.getParamAction() == 'COPYPARAM'>
// 目标数据 // 源数据
const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>'); const srcParam_${index}: any = actionContext.getParam('<#if param.getSrcPSDEUILogicParam?? && param.getSrcPSDEUILogicParam()??>${param.getSrcPSDEUILogicParam().codeName}</#if>');
const srcFieldName_${index} = '<#if param.getSrcFieldName?? && param.getSrcFieldName()??>${param.getSrcFieldName()?lower_case}</#if>'; // 目标数据
if (srcFieldName_${index}) { const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>');
dstParam_${index}.bind(srcParam_${index}.get(srcFieldName_${index})); srcParam_${index}.copyTo(dstParam_${index});
} else { <#elseif param.getParamAction() == 'BINDPARAM'>
dstParam_${index}.bind(srcParam_${index}.getReal()); // 源数据
} const srcParam_${index}: any = actionContext.getParam('<#if param.getSrcPSDEUILogicParam?? && param.getSrcPSDEUILogicParam()??>${param.getSrcPSDEUILogicParam().codeName}</#if>');
<#elseif param.getParamAction() == 'RENEWPARAM'> // 目标数据
// 目标数据 const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>');
const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>'); const srcFieldName_${index} = '<#if param.getSrcFieldName?? && param.getSrcFieldName()??>${param.getSrcFieldName()?lower_case}</#if>';
dstParam_${index}.renew(); if (srcFieldName_${index}) {
<#elseif param.getParamAction() == 'APPENDPARAM'> dstParam_${index}.bind(srcParam_${index}.get(srcFieldName_${index}));
// 源数据 } else {
const srcParam_${index}: any = actionContext.getParam('<#if param.getSrcPSDEUILogicParam?? && param.getSrcPSDEUILogicParam()??>${param.getSrcPSDEUILogicParam().codeName}</#if>'); dstParam_${index}.bind(srcParam_${index}.getReal());
// 目标数据 }
const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>'); <#elseif param.getParamAction() == 'RENEWPARAM'>
const srcFieldName_${index} = '<#if param.getSrcFieldName?? && param.getSrcFieldName()??>${param.getSrcFieldName()?lower_case}</#if>'; // 目标数据
let objParam_${index}: any; const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>');
if (srcFieldName_${index}) { dstParam_${index}.renew();
objParam_${index} = srcParam_${index}.get(srcFieldName_${index}); <#elseif param.getParamAction() == 'APPENDPARAM'>
} else { // 源数据
objParam_${index} = srcParam_${index}.getReal(); const srcParam_${index}: any = actionContext.getParam('<#if param.getSrcPSDEUILogicParam?? && param.getSrcPSDEUILogicParam()??>${param.getSrcPSDEUILogicParam().codeName}</#if>');
} // 目标数据
dstParam_${index}.append(${param.getDstIndex()?c}, objParam_${index}, ${param.getSrcIndex()?c}, ${param.getSrcSize()?c}); const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>');
<#elseif param.getParamAction() == 'SORTPARAM'> const srcFieldName_${index} = '<#if param.getSrcFieldName?? && param.getSrcFieldName()??>${param.getSrcFieldName()?lower_case}</#if>';
// 目标数据 let objParam_${index}: any;
const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>'); if (srcFieldName_${index}) {
const dstFieldName_${index} = '<#if param.getDstFieldName?? && param.getDstFieldName()??>${param.getDstFieldName()?lower_case}</#if>'; objParam_${index} = srcParam_${index}.get(srcFieldName_${index});
if (!dstFieldName_${index}) { } else {
throw new Error(`逻辑参数${param.name}未指定设置排序属性`); objParam_${index} = srcParam_${index}.getReal();
} else { }
dstParam_${index}.sort(dstFieldName_${index}, '${param.getDstSortDir()}'); dstParam_${index}.append(${param.getDstIndex()?c}, objParam_${index}, ${param.getSrcIndex()?c}, ${param.getSrcSize()?c});
} <#elseif param.getParamAction() == 'SORTPARAM'>
</#if> // 目标数据
</#if> const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>');
</#list> const dstFieldName_${index} = '<#if param.getDstFieldName?? && param.getDstFieldName()??>${param.getDstFieldName()?lower_case}</#if>';
} catch (error: any) { if (!dstFieldName_${index}) {
throw new Error(`逻辑节点 ${logicNode.name} <#noparse>${error && error.message ? error.message : '发生未知错误!'}`</#noparse>); throw new Error(`逻辑参数${param.name}未指定设置排序属性`);
} } else {
</#if> dstParam_${index}.sort(dstFieldName_${index}, '${param.getDstSortDir()}');
</#macro> }
<#-- END: 准备处理参数节点 --> </#if>
</#if>
<#-- START: 重置参数节点 --> </#list>
<#macro resetParamNode logicNode> } catch (error: any) {
<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??> throw new Error(`逻辑节点 ${logicNode.name} <#noparse>${error && error.message ? error.message : '发生未知错误!'}`</#noparse>);
const dstParam: any = actionContext.getParam('${logicNode.getDstPSDEUILogicParam().codeName}'); }
dstParam.resetAll(); </#if>
actionContext.bindLastReturnParam(null); </#macro>
<#else> <#-- END: 准备处理参数节点 -->
throw new Error(`操作参数缺失!`);
</#if> <#-- START: 重置参数节点 -->
</#macro> <#macro resetParamNode logicNode>
<#-- END: 重置参数节点 --> <#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>
const dstParam: any = actionContext.getParam('${logicNode.getDstPSDEUILogicParam().codeName}');
<#-- START: 拷贝参数节点 --> dstParam.resetAll();
<#macro copyParamNode logicNode> actionContext.bindLastReturnParam(null);
<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()?? && logicNode.getSrcPSDEUILogicParam?? && logicNode.getSrcPSDEUILogicParam()??> <#else>
try { throw new Error(`操作参数缺失!`);
// 源数据 </#if>
const srcParam:any = actionContext.getParam('${logicNode.getSrcPSDEUILogicParam().codeName}'); </#macro>
// 目标数据 <#-- END: 重置参数节点 -->
const dstParam: any = actionContext.getParam('${logicNode.getDstPSDEUILogicParam().codeName}');
srcParam.copyTo(dstParam); <#-- START: 拷贝参数节点 -->
actionContext.bindLastReturnParam(null); <#macro copyParamNode logicNode>
} catch (error: any) { <#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()?? && logicNode.getSrcPSDEUILogicParam?? && logicNode.getSrcPSDEUILogicParam()??>
throw new Error(`逻辑参数 ${logicNode.getDstPSDEUILogicParam().name} <#noparse>${error && error.message ? error.message : '发生未知错误!'}`</#noparse>); try {
} // 源数据
<#else> const srcParam:any = actionContext.getParam('${logicNode.getSrcPSDEUILogicParam().codeName}');
throw new Error('操作参数或者源参数缺失!'); // 目标数据
</#if> const dstParam: any = actionContext.getParam('${logicNode.getDstPSDEUILogicParam().codeName}');
</#macro> srcParam.copyTo(dstParam);
<#-- END: 拷贝参数节点 --> actionContext.bindLastReturnParam(null);
} catch (error: any) {
<#-- START: 绑定参数节点 --> throw new Error(`逻辑参数 ${logicNode.getDstPSDEUILogicParam().name} <#noparse>${error && error.message ? error.message : '发生未知错误!'}`</#noparse>);
<#macro bindParamNode logicNode> }
<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()?? && logicNode.getSrcPSDEUILogicParam?? && logicNode.getSrcPSDEUILogicParam()??> <#else>
try { throw new Error('操作参数或者源参数缺失!');
// 源数据 </#if>
const srcParam = actionContext.getParam('${logicNode.getSrcPSDEUILogicParam().codeName}'); </#macro>
// 目标数据 <#-- END: 拷贝参数节点 -->
const dstParam = actionContext.getParam('${logicNode.getDstPSDEUILogicParam().codeName}');
// 源属性 <#-- START: 绑定参数节点 -->
const srcFieldName: string = '<#if logicNode.getSrcFieldName?? && logicNode.getSrcFieldName()??>${logicNode.getSrcFieldName()?lower_case}</#if>'; <#macro bindParamNode logicNode>
if (srcFieldName) { <#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()?? && logicNode.getSrcPSDEUILogicParam?? && logicNode.getSrcPSDEUILogicParam()??>
dstParam.bind(srcParam.get(srcFieldName)); try {
} else { // 源数据
dstParam.bind(srcParam.getReal()); const srcParam = actionContext.getParam('${logicNode.getSrcPSDEUILogicParam().codeName}');
} // 目标数据
actionContext.bindLastReturnParam(null); const dstParam = actionContext.getParam('${logicNode.getDstPSDEUILogicParam().codeName}');
} catch (error: any) { // 源属性
throw new Error(`逻辑参数${logicNode.getDstPSDEUILogicParam().name} <#noparse>${error && error.message ? error.message : '发生未知错误!'}</#noparse>`); const srcFieldName: string = '<#if logicNode.getSrcFieldName?? && logicNode.getSrcFieldName()??>${logicNode.getSrcFieldName()?lower_case}</#if>';
} if (srcFieldName) {
<#else> dstParam.bind(srcParam.get(srcFieldName));
throw new Error('操作参数或者源参数缺失!'); } else {
</#if> dstParam.bind(srcParam.getReal());
</#macro> }
<#-- END: 绑定参数节点 --> actionContext.bindLastReturnParam(null);
} catch (error: any) {
<#-- START: 重新建立参数节点 --> throw new Error(`逻辑参数${logicNode.getDstPSDEUILogicParam().name} <#noparse>${error && error.message ? error.message : '发生未知错误!'}</#noparse>`);
<#macro renewParamNode logicNode> }
<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??> <#else>
const dstParam: any = actionContext.getParam('${logicNode.getDstPSDEUILogicParam().codeName}'); throw new Error('操作参数或者源参数缺失!');
dstParam.renew(); </#if>
actionContext.bindLastReturnParam(null); </#macro>
<#else> <#-- END: 绑定参数节点 -->
throw new Error(`操作参数缺失!`);
</#if> <#-- START: 重新建立参数节点 -->
</#macro> <#macro renewParamNode logicNode>
<#-- END: 重新建立参数节点 --> <#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>
const dstParam: any = actionContext.getParam('${logicNode.getDstPSDEUILogicParam().codeName}');
<#-- START: 调用实体界面行为节点 --> dstParam.renew();
<#macro deUIActionNode logicNode> actionContext.bindLastReturnParam(null);
<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??> <#else>
const data = actionContext.getParam('${logicNode.getDstPSDEUILogicParam().codeName}').getReal(); throw new Error(`操作参数缺失!`);
<#else> </#if>
const data = actionContext.defaultParam.getReal(); </#macro>
</#if> <#-- END: 重新建立参数节点 -->
const { context, viewparams } = actionContext;
const additionalParam = actionContext.additionalParam; <#-- START: 调用实体界面行为节点 -->
<#if logicNode.getDstPSAppDEUIAction?? && logicNode.getDstPSAppDEUIAction()??> <#macro deUIActionNode logicNode>
const uiService = await window.uiServiceRegister.getService('${logicNode.getDstPSAppDEUIAction().getPSAppDataEntity().codeName?lower_case}'); <#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>
<#if logicNode.getDstPSAppDEUIAction?? && logicNode.getDstPSAppDEUIAction()??> const data = actionContext.getParam('${logicNode.getDstPSDEUILogicParam().codeName}').getReal();
if (uiService && uiService['${logicNode.getDstPSAppDEUIAction().getFullCodeName()}'] && uiService['${logicNode.getDstPSAppDEUIAction().getFullCodeName()}'] instanceof Function) { <#else>
const xData = actionContext.activeCtrlParamName ? actionContext.getParam(actionContext.activeCtrlParamName).getReal() : additionalParam && additionalParam.xData ? additionalParam.xData : {}; const data = actionContext.defaultParam.getReal();
const container = actionContext.activeContainerParamName ? actionContext.getParam(actionContext.activeContainerParamName).getReal() : additionalParam && additionalParam.actioncontext ? additionalParam.actioncontext : {}; </#if>
const result = await uiService['${logicNode.getDstPSAppDEUIAction().getFullCodeName()}']( const { context, viewparams } = actionContext;
Object.prototype.toString.call(data) === '[object Array]' ? data : [data], const additionalParam = actionContext.additionalParam;
context, <#if logicNode.getDstPSAppDEUIAction?? && logicNode.getDstPSAppDEUIAction()??>
viewparams, const uiService = await window.uiServiceRegister.getService('${logicNode.getDstPSAppDEUIAction().getPSAppDataEntity().codeName?lower_case}');
additionalParam && additionalParam.$event ? additionalParam.$event : {}, <#if logicNode.getDstPSAppDEUIAction?? && logicNode.getDstPSAppDEUIAction()??>
xData, if (uiService && uiService['${logicNode.getDstPSAppDEUIAction().getFullCodeName()}'] && uiService['${logicNode.getDstPSAppDEUIAction().getFullCodeName()}'] instanceof Function) {
container, const xData = actionContext.activeCtrlParamName ? actionContext.getParam(actionContext.activeCtrlParamName).getReal() : additionalParam && additionalParam.xData ? additionalParam.xData : {};
additionalParam && additionalParam.parentDeName ? additionalParam.parentDeName : '' const container = actionContext.activeContainerParamName ? actionContext.getParam(actionContext.activeContainerParamName).getReal() : additionalParam && additionalParam.actioncontext ? additionalParam.actioncontext : {};
); const result = await uiService['${logicNode.getDstPSAppDEUIAction().getFullCodeName()}'](
if (result && result.ok && result.result) { Object.prototype.toString.call(data) === '[object Array]' ? data : [data],
actionContext.bindLastReturnParam(Array.isArray(result.result) ? result.result[0] : result.result); context,
} viewparams,
} additionalParam && additionalParam.$event ? additionalParam.$event : {},
<#else> xData,
throw new Error('未配置界面行为'); container,
</#if> additionalParam && additionalParam.parentDeName ? additionalParam.parentDeName : ''
</#if> );
</#macro> if (result && result.ok && result.result) {
<#-- END: 调用实体界面行为节点 --> actionContext.bindLastReturnParam(Array.isArray(result.result) ? result.result[0] : result.result);
}
<#-- START: 行为处理节点 --> }
<#macro deActionNode logicNode> <#else>
const dstParam = actionContext.getParam('<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if>'); throw new Error('未配置界面行为');
if (!Object.is(dstParam.logicParamType, UILogicParamType.entityListParam) && !Object.is(dstParam.logicParamType, UILogicParamType.entityParam)) { </#if>
throw new Error(`实体行为操作参数只能为数据对象变量类型或者数据对象列表类型`); </#if>
} </#macro>
const retParam = actionContext.getParam('<#if logicNode.getRetPSDEUILogicParam?? && logicNode.getRetPSDEUILogicParam()??>${logicNode.getRetPSDEUILogicParam().codeName}</#if>'); <#-- END: 调用实体界面行为节点 -->
<#if logicNode.getDstPSAppDataEntity?? && logicNode.getDstPSAppDataEntity()?? && logicNode.getDstPSAppDEAction?? && logicNode.getDstPSAppDEAction()??>
if (dstParam) { <#-- START: 行为处理节点 -->
try { <#macro deActionNode logicNode>
const service: any = await window.entityServiceRegister.getService('${logicNode.getDstPSAppDataEntity().getCodeName()?lower_case}'); const dstParam = actionContext.getParam('<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if>');
const getTempContext = (data: any) => { if (!Object.is(dstParam.logicParamType, UILogicParamType.entityListParam) && !Object.is(dstParam.logicParamType, UILogicParamType.entityParam)) {
const tempContext = Util.deepCopy(actionContext.context); throw new Error(`实体行为操作参数只能为数据对象变量类型或者数据对象列表类型`);
if (data) { }
Object.assign(tempContext, data); const retParam = actionContext.getParam('<#if logicNode.getRetPSDEUILogicParam?? && logicNode.getRetPSDEUILogicParam()??>${logicNode.getRetPSDEUILogicParam().codeName}</#if>');
} <#if logicNode.getDstPSAppDataEntity?? && logicNode.getDstPSAppDataEntity()?? && logicNode.getDstPSAppDEAction?? && logicNode.getDstPSAppDEAction()??>
return tempContext; if (dstParam) {
} try {
// 数据对象变量类型 const service: any = await window.entityServiceRegister.getService('${logicNode.getDstPSAppDataEntity().getCodeName()?lower_case}');
if (Object.is(dstParam.logicParamType, UILogicParamType.entityParam)) { const getTempContext = (data: any) => {
const tempContext = getTempContext(dstParam.getReal()); const tempContext = Util.deepCopy(actionContext.context);
const res = await service['${logicNode.getDstPSAppDEAction().codeName}'](tempContext, dstParam.getReal() ? dstParam.getReal() : {}); if (data) {
if (res && res.status === 200 && res.data) { Object.assign(tempContext, data);
if (retParam) { }
retParam.bind(res.data); return tempContext;
} }
actionContext.bindLastReturnParam(res.data); // 数据对象变量类型
} else { if (Object.is(dstParam.logicParamType, UILogicParamType.entityParam)) {
throw new Error(`执行实体行为失败`); const tempContext = getTempContext(dstParam.getReal());
} const res = await service['${logicNode.getDstPSAppDEAction().codeName}'](tempContext, dstParam.getReal() ? dstParam.getReal() : {});
} else { if (res && res.status === 200 && res.data) {
// 数据对象列表类型 if (retParam) {
if (dstParam.getReal() && (dstParam.getReal().length > 0)) { retParam.bind(res.data);
if (dstParam.getReal().length > 20) { }
throw new Error(`操作数据量超过20条,建议使用后台处理逻辑`); actionContext.bindLastReturnParam(res.data);
} } else {
let promises: any[] = []; throw new Error(`执行实体行为失败`);
dstParam.getReal().forEach((item: any) => { }
const tempContext = getTempContext(item); } else {
promises.push(service['${logicNode.getDstPSAppDEAction().codeName}'](tempContext, item ? item : {})); // 数据对象列表类型
}) if (dstParam.getReal() && (dstParam.getReal().length > 0)) {
const resArray = await Promise.all(promises); if (dstParam.getReal().length > 20) {
if (resArray && resArray.length > 0) { throw new Error(`操作数据量超过20条,建议使用后台处理逻辑`);
const resultArray: any[] = []; }
resArray.forEach((res: any) => { let promises: any[] = [];
if (res && res.status === 200 && res.data) { dstParam.getReal().forEach((item: any) => {
resultArray.push(res.data); const tempContext = getTempContext(item);
} promises.push(service['${logicNode.getDstPSAppDEAction().codeName}'](tempContext, item ? item : {}));
}) })
if (retParam) { const resArray = await Promise.all(promises);
retParam.bind(resultArray); if (resArray && resArray.length > 0) {
} const resultArray: any[] = [];
actionContext.bindLastReturnParam(resultArray); resArray.forEach((res: any) => {
} else { if (res && res.status === 200 && res.data) {
throw new Error(`执行实体行为失败`); resultArray.push(res.data);
} }
} else { })
if (retParam) { if (retParam) {
retParam.bind([]); retParam.bind(resultArray);
} }
actionContext.bindLastReturnParam([]); actionContext.bindLastReturnParam(resultArray);
} } else {
} throw new Error(`执行实体行为失败`);
} catch (error: any) { }
<#noparse>throw new Error(`${error.message ? error.message : error.data && error.data.message ? error.data.message : '执行实体行为失败'}`);</#noparse> } else {
} if (retParam) {
} else { retParam.bind([]);
throw new Error(`操作参数缺失!`); }
} actionContext.bindLastReturnParam([]);
<#else> }
throw new Error(`操作参数缺失!`); }
</#if> } catch (error: any) {
</#macro> <#noparse>throw new Error(`${error.message ? error.message : error.data && error.data.message ? error.data.message : '执行实体行为失败'}`);</#noparse>
<#-- END: 行为处理节点 --> }
} else {
<#-- START: 实体处理逻辑节点 --> throw new Error(`操作参数缺失!`);
<#macro deLogicNode logicNode> }
<#if logicNode.getDstPSAppDataEntity?? && logicNode.getDstPSAppDataEntity()?? && logicNode.getDstPSAppDELogic?? && logicNode.getDstPSAppDELogic()??> <#else>
const dstParam = actionContext.getParam('<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if>'); throw new Error(`操作参数缺失!`);
const retParam = actionContext.getParam('<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if>'); </#if>
if (dstParam) { </#macro>
try { <#-- END: 行为处理节点 -->
const deLogic: ${srfclassname('${logicNode.getDstPSAppDELogic().getCodeName()}')}Logic = new ${srfclassname('${logicNode.getDstPSAppDELogic().getCodeName()}')}Logic({ context: actionContext.context, data: dstParam.getReal() ? dstParam.getReal() : {} });
const result = await deLogic.onExecute(actionContext.context, dstParam.getReal() ? dstParam.getReal() : {}, false); <#-- START: 实体处理逻辑节点 -->
if (result) { <#macro deLogicNode logicNode>
if(retParam){ <#if logicNode.getDstPSAppDataEntity?? && logicNode.getDstPSAppDataEntity()?? && logicNode.getDstPSAppDELogic?? && logicNode.getDstPSAppDELogic()??>
retParam.bind(result); const dstParam = actionContext.getParam('<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if>');
} const retParam = actionContext.getParam('<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if>');
actionContext.bindLastReturnParam(result); if (dstParam) {
} else { try {
throw new Error(`调用实体处理逻辑异常`); const deLogic: ${srfclassname('${logicNode.getDstPSAppDELogic().getCodeName()}')}Logic = new ${srfclassname('${logicNode.getDstPSAppDELogic().getCodeName()}')}Logic({ context: actionContext.context, data: dstParam.getReal() ? dstParam.getReal() : {} });
} const result = await deLogic.onExecute(actionContext.context, dstParam.getReal() ? dstParam.getReal() : {}, false);
} catch (error: any) { if (result) {
<#noparse>throw new Error(`调用实体处理逻辑异常${error && error.message ? error.message : ''}`);</#noparse> if(retParam){
} retParam.bind(result);
} else { }
throw new Error(`操作参数缺失!`); actionContext.bindLastReturnParam(result);
} } else {
<#else> throw new Error(`调用实体处理逻辑异常`);
throw new Error(`操作参数缺失!`); }
</#if> } catch (error: any) {
</#macro> <#noparse>throw new Error(`调用实体处理逻辑异常${error && error.message ? error.message : ''}`);</#noparse>
<#-- END: 实体处理逻辑节点 --> }
} else {
<#-- START: 实体数据集节点 --> throw new Error(`操作参数缺失!`);
<#macro deDataSetNode logicNode> }
<#if logicNode.getDstPSAppDataEntity?? && logicNode.getDstPSAppDataEntity()?? && logicNode.getDstPSAppDEDataSet?? && logicNode.getDstPSAppDEDataSet()??> <#else>
const dstParam = actionContext.getParam('<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if>'); throw new Error(`操作参数缺失!`);
if (!Object.is(dstParam.logicParamType, UILogicParamType.filterParam)) { </#if>
throw new Error(`传入参数 <#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if> 类型不正确,必须为过滤器对象`); </#macro>
} <#-- END: 实体处理逻辑节点 -->
try {
const service: any = await window.entityServiceRegister.getService('${logicNode.getDstPSAppDataEntity().getCodeName()?lower_case}'); <#-- START: 实体数据集节点 -->
const res = await service['${logicNode.getDstPSAppDEDataSet().codeName}'](actionContext.context, dstParam.getReal() ? dstParam.getReal() : {}); <#macro deDataSetNode logicNode>
if (res && res.status === 200 && res.data) { <#if logicNode.getDstPSAppDataEntity?? && logicNode.getDstPSAppDataEntity()?? && logicNode.getDstPSAppDEDataSet?? && logicNode.getDstPSAppDEDataSet()??>
// 返回值绑定逻辑参数对象 const dstParam = actionContext.getParam('<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if>');
<#if logicNode.getRetPSDEUILogicParam?? && logicNode.getRetPSDEUILogicParam()??> if (!Object.is(dstParam.logicParamType, UILogicParamType.filterParam)) {
const retParam = actionContext.getParam('${logicNode.getRetPSDEUILogicParam().codeName}'); throw new Error(`传入参数 <#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if> 类型不正确,必须为过滤器对象`);
retParam.bind(res.data); }
actionContext.bindLastReturnParam(res.data); try {
<#else> const service: any = await window.entityServiceRegister.getService('${logicNode.getDstPSAppDataEntity().getCodeName()?lower_case}');
throw new Error(`查询实体数据集失败`); const res = await service['${logicNode.getDstPSAppDEDataSet().codeName}'](actionContext.context, dstParam.getReal() ? dstParam.getReal() : {});
</#if> if (res && res.status === 200 && res.data) {
} catch (error: any) { // 返回值绑定逻辑参数对象
<#noparse>throw new Error(`${error.message ? error.message : error.data && error.data.message ? error.data.message : '查询实体数据集失败'}`);</#noparse> <#if logicNode.getRetPSDEUILogicParam?? && logicNode.getRetPSDEUILogicParam()??>
} const retParam = actionContext.getParam('${logicNode.getRetPSDEUILogicParam().codeName}');
<#else> retParam.bind(res.data);
throw new Error(`操作参数缺失!`); actionContext.bindLastReturnParam(res.data);
</#if> <#else>
</#macro> throw new Error(`查询实体数据集失败`);
<#-- END: 实体数据集节点 --> </#if>
} catch (error: any) {
<#-- START: 附加到数组参数节点 --> <#noparse>throw new Error(`${error.message ? error.message : error.data && error.data.message ? error.data.message : '查询实体数据集失败'}`);</#noparse>
<#macro appendParamNode logicNode> }
// 源数据 <#else>
const srcParam: any = actionContext.getParam('<#if logicNode.getSrcPSDEUILogicParam?? && logicNode.getSrcPSDEUILogicParam()??>${logicNode.getSrcPSDEUILogicParam().codeName}</#if>'); throw new Error(`操作参数缺失!`);
// 目标数据 </#if>
const dstParam: any = actionContext.getParam('<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if>'); </#macro>
// 源属性 <#-- END: 实体数据集节点 -->
const srcFieldName: string = '<#if logicNode.getSrcFieldName?? && logicNode.getSrcFieldName()??>${logicNode.getSrcFieldName()?lower_case}</#if>';
let objParam: any; <#-- START: 附加到数组参数节点 -->
if (srcFieldName) { <#macro appendParamNode logicNode>
objParam = srcParam.get(srcFieldName); // 源数据
} else { const srcParam: any = actionContext.getParam('<#if logicNode.getSrcPSDEUILogicParam?? && logicNode.getSrcPSDEUILogicParam()??>${logicNode.getSrcPSDEUILogicParam().codeName}</#if>');
objParam = srcParam.getReal(); // 目标数据
} const dstParam: any = actionContext.getParam('<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if>');
dstParam.append(${logicNode.getDstIndex()?c}, objParam, ${logicNode.getSrcIndex()?c}, ${logicNode.getSrcSize()?c}); // 源属性
actionContext.bindLastReturnParam(null); const srcFieldName: string = '<#if logicNode.getSrcFieldName?? && logicNode.getSrcFieldName()??>${logicNode.getSrcFieldName()?lower_case}</#if>';
</#macro> let objParam: any;
<#-- END: 附加到数组参数节点 --> if (srcFieldName) {
objParam = srcParam.get(srcFieldName);
<#-- START: 排序数组参数节点 --> } else {
<#macro sortParamNode logicNode> objParam = srcParam.getReal();
// 目标数据 }
const dstParam: any = actionContext.getParam('<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if>'); dstParam.append(${logicNode.getDstIndex()?c}, objParam, ${logicNode.getSrcIndex()?c}, ${logicNode.getSrcSize()?c});
// 目标属性 actionContext.bindLastReturnParam(null);
const dstFieldName: string = '<#if logicNode.getDstFieldName?? && logicNode.getDstFieldName()??>${logicNode.getDstFieldName()?lower_case}</#if>'; </#macro>
if (!dstFieldName) { <#-- END: 附加到数组参数节点 -->
throw new Error(`逻辑参数${logicNode.name}未指定设置排序属性`);
} <#-- START: 排序数组参数节点 -->
dstParam.sort(dstFieldName, '${logicNode.getDstSortDir()}'); <#macro sortParamNode logicNode>
actionContext.bindLastReturnParam(null); // 目标数据
</#macro> const dstParam: any = actionContext.getParam('<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().codeName}</#if>');
<#-- END: 排序数组参数节点 --> // 目标属性
const dstFieldName: string = '<#if logicNode.getDstFieldName?? && logicNode.getDstFieldName()??>${logicNode.getDstFieldName()?lower_case}</#if>';
<#-- START: 视图部件调用节点 --> if (!dstFieldName) {
<#macro viewCtrlInvokeNode logicNode> throw new Error(`逻辑参数${logicNode.name}未指定设置排序属性`);
const invokeCtrl = '<#if logicNode.getInvokeCtrl?? && logicNode.getInvokeCtrl()??>${logicNode.getInvokeCtrl().codeName}</#if>'; }
const invokeMethod = '<#if logicNode.getInvokeMethod?? && logicNode.getInvokeMethod()??>${logicNode.getInvokeMethod()}</#if>'; dstParam.sort(dstFieldName, '${logicNode.getDstSortDir()}');
const invokeParam = '<#if logicNode.getInvokeParam?? && logicNode.getInvokeParam()??>${logicNode.getInvokeParam().codeName}</#if>'; actionContext.bindLastReturnParam(null);
if (!invokeCtrl || !invokeMethod) { </#macro>
throw new Error(`界面对象或者调用方法缺失`); <#-- END: 排序数组参数节点 -->
}
const invokeUICtrl = actionContext.getParam(invokeCtrl).getReal(); <#-- START: 视图部件调用节点 -->
if (invokeUICtrl[invokeMethod] && invokeUICtrl[invokeMethod] instanceof Function) { <#macro viewCtrlInvokeNode logicNode>
try { const invokeCtrl = '<#if logicNode.getInvokeCtrl?? && logicNode.getInvokeCtrl()??>${logicNode.getInvokeCtrl().codeName}</#if>';
const result = await invokeUICtrl[invokeMethod](); const invokeMethod = '<#if logicNode.getInvokeMethod?? && logicNode.getInvokeMethod()??>${logicNode.getInvokeMethod()}</#if>';
if (invokeParam) { const invokeParam = '<#if logicNode.getInvokeParam?? && logicNode.getInvokeParam()??>${logicNode.getInvokeParam().codeName}</#if>';
actionContext.getParam(invokeParam).bind(result); if (!invokeCtrl || !invokeMethod) {
} throw new Error(`界面对象或者调用方法缺失`);
actionContext.bindLastReturnParam(result); }
} catch (error:any) { const invokeUICtrl = actionContext.getParam(invokeCtrl).getReal();
<#noparse>throw new Error(`${invokeCtrl}界面对象调用${invokeMethod}方法发生异常`);</#noparse> if (invokeUICtrl[invokeMethod] && invokeUICtrl[invokeMethod] instanceof Function) {
} try {
} else { const result = await invokeUICtrl[invokeMethod]();
<#noparse>throw new Error(`${invokeCtrl}界面对象不存在${invokeMethod}方法`);</#noparse> if (invokeParam) {
} actionContext.getParam(invokeParam).bind(result);
</#macro> }
<#-- END: 视图部件调用节点 --> actionContext.bindLastReturnParam(result);
} catch (error:any) {
<#-- START: 视图部件事件触发节点 --> <#noparse>throw new Error(`${invokeCtrl}界面对象调用${invokeMethod}方法发生异常`);</#noparse>
<#macro viewCtrlFireEventNode logicNode> }
// 事件名称 } else {
const eventName: string = '${logicNode.getEventName()}'; <#noparse>throw new Error(`${invokeCtrl}界面对象不存在${invokeMethod}方法`);</#noparse>
// 事件参数 }
const eventParam = '<#if logicNode.getEventParam?? && logicNode.getEventParam()??>${logicNode.getEventParam().codeName}</#if>'; </#macro>
// 触发对象 <#-- END: 视图部件调用节点 -->
const fireCtrl = '<#if logicNode.getFireCtrl?? && logicNode.getFireCtrl()??>${logicNode.getFireCtrl().codeName}</#if>';
if (!eventParam || !eventParam || !fireCtrl) { <#-- START: 视图部件事件触发节点 -->
throw new Error(`触发对象、事件名称或者事件参数缺失`); <#macro viewCtrlFireEventNode logicNode>
} // 事件名称
// 触发UI对象 const eventName: string = '${logicNode.getEventName()}';
const fireUICtrl = actionContext.getParam(fireCtrl).getReal(); // 事件参数
// 事件参数 const eventParam = '<#if logicNode.getEventParam?? && logicNode.getEventParam()??>${logicNode.getEventParam().codeName}</#if>';
const eventArgs = actionContext.getParam(eventParam).getReal(); // 触发对象
if (!fireUICtrl) { const fireCtrl = '<#if logicNode.getFireCtrl?? && logicNode.getFireCtrl()??>${logicNode.getFireCtrl().codeName}</#if>';
throw new Error(`获取触发对象异常`); if (!eventParam || !eventParam || !fireCtrl) {
} throw new Error(`触发对象、事件名称或者事件参数缺失`);
try { }
// 自身触发 // 触发UI对象
fireUICtrl.$emit(eventName, eventArgs); const fireUICtrl = actionContext.getParam(fireCtrl).getReal();
actionContext.bindLastReturnParam(null); // 事件参数
} catch (error:any) { const eventArgs = actionContext.getParam(eventParam).getReal();
throw new Error(`视图部件事件触发未执行成功!`); if (!fireUICtrl) {
} throw new Error(`获取触发对象异常`);
</#macro> }
<#-- END: 视图部件事件触发节点 --> try {
// 自身触发
<#-- START: 调试逻辑参数节点 --> fireUICtrl.$emit(eventName, eventArgs);
<#macro debugParamNode logicNode> actionContext.bindLastReturnParam(null);
<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??> } catch (error:any) {
const dstParamValue = actionContext.getParam('${logicNode.getDstPSDEUILogicParam().codeName}').getReal(); throw new Error(`视图部件事件触发未执行成功!`);
actionContext.bindLastReturnParam(null); }
console.log('逻辑节点 ${logicNode.name} 操作参数值: ', dstParamValue); </#macro>
</#if> <#-- END: 视图部件事件触发节点 -->
</#macro>
<#-- END: 调试逻辑参数节点 --> <#-- START: 调试逻辑参数节点 -->
<#macro debugParamNode logicNode>
<#-- START: 消息弹窗节点 --> <#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>
<#macro msgBoxNode logicNode> const dstParamValue = actionContext.getParam('${logicNode.getDstPSDEUILogicParam().codeName}').getReal();
return new Promise<void>((resolve: any) => { console.log(`逻辑节点${logicNode.name}操作参数值:`, Util.deepCopy(dstParamValue));
const msgBoxParam: any = actionContext.getParam('<#if logicNode.getMsgBoxParam?? && logicNode.getMsgBoxParam()??>${logicNode.getMsgBoxParam().codeName}</#if>'); </#if>
const data = msgBoxParam ? msgBoxParam.getReal() : {}; </#macro>
const options = { <#-- END: 调试逻辑参数节点 -->
type: '${logicNode.getMsgBoxType()}',
title: data && data.title ? data.title : '<#if logicNode.getTitle()??>${logicNode.getTitle()}<#else>消息</#if>', <#-- START: 消息弹窗节点 -->
content: data && data.message ? data.message : '${logicNode.getMessage()}', <#macro msgBoxNode logicNode>
buttonType: '${logicNode.getButtonsType()?lower_case}', return new Promise<void>((resolve: any) => {
showMode: '<#if logicNode.getShowMode?? && logicNode.getShowMode()??>${logicNode.getShowMode()?lower_case}</#if>', const msgBoxParam: any = actionContext.getParam('<#if logicNode.getMsgBoxParam?? && logicNode.getMsgBoxParam()??>${logicNode.getMsgBoxParam().codeName}</#if>');
showClose: false, const data = msgBoxParam ? msgBoxParam.getReal() : {};
mask: true, const options = {
maskClosable: true type: '${logicNode.getMsgBoxType()}',
}; title: data && data.title ? data.title : '<#if logicNode.getTitle()??>${logicNode.getTitle()}<#else>消息</#if>',
const subject: Subject<any> | null = AppMessageBox.getInstance().open(options); content: data && data.message ? data.message : '${logicNode.getMessage()}',
if (subject) { buttonType: '${logicNode.getButtonsType()?lower_case}',
const handleResponse = (result: any) => { showMode: '<#if logicNode.getShowMode?? && logicNode.getShowMode()??>${logicNode.getShowMode()?lower_case}</#if>',
<#if logicNode.getButtonsType() == 'YESNO' || logicNode.getButtonsType() == 'YESNOCANCEL' || logicNode.getButtonsType() == 'OK' || logicNode.getButtonsType() == 'OKCANCEL'> showClose: false,
if (msgBoxParam) { mask: true,
msgBoxParam.bind(result); maskClosable: true
} };
actionContext.bindLastReturnParam(result); const subject: Subject<any> | null = AppMessageBox.getInstance().open(options);
<#if logicNode.getPSDEUILogicLinks?? && logicNode.getPSDEUILogicLinks()??> if (subject) {
<#list logicNode.getPSDEUILogicLinks() as link> const handleResponse = (result: any) => {
<#if link.getDstPSDEUILogicNode?? && link.getDstPSDEUILogicNode()??> <#if logicNode.getButtonsType() == 'YESNO' || logicNode.getButtonsType() == 'YESNOCANCEL' || logicNode.getButtonsType() == 'OK' || logicNode.getButtonsType() == 'OKCANCEL'>
<#if link.getPSDEUILogicLinkGroupCond?? && link.getPSDEUILogicLinkGroupCond()??> if (msgBoxParam) {
if(<@getCond link.getPSDEUILogicLinkGroupCond() />) { msgBoxParam.bind(result);
resolve(this.execute_${link.getDstPSDEUILogicNode().codeName?lower_case}_node(actionContext)); }
} actionContext.bindLastReturnParam(result);
<#else> <#if logicNode.getPSDEUILogicLinks?? && logicNode.getPSDEUILogicLinks()??>
resolve(this.execute_${link.getDstPSDEUILogicNode().codeName?lower_case}_node(actionContext)); <#list logicNode.getPSDEUILogicLinks() as link>
</#if> <#if link.getDstPSDEUILogicNode?? && link.getDstPSDEUILogicNode()??>
</#if> <#if link.getPSDEUILogicLinkGroupCond?? && link.getPSDEUILogicLinkGroupCond()??>
</#list> if(<@getCond link.getPSDEUILogicLinkGroupCond() />) {
</#if> resolve(this.execute_${link.getDstPSDEUILogicNode().codeName?lower_case}_node(actionContext));
console.log('已完成执行 ${logicNode.name} 节点'); }
<#else> <#else>
throw new Error('${logicNode.getButtonsType()}未实现'); resolve(this.execute_${link.getDstPSDEUILogicNode().codeName?lower_case}_node(actionContext));
</#if> </#if>
} </#if>
const subscription = subject.subscribe((result: any) => { </#list>
resolve(handleResponse(result)); </#if>
subscription!.unsubscribe(); <#else>
subject.complete(); throw new Error('${logicNode.getButtonsType()}未实现');
}); </#if>
} else { }
resolve(true); const subscription = subject.subscribe((result: any) => {
console.log('已完成执行 ${logicNode.name} 节点'); resolve(handleResponse(result));
} subscription!.unsubscribe();
}); subject.complete();
</#macro> });
<#-- END: 消息弹窗节点 --> } else {
resolve(true);
<#-- START: 前端代码节点 --> }
<#macro rawJSCoreNode logicNode> });
let data: any = actionContext.defaultParam.getReal(); </#macro>
let { context } = actionContext; <#-- END: 消息弹窗节点 -->
<#if logicNode.getCode?? && logicNode.getCode()??>
eval(`${logicNode.getCode()}`); <#-- START: 前端代码节点 -->
<#else> <#macro rawJSCoreNode logicNode>
throw new Error('无代码片段'); let data: any = actionContext.defaultParam.getReal();
</#if> let { context } = actionContext;
actionContext.bindLastReturnParam(null); <#if logicNode.getCode?? && logicNode.getCode()??>
</#macro> eval(`${logicNode.getCode()}`);
<#-- END: 前端代码节点 --> <#else>
throw new Error('无代码片段');
<#-- START: 异常处理节点 --> </#if>
<#macro throwExceptionNode logicNode> actionContext.bindLastReturnParam(null);
actionContext.actionContainer.$throw('<#if logicNode.getErrorInfo?? && logicNode.getErrorInfo()??>${logicNode.getErrorInfo()}</#if>'); </#macro>
actionContext.bindLastReturnParam(null); <#-- END: 前端代码节点 -->
</#macro>
<#-- END: 异常处理节点 --> <#-- START: 异常处理节点 -->
<#macro throwExceptionNode logicNode>
<#-- START: 结束节点 --> actionContext.actionContainer.$throw('<#if logicNode.getErrorInfo?? && logicNode.getErrorInfo()??>${logicNode.getErrorInfo()}</#if>');
<#macro endNode logicNode> actionContext.bindLastReturnParam(null);
const strReturnType: string = '<#if logicNode.getReturnType?? && logicNode.getReturnType()??>${logicNode.getReturnType()}</#if>'; </#macro>
if (Object.is(strReturnType, LogicReturnType.NONEVALUE) || Object.is(strReturnType, LogicReturnType.NULLVALUE)) { <#-- END: 异常处理节点 -->
actionContext.setResult(null);
} else if (Object.is(strReturnType, LogicReturnType.SRCVALUE)) { <#-- START: 结束节点 -->
actionContext.setResult('<#if logicNode.getRawValue?? && logicNode.getRawValue()??>${logicNode.getRawValue()}</#if>'); <#macro endNode logicNode>
} else if (Object.is(strReturnType, LogicReturnType.BREAK)) { const strReturnType: string = '<#if logicNode.getReturnType?? && logicNode.getReturnType()??>${logicNode.getReturnType()}</#if>';
actionContext.setResult(LogicReturnType.BREAK); if (Object.is(strReturnType, LogicReturnType.NONEVALUE) || Object.is(strReturnType, LogicReturnType.NULLVALUE)) {
} else if (Object.is(strReturnType, LogicReturnType.LOGICPARAM) || Object.is(strReturnType, LogicReturnType.LOGICPARAMFIELD)) { actionContext.setResult(null);
const returnParam = actionContext.getParam('<#if logicNode.getReturnParam?? && logicNode.getReturnParam()??>${logicNode.getReturnParam().codeName}</#if>'); } else if (Object.is(strReturnType, LogicReturnType.SRCVALUE)) {
if (Object.is(strReturnType, LogicReturnType.LOGICPARAM)) { actionContext.setResult('<#if logicNode.getRawValue?? && logicNode.getRawValue()??>${logicNode.getRawValue()}</#if>');
actionContext.setResult(returnParam.getReal()); } else if (Object.is(strReturnType, LogicReturnType.BREAK)) {
} else { actionContext.setResult(LogicReturnType.BREAK);
actionContext.setResult(returnParam.get('<#if logicNode.getDstFieldName?? && logicNode.getDstFieldName()??>${logicNode.getDstFieldName()}</#if>')); } else if (Object.is(strReturnType, LogicReturnType.LOGICPARAM) || Object.is(strReturnType, LogicReturnType.LOGICPARAMFIELD)) {
} const returnParam = actionContext.getParam('<#if logicNode.getReturnParam?? && logicNode.getReturnParam()??>${logicNode.getReturnParam().codeName}</#if>');
} else { if (Object.is(strReturnType, LogicReturnType.LOGICPARAM)) {
<#noparse>throw new Error(`无法识别的返回值类型${strReturnType}`);</#noparse> actionContext.setResult(returnParam.getReal());
} } else {
</#macro> actionContext.setResult(returnParam.get('<#if logicNode.getDstFieldName?? && logicNode.getDstFieldName()??>${logicNode.getDstFieldName()}</#if>'));
<#-- END: 结束节点 --> }
} else {
<#noparse>throw new Error(`无法识别的返回值类型${strReturnType}`);</#noparse>
<#-- 执行节点 --> }
<#macro executenode logicNode> </#macro>
/** <#-- END: 结束节点 -->
* ${logicNode.name}
*
* @param {UIActionContext} actionContext 界面逻辑上下文 <#-- 执行节点 -->
* @memberof ${srfclassname('${item.getCodeName()}')}UILogicBase <#macro executenode logicNode>
*/ /**
protected async execute_${logicNode.codeName?lower_case}_node(actionContext: UIActionContext) { * ${logicNode.name}
<#assign needNextNode = true> *
<#if logicNode.getLogicNodeType() == 'BEGIN'> * @param {UIActionContext} actionContext 界面逻辑上下文
<#-- 开始节点 --> * @memberof ${srfclassname('${item.getCodeName()}')}UILogicBase
<@beginNode logicNode/> */
<#elseif logicNode.getLogicNodeType() == 'PREPAREJSPARAM'> protected async execute_${logicNode.codeName?lower_case}_node(actionContext: UIActionContext) {
<#-- 准备参数节点 --> <#assign needNextNode = true>
<@prepareParamNode logicNode/> <#if logicNode.getLogicNodeType() == 'BEGIN'>
<#elseif logicNode.getLogicNodeType() == 'RESETPARAM'> <#-- 开始节点 -->
<#-- 重置参数节点 --> <@beginNode logicNode/>
<@resetParamNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'PREPAREJSPARAM'>
<#elseif logicNode.getLogicNodeType() == 'COPYPARAM'> <#-- 准备参数节点 -->
<#-- 拷贝参数节点 --> <@prepareParamNode logicNode/>
<@copyParamNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'RESETPARAM'>
<#elseif logicNode.getLogicNodeType() == 'BINDPARAM'> <#-- 重置参数节点 -->
<#-- 绑定参数节点 --> <@resetParamNode logicNode/>
<@bindParamNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'COPYPARAM'>
<#elseif logicNode.getLogicNodeType() == 'RENEWPARAM'> <#-- 拷贝参数节点 -->
<#-- 重新建立参数节点 --> <@copyParamNode logicNode/>
<@renewParamNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'BINDPARAM'>
<#elseif logicNode.getLogicNodeType() == 'DEUIACTION'> <#-- 绑定参数节点 -->
<#-- 调用实体界面行为节点 --> <@bindParamNode logicNode/>
<@deUIActionNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'RENEWPARAM'>
<#elseif logicNode.getLogicNodeType() == 'DEACTION'> <#-- 重新建立参数节点 -->
<#-- 行为处理节点 --> <@renewParamNode logicNode/>
<@deActionNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'DEUIACTION'>
<#elseif logicNode.getLogicNodeType() == 'DELOGIC'> <#-- 调用实体界面行为节点 -->
<#-- 实体处理逻辑节点 --> <@deUIActionNode logicNode/>
<@deLogicNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'DEACTION'>
<#elseif logicNode.getLogicNodeType() == 'DEDATASET'> <#-- 行为处理节点 -->
<#-- 实体数据集节点 --> <@deActionNode logicNode/>
<@deDataSetNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'DELOGIC'>
<#elseif logicNode.getLogicNodeType() == 'APPENDPARAM'> <#-- 实体处理逻辑节点 -->
<#-- 附加到数组参数节点 --> <@deLogicNode logicNode/>
<@appendParamNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'DEDATASET'>
<#elseif logicNode.getLogicNodeType() == 'SORTPARAM'> <#-- 实体数据集节点 -->
<#-- 排序数组参数节点 --> <@deDataSetNode logicNode/>
<@sortParamNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'APPENDPARAM'>
<#elseif logicNode.getLogicNodeType() == 'VIEWCTRLINVOKE'> <#-- 附加到数组参数节点 -->
<#-- 视图部件调用节点 --> <@appendParamNode logicNode/>
<@viewCtrlInvokeNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'SORTPARAM'>
<#elseif logicNode.getLogicNodeType() == 'VIEWCTRLFIREEVENT'> <#-- 排序数组参数节点 -->
<#-- 视图部件事件触发节点 --> <@sortParamNode logicNode/>
<@viewCtrlFireEventNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'VIEWCTRLINVOKE'>
<#elseif logicNode.getLogicNodeType() == 'DEBUGPARAM'> <#-- 视图部件调用节点 -->
<#-- 调试逻辑参数节点 --> <@viewCtrlInvokeNode logicNode/>
<@debugParamNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'VIEWCTRLFIREEVENT'>
<#elseif logicNode.getLogicNodeType() == 'MSGBOX'> <#-- 视图部件事件触发节点 -->
<#assign needNextNode = false> <@viewCtrlFireEventNode logicNode/>
<#-- 消息弹窗节点 --> <#elseif logicNode.getLogicNodeType() == 'DEBUGPARAM'>
<@msgBoxNode logicNode/> <#-- 调试逻辑参数节点 -->
<#elseif logicNode.getLogicNodeType() == 'RAWJSCODE'> <@debugParamNode logicNode/>
<#-- 前端代码节点 --> <#elseif logicNode.getLogicNodeType() == 'MSGBOX'>
<@rawJSCoreNode logicNode/> <#assign needNextNode = false>
<#elseif logicNode.getLogicNodeType() == 'THROWEXCEPTION'> <#-- 消息弹窗节点 -->
<#-- 异常处理节点 --> <@msgBoxNode logicNode/>
<@throwExceptionNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'RAWJSCODE'>
<#elseif logicNode.getLogicNodeType() == 'END'> <#-- 前端代码节点 -->
<#-- 结束节点 --> <@rawJSCoreNode logicNode/>
<@endNode logicNode/> <#elseif logicNode.getLogicNodeType() == 'THROWEXCEPTION'>
<#else> <#-- 异常处理节点 -->
console.log('${logicNode.getLogicNodeType()}暂未支持'); <@throwExceptionNode logicNode/>
</#if> <#elseif logicNode.getLogicNodeType() == 'END'>
<#if needNextNode> <#-- 结束节点 -->
console.log('已完成执行 ${logicNode.name} 节点'); <@endNode logicNode/>
<@computeNextNode logicNode/> <#else>
</#if> </#if>
} <#if needNextNode>
<@computeNextNode logicNode/>
</#if>
}
</#macro> </#macro>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册