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

add:添加界面逻辑参数

上级 e06847e8
export * from './logic-node';
export { UIActionContext } from './uiaction-context';
\ No newline at end of file
export { UIActionContext } from './uiaction-context';
export { UILogicParamService } from './logic-param/ui-logic-param-service';
\ No newline at end of file
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 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
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 当前容器对象
*
* @export
* @class UILogicActiveContainerParam
*/
export class UILogicActiveContainerParam extends UILogicParamBase {
/**
* Creates an instance of UILogicActiveContainerParam.
* @param {*} opts
* @memberof UILogicActiveContainerParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof UILogicActiveContainerParam
*/
protected init(params: any) {
this.logicParamType = UILogicParamType.activeContainerParam;
this.setReal(params.actioncontext);
}
/**
* 重置指定属性
*
* @param {string} strName
* @memberof UILogicActiveContainerParam
*/
public reset(strName: string) {
throw new Error(`逻辑参数${this.strCodeName}为当前容器类型,无法重置指定属性`);
}
/**
* 重置全部
*
* @memberof UILogicActiveContainerParam
*/
public resetAll() {
throw new Error(`逻辑参数${this.strCodeName}为当前容器类型,无法重置全部`);
}
/**
* 拷贝当前变量到指定变量
*
* @param {*} dstParam
* @memberof UILogicActiveContainerParam
*/
public copyTo(dstParam: any) {
throw new Error(`逻辑参数${this.strCodeName}为当前容器类型,无法拷贝当前变量到指定变量`);
}
/**
* 绑定指定参数对象
*
* @param {*} opts
* @memberof UILogicActiveContainerParam
*/
public bind(opts: any) {
throw new Error(`逻辑参数${this.strCodeName}为当前容器类型,无法绑定指定参数对象`);
}
/**
* 重新建立参数对象
*
* @memberof UILogicActiveContainerParam
*/
public renew() {
throw new Error(`逻辑参数${this.strCodeName}为当前容器类型,无法重新建立参数对象`);
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 当前部件对象参数
*
* @export
* @class UILogicActiveCtrlParam
*/
export class UILogicActiveCtrlParam extends UILogicParamBase {
/**
* Creates an instance of UILogicActiveCtrlParam.
* @param {*} opts
* @memberof UILogicActiveCtrlParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof UILogicActiveCtrlParam
*/
protected init(params: any) {
this.logicParamType = UILogicParamType.activeCtrlParam;
this.setReal(this.getActiveCtrl(params));
}
/**
* 获取激活部件
*
* @private
* @param {any} params
* @memberof UILogicActiveCtrlParam
*/
private getActiveCtrl(params: any) {
const { actioncontext, xData } = params;
console.log(2222, params);
if (xData) {
return xData;
} else {
// 部件触发肯定存在
if (actioncontext.viewCtx && actioncontext.viewCtx.ctrl) {
return actioncontext.viewCtx.ctrl;
} else {
// 非部件触发(视图触发)
if (actioncontext.viewCtx && actioncontext.viewCtx.view) {
const view = actioncontext.viewCtx.view;
const xDataMap: string[] = ['GRID', 'LIST', 'FORM', 'TREEVIEW', 'DATAVIEW'];
// const xDataControl = (view.viewInstance.getPSControls?.() || []).find((control: any) => xDataMap.indexOf(control.controlType) !== -1);
// const xDataCtrl = view.$refs[xDataControl.name.toLowerCase()].ctrl;
// return xDataCtrl ? xDataCtrl : null;
return null;
} else {
return null;
}
}
}
}
/**
* 重置指定属性
*
* @param {string} strName
* @memberof UILogicActiveCtrlParam
*/
public reset(strName: string) {
throw new Error(`逻辑参数${this.strCodeName}为当前部件类型,无法重置指定属性`);
}
/**
* 重置全部
*
* @memberof UILogicActiveCtrlParam
*/
public resetAll() {
throw new Error(`逻辑参数${this.strCodeName}为当前部件类型,无法重置全部`);
}
/**
* 拷贝当前变量到指定变量
*
* @param {*} dstParam
* @memberof UILogicActiveCtrlParam
*/
public copyTo(dstParam: any) {
throw new Error(`逻辑参数${this.strCodeName}为当前部件类型,无法拷贝当前变量到指定变量`);
}
/**
* 绑定指定参数对象
*
* @param {*} opts
* @memberof UILogicActiveCtrlParam
*/
public bind(opts: any) {
throw new Error(`逻辑参数${this.strCodeName}为当前部件类型,无法绑定指定参数对象`);
}
/**
* 重新建立参数对象
*
* @memberof UILogicActiveCtrlParam
*/
public renew() {
throw new Error(`逻辑参数${this.strCodeName}为当前部件类型,无法重新建立参数对象`);
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 当前视图
*
* @export
* @class UILogicActiveViewParam
*/
export class UILogicActiveViewParam extends UILogicParamBase {
/**
* Creates an instance of UILogicActiveViewParam.
* @param {*} opts
* @memberof UILogicActiveViewParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof UILogicActiveViewParam
*/
protected init(params: any) {
this.logicParamType = UILogicParamType.activeViewParam;
this.setReal(this.getActiveView(params));
}
/**
* 获取激活视图
*
* @private
* @param {any} params
* @memberof UILogicActiveViewParam
*/
private getActiveView(params: any) {
const { actioncontext } = params;
if (actioncontext && actioncontext.viewCtx && actioncontext.viewCtx.view) {
return actioncontext.viewCtx.view;
} else {
return null;
}
}
/**
* 获取指定属性值(获取当前视图指定名称部件)
*
* @param {string} strName
* @memberof UILogicActiveViewParam
*/
public get(strName: string) {
const actionContainer = this.actionSession.actionContainer;
if (actionContainer && actionContainer.viewCtx && actionContainer.viewCtx.view) {
const view = actionContainer.viewCtx.view;
let ctrl = view.$refs[strName.toLowerCase()];
if (ctrl) {
return ctrl;
} else {
// 视图布局面板获取
if (Object.is(actionContainer.type, 'VIEWLAYOUT')) {
const { args } = this.actionSession.additionalParam;
// 多数据域
if (args && args.hasMulParent) {
ctrl = actionContainer.layoutDetailsModel[`${strName.toLowerCase()}_${args.index}`];
} else {
ctrl = actionContainer.layoutDetailsModel[strName.toLowerCase()];
}
if (ctrl) {
return ctrl;
} else {
throw new Error(`逻辑参数${this.strCodeName}无法找到指定部件`);
}
} else {
throw new Error(`逻辑参数${this.strCodeName}无法找到指定部件`);
}
}
}
}
/**
* 重置指定属性
*
* @param {string} strName
* @memberof UILogicActiveViewParam
*/
public reset(strName: string) {
throw new Error(`逻辑参数${this.strCodeName}为当前视图类型,无法重置指定属性`);
}
/**
* 重置全部
*
* @memberof UILogicActiveViewParam
*/
public resetAll() {
throw new Error(`逻辑参数${this.strCodeName}为当前视图类型,无法重置全部`);
}
/**
* 拷贝当前变量到指定变量
*
* @param {*} dstParam
* @memberof UILogicActiveViewParam
*/
public copyTo(dstParam: any) {
throw new Error(`逻辑参数${this.strCodeName}为当前视图类型,无法拷贝当前变量到指定变量`);
}
/**
* 绑定指定参数对象
*
* @param {*} opts
* @memberof UILogicActiveViewParam
*/
public bind(opts: any) {
throw new Error(`逻辑参数${this.strCodeName}为当前视图类型,无法绑定指定参数对象`);
}
/**
* 重新建立参数对象
*
* @memberof UILogicActiveViewParam
*/
public renew() {
throw new Error(`逻辑参数${this.strCodeName}为当前视图类型,无法重新建立参数对象`);
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 应用全局变量
*
* @export
* @class UILogicAppGlobalParam
*/
export class UILogicAppGlobalParam extends UILogicParamBase {
/**
* Creates an instance of UILogicAppGlobalParam.
* @param {*} opts
* @memberof UILogicAppGlobalParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof UILogicAppGlobalParam
*/
protected init(params: any) {
this.logicParamType = UILogicParamType.appGlobalParam;
this.setReal(this.getAppGlobalParam(params));
}
/**
* 设置实际参数值
*
* @param {*} opts
* @memberof AppDeUILogicParamBase
*/
public setReal(opts: any) {
this.realValue = opts;
// AppServiceBase.getInstance().getAppStore().commit('addAppGlobal', { tag: this.logicParamModel.paramFieldName, param: opts });
}
/**
* 获取应用全局变量
*
* @private
* @param {any} params
* @memberof UILogicAppGlobalParam
*/
private getAppGlobalParam(params: any) {
const { actioncontext } = params;
const { viewCtx } = actioncontext;
if (viewCtx && viewCtx['appGlobal']) {
let result = actioncontext.viewCtx['appGlobal'][this.logicParamModel.paramFieldName];
if (!result) {
result = {};
}
return result;
}
}
/**
* 设置指定属性值
*
* @param {string} strName
* @param {*} value
* @memberof UILogicAppGlobalParam
*/
public set(strName: string, value: any) {
this.realValue[strName] = value;
// AppServiceBase.getInstance().getAppStore().commit('addAppGlobal', { tag: this.logicParamModel.paramFieldName, param: this.realValue });
}
/**
* 重置指定属性
*
* @param {string} strName
* @memberof UILogicAppGlobalParam
*/
public reset(strName: string) {
this.realValue[strName] = null;
// AppServiceBase.getInstance().getAppStore().commit('addAppGlobal', { tag: this.logicParamModel.paramFieldName, param: this.realValue });
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 应用程序变量
*
* @export
* @class AppDeUILogicAppParam
*/
export class AppDeUILogicAppParam extends UILogicParamBase {
/**
* Creates an instance of AppDeUILogicAppParam.
* @param {*} opts
* @memberof AppDeUILogicAppParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof AppDeUILogicAppParam
*/
protected init(params: any) {
this.setReal(this.getActiveApp(params));
this.logicParamType = UILogicParamType.applicationParam;
}
/**
* 获取激活视图
*
* @private
* @param {any} params
* @memberof AppDeUILogicAppParam
*/
private getActiveApp(params: any) {
const { actioncontext } = params;
if (actioncontext && actioncontext.viewCtx && actioncontext.viewCtx.app) {
return actioncontext.viewCtx.app;
} else {
return null;
}
}
/**
* 设置指定属性值
*
* @param {string} strName
* @param {*} value
* @memberof AppDeUILogicAppParam
*/
public set(strName: string, value: any) {
throw new Error(`逻辑参数${this.strCodeName}为应用程序变量类型,无法设置指定属性值`);
}
/**
* 获取指定属性值
*
* @param {string} strName
* @memberof AppDeUILogicAppParam
*/
public get(strName: string) {
throw new Error(`逻辑参数${this.strCodeName}为应用程序变量类型,无法获取指定属性值`);
}
/**
* 重置指定属性
*
* @param {string} strName
* @memberof AppDeUILogicAppParam
*/
public reset(strName: string) {
throw new Error(`逻辑参数${this.strCodeName}为应用程序变量类型,无法重置指定属性`);
}
/**
* 重置全部
*
* @memberof AppDeUILogicParamBase
*/
public resetAll() {
throw new Error(`逻辑参数${this.strCodeName}为应用程序变量类型,无法重置全部`);
}
/**
* 拷贝当前变量到指定变量
*
* @param {*} dstParam
* @memberof AppDeUILogicParamBase
*/
public copyTo(dstParam: any) {
throw new Error(`逻辑参数${this.strCodeName}为应用程序变量类型,无法拷贝当前变量到指定变量`);
}
/**
* 绑定指定参数对象
*
* @param {*} opts
* @memberof AppDeUILogicParamBase
*/
public bind(opts: any) {
throw new Error(`逻辑参数${this.strCodeName}为应用程序变量类型,无法绑定指定参数对象`);
}
/**
* 重新建立参数对象
*
* @memberof AppDeUILogicParamBase
*/
public renew() {
throw new Error(`逻辑参数${this.strCodeName}为应用程序变量类型,无法重新建立参数对象`);
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 指定部件对象参数
*
* @export
* @class UILogicCtrlParam
*/
export class UILogicCtrlParam extends UILogicParamBase {
/**
* Creates an instance of UILogicCtrlParam.
* @param {*} opts
* @memberof UILogicCtrlParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof UILogicCtrlParam
*/
protected init(params: any) {
this.logicParamType = UILogicParamType.ctrlParam;
this.setReal({});
}
/**
* 重置指定属性
*
* @param {string} strName
* @memberof UILogicCtrlParam
*/
public reset(strName: string) {
throw new Error(`逻辑参数${this.strCodeName}为指定部件类型,无法重置指定属性`);
}
/**
* 重置全部
*
* @memberof UILogicCtrlParam
*/
public resetAll() {
throw new Error(`逻辑参数${this.strCodeName}为指定部件类型,无法重置全部`);
}
/**
* 拷贝当前变量到指定变量
*
* @param {*} dstParam
* @memberof UILogicCtrlParam
*/
public copyTo(dstParam: any) {
throw new Error(`逻辑参数${this.strCodeName}为指定部件类型,无法拷贝当前变量到指定变量`);
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 逻辑数据对象列表参数
*
* @export
* @class AppDeUILogicEntityListParam
*/
export class AppDeUILogicEntityListParam extends UILogicParamBase {
/**
* Creates an instance of AppDeUILogicEntityListParam.
* @param {*} opts
* @memberof AppDeUILogicEntityListParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof AppDeUILogicEntityListParam
*/
protected init(params: any) {
this.setReal(this.getDefaultValue(params, []));
this.logicParamType = UILogicParamType.entityListParam;
}
/**
* 重置全部
*
* @memberof AppDeUILogicEntityListParam
*/
public resetAll() {
this.realValue = [];
}
/**
* 绑定指定参数对象
*
* @param {*} opts
* @memberof AppDeUILogicEntityListParam
*/
public bind(opts: any) {
if (Object.prototype.toString.call(opts) !== '[object Array]') {
throw new Error(`逻辑参数${this.strCodeName}无法绑定非数组类型参数`);
}
this.setReal(opts);
}
/**
* 重新建立参数对象
*
* @memberof AppDeUILogicEntityListParam
*/
public renew() {
this.realValue = [];
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 逻辑数据对象列表参数
*
* @export
* @class AppDeUILogicEntityPageParam
*/
export class AppDeUILogicEntityPageParam extends UILogicParamBase {
/**
* Creates an instance of AppDeUILogicEntityPageParam.
* @param {*} opts
* @memberof AppDeUILogicEntityPageParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof AppDeUILogicEntityPageParam
*/
protected init(params: any) {
this.setReal(this.getDefaultValue(params, []));
this.logicParamType = UILogicParamType.entityListParam;
}
/**
* 重置全部
*
* @memberof AppDeUILogicEntityPageParam
*/
public resetAll() {
this.realValue = [];
}
/**
* 绑定指定参数对象
*
* @param {*} opts
* @memberof AppDeUILogicEntityPageParam
*/
public bind(opts: any) {
if (Object.prototype.toString.call(opts) !== '[object Array]') {
throw new Error(`逻辑参数${this.strCodeName}无法绑定非数组类型参数`);
}
this.setReal(opts);
}
/**
* 重新建立参数对象
*
* @memberof AppDeUILogicEntityPageParam
*/
public renew() {
this.realValue = [];
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 逻辑数据对象参数
*
* @export
* @class AppDeUILogicEntityParam
*/
export class AppDeUILogicEntityParam extends UILogicParamBase {
/**
* Creates an instance of AppDeUILogicEntityParam.
* @param {*} opts
* @memberof AppDeUILogicEntityParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof AppDeUILogicEntityParam
*/
protected init(params: any) {
super.init(params);
this.logicParamType = UILogicParamType.entityParam;
}
/**
* 绑定指定参数对象
*
* @param {*} opts
* @memberof AppDeUILogicEntityParam
*/
public bind(opts: any) {
let srcObj: any;
if (opts) {
if (Object.prototype.toString.call(opts) === '[object Object]') {
srcObj = opts;
}else if (Object.prototype.toString.call(opts) === '[object Array]') {
srcObj = opts[0];
}else{
srcObj = opts;
}
this.setReal(srcObj);
}
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 逻辑过滤对象参数
*
* @export
* @class AppDeUILogicFilterParam
*/
export class AppDeUILogicFilterParam extends UILogicParamBase {
/**
* Creates an instance of AppDeUILogicFilterParam.
* @param {*} opts
* @memberof AppDeUILogicFilterParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof AppDeUILogicFilterParam
*/
protected init(params: any) {
super.init(params);
this.logicParamType = UILogicParamType.filterParam;
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 逻辑上一次调用返回参数
*
* @export
* @class AppDeUILogicLastReturnParam
*/
export class AppDeUILogicLastReturnParam extends UILogicParamBase {
/**
* Creates an instance of AppDeUILogicLastReturnParam.
* @param {*} opts
* @memberof AppDeUILogicLastReturnParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof AppDeUILogicLastReturnParam
*/
protected init(params: any) {
super.init(params);
this.logicParamType = UILogicParamType.lastReturnParam;
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 导航上下文绑定参数
*
* @export
* @class UILogicNavContextParam
*/
export class UILogicNavContextParam extends UILogicParamBase {
/**
* Creates an instance of UILogicNavContextParam.
* @param {*} opts
* @memberof UILogicNavContextParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof UILogicNavContextParam
*/
protected init(params: any) {
this.logicParamType = UILogicParamType.navContextParam;
this.setReal(this.getNavContextParam(params));
}
/**
* 获取导航上下文绑定参数
*
* @private
* @param {any} params
* @memberof UILogicNavContextParam
*/
private getNavContextParam(params: any) {
const { context } = params;
return context;
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 导航视图参数绑定参数
*
* @export
* @class UILogicNavViewParam
*/
export class UILogicNavViewParam extends UILogicParamBase {
/**
* Creates an instance of UILogicNavViewParam.
* @param {*} opts
* @memberof UILogicNavViewParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof UILogicNavViewParam
*/
protected init(params: any) {
this.logicParamType = UILogicParamType.navViewParamParam;
this.realValue = this.getNavViewParam(params);
}
/**
* 获取导航视图参数绑定参数
*
* @private
* @param {any} params
* @memberof UILogicNavViewParam
*/
private getNavViewParam(params: any) {
return params.params;
}
}
\ No newline at end of file
import { Util } from "@/utils";
/**
* 界面逻辑参数基类
*
* @export
* @class UILogicParamBase
*/
export class UILogicParamBase {
/**
* 代码名称
*
* @type {*}
* @memberof UILogicParamBase
*/
protected strCodeName: any;
/**
* 操作会话
*
* @type {*}
* @memberof UILogicParamBase
*/
protected actionSession: any;
/**
* 逻辑参数模型
*
* @type {*}
* @memberof UILogicParamBase
*/
protected logicParamModel: any;
/**
* 逻辑类型
*
* @type {*}
* @memberof UILogicParamBase
*/
protected logicParamType: any;
/**
* 实际值
*
* @type {*}
* @memberof UILogicParamBase
*/
protected realValue: any;
/**
* Creates an instance of UILogicParamBase.
* @param {*} opts
* @memberof UILogicParamBase
*/
public constructor(opts: any) {
const { actionSession, model, params } = opts;
this.actionSession = actionSession;
this.logicParamModel = model;
this.strCodeName = model.codeName;
this.init(params);
}
/**
* 初始化
*
* @protected
* @memberof UILogicParamBase
*/
protected init(params: any) {
this.setReal(this.getDefaultValue(params, {}));
}
/**
* 获取默认值
*
* @protected
* @memberof UILogicParamBase
*/
protected getDefaultValue(params: any, defaultValue: any) {
const { args } = params;
if (this.logicParamModel.default) {
return args;
} else {
return defaultValue;
}
}
/**
* 获取实际参数值
*
* @memberof UILogicParamBase
*/
public getReal() {
return this.realValue;
}
/**
* 设置实际参数值
*
* @param {*} opts
* @memberof UILogicParamBase
*/
public setReal(opts: any) {
this.realValue = opts;
}
/**
* 设置指定属性值
*
* @param {string} strName
* @param {*} value
* @memberof UILogicParamBase
*/
public set(strName: string, value: any) {
if (Object.prototype.toString.call(this.realValue) !== '[object Object]') {
throw new Error(`逻辑参数${this.strCodeName}无法执行绑定非对象类型参数`);
}
this.realValue[strName] = value;
}
/**
* 获取指定属性值
*
* @param {string} strName
* @memberof UILogicParamBase
*/
public get(strName: string) {
if (Object.prototype.toString.call(this.realValue) !== '[object Object]') {
throw new Error(`逻辑参数${this.strCodeName}非对象类型参数无法执行获取指定属性值`);
}
return this.realValue[strName];
}
/**
* 重置指定属性
*
* @param {string} strName
* @memberof UILogicParamBase
*/
public reset(strName: string) {
if (Object.prototype.toString.call(this.realValue) !== '[object Object]') {
throw new Error(`逻辑参数${this.strCodeName}非对象类型参数无法执行重置指定属性`);
}
this.realValue[strName] = null;
}
/**
* 重置全部
*
* @memberof UILogicParamBase
*/
public resetAll() {
if (Object.prototype.toString.call(this.realValue) !== '[object Object]') {
throw new Error(`逻辑参数${this.strCodeName}非对象类型参数无法执行重置全部`);
}
this.setReal({});
}
/**
* 拷贝当前变量到指定变量
*
* @param {*} dstParam
* @memberof UILogicParamBase
*/
public copyTo(dstParam: any) {
if (Object.is(typeof (this.realValue), 'object')) {
dstParam.setReal(Util.deepCopy(this.realValue));
} else {
dstParam.setReal(this.realValue);
}
}
/**
* 绑定指定参数对象
*
* @param {*} opts
* @memberof UILogicParamBase
*/
public bind(opts: any) {
this.setReal(opts);
}
/**
* 重新建立参数对象
*
* @memberof UILogicParamBase
*/
public renew() {
this.setReal({});
}
/**
* 附加参数对象
*
* @param {number} nPos
* @param {*} paramObject
* @param {number} nSrcPos
* @param {number} nSrcLength
* @memberof UILogicParamBase
*/
public append(nPos: number, paramObject: any, nSrcPos: number, nSrcLength: number) {
if (Object.prototype.toString.call(paramObject) !== '[object Array]') {
throw new Error(`逻辑参数${this.strCodeName}源数据不是数据对象列表类型`);
}
if (this.realValue && !Array.isArray(this.realValue)) {
throw new Error(`逻辑参数${this.strCodeName}不是数据对象列表类型`);
}
// 补足参数
if (nPos === -1) {
nPos = 0;
}
if (nSrcPos === -1) {
nSrcPos = 0;
}
if (nSrcLength === -1) {
nSrcLength = paramObject.length;
}
const list: Array<any> = this.realValue;
if (nPos > list.length) {
throw new Error(`逻辑参数${this.strCodeName}插入位置溢出`);
}
const srcList = paramObject.slice(nSrcPos, nSrcLength);
list.splice(nPos, 0, ...srcList);
}
/**
* 排序参数对象
*
* @param {string} strField
* @param {string} strSortDir
* @memberof UILogicParamBase
*/
public sort(strField: string, strSortDir: string) {
if (this.realValue && !Array.isArray(this.realValue)) {
throw new Error(`逻辑参数${this.strCodeName}不是数据对象列表类型`);
}
// 是否降序
const bSortDesc: boolean = Object.is(strSortDir.toLowerCase(), 'desc') ? true : false;
// 对数组排序(升序)
this.realValue.sort((a: any, b: any) => {
return a[strField] - b[strField];
})
if (bSortDesc) {
this.realValue.reverse();
}
}
}
\ No newline at end of file
import { UILogicActiveContainerParam } from "./ui-logic-active-container-param";
import { UILogicActiveCtrlParam } from "./ui-logic-active-ctrl-param";
import { UILogicActiveViewParam } from "./ui-logic-active-view-param";
import { UILogicAppGlobalParam } from "./ui-logic-app-global-param";
import { AppDeUILogicAppParam } from "./ui-logic-app-param";
import { UILogicCtrlParam } from "./ui-logic-ctrl-param";
import { AppDeUILogicEntityListParam } from "./ui-logic-entity-list-param";
import { AppDeUILogicEntityPageParam } from "./ui-logic-entity-page-param";
import { AppDeUILogicEntityParam } from "./ui-logic-entity-param";
import { AppDeUILogicFilterParam } from "./ui-logic-filter-param";
import { AppDeUILogicLastReturnParam } from "./ui-logic-last-return-param";
import { UILogicNavContextParam } from "./ui-logic-nav-context-param";
import { UILogicNavViewParam } from "./ui-logic-nav-view-param";
import { UILogicParamBase } from "./ui-logic-param-base";
import { UILogicRouteViewSessionParam } from "./ui-logic-route-view-session-param";
import { AppDeUILogicSimpleListParam } from "./ui-logic-simple-list-param";
import { AppDeUILogicSampleParam } from "./ui-logic-simple-param";
import { UILogicViewNavDataParam } from "./ui-logic-view-navdata-param";
import { UILogicViewSessionParam } from "./ui-logic-view-session-param";
export class UILogicParamService {
/**
* 获取界面逻辑参数实例
*
* @static
* @param {*} actionSession 操作会话
* @param {*} model 模型
* @memberof UILogicParamService
*/
public static getLogicParamInstance(actionSession: any, model: any, params: any) {
const inputParam = { actionSession, model, params };
// 应用程序变量
if (model.applicationParam) {
return new AppDeUILogicAppParam(inputParam);
}
// 当前容器对象
if (model.activeContainerParam) {
return new UILogicActiveContainerParam(inputParam);
}
// 当前部件对象
if (model.activeCtrlParam) {
return new UILogicActiveCtrlParam(inputParam);
}
// 指定部件对象
if (model.ctrlParam) {
return new UILogicCtrlParam(inputParam);
}
// 当前视图对象
if (model.activeViewParam) {
return new UILogicActiveViewParam(inputParam);
}
// 简单数据变量
if (model.simpleParam) {
return new AppDeUILogicSampleParam(inputParam);
}
// 逻辑数据对象参数
if (model.entityParam) {
return new AppDeUILogicEntityParam(inputParam);
}
// 数据对象列表变量
if (model.entityListParam) {
return new AppDeUILogicEntityListParam(inputParam);
}
// 上一次调用返回变量
if (model.lastReturnParam) {
return new AppDeUILogicLastReturnParam(inputParam);
}
// 简单数据列表变量
if (model.simpleListParam) {
return new AppDeUILogicSimpleListParam(inputParam);
}
// 分页查询结果变量
if (model.entityPageParam) {
return new AppDeUILogicEntityPageParam(inputParam);
}
// 应用全局参数绑定参数
if (model.appGlobalParam) {
return new UILogicAppGlobalParam(inputParam);
}
// 过滤器
if (model.filterParam) {
return new AppDeUILogicFilterParam(inputParam);
}
// 导航上下文绑定参数
if (model.navContextParam) {
return new UILogicNavContextParam(inputParam);
}
// 导航视图参数绑定参数
if (model.navViewParamParam) {
return new UILogicNavViewParam(inputParam);
}
// 顶级视图会话共享参数绑定参数
if (model.routeViewSessionParam) {
return new UILogicRouteViewSessionParam(inputParam);
}
// 导航数据参数绑定参数
if (model.viewNavDataParam) {
return new UILogicViewNavDataParam(inputParam);
}
// 当前视图会话共享参数绑定参数
if (model.viewSessionParam) {
return new UILogicViewSessionParam(inputParam);
}
return new UILogicParamBase(inputParam);
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 界面顶级视图会话共享参数绑定参数
*
* @export
* @class UILogicRouteViewSessionParam
*/
export class UILogicRouteViewSessionParam extends UILogicParamBase {
/**
* Creates an instance of UILogicRouteViewSessionParam.
* @param {*} opts
* @memberof UILogicRouteViewSessionParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof UILogicRouteViewSessionParam
*/
protected init(params: any) {
this.logicParamType = UILogicParamType.routeViewSessionParam;
this.realValue = this.setReal(this.getRouteViewSessionParam(params));
}
/**
* 设置实际参数值
*
* @param {*} opts
* @memberof UILogicRouteViewSessionParam
*/
public setReal(opts: any) {
this.realValue = opts;
const actionContainer = this.actionSession.actionContainer;
this.$store.commit('addRouteViewGlobal', { tag: actionContainer.context.srfsessionid, param: { [this.logicParamModel.paramFieldName]: opts } });
}
/**
* 获取界面顶级视图会话共享参数绑定参数
*
* @private
* @param {any} params
* @memberof UILogicRouteViewSessionParam
*/
private getRouteViewSessionParam(params: any) {
const { actioncontext } = params;
const { viewCtx, context } = actioncontext;
if (viewCtx && viewCtx['routeViewGlobal']) {
let result = actioncontext.viewCtx['routeViewGlobal'][this.logicParamModel.paramFieldName];
if (!result) {
result = {};
}
return result;
}
}
/**
* 设置指定属性值
*
* @param {string} strName
* @param {*} value
* @memberof UILogicRouteViewSessionParam
*/
public set(strName: string, value: any) {
this.realValue[strName] = value;
const actionContainer = this.actionSession.actionContainer;
this.$store.commit('addRouteViewGlobal', { tag: actionContainer.context.srfsessionid, param: { [this.logicParamModel.paramFieldName]: this.realValue } });
}
/**
* 重置指定属性
*
* @param {string} strName
* @memberof UILogicRouteViewSessionParam
*/
public reset(strName: string) {
this.realValue[strName] = null;
const actionContainer = this.actionSession.actionContainer;
this.$store.commit('addRouteViewGlobal', { tag: actionContainer.context.srfsessionid, param: { [this.logicParamModel.paramFieldName]: this.realValue } });
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 逻辑简单数据列表参数
*
* @export
* @class AppDeUILogicSimpleListParam
*/
export class AppDeUILogicSimpleListParam extends UILogicParamBase {
/**
* Creates an instance of AppDeUILogicSimpleListParam.
* @param {*} opts
* @memberof AppDeUILogicSimpleListParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof AppDeUILogicSimpleListParam
*/
protected init(params: any) {
this.setReal(this.getDefaultValue(params, []));
this.logicParamType = UILogicParamType.simpleListParam;
}
/**
* 重置全部
*
* @memberof AppDeUILogicSimpleListParam
*/
public resetAll() {
this.realValue = [];
}
/**
* 绑定指定参数对象
*
* @param {*} opts
* @memberof AppDeUILogicSimpleListParam
*/
public bind(opts: any) {
if (Object.prototype.toString.call(opts) !== '[object Array]') {
throw new Error(`逻辑参数${this.strCodeName}无法绑定非数组类型参数`);
}
this.setReal(opts);
}
/**
* 重新建立参数对象
*
* @memberof AppDeUILogicSimpleListParam
*/
public renew() {
this.realValue = [];
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 逻辑简单数据参数
*
* @export
* @class AppDeUILogicSampleParam
*/
export class AppDeUILogicSampleParam extends UILogicParamBase {
/**
* Creates an instance of AppDeUILogicSampleParam.
* @param {*} opts
* @memberof AppDeUILogicSampleParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof AppDeUILogicParamBase
*/
protected init(opts: any) {
this.logicParamType = UILogicParamType.simpleParam;
this.setReal(null);
}
/**
* 绑定指定参数对象
*
* @param {*} opts
* @memberof AppDeUILogicSampleParam
*/
public bind(opts: any) {
const typeResult = Object.prototype.toString.call(opts);
if ((typeResult !== '[object String]') && (typeResult !== '[object Boolean]') && (typeResult !== '[object Number]') && (typeResult !== '[object Null]') && (typeResult !== '[object Undefined]')) {
throw new Error(`逻辑参数${this.strCodeName}无法绑定非基本类型参数`);
}
this.setReal(opts);
}
/**
* 设置指定属性值
*
* @param {string} strName
* @param {*} value
* @memberof AppDeUILogicSampleParam
*/
public set(strName: string, value: any) {
this.setReal(value);
}
/**
* 获取指定属性值
*
* @param {string} strName
* @memberof AppDeUILogicSampleParam
*/
public get(strName: string) {
return this.realValue;
}
/**
* 重置指定属性
*
* @param {string} strName
* @memberof AppDeUILogicSampleParam
*/
public reset(strName: string) {
this.realValue = null;
}
/**
* 重置全部
*
* @memberof AppDeUILogicSampleParam
*/
public resetAll() {
this.realValue = null;
}
/**
* 重新建立参数对象
*
* @memberof AppDeUILogicSampleParam
*/
public renew() {
this.realValue = null;
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 导航数据参数绑定参数
*
* @export
* @class UILogicViewNavDataParam
*/
export class UILogicViewNavDataParam extends UILogicParamBase {
/**
* Creates an instance of UILogicViewNavDataParam.
* @param {*} opts
* @memberof UILogicViewNavDataParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof UILogicViewNavDataParam
*/
protected init(params: any) {
this.logicParamType = UILogicParamType.viewNavDataParam;
this.realValue = this.getViewNavDataParam(params);
}
/**
* 获取导航数据参数绑定参数
*
* @private
* @param {any} params
* @memberof UILogicViewNavDataParam
*/
private getViewNavDataParam(params: any) {
const { actioncontext } = params;
const { viewCtx } = actioncontext;
if (viewCtx && viewCtx['viewNavData']) {
return viewCtx['viewNavData'];
}
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
/**
* 当前视图会话共享参数绑定参数
*
* @export
* @class UILogicViewSessionParam
*/
export class UILogicViewSessionParam extends UILogicParamBase {
/**
* Creates an instance of UILogicViewSessionParam.
* @param {*} opts
* @memberof UILogicViewSessionParam
*/
public constructor(opts: any) {
super(opts);
}
/**
* 初始化
*
* @protected
* @memberof UILogicViewSessionParam
*/
protected init(params: any) {
this.logicParamType = UILogicParamType.viewSessionParam;
this.realValue = this.getViewSessionParam(params);
}
/**
* 获取当前视图会话共享参数绑定参数
*
* @private
* @param {any} params
* @memberof UILogicViewSessionParam
*/
private getViewSessionParam(params: any) {
const { actioncontext } = params;
const { viewCtx } = actioncontext;
if (viewCtx && viewCtx['viewGlobal']) {
return viewCtx['viewGlobal'];
}
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册