提交 | 用户 | 时间
|
820397
|
1 |
export const template = (isTaskListener) => { |
H |
2 |
return ` |
|
3 |
<div class="panel-tab__content"> |
|
4 |
<el-table :data="elementListenersList" size="small" border> |
|
5 |
<el-table-column label="序号" width="50px" type="index" /> |
|
6 |
<el-table-column label="事件类型" min-width="100px" prop="event" /> |
|
7 |
<el-table-column label="监听器类型" min-width="100px" show-overflow-tooltip :formatter="row => listenerTypeObject[row.listenerType]" /> |
|
8 |
<el-table-column label="操作" width="90px"> |
|
9 |
<template #default="scope"> |
|
10 |
<el-button size="small" type="primary" link @click="openListenerForm(scope, scope.$index)">编辑</el-button> |
|
11 |
<el-divider direction="vertical" /> |
|
12 |
<el-button size="small" type="primary" link style="color: #ff4d4f" @click="removeListener(scope, scope.$index)">移除</el-button> |
|
13 |
</template> |
|
14 |
</el-table-column> |
|
15 |
</el-table> |
|
16 |
<div class="element-drawer__button"> |
|
17 |
<el-button size="small" type="primary" icon="el-icon-plus" @click="openListenerForm(null)">添加监听器</el-button> |
|
18 |
</div> |
|
19 |
|
|
20 |
<!-- 监听器 编辑/创建 部分 --> |
|
21 |
<el-drawer :visible.sync="listenerFormModelVisible" title="执行监听器" :size="width + 'px'" append-to-body destroy-on-close> |
|
22 |
<el-form size="small" :model="listenerForm" label-width="96px" ref="listenerFormRef" @submit.native.prevent> |
|
23 |
<el-form-item label="事件类型" prop="event" :rules="{ required: true, trigger: ['blur', 'change'] }"> |
|
24 |
<el-select v-model="listenerForm.event"> |
|
25 |
<el-option label="start" value="start" /> |
|
26 |
<el-option label="end" value="end" /> |
|
27 |
</el-select> |
|
28 |
</el-form-item> |
|
29 |
<el-form-item label="监听器类型" prop="listenerType" :rules="{ required: true, trigger: ['blur', 'change'] }"> |
|
30 |
<el-select v-model="listenerForm.listenerType"> |
|
31 |
<el-option v-for="i in Object.keys(listenerTypeObject)" :key="i" :label="listenerTypeObject[i]" :value="i" /> |
|
32 |
</el-select> |
|
33 |
</el-form-item> |
|
34 |
<el-form-item |
|
35 |
v-if="listenerForm.listenerType === 'classListener'" |
|
36 |
label="Java类" |
|
37 |
prop="class" |
|
38 |
key="listener-class" |
|
39 |
:rules="{ required: true, trigger: ['blur', 'change'] }" |
|
40 |
> |
|
41 |
<el-input v-model="listenerForm.class" clearable /> |
|
42 |
</el-form-item> |
|
43 |
<el-form-item |
|
44 |
v-if="listenerForm.listenerType === 'expressionListener'" |
|
45 |
label="表达式" |
|
46 |
prop="expression" |
|
47 |
key="listener-expression" |
|
48 |
:rules="{ required: true, trigger: ['blur', 'change'] }" |
|
49 |
> |
|
50 |
<el-input v-model="listenerForm.expression" clearable /> |
|
51 |
</el-form-item> |
|
52 |
<el-form-item |
|
53 |
v-if="listenerForm.listenerType === 'delegateExpressionListener'" |
|
54 |
label="代理表达式" |
|
55 |
prop="delegateExpression" |
|
56 |
key="listener-delegate" |
|
57 |
:rules="{ required: true, trigger: ['blur', 'change'] }" |
|
58 |
> |
|
59 |
<el-input v-model="listenerForm.delegateExpression" clearable /> |
|
60 |
</el-form-item> |
|
61 |
<template v-if="listenerForm.listenerType === 'scriptListener'"> |
|
62 |
<el-form-item |
|
63 |
label="脚本格式" |
|
64 |
prop="scriptFormat" |
|
65 |
key="listener-script-format" |
|
66 |
:rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本格式' }" |
|
67 |
> |
|
68 |
<el-input v-model="listenerForm.scriptFormat" clearable /> |
|
69 |
</el-form-item> |
|
70 |
<el-form-item |
|
71 |
label="脚本类型" |
|
72 |
prop="scriptType" |
|
73 |
key="listener-script-type" |
|
74 |
:rules="{ required: true, trigger: ['blur', 'change'], message: '请选择脚本类型' }" |
|
75 |
> |
|
76 |
<el-select v-model="listenerForm.scriptType"> |
|
77 |
<el-option label="内联脚本" value="inlineScript" /> |
|
78 |
<el-option label="外部脚本" value="externalScript" /> |
|
79 |
</el-select> |
|
80 |
</el-form-item> |
|
81 |
<el-form-item |
|
82 |
v-if="listenerForm.scriptType === 'inlineScript'" |
|
83 |
label="脚本内容" |
|
84 |
prop="value" |
|
85 |
key="listener-script" |
|
86 |
:rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本内容' }" |
|
87 |
> |
|
88 |
<el-input v-model="listenerForm.value" clearable /> |
|
89 |
</el-form-item> |
|
90 |
<el-form-item |
|
91 |
v-if="listenerForm.scriptType === 'externalScript'" |
|
92 |
label="资源地址" |
|
93 |
prop="resource" |
|
94 |
key="listener-resource" |
|
95 |
:rules="{ required: true, trigger: ['blur', 'change'], message: '请填写资源地址' }" |
|
96 |
> |
|
97 |
<el-input v-model="listenerForm.resource" clearable /> |
|
98 |
</el-form-item> |
|
99 |
</template> |
|
100 |
${ |
|
101 |
isTaskListener |
|
102 |
? "<el-form-item label='定时器类型' prop='eventDefinitionType' key='eventDefinitionType'>" + |
|
103 |
"<el-select v-model='listenerForm.eventDefinitionType'>" + |
|
104 |
"<el-option label='日期' value='date' />" + |
|
105 |
"<el-option label='持续时长' value='duration' />" + |
|
106 |
"<el-option label='循环' value='cycle' />" + |
|
107 |
"<el-option label='无' value='' />" + |
|
108 |
'</el-select>' + |
|
109 |
'</el-form-item>' + |
|
110 |
"<el-form-item v-if='!!listenerForm.eventDefinitionType' label='定时器' prop='eventDefinitions' key='eventDefinitions'>" + |
|
111 |
"<el-input v-model='listenerForm.eventDefinitions' clearable />" + |
|
112 |
'</el-form-item>' |
|
113 |
: '' |
|
114 |
} |
|
115 |
</el-form> |
|
116 |
<el-divider /> |
|
117 |
<p class="listener-filed__title"> |
|
118 |
<span><i class="el-icon-menu"></i>注入字段:</span> |
|
119 |
<el-button size="small" type="primary" @click="openListenerFieldForm(null)">添加字段</el-button> |
|
120 |
</p> |
|
121 |
<el-table :data="fieldsListOfListener" size="small" max-height="240" border fit style="flex: none"> |
|
122 |
<el-table-column label="序号" width="50px" type="index" /> |
|
123 |
<el-table-column label="字段名称" min-width="100px" prop="name" /> |
|
124 |
<el-table-column label="字段类型" min-width="80px" show-overflow-tooltip :formatter="row => fieldTypeObject[row.fieldType]" /> |
|
125 |
<el-table-column label="字段值/表达式" min-width="100px" show-overflow-tooltip :formatter="row => row.string || row.expression" /> |
|
126 |
<el-table-column label="操作" width="100px"> |
|
127 |
<template #default="scope"> |
|
128 |
<el-button size="small" type="primary" link @click="openListenerFieldForm(scope, scope.$index)">编辑</el-button> |
|
129 |
<el-divider direction="vertical" /> |
|
130 |
<el-button size="small" type="primary" link style="color: #ff4d4f" @click="removeListenerField(scope, scope.$index)">移除</el-button> |
|
131 |
</template> |
|
132 |
</el-table-column> |
|
133 |
</el-table> |
|
134 |
|
|
135 |
<div class="element-drawer__button"> |
|
136 |
<el-button size="small" @click="listenerFormModelVisible = false">取 消</el-button> |
|
137 |
<el-button size="small" type="primary" @click="saveListenerConfig">保 存</el-button> |
|
138 |
</div> |
|
139 |
</el-drawer> |
|
140 |
|
|
141 |
<!-- 注入西段 编辑/创建 部分 --> |
|
142 |
<el-dialog title="字段配置" :visible.sync="listenerFieldFormModelVisible" width="600px" append-to-body destroy-on-close> |
|
143 |
<el-form :model="listenerFieldForm" size="small" label-width="96px" ref="listenerFieldFormRef" style="height: 136px" @submit.native.prevent> |
|
144 |
<el-form-item label="字段名称:" prop="name" :rules="{ required: true, trigger: ['blur', 'change'] }"> |
|
145 |
<el-input v-model="listenerFieldForm.name" clearable /> |
|
146 |
</el-form-item> |
|
147 |
<el-form-item label="字段类型:" prop="fieldType" :rules="{ required: true, trigger: ['blur', 'change'] }"> |
|
148 |
<el-select v-model="listenerFieldForm.fieldType"> |
|
149 |
<el-option v-for="i in Object.keys(fieldTypeObject)" :key="i" :label="fieldTypeObject[i]" :value="i" /> |
|
150 |
</el-select> |
|
151 |
</el-form-item> |
|
152 |
<el-form-item |
|
153 |
v-if="listenerFieldForm.fieldType === 'string'" |
|
154 |
label="字段值:" |
|
155 |
prop="string" |
|
156 |
key="field-string" |
|
157 |
:rules="{ required: true, trigger: ['blur', 'change'] }" |
|
158 |
> |
|
159 |
<el-input v-model="listenerFieldForm.string" clearable /> |
|
160 |
</el-form-item> |
|
161 |
<el-form-item |
|
162 |
v-if="listenerFieldForm.fieldType === 'expression'" |
|
163 |
label="表达式:" |
|
164 |
prop="expression" |
|
165 |
key="field-expression" |
|
166 |
:rules="{ required: true, trigger: ['blur', 'change'] }" |
|
167 |
> |
|
168 |
<el-input v-model="listenerFieldForm.expression" clearable /> |
|
169 |
</el-form-item> |
|
170 |
</el-form> |
|
171 |
<template #footer> |
|
172 |
<el-button size="small" @click="listenerFieldFormModelVisible = false">取 消</el-button> |
|
173 |
<el-button size="small" type="primary" @click="saveListenerFiled">确 定</el-button> |
|
174 |
</template> |
|
175 |
</el-dialog> |
|
176 |
</div> |
|
177 |
` |
|
178 |
} |