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

delete:删除脏文件

上级 1a6396d9
import { ILogicNode } from "@/interface/logic";
import { UILogicNodeBase } from "./logic-node-base";
import { UIActionContext } from '../uiaction-context';
/**
* 附加到数组参数节点
*
* @export
* @class AppendParamNode
* @extends {LogicNodeBase}
*/
export class UILogicAppendParamNode extends UILogicNodeBase {
/**
* 执行节点
*
* @static
* @param {IPSDEAppendParamLogic} logicNode 逻辑节点
* @param {UIActionContext} actionContext 逻辑上下文
* @memberof AppDeLogicAppendParamNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
this.onAppendParam(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error?.message ? error?.message : '发生未知错误!'}`);
}
}
/**
* 附加到数组
*
* @param {IPSDEAppendParamLogic} logicNode
* @param {UIActionContext} actionContext
* @memberof AppDeLogicAppendParamNode
*/
public onAppendParam(logicNode: ILogicNode, actionContext: UIActionContext) {
// 源数据
const srcParam: any = actionContext.getParam(logicNode.srcParam as string);
// 目标数据
const dstParam: any = actionContext.getParam(logicNode.dstParam as string);
// 源属性
const srcFieldName: string = (logicNode.srcFieldName as string).toLowerCase();
let objParam: any;
if (srcFieldName) {
// objParam = srcParam.get(srcFieldName);
objParam = srcParam.getReal();
} else {
objParam = srcParam.getReal();
}
dstParam.append(logicNode.dstIndex, objParam, logicNode.srcIndex, logicNode.srcSize);
actionContext.bindLastReturnParam(null);
}
}
\ No newline at end of file
import { ILogicNode } from "@/interface/logic/logic-node";
import { UIActionContext } from '../uiaction-context';
import { UILogicNodeBase } from "./logic-node-base";
export class UILogicBeginNode extends UILogicNodeBase {
/**
* 执行节点
*
* @static
* @param {IPSDELogicNode} logicNode 逻辑节点
* @param {ActionContext} actionContext 逻辑上下文
* @memberof AppDeLogicBeginNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
// 默认设置当前逻辑返回结果为当前默认输入参数
actionContext.setResult(actionContext.defaultParam.getReal());
return this.computeNextNodes(logicNode, actionContext);
}
}
\ No newline at end of file
import { ILogicNode } from "@/interface/logic";
import { UIActionContext } from "../uiaction-context";
import { UILogicNodeBase } from "./logic-node-base";
export class UILogicBindParamNode extends UILogicNodeBase {
/**
* 执行节点
*
* @param {IPSDEUIBindParamLogic} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof AppUILogicBindParamNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
this.onBindParam(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error?.message ? error?.message : '发生未知错误!'}`);
}
}
/**
* 处理参数
*
* @param {IPSDEUIBindParamLogic} logicNode 节点模型数据
* @param {UIActionContext} actionContext 逻辑上下文
* @memberof AppUILogicBindParamNode
*/
public onBindParam(logicNode: ILogicNode, actionContext: UIActionContext) {
if (!logicNode || !logicNode.dstParam || !logicNode.srcParam) {
throw new Error(`操作参数或者源参数缺失!`);
}
try {
// 源数据
const srcParam: any = actionContext.getParam(logicNode.srcParam);
// 目标数据
const dstParam: any = actionContext.getParam(logicNode.dstParam);
// 源属性
const srcFieldName: string = logicNode.srcFieldName ? logicNode.srcFieldName.toLowerCase() : '';
if (srcFieldName) {
dstParam.bind(srcParam.get(srcFieldName));
} else {
dstParam.bind(srcParam.getReal());
}
actionContext.bindLastReturnParam(null);
} catch (error: any) {
throw new Error(`逻辑参数${logicNode.dstParam}${error && error.message ? error.message : '发生未知错误!'}`);
}
}
}
\ No newline at end of file
import { ILogicNode } from "@/interface/logic";
import { UIActionContext } from "../uiaction-context";
import { UILogicNodeBase } from "./logic-node-base";
/**
* 拷贝参数节点
*
* @export
* @class UILogicCopyParamNode
* @extends {UILogicNodeBase}
*/
export class UILogicCopyParamNode extends UILogicNodeBase {
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicCopyParamNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
this.onCopyParam(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error && error.message ? error.message : "发生未知错误!"}`);
}
}
/**
* 处理参数
*
* @param {ILogicNode} logicNode 节点模型数据
* @param {UIActionContext} actionContext 逻辑上下文
* @memberof UILogicCopyParamNode
*/
public onCopyParam(logicNode: ILogicNode, actionContext: UIActionContext) {
if (!logicNode || !logicNode.dstParam || !logicNode.srcParam) {
throw new Error(`操作参数或者源参数缺失!`);
}
try {
// 源数据
const srcParam: any = actionContext.getParam(logicNode.srcParam);
// 目标数据
const dstParam: any = actionContext.getParam(logicNode.dstParam);
srcParam.copyTo(dstParam);
actionContext.bindLastReturnParam(null);
} catch (error: any) {
throw new Error(
`逻辑参数${logicNode.dstParam}${error && error.message ? error.message : "发生未知错误!"}`
);
}
}
}
import { ILogicNode } from "@/interface/logic";
import { UIActionContext } from "../uiaction-context";
import { UILogicNodeBase } from "./logic-node-base";
/**
* 实体行为调用节点
*
* @export
* @class AppUILogicDeactionNode
*/
export class UILogicDeActionNode extends UILogicNodeBase {
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof AppUILogicDeactionNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
await this.handleDEAction(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error && error.message ? error.message : '发生未知错误!'}`);
}
}
/**
* 处理实体行为
*
* @private
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof AppUILogicDeactionNode
*/
private async handleDEAction(logicNode: ILogicNode, actionContext: UIActionContext) {
// const dstEntity = logicNode.getDstPSAppDataEntity();
// const deAction = await getDstPSAppDEAction(logicNode);
// const dstParam = actionContext.getParam((logicNode.getDstPSDEUILogicParam() as IPSDEUILogicParam)?.codeName);
// if (!Object.is(dstParam.logicParamType, UILogicParamType.entityListParam) && !Object.is(dstParam.logicParamType, UILogicParamType.entityParam)) {
// throw new Error(`实体行为操作参数只能为数据对象变量类型或者数据对象列表类型`);
// }
// const retParam = actionContext.getParam((logicNode.getRetPSDEUILogicParam() as IPSDEUILogicParam)?.codeName);
// if (dstEntity && deAction && dstParam) {
// try {
// const service = await DataServiceHelp.getInstance().getService(dstEntity);
// const getTempContext = (data: any) => {
// const tempContext = Util.deepCopy(actionContext.context);
// if (data) {
// Object.assign(tempContext, data);
// }
// return tempContext;
// }
// // 数据对象变量类型
// if (Object.is(dstParam.logicParamType, UILogicParamType.entityParam)) {
// const tempContext = getTempContext(dstParam.getReal());
// const res = await service.execute(deAction.codeName, tempContext, dstParam.getReal() ? dstParam.getReal() : {});
// if (res && res.ok && res.data) {
// if (retParam) {
// retParam.bind(res.data);
// }
// actionContext.bindLastReturnParam(res.data);
// } else {
// throw new Error(`执行实体行为失败`);
// }
// } else {
// // 数据对象列表类型
// if (dstParam.getReal() && (dstParam.getReal().length > 0)) {
// if (dstParam.getReal().length > 20) {
// throw new Error(`操作数据量超过20条,建议使用后台处理逻辑`);
// }
// let promises: any[] = [];
// dstParam.getReal().forEach((item: any) => {
// const tempContext = getTempContext(item);
// promises.push(service.execute(deAction.codeName, tempContext, item ? item : {}));
// })
// const resArray = await Promise.all(promises);
// if (resArray && resArray.length > 0) {
// const resultArray: any[] = [];
// resArray.forEach((res: any) => {
// if (res && res.ok && res.data) {
// resultArray.push(res.data);
// }
// })
// if (retParam) {
// retParam.bind(resultArray);
// }
// actionContext.bindLastReturnParam(resultArray);
// } else {
// throw new Error(`执行实体行为失败`);
// }
// } else {
// if (retParam) {
// retParam.bind([]);
// }
// actionContext.bindLastReturnParam([]);
// }
// }
// } catch (error: any) {
// throw new Error(`${error.message ? error.message : error.data?.message ? error.data.message : '执行实体行为失败'}`);
// }
// } else {
// throw new Error(`执行实体行为所需参数不足`);
// }
}
}
\ No newline at end of file
import { ILogicNode } from '@/interface/logic';
import { UIActionContext } from '../uiaction-context';
import { UILogicNodeBase } from './logic-node-base';
/**
* 调试逻辑参数节点
*
* @export
* @class UILogicDebugParamNode
*/
export class UILogicDebugParamNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicDebugParamNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
this.handleDebugParam(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error?.message ? error?.message : '发生未知错误!'}`);
}
}
/**
* 处理调试逻辑参数
*
* @private
* @param {ILogicNode} logicNode
* @param {UIActionContext} actionContext
* @memberof UILogicDebugParamNode
*/
private handleDebugParam(logicNode: ILogicNode, actionContext: UIActionContext) {
// if (logicNode.getDstPSDEUILogicParam()) {
// const dstParamValue = actionContext.getParam(logicNode.getDstPSDEUILogicParam()?.codeName as string).getReal();
// actionContext.bindLastReturnParam(null);
// console.log(`逻辑节点${logicNode.name}操作参数值:`, dstParamValue);
// }
}
}
\ No newline at end of file
import { ILogicNode } from "@/interface/logic";
import { UIActionContext } from "../uiaction-context";
import { UILogicNodeBase } from "./logic-node-base";
/**
* 实体数据集节点
*
* @export
* @class UILogicDataSetNode
* @extends {AppUILogicNodeBase}
*/
export class UILogicDataSetNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @static
* @param {ILogicNode} logicNode 逻辑节点
* @param {ActionContext} actionContext 逻辑上下文
* @memberof UILogicDataSetNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
await this.handleDataSet(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error?.message ? error?.message : '发生未知错误!'}`);
}
}
/**
* 处理实体数据集
*
* @private
* @param {ILogicNode} logicNode
* @param {ActionContext} actionContext
* @memberof UILogicDataSetNode
*/
private async handleDataSet(logicNode: ILogicNode, actionContext: UIActionContext) {
// const dstEntity = logicNode.getDstPSAppDataEntity();
// await dstEntity?.fill();
// const dstDataSet = logicNode.getDstPSAppDEDataSet();
// // 过滤器
// const dstParamModel = logicNode.getDstPSDEUILogicParam();
// const dstParam = actionContext.getParam(dstParamModel?.codeName as string);
// if (!dstParamModel || !Object.is(dstParam.logicParamType, UILogicParamType.filterParam)) {
// throw new Error(`传入参数${dstParamModel?.codeName}类型不正确,必须为过滤器对象`);
// }
// if (dstEntity && dstDataSet) {
// try {
// const service = await DataServiceHelp.getInstance().getService(dstEntity);
// const res = await service.execute(dstDataSet.codeName, actionContext.context, dstParam.getReal() ? dstParam.getReal() : {});
// if (res && res.ok && res.data) {
// // 返回值绑定逻辑参数对象
// if (logicNode.getRetPSDEUILogicParam()) {
// const retParam = actionContext.getParam(logicNode.getRetPSDEUILogicParam()?.codeName as string);
// retParam.bind(res.data);
// }
// actionContext.bindLastReturnParam(res.data);
// } else {
// throw new Error(`查询实体数据集失败`);
// }
// } catch (error: any) {
// throw new Error(`${error.message ? error.message : error.data?.message ? error.data.message : '查询实体数据集失败'}`);
// }
// } else {
// throw new Error(`查询实体数据集参数不足`);
// }
}
}
\ No newline at end of file
import { ILogicNode } from '@/interface/logic';
import { UIActionContext } from '../uiaction-context';
import { UILogicNodeBase } from './logic-node-base';
/**
* 实体处理逻辑节点
*
* @export
* @class UILogicNodeBase
*/
export class UILogicDeLogicNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicDeLogicNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
await this.handleDELogic(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error?.message ? error?.message : '发生未知错误!'}`);
}
}
/**
* 处理实体处理逻辑
*
* @private
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicDeLogicNode
*/
private async handleDELogic(logicNode: ILogicNode, actionContext: UIActionContext) {
// const dstEntity = logicNode.getDstPSAppDataEntity();
// const deLogicCodeName = logicNode.getDstPSAppDELogic()?.codeName;
// const dstParam = actionContext.getParam((logicNode.getDstPSDEUILogicParam() as IPSDEUILogicParam)?.codeName);
// const retParam = actionContext.getParam((logicNode.getRetPSDEUILogicParam() as IPSDEUILogicParam)?.codeName);
// if (dstEntity && dstParam && deLogicCodeName) {
// try {
// const service = await DataServiceHelp.getInstance().getService(dstEntity);
// const result = await service['executeAppDELogic'](deLogicCodeName, actionContext.context, dstParam.getReal() ? dstParam.getReal() : {});
// if (result) {
// if(retParam){
// retParam.bind(result);
// }
// actionContext.bindLastReturnParam(result);
// return retParam;
// } else {
// throw new Error(`调用实体处理逻辑异常`);
// }
// } catch (error: any) {
// throw new Error(`调用实体处理逻辑异常${error?.message ? error.message : ''}`);
// }
// } else {
// throw new Error(`调用实体处理逻辑参数不足`);
// }
}
}
\ No newline at end of file
import { ILogicNode } from '@/interface/logic';
import { UIActionContext } from '../uiaction-context';
import { UILogicNodeBase } from './logic-node-base';
/**
* 实体界面行为调用节点
*
* @export
* @class AppUILogicDeUIActionNode
*/
export class UILogicDeUIActionNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof AppUILogicDeUIActionNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
await this.handleDEUIAction(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext)
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error && error.message ? error.message : '发生未知错误!'}`);
}
}
/**
* 处理界面行为
*
* @private
* @param {ILogicNode} logicNode
* @param {UIActionContext} actionContext
* @memberof AppUILogicDeUIActionNode
*/
private async handleDEUIAction(logicNode: ILogicNode, actionContext: UIActionContext) {
// const data = actionContext.defaultParam.getReal();
// const { context, viewparams } = actionContext;
// const additionalParam = actionContext.additionalParam;
// const dstEntity = logicNode.getDstPSAppDataEntity();
// const dstUIAction = await getDstPSAppDEUIAction(logicNode);
// if (dstEntity && dstUIAction) {
// try {
// const targetUIService = await UIServiceHelp.getInstance().getService(dstEntity,{context});
// await targetUIService.loaded();
// const result = await targetUIService.excuteAction(
// dstUIAction.uIActionTag,
// [data],
// context,
// viewparams,
// additionalParam?.$event,
// actionContext.getParam(actionContext.activeCtrlParamName).getReal(),
// actionContext.getParam(actionContext.activeContainerParamName).getReal(),
// additionalParam?.parentDeName,
// );
// const dstParam = actionContext.getParam((logicNode.getDstPSDEUILogicParam() as IPSDEUILogicParam)?.codeName);
// if (result && result.ok && result.result) {
// dstParam.bind(Array.isArray(result?.result) ? result.result[0] : result.result);
// actionContext.bindLastReturnParam(Array.isArray(result?.result) ? result.result[0] : result.result);
// }
// return dstParam;
// } catch (error: any) {
// throw new Error(`调用实体行为异常${error?.message ? error.message : ''}`);
// }
// } else {
// throw new Error(`调用界面行为参数不足`);
// }
}
}
\ No newline at end of file
import { ILogicNode } from "@/interface/logic";
import { LogicReturnType } from "@/logic/const/logic-return-type";
import { UIActionContext } from "../uiaction-context";
import { UILogicNodeBase } from "./logic-node-base";
/**
* 结束节点
*
* @export
* @class EndNode
*/
export class UILogicEndNode extends UILogicNodeBase {
/**
* 执行节点
*
* @param {ILogicNode} logicNode
* @param {UIActionContext} actionContext
* @return {*}
* @memberof EndNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
this.handleEndNode(logicNode, actionContext);
console.log(`已完成执行${logicNode?.name}节点,操作参数数据如下:`);
if (actionContext.paramsMap && (actionContext.paramsMap.size > 0)) {
for (let [key, value] of actionContext.paramsMap) {
console.log(`${key}:`, value.getReal());
}
}
return { nextNodes: [], actionContext };
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error && error.message ? error.message : '发生未知错误!'}`);
}
}
/**
* 处理结束节点
*
* @private
* @param {IPSDEEndLogic} logicNode
* @param {UIActionContext} actionContext
* @memberof EndNode
*/
private handleEndNode(logicNode: ILogicNode, actionContext: UIActionContext) {
const strReturnType: string = logicNode.returnType as string;
if (Object.is(strReturnType, LogicReturnType.NONEVALUE) || Object.is(strReturnType, LogicReturnType.NULLVALUE)) {
actionContext.setResult(null);
} else if (Object.is(strReturnType, LogicReturnType.SRCVALUE)) {
actionContext.setResult(logicNode.returnRawValue);
} else if (Object.is(strReturnType, LogicReturnType.BREAK)) {
actionContext.setResult(LogicReturnType.BREAK);
} else if (Object.is(strReturnType, LogicReturnType.LOGICPARAM) || Object.is(strReturnType, LogicReturnType.LOGICPARAMFIELD)) {
const returnParam = actionContext.getParam(logicNode.returnParam as string);
if (Object.is(strReturnType, LogicReturnType.LOGICPARAM)) {
actionContext.setResult(returnParam.getReal());
} else {
actionContext.setResult(returnParam.get(logicNode.dstFieldName));
}
} else {
throw new Error(`无法识别的返回值类型${strReturnType}`);
}
}
}
\ No newline at end of file
export { UILogicAppendParamNode } from './appendparam-node';
export { UILogicBeginNode } from './begin-node';
export { UILogicBindParamNode } from './bindparam-node';
export { UILogicCopyParamNode } from './copyparam-node';
export { UILogicDeActionNode } from './deaction-node';
export { UILogicDebugParamNode } from './debugparam-node';
export { UILogicDataSetNode } from './dedataset-node';
export { UILogicDeLogicNode } from './delogic-node';
export { UILogicDeUIActionNode } from './deuiaction-node';
export { UILogicEndNode } from './end-node';
export { UILogicNodeBase } from './logic-node-base';
export { UILogicMsgboxNode } from './msgbox-node';
export { UILogicPluginNode } from './plugin-node';
export { UILogicPrepareParamNode } from './prepareparam-node';
export { UILogicRawCodeNode } from './rawcode-node';
export { UILogicReNewParamNode } from './renewparam-node';
export { UILogicResetParamNode } from './resetparam-node';
export { UILogicSortParamNode } from './sortparam-node';
export { UILogicThrowExceptionNode } from './throw-exception-node';
export { UILogicViewctrlFireEventNode } from './viewctrl-fire-event';
export { UILogicViewctrlInvokeNode } from './viewctrl-invoke-node';
\ No newline at end of file
import { ILogicNode } from "@/interface/logic";
import { Util, Verify } from "@/utils";
import { UIActionContext } from "../uiaction-context";
/**
* 处理逻辑节点基类
*
* @export
* @class UILogicNodeBase
*/
export class UILogicNodeBase {
constructor() {}
/**
* 根据处理链接计算后续逻辑节点
*
* @param {*} logicNode
* @param {UIActionContext} actionContext
* @return {*}
* @memberof LogicNodeBase
*/
public computeNextNodes(logicNode: ILogicNode, actionContext: UIActionContext) {
console.log(`已完成执行${logicNode?.name}节点,操作参数数据如下:`)
if (actionContext.paramsMap && (actionContext.paramsMap.size > 0)) {
for (let [key, value] of actionContext.paramsMap) {
console.log(`${key}:`, Util.deepCopy(value.getReal()));
}
}
let result: any = { nextNodes: [], actionContext };
if (logicNode && logicNode.logicLinks && logicNode.logicLinks.length > 0) {
for (let logicLink of logicNode.logicLinks) {
let nextNode = logicLink.dstLogicNode;
// 没有连接条件组或有条件组且满足条件组时执行下一个节点
if (!logicLink.dstLogicNode || this.computeCond(logicLink.linkGroupCond || [], actionContext)) {
// console.log(`即将执行${nextNode?}节点`);
console.log('执行下一节点');
result.nextNodes.push(nextNode);
}
}
}
return result;
}
/**
* 计算是否通过逻辑连接
*
* @param {} logicLinkCond
* @return {*}
* @memberof UILogicNodeBase
*/
public computeCond(logicLinkCond: any, actionContext: UIActionContext): any {
if (logicLinkCond.logicType == 'GROUP') {
const logicLinkGroupCond = logicLinkCond
const childConds: any = logicLinkGroupCond.getPSDELogicLinkConds();
if (childConds?.length > 0) {
// return Verify.logicForEach(
// childConds,
// (item: any) => {
// return this.computeCond(item, actionContext);
// },
// logicLinkGroupCond.groupOP,
// !!logicLinkGroupCond.notMode,
// );
}
} else {
if (logicLinkCond.logicType == 'SINGLE') {
const logicLinkSingleCond = logicLinkCond
let dstValue = actionContext.getParam(logicLinkSingleCond?.getDstLogicParam?.()?.codeName as string);
if (logicLinkSingleCond.dstFieldName) {
dstValue = dstValue.get(logicLinkSingleCond.dstFieldName.toLowerCase());
}
let targetValue;
if (logicLinkSingleCond.paramType) {
switch (logicLinkSingleCond.paramType) {
case 'CURTIME':
targetValue = Util.dateFormat(new Date(), 'YYYY-MM-DD');
break;
default:
targetValue = logicLinkSingleCond.paramValue;
}
} else {
targetValue = logicLinkSingleCond.paramValue;
}
return Verify.testCond(dstValue, logicLinkSingleCond.condOP, targetValue)
}
}
}
}
\ No newline at end of file
import { ILogicNode } from '@/interface/logic';
import { Subject } from 'rxjs';
import { UIActionContext } from '../uiaction-context';
import { UILogicNodeBase } from './logic-node-base';
/**
* 消息弹窗节点
*
* @export
* @class UILogicMsgboxNode
*/
export class UILogicMsgboxNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicMsgboxNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
// return new Promise<void>((resolve) => {
// let msgBoxParam: any = actionContext.getParam((logicNode.getMsgBoxParam() as IPSDEUILogicParam)?.codeName);
// const data = msgBoxParam?.getReal();
// const options = {
// type: logicNode.msgBoxType?.toLowerCase(),
// title: data?.title ? data.title : logicNode.title ? eval('`' + logicNode.title + '`') : '消息',
// content: data?.message ? data.message : logicNode.message ? eval('`' + logicNode.message + '`') : '',
// buttonType: logicNode.buttonsType?.toLowerCase(),
// showMode: logicNode.showMode?.toLowerCase(),
// showClose: false,
// mask: true,
// maskClosable: true
// };
// const subject: Subject<any> | null = AppMessageBoxService.getInstance().open(options);
// const subscription = subject?.subscribe((result: any) => {
// resolve(this.handleResponse(logicNode, actionContext, options, result));
// subscription!.unsubscribe();
// subject.complete();
// })
// });
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error && error.message ? error.message : '发生未知错误!'}`);
}
}
/**
* 处理响应
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @param {string} result 响应结果
* @memberof UILogicMsgboxNode
*/
public handleResponse(logicNode: ILogicNode, actionContext: UIActionContext, options: any, result: string) {
// const { buttonsType } = logicNode;
// if (!Object.is(buttonsType, 'YESNO') && !Object.is(buttonsType, 'YESNOCANCEL') && !Object.is(buttonsType, 'OK') && !Object.is(buttonsType, 'OKCANCEL')) {
// throw new Error(`${buttonsType}未实现`);
// }
// let msgBoxParam: any = actionContext.getParam((logicNode.getMsgBoxParam() as IPSDEUILogicParam)?.codeName);
// if (msgBoxParam){
// msgBoxParam.bind(result);
// }
// actionContext.bindLastReturnParam(result);
// return this.computeNextNodes(logicNode, actionContext);
}
}
\ No newline at end of file
import { ILogicNode } from '@/interface/logic';
import { UIActionContext } from '../uiaction-context';
import { UILogicNodeBase } from './logic-node-base';
/**
* 前端扩展插件调用节点
*
* @export
* @class UILogicPluginNode
*/
export class UILogicPluginNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicPluginNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
throw new Error(`逻辑节点${logicNode.name}前端扩展插件类型暂未实现!`);
}
}
\ No newline at end of file
import { ILogicNode } from "@/interface/logic";
import { UIActionContext } from "../uiaction-context";
import { UILogicNodeBase } from "./logic-node-base";
/**
* 准备处理参数节点
*
* @export
* @class UILogicPrepareParamNode
*/
export class UILogicPrepareParamNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicPrepareParamNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
this.handleParam(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error && error.message ? error.message : "发生未知错误!"}`);
}
}
/**
* 处理参数
*
* @param {IPSDELogicNode} logicNode 节点模型数据
* @param {ActionContext} actionContext 逻辑上下文
* @memberof UILogicPrepareParamNode
*/
public handleParam(logicNode: ILogicNode, actionContext: UIActionContext) {
// if (!logicNode || !logicNode.getPSDEUILogicNodeParams()) {
// return;
// }
try {
// for (let logicNodeParam of logicNode.getPSDEUILogicNodeParams() as any[]) {
// // 设置变量
// if (Object.is(logicNodeParam.paramAction, UILogicParamValueType.SETPARAMVALUE)) {
// this.onSetParamValue(logicNodeParam, actionContext);
// }
// // 重置变量
// if (Object.is(logicNodeParam.paramAction, UILogicParamValueType.RESETPARAM)) {
// this.onResetParam(logicNodeParam, actionContext);
// }
// // 拷贝变量
// if (Object.is(logicNodeParam.paramAction, UILogicParamValueType.COPYPARAM)) {
// this.onCopyParam(logicNodeParam, actionContext);
// }
// // 绑定参数
// if (Object.is(logicNodeParam.paramAction, UILogicParamValueType.BINDPARAM)) {
// this.onBindParam(logicNodeParam, actionContext);
// }
// // 重新建立变量
// if (Object.is(logicNodeParam.paramAction, UILogicParamValueType.RENEWPARAM)) {
// this.onRenewParam(logicNodeParam, actionContext);
// }
// // 附加到数组变量
// if (Object.is(logicNodeParam.paramAction, UILogicParamValueType.APPENDPARAM)) {
// this.onAppendParam(logicNodeParam, actionContext);
// }
// // 排序数组变量
// if (Object.is(logicNodeParam.paramAction, UILogicParamValueType.SORTPARAM)) {
// this.onSortParam(logicNodeParam, actionContext);
// }
// }
} catch (error: any) {
throw new Error(`${error && error.message ? error.message : "发生未知错误!"}`);
}
}
/**
* 设置参数(根据配置把源逻辑参数的值赋给目标逻辑参数)
*
* @param {any} logicNodeParam 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicPrepareParamNode
*/
public onSetParamValue(logicNodeParam: any, actionContext: UIActionContext) {
// try {
// // 源类型参数/目标逻辑参数/目标属性缺一跳过不做处理
// if (!logicNodeParam.getDstPSDEUILogicParam() || !logicNodeParam.srcValueType) {
// throw new Error(`逻辑参数${logicNodeParam.name}源类型参数或者目标逻辑参数缺失`);
// }
// // 目标数据
// const dstParam: any = actionContext.getParam(
// (logicNodeParam.getDstPSDEUILogicParam() as IPSDEUILogicParam)?.codeName
// );
// // 无值类型
// if (Object.is(logicNodeParam.srcValueType, "NONEVALUE")) {
// if (logicNodeParam.dstFieldName) {
// dstParam.reset(logicNodeParam.dstFieldName.toLowerCase());
// } else {
// dstParam.bind(undefined);
// }
// } else {
// const result = this.computeTargetParam(logicNodeParam, actionContext);
// if (logicNodeParam.dstFieldName) {
// dstParam.set(logicNodeParam.dstFieldName.toLowerCase(), result);
// } else {
// dstParam.bind(result);
// }
// }
// } catch (error) {
// throw new Error(
// `逻辑参数${logicNodeParam.name}${error && error.message ? error.message : "发生未知错误!"}`
// );
// }
}
/**
* 重置变量
*
* @param {any} logicNodeParam
* @param {ActionContext} actionContext
* @memberof UILogicPrepareParamNode
*/
public onResetParam(logicNodeParam: any, actionContext: UIActionContext) {
// try {
// // 目标数据
// const dstParam: any = actionContext.getParam(
// (logicNodeParam.getDstPSDEUILogicParam() as IPSDEUILogicParam)?.codeName
// );
// dstParam.resetAll();
// } catch (error: any) {
// throw new Error(
// `逻辑参数${logicNodeParam.name}${error && error.message ? error.message : "发生未知错误!"}`
// );
// }
}
/**
* 拷贝变量
*
* @param {any} logicNodeParam
* @param {ActionContext} actionContext
* @memberof UILogicPrepareParamNode
*/
public onCopyParam(logicNodeParam: any, actionContext: UIActionContext) {
// try {
// // 源数据
// const srcParam: any = actionContext.getParam(
// (logicNodeParam.getSrcPSDEUILogicParam() as IPSDEUILogicParam)?.codeName
// );
// // 目标数据
// const dstParam: any = actionContext.getParam(
// (logicNodeParam.getDstPSDEUILogicParam() as IPSDEUILogicParam)?.codeName
// );
// srcParam.copyTo(dstParam);
// } catch (error) {
// throw new Error(
// `逻辑参数${logicNodeParam.name}${error && error.message ? error.message : "发生未知错误!"}`
// );
// }
}
/**
* 绑定参数
*
* @param {any} logicNodeParam
* @param {ActionContext} actionContext
* @memberof UILogicPrepareParamNode
*/
public onBindParam(logicNodeParam: any, actionContext: UIActionContext) {
// try {
// // 源数据
// const srcParam: any = actionContext.getParam(
// (logicNodeParam.getSrcPSDEUILogicParam() as IPSDEUILogicParam)?.codeName
// );
// // 目标数据
// const dstParam: any = actionContext.getParam(
// (logicNodeParam.getDstPSDEUILogicParam() as IPSDEUILogicParam)?.codeName
// );
// // 源属性
// const srcFieldName: string = logicNodeParam.srcFieldName?.toLowerCase?.();
// if (srcFieldName) {
// dstParam.bind(srcParam.get(srcFieldName));
// } else {
// dstParam.bind(srcParam.getReal());
// }
// } catch (error) {
// throw new Error(
// `逻辑参数${logicNodeParam.name}${error && error.message ? error.message : "发生未知错误!"}`
// );
// }
}
/**
* 重新建立变量
*
* @param {any} logicNodeParam
* @param {UIActionContext} actionContext
* @memberof UILogicPrepareParamNode
*/
public onRenewParam(logicNodeParam: any, actionContext: UIActionContext) {
// try {
// // 目标参数
// const dstParam: any = actionContext.getParam(
// (logicNodeParam.getDstPSDEUILogicParam() as IPSDEUILogicParam)?.codeName
// );
// dstParam.renew();
// } catch (error) {
// throw new Error(
// `逻辑参数${logicNodeParam.name}${error && error.message ? error.message : "发生未知错误!"}`
// );
// }
}
/**
* 附加到数组变量
*
* @param {any} logicNodeParam
* @param {UIActionContext} actionContext
* @memberof UILogicPrepareParamNode
*/
public onAppendParam(logicNodeParam: any, actionContext: UIActionContext) {
// try {
// // 源数据
// const srcParam: any = actionContext.getParam(
// (logicNodeParam.getSrcPSDEUILogicParam() as IPSDEUILogicParam)?.codeName
// );
// // 目标数据
// const dstParam: any = actionContext.getParam(
// (logicNodeParam.getDstPSDEUILogicParam() as IPSDEUILogicParam)?.codeName
// );
// // 源属性
// const srcFieldName: string = logicNodeParam.srcFieldName?.toLowerCase?.();
// let objParam: any;
// if (srcFieldName) {
// objParam = srcParam.get(srcFieldName);
// } else {
// objParam = srcParam.getReal();
// }
// dstParam.append(logicNodeParam.dstIndex, objParam, logicNodeParam.srcIndex, logicNodeParam.srcSize);
// } catch (error) {
// throw new Error(
// `逻辑参数${logicNodeParam.name}${error && error.message ? error.message : "发生未知错误!"}`
// );
// }
}
/**
* 排序数组变量
*
* @param {any} logicNodeParam
* @param {UIActionContext} actionContext
* @memberof UILogicPrepareParamNode
*/
public onSortParam(logicNodeParam: any, actionContext: UIActionContext) {
// try {
// // 目标数据
// const dstParam: any = actionContext.getParam(
// (logicNodeParam.getDstPSDEUILogicParam() as IPSDEUILogicParam)?.codeName
// );
// // 目标属性
// const dstFieldName: string = logicNodeParam.dstFieldName?.toLowerCase?.();
// if (!dstFieldName) {
// throw new Error(`逻辑参数${logicNodeParam.name}未指定设置排序属性`);
// }
// dstParam.sort(dstFieldName, logicNodeParam.dstSortDir);
// } catch (error) {
// throw new Error(
// `逻辑参数${logicNodeParam.name}${error && error.message ? error.message : "发生未知错误!"}`
// );
// }
}
/**
* 计算目标值
*
* @param {any} logicNodeParam 节点参数
* @param {ActionContext} actionContext 逻辑上下文
* @memberof UILogicPrepareParamNode
*/
public computeTargetParam(logicNodeParam: any, actionContext: UIActionContext) {
// let targetValue: any;
// // 源数据
// const srcParam: any = actionContext.getParam(
// (logicNodeParam.getSrcPSDEUILogicParam() as IPSDEUILogicParam)?.codeName
// );
// // 源属性
// try {
// const srcFieldName: string = logicNodeParam?.srcFieldName?.toLowerCase();
// switch (logicNodeParam.srcValueType) {
// case "SRCDLPARAM": // 源逻辑参数
// case "WEBCONTEXT": // 网页请求上下文
// case "VIEWPARAM": // 当前视图参数
// targetValue = srcParam.get(srcFieldName) ? srcParam.get(srcFieldName) : null;
// break;
// case "APPLICATION": // 系统全局对象
// case "SESSION": // 用户全局对象
// case "APPDATA": // 应用上下文
// case "DATACONTEXT": // 数据上下文
// const { context } = actionContext;
// targetValue = context[srcFieldName];
// break;
// case "ENVPARAM": // 当前环境参数
// const Environment = AppServiceBase.getInstance().getAppEnvironment();
// targetValue = Environment[srcFieldName];
// break;
// case "EXPRESSION": // 计算式
// targetValue = this.computeExpRessionValue(logicNodeParam, actionContext);
// break;
// case "SRCVALUE": // 直接值
// targetValue = logicNodeParam?.srcValue;
// break;
// case "NULLVALUE": // 空值(NULL)
// targetValue = null;
// break;
// default:
// throw new Error(`源值类型${logicNodeParam.srcValueType}暂未支持`);
// }
// return targetValue;
// } catch (error) {
// throw new Error(`${error && error.message ? error.message : "发生未知错误!"}`);
// }
}
/**
* 计算表达式值
*
* @param {any} logicNodeParam 节点参数
* @param {ActionContext} actionContext 逻辑上下文
* @memberof UILogicPrepareParamNode
*/
private computeExpRessionValue(logicNodeParam: any, actionContext: UIActionContext) {
let expression: string = logicNodeParam?.expression;
let data: any = actionContext.defaultParam.getReal();
let { context } = actionContext;
if (!expression) {
throw new Error(`表达式不能为空`);
}
try {
expression = this.translateExpression(expression);
return eval(expression);
} catch (error) {
throw new Error(`表达式计算异常: ${error}`);
}
}
/**
* 解析表达式
*
* @param {string} expression 表达式
* @memberof UILogicPrepareParamNode
*/
private translateExpression(expression: string): string {
if (expression.indexOf("${") != -1 && expression.indexOf("}") != -1) {
const start: number = expression.indexOf("${");
const end: number = expression.indexOf("}");
const contentStr: string = expression.slice(start + 2, end);
expression = expression.replace(expression.slice(start, end + 1), `data.${contentStr}`);
return this.translateExpression(expression);
}
return expression;
}
}
import { ILogicNode } from '@/interface/logic';
import { UIActionContext } from '../uiaction-context';
import { UILogicNodeBase } from './logic-node-base';
/**
* 直接前台代码节点
*
* @export
* @class UILogicRawCodeNode
*/
export class UILogicRawCodeNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicRawCodeNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
this.handleRawCode(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error && error.message ? error.message : '发生未知错误!'}`);
}
}
/**
* 处置直接执行代码
*
* @private
* @param {ILogicNode} logicNode
* @param {UIActionContext} actionContext
* @memberof UILogicRawCodeNode
*/
private handleRawCode(logicNode: ILogicNode, actionContext: UIActionContext) {
// let data: any = actionContext.defaultParam.getReal();
// let { context } = actionContext;
// if (logicNode && logicNode.code) {
// eval(logicNode?.code);
// } else {
// throw new Error('无代码片段');
// }
// actionContext.bindLastReturnParam(null);
}
}
\ No newline at end of file
import { ILogicNode } from '@/interface/logic';
import { UIActionContext } from '../uiaction-context';
import { UILogicNodeBase } from './logic-node-base';
/**
* 重新建立参数节点
*
* @export
* @class UILogicReNewParamNode
*/
export class UILogicReNewParamNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicReNewParamNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
this.onRenewParam(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error && error.message ? error.message : '发生未知错误!'}`);
}
}
/**
* 处理参数
*
* @param {ILogicNode} logicNode 节点模型数据
* @param {UIActionContext} actionContext 逻辑上下文
* @memberof UILogicReNewParamNode
*/
public onRenewParam(logicNode: ILogicNode, actionContext: UIActionContext) {
// if (!logicNode || !logicNode.getDstPSDEUILogicParam()) {
// throw new Error(`操作参数缺失!`);
// }
// try {
// // 目标数据
// const dstParam: any = actionContext.getParam((logicNode.getDstPSDEUILogicParam() as IPSDEUILogicParam)?.codeName);
// dstParam.renew();
// actionContext.bindLastReturnParam(null);
// } catch (error: any) {
// throw new Error(`逻辑参数${logicNode.getDstPSDEUILogicParam()?.name}${error && error.message ? error.message : '发生未知错误!'}`);
// }
}
}
\ No newline at end of file
import { ILogicNode } from '@/interface/logic';
import { UIActionContext } from '../uiaction-context';
import { UILogicNodeBase } from './logic-node-base';
/**
* 重置参数节点
*
* @export
* @class UILogicResetParamNode
*/
export class UILogicResetParamNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicResetParamNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
this.onResetParam(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error && error.message ? error.message : '发生未知错误!'}`);
}
}
/**
* 处理参数
*
* @param {IPSDELogicNode} logicNode 节点模型数据
* @param {ActionContext} actionContext 逻辑上下文
* @memberof UILogicResetParamNode
*/
public onResetParam(logicNode: ILogicNode, actionContext: UIActionContext) {
// if (!logicNode || !logicNode.getDstPSDEUILogicParam()) {
// throw new Error(`操作参数缺失!`);
// }
// try {
// // 目标数据
// const dstParam: any = actionContext.getParam((logicNode.getDstPSDEUILogicParam() as IPSDEUILogicParam)?.codeName);
// dstParam.resetAll();
// actionContext.bindLastReturnParam(null);
// } catch (error: any) {
// throw new Error(`逻辑参数${logicNode.getDstPSDEUILogicParam()?.name}${error && error.message ? error.message : '发生未知错误!'}`);
// }
}
}
\ No newline at end of file
import { ILogicNode } from '@/interface/logic';
import { UIActionContext } from '../uiaction-context';
import { UILogicNodeBase } from './logic-node-base';
/**
* 排序数组参数节点
*
* @export
* @class UILogicSortParamNode
*/
export class UILogicSortParamNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicSortParamNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
this.onSortParam(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error && error.message ? error.message : '发生未知错误!'}`);
}
}
/**
* 排序数组变量
*
* @param {ILogicNode} logicNodeParam
* @param {UIActionContext} actionContext
* @memberof UILogicPrepareParamNode
*/
public onSortParam(logicNodeParam: ILogicNode, actionContext: UIActionContext) {
// // 目标数据
// const dstParam: any = actionContext.getParam((logicNodeParam.getDstPSDEUILogicParam() as IPSDEUILogicParam)?.codeName);
// // 目标属性
// const dstFieldName: string = logicNodeParam.dstFieldName?.toLowerCase?.();
// if (!dstFieldName) {
// throw new Error(`逻辑参数${logicNodeParam.name}未指定设置排序属性`);
// }
// dstParam.sort(dstFieldName, logicNodeParam.dstSortDir);
// actionContext.bindLastReturnParam(null);
}
}
\ No newline at end of file
import { ILogicNode } from '@/interface/logic';
import { UIActionContext } from '../uiaction-context';
import { UILogicNodeBase } from './logic-node-base';
/**
* 抛出异常节点
*
* @export
* @class UILogicThrowExceptionNode
*/
export class UILogicThrowExceptionNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicThrowExceptionNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
// actionContext.actionContainer.$throw(logicNode.errorInfo);
// actionContext.bindLastReturnParam(null);
// console.log(`已完成执行${logicNode?.name}节点,操作参数数据如下:`);
// if (actionContext.paramsMap && (actionContext.paramsMap.size > 0)) {
// for (let [key, value] of actionContext.paramsMap) {
// console.log(`${key}:`, value.getReal());
// }
// }
}
}
\ No newline at end of file
import { ILogicNode } from '@/interface/logic';
import { UIActionContext } from '../uiaction-context';
import { UILogicNodeBase } from './logic-node-base';
/**
* 视图部件事件触发节点
*
* @export
* @class UILogicViewctrlFireEventNode
*/
export class UILogicViewctrlFireEventNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicViewctrlFireEventNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
await this.handleViewCtrFireEvent(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error && error.message ? error.message : '发生未知错误!'}`);
}
}
/**
* 处理视图部件触发事件
*
* @private
* @param {ILogicNode} logicNode
* @param {UIActionContext} actionContext
* @memberof UILogicViewctrlFireEventNode
*/
private async handleViewCtrFireEvent(logicNode: ILogicNode, actionContext: UIActionContext) {
// // 事件名称
// const eventName = logicNode.eventName;
// // 事件参数
// const eventParam = logicNode.getEventParam();
// // 触发对象
// const fireCtrl = logicNode.getFireCtrl();
// if (!eventName || !eventParam || !fireCtrl) {
// throw new Error(`触发对象、事件名称或者事件参数缺失`);
// }
// // 触发UI对象
// const fireUICtrl = actionContext.getParam(fireCtrl.codeName).getReal();
// // 事件参数
// const eventArgs = actionContext.getParam(eventParam.codeName).getReal();
// if (!fireUICtrl) {
// throw new Error(`获取触发对象异常`);
// }
// try {
// // 自身触发
// fireUICtrl.$emit(eventName, eventArgs);
// // 如果是部件,需向视图抛出
// if (fireUICtrl.controlInstance) {
// fireUICtrl.ctrlEvent({
// controlname: fireUICtrl.controlInstance.name,
// action: eventName,
// data: eventArgs
// })
// }
// // 如果是视图,需向外抛出
// if (fireUICtrl.viewInstance) {
// fireUICtrl.$emit('view-event', { viewName: fireUICtrl.viewCodeName, action: eventName, data: eventArgs });
// }
// actionContext.bindLastReturnParam(null);
// } catch (error:any) {
// throw new Error(`视图部件事件触发未执行成功!`);
// }
}
}
\ No newline at end of file
import { ILogicNode } from '@/interface/logic';
import { UIActionContext } from '../uiaction-context';
import { UILogicNodeBase } from './logic-node-base';
/**
* 视图部件调用节点
*
* @export
* @class UILogicViewctrlInvokeNode
*/
export class UILogicViewctrlInvokeNode extends UILogicNodeBase {
constructor() {
super();
}
/**
* 执行节点
*
* @param {ILogicNode} logicNode 逻辑节点模型数据
* @param {UIActionContext} actionContext 界面逻辑上下文
* @memberof UILogicViewctrlInvokeNode
*/
public async executeNode(logicNode: ILogicNode, actionContext: UIActionContext) {
try {
await this.handleViewCtrlInvoke(logicNode, actionContext);
return this.computeNextNodes(logicNode, actionContext);
} catch (error: any) {
throw new Error(`逻辑节点 ${logicNode.name}${error && error.message ? error.message : '发生未知错误!'}`);
}
}
/**
* 处理视图部件调用
*
* @private
* @param {ILogicNode} logicNode
* @param {UIActionContext} actionContext
* @memberof UILogicViewctrlInvokeNode
*/
private async handleViewCtrlInvoke(logicNode: ILogicNode, actionContext: UIActionContext) {
// const invokeCtrl = logicNode.getInvokeCtrl()?.codeName;
// const invokeMethod = logicNode.invokeMethod;
// const invokeParam = logicNode.getInvokeParam()?.codeName;
// if (!invokeCtrl || !invokeMethod) {
// throw new Error(`界面对象或者调用方法缺失`);
// }
// const invokeUICtrl = actionContext.getParam(invokeCtrl).getReal();
// if (invokeUICtrl[invokeMethod] && invokeUICtrl[invokeMethod] instanceof Function) {
// try {
// const result = await invokeUICtrl[invokeMethod]();
// if (invokeParam) {
// actionContext.getParam(invokeParam).bind(result);
// }
// actionContext.bindLastReturnParam(result);
// } catch (error:any) {
// throw new Error(`${invokeCtrl}界面对象调用${invokeMethod}方法发生异常`);
// }
// } else {
// throw new Error(`${invokeCtrl}界面对象不存在${invokeMethod}方法`);
// }
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册