forked from dmaria58/react-flow-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
110 lines (96 loc) · 3.11 KB
/
index.js
File metadata and controls
110 lines (96 loc) · 3.11 KB
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
110
'use strict'
//time类型
const timeType = {
TABLE_SOURCE: 3000,
NOMAL_SOURCE: 1000,
QUICK_TYPE: 300,
}
let funList ={};
//时间列表
const flowTimeObject= {};
let flowTimeMode ={};
let tnum = 0;
let isflowcheck = true;
const flowImport = ({id,FlowMent,doMent,doLists,doid}) => {
FlowMent.type.prototype.componentDidMount=()=>{
FlowMent.type.prototype.componentDidMount;
funList[doid]=doMent(eval('this'),id);
flowFunc(funList[doid],doLists,id,doid);
}
}
const flowFunc = (funList,doList,id,doid) => {
for(let key in doList){
flowTimeObject[doid] = flowTimeObject[doid]?flowTimeObject[doid]:0;
let data = doList[key];
for(let num = 0 ;num<data.length;num++){
let list = data[num];
if(!list.STEP_TIME || !list.doMent || !list.id || !list.funKey|| !list.num){
console.log("%c 【ERROR】doList["+num+"] 格式错误,STEP_TIME doMent funKey id num字段不可缺少", "color:red");
return;
}
if(!flowTimeMode[key] && flowTimeObject[doid]==0){
flowTimeMode[key]=[timeType[list.STEP_TIME]];
flowTimeObject[doid] += timeType[list.STEP_TIME]?timeType[list.STEP_TIME]:list.STEP_TIME;
}
else if(!flowTimeMode[key] && flowTimeObject[doid]){
flowTimeObject[doid] += timeType[list.STEP_TIME]?timeType[list.STEP_TIME]:list.STEP_TIME;
flowTimeMode[key]=[flowTimeObject[doid]];
}
else{
flowTimeObject[doid] += timeType[list.STEP_TIME]?timeType[list.STEP_TIME]:list.STEP_TIME;
flowTimeMode[key].push(flowTimeObject[doid]);
}
if(list.doMent && funList[list.doMent] && id == list.id){
setTimeout(()=>{
funList[list.doMent](list.funKey);
let disc = list.description?list.description:"";
if(list.checkReactDo){
let ischeckReactDo = true;
let returndata = funList[list.doMent](list.funKey);
let checkdata = list.checkReactDo;
//判断是否需要验证
if(typeof(list.checkReactDo) == 'function'){
if( checkdata(returndata)!= true){
ischeckReactDo = false;
}
}
else if(typeof(list.checkReactDo) == 'object'){
checkReactDoIs(returndata,checkdata);
if( isflowcheck == false){
ischeckReactDo = false;
}
}
else{
console.log("%c 【"+key+"】"+list.num+" "+list.doMent +" 格式定义错误", "color:red");
return
}
//验证报错提醒
if(ischeckReactDo == false){
console.log("%c 【"+key+"】"+list.num+" "+list.doMent +"验证出错","color:red",returndata);
}
else{
console.log("%c 【"+key+"】【验证】"+list.num+" "+list.doMent +" "+disc, "color:blue")
}
}
else{
console.log("%c 【"+key+"】"+list.num+" "+list.doMent +" "+disc, "color:green")
}
},flowTimeMode[key][num])
}
}
}
}
const checkReactDoIs =(rdata,cdata)=> {
for(let key in cdata){
if(typeof(cdata[key])== "object"){
checkReactDoIs(rdata[key],cdata[key])
}
else{
if(cdata[key] != rdata[key]){
console.log("%c 【error】"+key+" "+ cdata[key] +"!="+ rdata[key] ,"color:red");
isflowcheck = false;
}
}
}
}
export {flowImport,flowFunc}