1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import { Verify } from '@/utils/verify/verify';
/**
* 执行上一步
*
* @export
* @class PreActionLogicBase
*/
export default class PreActionLogicBase {
/**
* 名称
*
* @memberof PreActionLogicBase
*/
private name:string ="PreAction";
/**
* 唯一标识
*
* @memberof PreActionLogicBase
*/
private id:string = "e2c9236d5edf802f0ba1d8b0fa028270";
/**
* 默认参数名称
*
* @memberof PreActionLogicBase
*/
private defaultParamName:string = "Default";
/**
* 参数集合
*
* @memberof PreActionLogicBase
*/
private paramsMap:Map<string,any> = new Map();
/**
* Creates an instance of PreActionLogicBase.
*
* @param {*} [opts={}]
* @memberof PreActionLogicBase
*/
constructor(opts: any = {}) {
this.initParams(opts);
}
/**
* 初始化参数集合
*
* @param {*} [opts={}]
* @memberof PreActionLogicBase
*/
public initParams(opts:any){
this.paramsMap.set('Default',opts);
}
/**
* 计算0节点结果
*
* @param params 传入参数
*/
public compute0Cond(params:any):boolean{
return true;
}
/**
* 执行逻辑
*
* @param context 应用上下文
* @param params 传入参数
*/
public onExecute(context:any,params:any,isloading:boolean){
return this.executeBegin(context,params,isloading);
}
/**
* 开始
*
* @param params 传入参数
*/
private async executeBegin(context:any,params:any,isloading:boolean){
//开始节点
if(this.compute0Cond(params)){
return this.executePrepareparam1(context,params,isloading);
}
}
/**
* 准备参数
*
* @param context 应用上下文
* @param params 传入参数
*/
private async executePrepareparam1(context:any,params:any,isloading:boolean){
// 准备参数节点
let tempDstParam0Context:any = this.paramsMap.get('Default').context?this.paramsMap.get('Default').context:{};
let tempDstParam0Data:any = this.paramsMap.get('Default').data?this.paramsMap.get('Default').data:{};
Object.assign(tempDstParam0Data,{stepstatus:"step1"});
this.paramsMap.set('Default',{data:tempDstParam0Data,context:tempDstParam0Context});
return this.paramsMap.get(this.defaultParamName).data;
}
}