提交 | 用户 | 时间
|
a57dc2
|
1 |
// 初始化表单数据 |
W |
2 |
export function initListenerForm(listener) { |
|
3 |
let self = { |
|
4 |
...listener |
|
5 |
}; |
|
6 |
if (listener.script) { |
|
7 |
self = { |
|
8 |
...listener, |
|
9 |
...listener.script, |
|
10 |
scriptType: listener.script.resource ? "externalScript" : "inlineScript" |
|
11 |
}; |
|
12 |
} |
|
13 |
if (listener.event === "timeout" && listener.eventDefinitions) { |
|
14 |
if (listener.eventDefinitions.length) { |
|
15 |
let k = ""; |
|
16 |
for (let key in listener.eventDefinitions[0]) { |
|
17 |
console.log(listener.eventDefinitions, key); |
|
18 |
if (key.indexOf("time") !== -1) { |
|
19 |
k = key; |
|
20 |
self.eventDefinitionType = key.replace("time", "").toLowerCase(); |
|
21 |
} |
|
22 |
} |
|
23 |
console.log(k); |
|
24 |
self.eventTimeDefinitions = listener.eventDefinitions[0][k].body; |
|
25 |
} |
|
26 |
} |
|
27 |
return self; |
|
28 |
} |
|
29 |
|
|
30 |
export function initListenerType(listener) { |
|
31 |
let listenerType; |
|
32 |
if (listener.class) listenerType = "classListener"; |
|
33 |
if (listener.expression) listenerType = "expressionListener"; |
|
34 |
if (listener.delegateExpression) listenerType = "delegateExpressionListener"; |
|
35 |
if (listener.script) listenerType = "scriptListener"; |
|
36 |
return { |
|
37 |
...JSON.parse(JSON.stringify(listener)), |
|
38 |
...(listener.script ?? {}), |
|
39 |
listenerType: listenerType |
|
40 |
}; |
|
41 |
} |
|
42 |
|
|
43 |
export const listenerType = { |
|
44 |
classListener: "Java 类", |
|
45 |
expressionListener: "表达式", |
|
46 |
delegateExpressionListener: "代理表达式", |
|
47 |
scriptListener: "脚本" |
|
48 |
}; |
|
49 |
|
|
50 |
export const eventType = { |
|
51 |
create: "创建", |
|
52 |
assignment: "指派", |
|
53 |
complete: "完成", |
|
54 |
delete: "删除", |
|
55 |
update: "更新", |
|
56 |
timeout: "超时" |
|
57 |
}; |
|
58 |
|
|
59 |
export const fieldType = { |
|
60 |
string: "字符串", |
|
61 |
expression: "表达式" |
|
62 |
}; |