提交 301c6f27 编写于 作者: Mosher's avatar Mosher

update:更新

上级 a3131601
<#ibiztemplate>
TARGET=PSAPPDEUILOGIC
</#ibiztemplate>
<#ibizinclude>
../@MACRO/ui-logic-node.txt
</#ibizinclude>
import { UIActionContext } from "@/logic/ui-logic";
import { LogicReturnType } from "@/logic/const/logic-return-type";
/**
......@@ -145,10 +148,10 @@ export default class ${srfclassname('${item.getCodeName()}')}UILogicBase {
}
<#if item.getPSDEUILogicNodes?? && item.getPSDEUILogicNodes()??>
<#-- <#list item.getPSDEUILogicNodes() as logicNode>
<#list item.getPSDEUILogicNodes() as logicNode>
<@executenode logicNode/>
</#list> -->
</#list>
</#if>
}
\ No newline at end of file
......@@ -21,7 +21,111 @@
<#-- START: 准备处理参数节点 -->
<#macro prepareParamNode logicNode>
<#if logicNode.getPSDEUILogicNodeParams?? && logicNode.getPSDEUILogicNodeParams()??>
try {
<#assign index = 0>
<#list logicNode.getPSDEUILogicNodeParams() as param>
<#assign index = index + 1>
<#if param.getParamAction?? && param.getParamAction()??>
<#if param.getParamAction() == 'SETPARAMVALUE'>
<#if (param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??) || (param.getSrcValueType?? && param.getSrcValueType()??)>
// 目标数据
const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>');
// 无值类型
<#if param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'NONEVALUE'>
<#if param.getDstFieldName?? && param.getDstFieldName()??>
dstParam_${index}.reset('${param.getDstFieldName()?lower_case}');
<#else>
dstParam_${index}.bind(undefined);
</#if>
<#else>
<#if param.getSrcValueType?? && param.getSrcValueType()?? && (param.getSrcValueType() == 'SRCDLPARAM' || param.getSrcValueType() == 'WEBCONTEXT' || param.getSrcValueType() == 'VIEWPARAM')>
// 源逻辑参数、网页请求上下文、当前视图参数
const srcParam_${index} = actionContext.getParam('<#if param.getSrcPSDEUILogicParam?? && param.getSrcPSDEUILogicParam()??>${param.getSrcPSDEUILogicParam().codeName}</#if>');
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;
<#elseif param.getSrcValueType?? && param.getSrcValueType()?? && (param.getSrcValueType() == 'APPLICATION' || param.getSrcValueType() == 'SESSION' || param.getSrcValueType() == 'APPDATA' || param.getSrcValueType() == 'DATACONTEXT')>
// 系统全局对象、用户全局对象、应用上下文、数据上下文
const result_${index} = actionContext['<#if param.getSrcFieldName?? && param.getSrcFieldName()??>${param.getSrcFieldName()?lower_case}</#if>'];
<#elseif param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'ENVPARAM'>
// 环境参数
// TODO 环境参数
const result_${index} = '';
<#elseif param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'EXPRESSION'>
// 计算式
// TODO 计算式
const result_${index} = '';
<#elseif param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'SRCVALUE'>
// 直接值
const result_${index} = '<#if param.getSrcValue?? && param.getSrcValue()??>${param.getSrcValue()}</#if>';
<#elseif param.getSrcValueType?? && param.getSrcValueType()?? && param.getSrcValueType() == 'NULLVALUE'>
// 空值(NULL)
const result_${index} = null;
<#else>
// 未支持
const result_${index} = undefined;
</#if>
<#if param.getDstFieldName?? && param.getDstFieldName()??>
const dstParam_${index}.set('${param.getDstFieldName()?lower_case}', result_${index});
<#else>
dstParam_${index}.bind(result_${index});
</#if>
</#if>
<#else>
throw new Error(`逻辑参数${param.name}源类型参数或者目标逻辑参数缺失`);
</#if>
<#elseif param.getParamAction() == 'RESETPARAM'>
const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>');
dstParam_${index}.resetAll();
<#elseif param.getParamAction() == 'COPYPARAM'>
// 源数据
const srcParam_${index}: any = actionContext.getParam('<#if param.getSrcPSDEUILogicParam?? && param.getSrcPSDEUILogicParam()??>${param.getSrcPSDEUILogicParam().codeName}</#if>');
// 目标数据
const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>');
srcParam_${index}.copyTo(dstParam_${index});
<#elseif param.getParamAction() == 'BINDPARAM'>
// 源数据
const srcParam_${index}: any = actionContext.getParam('<#if param.getSrcPSDEUILogicParam?? && param.getSrcPSDEUILogicParam()??>${param.getSrcPSDEUILogicParam().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>';
if (srcFieldName_${index}) {
dstParam_${index}.bind(srcParam_${index}.get(srcFieldName_${index}));
} else {
dstParam_${index}.bind(srcParam_${index}.getReal());
}
<#elseif param.getParamAction() == 'RENEWPARAM'>
// 目标数据
const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>');
dstParam_${index}.renew();
<#elseif param.getParamAction() == 'APPENDPARAM'>
// 源数据
const srcParam_${index}: any = actionContext.getParam('<#if param.getSrcPSDEUILogicParam?? && param.getSrcPSDEUILogicParam()??>${param.getSrcPSDEUILogicParam().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>';
let objParam_${index}: any;
if (srcFieldName_${index}) {
objParam_${index} = srcParam_${index}.get(srcFieldName_${index});
} else {
objParam_${index} = srcParam_${index}.getReal();
}
dstParam_${index}.append(${param.getDstIndex()?c}, objParam_${index}, ${param.getSrcIndex()?c}, ${param.getSrcSize()?c});
<#elseif param.getParamAction() == 'SORTPARAM'>
// 目标数据
const dstParam_${index}: any = actionContext.getParam('<#if param.getDstPSDEUILogicParam?? && param.getDstPSDEUILogicParam()??>${param.getDstPSDEUILogicParam().codeName}</#if>');
const dstFieldName_${index} = '<#if param.getDstFieldName?? && param.getDstFieldName()??>${param.getDstFieldName()?lower_case}</#if>';
if (!dstFieldName_${index}) {
throw new Error(`逻辑参数${param.name}未指定设置排序属性`);
} else {
dstParam_${index}.sort(dstFieldName_${index}, '${param.getDstSortDir()}');
}
</#if>
</#if>
</#list>
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name} <#noparse>${error ## error.message ? error.message : '发生未知错误!'}`</#noparse>);
}
</#if>
</#macro>
<#-- END: 准备处理参数节点 -->
......@@ -73,7 +177,7 @@
}
actionContext.bindLastReturnParam(null);
} catch (error: any) {
throw new Error(`逻辑参数<#if logicNode.getDstPSDEUILogicParam?? && logicNode.getDstPSDEUILogicParam()??>${logicNode.getDstPSDEUILogicParam().name}</#if> <#noparse>${error && error.message ? error.message : '发生未知错误!'}</#noparse>`);
throw new Error(`逻辑参数${logicNode.getDstPSDEUILogicParam().name} <#noparse>${error && error.message ? error.message : '发生未知错误!'}</#noparse>`);
}
<#else>
throw new Error('操作参数或者源参数缺失!');
......@@ -97,8 +201,7 @@
<#macro deUIActionNode logicNode>
const data = actionContext.defaultParam.getReal();
const { context, viewparams } = actionContext;
<#if logicNode.getDstPSAppDataEntity?? && logicNode.getDstPSAppDataEntity()??>
</#if>
// TODO 调用实体界面行为节点
</#macro>
<#-- END: 调用实体界面行为节点 -->
......@@ -166,7 +269,7 @@
}
}
} catch (error: any) {
throw new Error(`${error.message ? error.message : error.data?.message ? error.data.message : '执行实体行为失败'}`);
<#noparse>throw new Error(`${error.message ? error.message : error.data && error.data.message ? error.data.message : '执行实体行为失败'}`);</#noparse>
}
} else {
throw new Error(`操作参数缺失!`);
......@@ -227,7 +330,7 @@
throw new Error(`查询实体数据集失败`);
</#if>
} catch (error: any) {
throw new Error(`${error.message ? error.message : error.data && error.data.message ? error.data.message : '查询实体数据集失败'}`);
<#noparse>throw new Error(`${error.message ? error.message : error.data && error.data.message ? error.data.message : '查询实体数据集失败'}`);</#noparse>
}
<#else>
throw new Error(`操作参数缺失!`);
......@@ -261,7 +364,7 @@
// 目标属性
const dstFieldName: string = '<#if logicNode.getDstFieldName?? && logicNode.getDstFieldName()??>${logicNode.getDstFieldName()?lower_case}</#if>';
if (!dstFieldName) {
throw new Error(`逻辑参数${logicNodeParam.name}未指定设置排序属性`);
throw new Error(`逻辑参数${logicNode.name}未指定设置排序属性`);
}
dstParam.sort(dstFieldName, '${logicNode.getDstSortDir()}');
actionContext.bindLastReturnParam(null);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册