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

update:更新

上级 71fbdee6
<#ibiztemplate>
TARGET=PSAPPDEUILOGIC
</#ibiztemplate>
<#-- 获取逻辑节点类型 -->
<#macro getLogicNodeByType logicNode>
<#compress>
<#if logicNode.getLogicNodeType?? && logicNode.getLogicNodeType()??>
<#assign type = logicNode.getLogicNodeType()>
<#if type == 'BEGIN'>
BeginNode
<#elseif type == 'END'>
EndNode
<#else>
LogicNodeBase
</#if>
<#else>
LogicNodeBase
</#if>
</#compress>
</#macro>
import { UIActionContext } from "@/logic/uiaction-context";
import { BeginNode, EndNode, AppendParamNode } from "@/logic/logic-node";
/**
* ${item.name}
......@@ -35,8 +20,28 @@ export default class ${srfclassname('${item.getCodeName()}')}UILogicBase {
*/
constructor(opts: any = {}) { }
protected readonly startLogicNode: string = '<#if item.getStartPSDEUILogicNode?? && item.getStartPSDEUILogicNode()??>${item.getStartPSDEUILogicNode().codeName}</#if>';
protected logicParams: any[] = [
<#if item.getPSDEUILogicParams?? && item.getPSDEUILogicParams()??>
<#list item.getPSDEUILogicParams() as logicParam>
{
name: '${logicParam.name}',
codeName: '${logicParam.codeName}',
default: <#if logicParam.isDefault?? && logicParam.isDefault()>true<#else>false</#if>,
navContextParam: <#if logicParam.isNavContextParam?? && logicParam.isNavContextParam()>true<#else>false</#if>,
navViewParamParam: <#if logicParam.isNavViewParamParam?? && logicParam.isNavViewParamParam()>true<#else>false</#if>,
activeContainerParam: <#if logicParam.isActiveContainerParam?? && logicParam.isActiveContainerParam()>true<#else>false</#if>,
activeCtrlParam: <#if logicParam.isActiveCtrlParam?? && logicParam.isActiveCtrlParam()>true<#else>false</#if>,
activeViewParam: <#if logicParam.isActiveViewParam?? && logicParam.isActiveViewParam()>true<#else>false</#if>,
lastReturnParam: <#if logicParam.isLastReturnParam?? && logicParam.isLastReturnParam()>true<#else>false</#if>
},
</#list>
</#if>
];
protected logicNodes: any = {
protected logicNodes: ILogicNode[] = [
<#if item.getPSDEUILogicNodes?? && item.getPSDEUILogicNodes()??>
<#list item.getPSDEUILogicNodes() as logicNode>
<#assign node>
......@@ -61,6 +66,15 @@ export default class ${srfclassname('${item.getCodeName()}')}UILogicBase {
<#if logicNode.getSrcSize?? && logicNode.getSrcSize()??>
srcSize: '${logicNode.getSrcSize()?c}',
</#if>
<#if logicNode.getReturnParam?? && logicNode.getReturnParam()??>
returnParam: '${logicNode.getReturnParam().codeName}',
</#if>
<#if logicNode.getReturnType?? && logicNode.getReturnType()??>
returnType: '${logicNode.getReturnType().codeName}',
</#if>
<#if logicNode.getRawValue?? && logicNode.getRawValue()??>
returnRawValue: '${logicNode.getRawValue()}',
</#if>
<#if logicNode.getPSDEUILogicLinks?? && logicNode.getPSDEUILogicLinks()??>
logicLinks: [
<#list logicNode.getPSDEUILogicLinks() as link>
......@@ -76,9 +90,14 @@ export default class ${srfclassname('${item.getCodeName()}')}UILogicBase {
]
</#if>
</#assign>
<@compress single_line=true>'${logicNode.codeName}': new <@getLogicNodeByType logicNode />({ ${node} }),</@compress>
<@compress single_line=true>{ ${node} }</@compress>
</#list>
</#if>
];
public beforeExecute(args: any, context: any = {}, params: any = {},
$event?: any, xData?: any, actioncontext?: any, srfParentDeName?: string) {
return new UIActionContext(this.logicParams, args, context, params, $event, xData, actioncontext, srfParentDeName)
}
/**
......@@ -93,8 +112,33 @@ export default class ${srfclassname('${item.getCodeName()}')}UILogicBase {
* @param {string} [srfParentDeName]
* @memberof GridViewLoadUILogicBase
*/
execute(args: any[], context:any = {} ,params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string) {
console.log('执行UILogic ${item.name}');
async execute(args: any[], context:any = {} ,params: any = {}, $event?: any, xData?: any, actioncontext?: any, srfParentDeName?: string) {
try {
const actionContext = this.beforeExecute(args, context, params, $event, xData, actioncontext, srfParentDeName);
const startNode = this.logicNodes.find((logicNode: ILogicNode) => logicNode.codeName === this.startLogicNode);
if (!startNode) {
throw new Error('没有开始节点');
}
await this.executeNode(startNode, actionContext);
return actionContext.getResult();
} catch (error: any) {
throw new Error(`${error?.message ? error?.message : '发生未知错误!'}`);
}
}
executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
switch (logicNode.logicNodeType) {
case 'BEGIN':
console.log(111, '执行开始节点');
break;
case 'END':
console.log(111, '执行结束节点');
break;
}
} catch (error: any) {
}
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册