gbflowengine 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +270 -2
- package/dist/gbflowengine.css +1 -0
- package/dist/gbflowengine.js +19682 -0
- package/dist/gbflowengine.js.map +1 -0
- package/dist/gbflowengine.umd.cjs +5 -0
- package/dist/gbflowengine.umd.cjs.map +1 -0
- package/package.json +83 -4
- package/src/center/DefinitionInspect.vue +291 -0
- package/src/center/FlowCenter.vue +33 -0
- package/src/center/index.js +29 -0
- package/src/center/storage.js +748 -0
- package/src/core/flow/condition.js +160 -0
- package/src/core/flow/customNode.js +385 -0
- package/src/core/flow/defaults.js +124 -0
- package/src/core/flow/flowConstant.js +265 -0
- package/src/core/flow/flowNodeUtils.js +30 -0
- package/src/core/flow/index.js +47 -0
- package/src/core/flow/node.js +44 -0
- package/src/core/flow/nodeFactory.js +58 -0
- package/src/core/flow/prediction.js +325 -0
- package/src/core/flow/runtime/auto.js +83 -0
- package/src/core/flow/runtime/decide.js +329 -0
- package/src/core/flow/runtime/event.js +28 -0
- package/src/core/flow/runtime/execute.js +357 -0
- package/src/core/flow/runtime/helpers.js +52 -0
- package/src/core/flow/runtime/query.js +146 -0
- package/src/core/flow/runtime/reject.js +137 -0
- package/src/core/flow/runtime/token.js +269 -0
- package/src/core/flow/runtime.js +129 -0
- package/src/core/flow/schema.js +864 -0
- package/src/definition/FlowDefinitionDesigner.vue +338 -0
- package/src/definition/index.js +9 -0
- package/src/index.js +39 -0
- package/src/storage.js +200 -0
- package/src/testing/FlowTestPanel.vue +2502 -0
- package/src/testing/UserConfigDrawer.vue +376 -0
- package/src/testing/diagram/FlowProgressDiagram.vue +318 -0
- package/src/testing/diagramModel.js +517 -0
- package/src/testing/index.js +23 -0
- package/src/testing/mock.js +246 -0
- package/src/testing/oaExecutors.js +51 -0
- package/src/testing/oaSeed.js +467 -0
- package/src/testing/sample.js +412 -0
- package/src/testing/seed.js +122 -0
- package/src/utils/format.js +27 -0
- package/src/visual/FlowCanvas.vue +441 -0
- package/src/visual/NodeProgressDetail.vue +43 -0
- package/src/visual/NodeStatusBadge.vue +17 -0
- package/src/visual/NodeWrap.vue +47 -0
- package/src/visual/ScWorkflow.vue +50 -0
- package/src/visual/SelectDialog.vue +460 -0
- package/src/visual/conditionHelpers.js +117 -0
- package/src/visual/index.js +6 -0
- package/src/visual/nodes/AddNode.vue +223 -0
- package/src/visual/nodes/ApproverNode.vue +348 -0
- package/src/visual/nodes/BranchNode.vue +442 -0
- package/src/visual/nodes/CustomNode.vue +339 -0
- package/src/visual/nodes/EndNode.vue +22 -0
- package/src/visual/nodes/PassNode.vue +101 -0
- package/src/visual/nodes/PromoterNode.vue +135 -0
- package/src/visual/nodes/RejectNode.vue +101 -0
- package/src/visual/nodes/SendNode.vue +152 -0
- package/src/visual/styles.scss +879 -0
- package/src/visual/useScNodeStatus.js +18 -0
- package/src/workbench/OaWorkbench.vue +1341 -0
- package/src/workbench/components/ApprovalWorkspace.vue +2090 -0
- package/src/workbench/components/CategoryIcon.vue +74 -0
- package/src/workbench/components/NotificationIcon.vue +73 -0
- package/src/workbench/components/ProcessSteps.vue +557 -0
- package/src/workbench/components/ResubmitDialog.vue +227 -0
- package/src/workbench/components/SidebarNav.vue +138 -0
- package/src/workbench/components/StartFlowDialog.vue +1058 -0
- package/src/workbench/components/UserAvatar.vue +68 -0
- package/src/workbench/custom-tasks.js +130 -0
- package/src/workbench/model.js +1080 -0
- package/src/workbench/pages/DesignPage.vue +798 -0
- package/src/workbench/pages/HomePage.vue +1050 -0
- package/src/workbench/pages/MonitorPage.vue +1029 -0
- package/src/workbench/pages/NotificationsPage.vue +554 -0
- package/src/workbench/pages/RequestsPage.vue +644 -0
- package/src/workbench/pages/TaskCenterPage.vue +1155 -0
- package/src/workbench/pages/TemplatesPage.vue +680 -0
- package/src/workbench/persistence.js +89 -0
- package/src/workbench/shared.js +18 -0
- package/src/workbench/styles.scss +555 -0
- package/src/workbench/useWorkbench.js +955 -0
- package/types/center.d.ts +5 -0
- package/types/core.d.ts +479 -0
- package/types/definition.d.ts +4 -0
- package/types/index.d.ts +34 -0
- package/types/testing.d.ts +20 -0
- package/types/visual.d.ts +20 -0
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
v-model="dialogVisible"
|
|
4
|
+
:title="titleMap[type - 1]"
|
|
5
|
+
:width="type == 1 ? 680 : 460"
|
|
6
|
+
destroy-on-close
|
|
7
|
+
append-to-body
|
|
8
|
+
@closed="$emit('closed')"
|
|
9
|
+
>
|
|
10
|
+
<template v-if="type == 1">
|
|
11
|
+
<div class="sc-user-select">
|
|
12
|
+
<div class="sc-user-select__left">
|
|
13
|
+
<div class="sc-user-select__search">
|
|
14
|
+
<el-input v-model="keyword" :prefix-icon="Search" placeholder="搜索成员" clearable @keyup.enter="search">
|
|
15
|
+
<template #append>
|
|
16
|
+
<el-button :icon="Search" @click="search" />
|
|
17
|
+
</template>
|
|
18
|
+
</el-input>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="sc-user-select__select">
|
|
21
|
+
<div class="sc-user-select__tree" v-loading="showGrouploading">
|
|
22
|
+
<el-scrollbar>
|
|
23
|
+
<el-tree
|
|
24
|
+
class="menu"
|
|
25
|
+
ref="groupTree"
|
|
26
|
+
:data="group"
|
|
27
|
+
:node-key="groupProps.key"
|
|
28
|
+
:props="groupProps"
|
|
29
|
+
highlight-current
|
|
30
|
+
:expand-on-click-node="false"
|
|
31
|
+
:current-node-key="groupId"
|
|
32
|
+
@node-click="groupClick"
|
|
33
|
+
/>
|
|
34
|
+
</el-scrollbar>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="sc-user-select__user" v-loading="showUserloading">
|
|
37
|
+
<div class="sc-user-select__user__list">
|
|
38
|
+
<el-scrollbar ref="userScrollbar">
|
|
39
|
+
<el-tree
|
|
40
|
+
class="menu"
|
|
41
|
+
ref="userTree"
|
|
42
|
+
:data="user"
|
|
43
|
+
:node-key="userProps.key"
|
|
44
|
+
:props="userProps"
|
|
45
|
+
:default-checked-keys="selectedIds"
|
|
46
|
+
show-checkbox
|
|
47
|
+
check-on-click-node
|
|
48
|
+
@check-change="userClick"
|
|
49
|
+
/>
|
|
50
|
+
<el-empty v-if="!user.length && !showUserloading" description="暂无人员" :image-size="60" />
|
|
51
|
+
</el-scrollbar>
|
|
52
|
+
</div>
|
|
53
|
+
<footer>
|
|
54
|
+
<el-pagination
|
|
55
|
+
background
|
|
56
|
+
layout="prev,next"
|
|
57
|
+
small
|
|
58
|
+
:total="total"
|
|
59
|
+
:page-size="pageSize"
|
|
60
|
+
v-model:current-page="currentPage"
|
|
61
|
+
@current-change="paginationChange"
|
|
62
|
+
/>
|
|
63
|
+
</footer>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="sc-user-select__toicon">
|
|
68
|
+
<el-icon><ArrowRight /></el-icon>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="sc-user-select__selected">
|
|
71
|
+
<header>已选 ({{ selected.length }})</header>
|
|
72
|
+
<ul>
|
|
73
|
+
<el-scrollbar>
|
|
74
|
+
<li v-for="(item, index) in selected" :key="item.id">
|
|
75
|
+
<span class="name">
|
|
76
|
+
<el-avatar size="small">{{ (item.name || '').substring(0, 1) }}</el-avatar>
|
|
77
|
+
<label>{{ item.name }}</label>
|
|
78
|
+
</span>
|
|
79
|
+
<span class="delete">
|
|
80
|
+
<el-button type="danger" :icon="Delete" circle size="small" @click="deleteSelected(index)" />
|
|
81
|
+
</span>
|
|
82
|
+
</li>
|
|
83
|
+
</el-scrollbar>
|
|
84
|
+
</ul>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<template v-if="type == 2">
|
|
90
|
+
<div class="sc-user-select sc-user-select-role">
|
|
91
|
+
<div class="sc-user-select__left">
|
|
92
|
+
<div class="sc-user-select__select">
|
|
93
|
+
<div class="sc-user-select__tree" v-loading="showGrouploading">
|
|
94
|
+
<el-scrollbar>
|
|
95
|
+
<el-tree
|
|
96
|
+
class="menu"
|
|
97
|
+
ref="groupTree"
|
|
98
|
+
:data="role"
|
|
99
|
+
:node-key="roleProps.key"
|
|
100
|
+
:props="roleProps"
|
|
101
|
+
show-checkbox
|
|
102
|
+
check-strictly
|
|
103
|
+
check-on-click-node
|
|
104
|
+
:expand-on-click-node="false"
|
|
105
|
+
:default-checked-keys="selectedIds"
|
|
106
|
+
@check-change="roleClick"
|
|
107
|
+
/>
|
|
108
|
+
<el-empty v-if="!role.length && !showGrouploading" description="暂无角色" :image-size="60" />
|
|
109
|
+
</el-scrollbar>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
<div class="sc-user-select__toicon">
|
|
114
|
+
<el-icon><ArrowRight /></el-icon>
|
|
115
|
+
</div>
|
|
116
|
+
<div class="sc-user-select__selected">
|
|
117
|
+
<header>已选 ({{ selected.length }})</header>
|
|
118
|
+
<ul>
|
|
119
|
+
<el-scrollbar>
|
|
120
|
+
<li v-for="(item, index) in selected" :key="item.id">
|
|
121
|
+
<span class="name">
|
|
122
|
+
<label>{{ item.name }}</label>
|
|
123
|
+
</span>
|
|
124
|
+
<span class="delete">
|
|
125
|
+
<el-button type="danger" :icon="Delete" circle size="small" @click="deleteSelected(index)" />
|
|
126
|
+
</span>
|
|
127
|
+
</li>
|
|
128
|
+
</el-scrollbar>
|
|
129
|
+
</ul>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</template>
|
|
133
|
+
|
|
134
|
+
<template #footer>
|
|
135
|
+
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
136
|
+
<el-button type="primary" @click="save">确 认</el-button>
|
|
137
|
+
</template>
|
|
138
|
+
</el-dialog>
|
|
139
|
+
</template>
|
|
140
|
+
|
|
141
|
+
<script setup>
|
|
142
|
+
import { computed, inject, ref } from 'vue'
|
|
143
|
+
import { ArrowRight, Delete, Search } from 'gbicons'
|
|
144
|
+
|
|
145
|
+
defineOptions({ name: 'ScSelectDialog' })
|
|
146
|
+
|
|
147
|
+
const props = defineProps({
|
|
148
|
+
pageSizeDefault: { type: Number, default: 20 }
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
const emit = defineEmits(['closed'])
|
|
152
|
+
|
|
153
|
+
const adapters = inject('gbDesignerAdapters', null)
|
|
154
|
+
|
|
155
|
+
const groupProps = { key: 'id', label: 'label', children: 'children' }
|
|
156
|
+
const userProps = { key: 'id', label: 'name' }
|
|
157
|
+
const roleProps = { key: 'id', label: 'name' }
|
|
158
|
+
|
|
159
|
+
const titleMap = ['人员选择', '角色选择']
|
|
160
|
+
const dialogVisible = ref(false)
|
|
161
|
+
const showGrouploading = ref(false)
|
|
162
|
+
const showUserloading = ref(false)
|
|
163
|
+
const keyword = ref('')
|
|
164
|
+
const groupId = ref('')
|
|
165
|
+
const pageSize = ref(props.pageSizeDefault)
|
|
166
|
+
const total = ref(0)
|
|
167
|
+
const currentPage = ref(1)
|
|
168
|
+
const group = ref([])
|
|
169
|
+
const user = ref([])
|
|
170
|
+
const role = ref([])
|
|
171
|
+
const type = ref(1)
|
|
172
|
+
const selected = ref([])
|
|
173
|
+
const value = ref([])
|
|
174
|
+
const groupTree = ref(null)
|
|
175
|
+
const userTree = ref(null)
|
|
176
|
+
const userScrollbar = ref(null)
|
|
177
|
+
|
|
178
|
+
const selectedIds = computed(() => selected.value.map((item) => item.id))
|
|
179
|
+
|
|
180
|
+
const mapUser = (item) => ({
|
|
181
|
+
id: item.id ?? item.userId ?? item.username,
|
|
182
|
+
name: item.realName || item.nickName || item.name || item.userName || item.username || `用户${item.id}`,
|
|
183
|
+
deptName: item.deptName || ''
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
const getGroup = async () => {
|
|
187
|
+
if (typeof adapters?.fetchDepartments !== 'function') {
|
|
188
|
+
group.value = [{ id: '', label: '所有' }]
|
|
189
|
+
return
|
|
190
|
+
}
|
|
191
|
+
showGrouploading.value = true
|
|
192
|
+
try {
|
|
193
|
+
const res = await adapters.fetchDepartments()
|
|
194
|
+
const list = Array.isArray(res) ? res : res?.list || res?.data || []
|
|
195
|
+
group.value = [{ id: '', label: '所有' }, ...list]
|
|
196
|
+
} catch {
|
|
197
|
+
group.value = [{ id: '', label: '所有' }]
|
|
198
|
+
} finally {
|
|
199
|
+
showGrouploading.value = false
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const getUser = async () => {
|
|
204
|
+
if (typeof adapters?.fetchUsers !== 'function') {
|
|
205
|
+
user.value = []
|
|
206
|
+
total.value = 0
|
|
207
|
+
return
|
|
208
|
+
}
|
|
209
|
+
showUserloading.value = true
|
|
210
|
+
try {
|
|
211
|
+
const res = await adapters.fetchUsers({
|
|
212
|
+
keyword: keyword.value || null,
|
|
213
|
+
groupId: groupId.value || null,
|
|
214
|
+
page: currentPage.value,
|
|
215
|
+
pageSize: pageSize.value
|
|
216
|
+
})
|
|
217
|
+
const list = Array.isArray(res) ? res : res?.list || res?.rows || res?.data || []
|
|
218
|
+
user.value = list.map(mapUser)
|
|
219
|
+
total.value = Number(Array.isArray(res) ? list.length : res?.total) || list.length
|
|
220
|
+
userScrollbar.value?.setScrollTop(0)
|
|
221
|
+
} catch {
|
|
222
|
+
user.value = []
|
|
223
|
+
total.value = 0
|
|
224
|
+
} finally {
|
|
225
|
+
showUserloading.value = false
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const getRole = async () => {
|
|
230
|
+
if (typeof adapters?.fetchRoles !== 'function') {
|
|
231
|
+
role.value = []
|
|
232
|
+
return
|
|
233
|
+
}
|
|
234
|
+
showGrouploading.value = true
|
|
235
|
+
try {
|
|
236
|
+
const res = await adapters.fetchRoles({ keyword: keyword.value || null })
|
|
237
|
+
const list = Array.isArray(res) ? res : res?.list || res?.rows || res?.data || []
|
|
238
|
+
role.value = list.map((item) => ({
|
|
239
|
+
id: item.id ?? item.roleId,
|
|
240
|
+
name: item.roleName || item.name || `角色${item.id}`
|
|
241
|
+
}))
|
|
242
|
+
} catch {
|
|
243
|
+
role.value = []
|
|
244
|
+
} finally {
|
|
245
|
+
showGrouploading.value = false
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const open = (openType, target) => {
|
|
250
|
+
type.value = openType
|
|
251
|
+
value.value = target || []
|
|
252
|
+
selected.value = JSON.parse(JSON.stringify(target || []).filter((item) => item && item.id !== undefined))
|
|
253
|
+
dialogVisible.value = true
|
|
254
|
+
keyword.value = ''
|
|
255
|
+
groupId.value = ''
|
|
256
|
+
currentPage.value = 1
|
|
257
|
+
if (type.value == 1) {
|
|
258
|
+
getGroup()
|
|
259
|
+
getUser()
|
|
260
|
+
} else if (type.value == 2) {
|
|
261
|
+
getRole()
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const groupClick = (data) => {
|
|
266
|
+
keyword.value = ''
|
|
267
|
+
currentPage.value = 1
|
|
268
|
+
groupId.value = data[groupProps.key]
|
|
269
|
+
getUser()
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const userClick = (data, checked) => {
|
|
273
|
+
if (checked) {
|
|
274
|
+
if (!selected.value.some((item) => item.id === data[userProps.key])) {
|
|
275
|
+
selected.value.push({ id: data[userProps.key], name: data[userProps.label], deptName: data.deptName || '' })
|
|
276
|
+
}
|
|
277
|
+
} else {
|
|
278
|
+
selected.value = selected.value.filter((item) => item.id !== data[userProps.key])
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const roleClick = (data, checked) => {
|
|
283
|
+
if (checked) {
|
|
284
|
+
if (!selected.value.some((item) => item.id === data[roleProps.key])) {
|
|
285
|
+
selected.value.push({ id: data[roleProps.key], name: data[roleProps.label] })
|
|
286
|
+
}
|
|
287
|
+
} else {
|
|
288
|
+
selected.value = selected.value.filter((item) => item.id !== data[roleProps.key])
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const paginationChange = () => {
|
|
293
|
+
getUser()
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const search = () => {
|
|
297
|
+
groupId.value = ''
|
|
298
|
+
groupTree.value?.setCurrentKey('')
|
|
299
|
+
currentPage.value = 1
|
|
300
|
+
getUser()
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const deleteSelected = (index) => {
|
|
304
|
+
selected.value.splice(index, 1)
|
|
305
|
+
if (type.value == 1) {
|
|
306
|
+
userTree.value?.setCheckedKeys(selectedIds.value)
|
|
307
|
+
} else if (type.value == 2) {
|
|
308
|
+
groupTree.value?.setCheckedKeys(selectedIds.value)
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const save = () => {
|
|
313
|
+
value.value.splice(0, value.value.length)
|
|
314
|
+
selected.value.forEach((item) => {
|
|
315
|
+
value.value.push(item)
|
|
316
|
+
})
|
|
317
|
+
dialogVisible.value = false
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
defineExpose({ open })
|
|
321
|
+
</script>
|
|
322
|
+
|
|
323
|
+
<style scoped lang="scss">
|
|
324
|
+
.sc-user-select {
|
|
325
|
+
display: flex;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.sc-user-select__left {
|
|
329
|
+
width: 400px;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.sc-user-select__right {
|
|
333
|
+
flex: 1;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.sc-user-select__search {
|
|
337
|
+
padding-bottom: 10px;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.sc-user-select__select {
|
|
341
|
+
display: flex;
|
|
342
|
+
border: 1px solid var(--el-border-color-light);
|
|
343
|
+
background: var(--el-color-white);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.sc-user-select__tree {
|
|
347
|
+
width: 200px;
|
|
348
|
+
height: 300px;
|
|
349
|
+
border-right: 1px solid var(--el-border-color-light);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.sc-user-select__user {
|
|
353
|
+
width: 200px;
|
|
354
|
+
height: 300px;
|
|
355
|
+
display: flex;
|
|
356
|
+
flex-direction: column;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.sc-user-select__user__list {
|
|
360
|
+
flex: 1;
|
|
361
|
+
overflow: auto;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.sc-user-select__user footer {
|
|
365
|
+
height: 36px;
|
|
366
|
+
padding-top: 5px;
|
|
367
|
+
border-top: 1px solid var(--el-border-color-light);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.sc-user-select__toicon {
|
|
371
|
+
display: flex;
|
|
372
|
+
justify-content: center;
|
|
373
|
+
align-items: center;
|
|
374
|
+
margin: 0 10px;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.sc-user-select__toicon i,
|
|
378
|
+
.sc-user-select__toicon .el-icon {
|
|
379
|
+
display: flex;
|
|
380
|
+
justify-content: center;
|
|
381
|
+
align-items: center;
|
|
382
|
+
background: #ccc;
|
|
383
|
+
width: 20px;
|
|
384
|
+
height: 20px;
|
|
385
|
+
text-align: center;
|
|
386
|
+
line-height: 20px;
|
|
387
|
+
border-radius: 50%;
|
|
388
|
+
color: #fff;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.sc-user-select__selected {
|
|
392
|
+
height: 345px;
|
|
393
|
+
width: 200px;
|
|
394
|
+
border: 1px solid var(--el-border-color-light);
|
|
395
|
+
background: var(--el-color-white);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.sc-user-select__selected header {
|
|
399
|
+
height: 43px;
|
|
400
|
+
line-height: 43px;
|
|
401
|
+
border-bottom: 1px solid var(--el-border-color-light);
|
|
402
|
+
padding: 0 15px;
|
|
403
|
+
font-size: 12px;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.sc-user-select__selected ul {
|
|
407
|
+
height: 300px;
|
|
408
|
+
overflow: auto;
|
|
409
|
+
margin: 0;
|
|
410
|
+
padding: 0;
|
|
411
|
+
list-style: none;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.sc-user-select__selected li {
|
|
415
|
+
display: flex;
|
|
416
|
+
align-items: center;
|
|
417
|
+
justify-content: space-between;
|
|
418
|
+
padding: 5px 5px 5px 15px;
|
|
419
|
+
height: 38px;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.sc-user-select__selected li .name {
|
|
423
|
+
display: flex;
|
|
424
|
+
align-items: center;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.sc-user-select__selected li .name .el-avatar {
|
|
428
|
+
background: #409eff;
|
|
429
|
+
margin-right: 10px;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.sc-user-select__selected li .delete {
|
|
433
|
+
display: none;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.sc-user-select__selected li:hover {
|
|
437
|
+
background: var(--el-color-primary-light-9);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.sc-user-select__selected li:hover .delete {
|
|
441
|
+
display: inline-block;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.sc-user-select-role .sc-user-select__left {
|
|
445
|
+
width: 200px;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.sc-user-select-role .sc-user-select__tree {
|
|
449
|
+
border: none;
|
|
450
|
+
height: 343px;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
[data-theme='dark'] .sc-user-select__selected li:hover {
|
|
454
|
+
background: rgba(0, 0, 0, 0.2);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
[data-theme='dark'] .sc-user-select__toicon i {
|
|
458
|
+
background: #383838;
|
|
459
|
+
}
|
|
460
|
+
</style>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { findFormVariable, OPERATOR_LABEL_MAP } from 'gbformdesign'
|
|
2
|
+
|
|
3
|
+
export function getVariable(formVariables, variableName) {
|
|
4
|
+
return findFormVariable(formVariables, variableName)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Maps a form variable to the editor control used for its comparison value.
|
|
9
|
+
*/
|
|
10
|
+
export function getValueControl(formVariables, variableName) {
|
|
11
|
+
const variable = getVariable(formVariables, variableName)
|
|
12
|
+
if (!variable) return 'text'
|
|
13
|
+
const dataType = variable.dataType
|
|
14
|
+
if (dataType === 'integer' || dataType === 'decimal') return 'number'
|
|
15
|
+
if (dataType === 'date') return 'date'
|
|
16
|
+
if (dataType === 'datetime') return 'datetime'
|
|
17
|
+
if (dataType === 'array') return 'array'
|
|
18
|
+
if (dataType === 'boolean') return 'boolean'
|
|
19
|
+
if (['radio-group', 'select'].includes(variable.componentType)) return 'options'
|
|
20
|
+
return 'text'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getVariableOptions(formVariables, variableName) {
|
|
24
|
+
const variable = getVariable(formVariables, variableName)
|
|
25
|
+
return variable?.getOptions?.() || variable?.metadata?.options || []
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function getVariableDateFormat(formVariables, variableName) {
|
|
29
|
+
const variable = getVariable(formVariables, variableName)
|
|
30
|
+
return variable?.getDateFormat?.() || variable?.metadata?.dateFormat || 'date'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function isIntegerVariable(formVariables, variableName) {
|
|
34
|
+
const variable = getVariable(formVariables, variableName)
|
|
35
|
+
return variable?.dataType === 'integer'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function operatorLabel(operator) {
|
|
39
|
+
return OPERATOR_LABEL_MAP[operator] || operator || ''
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function operatorsForVariable(formVariables, variableName) {
|
|
43
|
+
const variable = getVariable(formVariables, variableName)
|
|
44
|
+
const dataType = variable?.dataType || 'string'
|
|
45
|
+
return Object.entries(OPERATOR_LABEL_MAP)
|
|
46
|
+
.filter(([value]) => {
|
|
47
|
+
if (value === 'is_empty' || value === 'is_not_empty') return true
|
|
48
|
+
if (dataType === 'array') return ['contains', 'not_contains'].includes(value)
|
|
49
|
+
if (dataType === 'boolean') return ['==', '!='].includes(value)
|
|
50
|
+
if (['integer', 'decimal', 'date', 'datetime'].includes(dataType)) {
|
|
51
|
+
return ['==', '!=', '>', '<', '>=', '<='].includes(value)
|
|
52
|
+
}
|
|
53
|
+
return ['==', '!=', 'contains', 'not_contains'].includes(value)
|
|
54
|
+
})
|
|
55
|
+
.map(([value, label]) => ({ value, label }))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function needsValue(operator) {
|
|
59
|
+
return !['is_empty', 'is_not_empty'].includes(operator)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Condition summary in the reference project's style:
|
|
64
|
+
* `field operator value` joined by 和 / 或者.
|
|
65
|
+
*/
|
|
66
|
+
export function summarizeConditions(formVariables, conditions) {
|
|
67
|
+
if (!Array.isArray(conditions) || conditions.length === 0) return ''
|
|
68
|
+
return conditions
|
|
69
|
+
.map((condition, index) => {
|
|
70
|
+
const label = condition.variableName || condition.variable || '未设置'
|
|
71
|
+
const op = operatorLabel(condition.operator)
|
|
72
|
+
let text
|
|
73
|
+
if (!needsValue(condition.operator)) {
|
|
74
|
+
text = `${label}${op}`
|
|
75
|
+
} else {
|
|
76
|
+
const value = Array.isArray(condition.value) ? condition.value.join(',') : condition.value
|
|
77
|
+
text = `${label}${op}${value === undefined || value === null ? '' : value}`
|
|
78
|
+
}
|
|
79
|
+
if (index < conditions.length - 1) {
|
|
80
|
+
text += condition.logic === 'OR' ? ' 或者 ' : ' 和 '
|
|
81
|
+
}
|
|
82
|
+
return text
|
|
83
|
+
})
|
|
84
|
+
.join('')
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The designer edits conditions as OR-separated groups (flowlong style),
|
|
89
|
+
* while the schema stores a flat list linked by the preceding `logic` flag.
|
|
90
|
+
*/
|
|
91
|
+
export function groupsFromConditions(conditions) {
|
|
92
|
+
const list = Array.isArray(conditions) ? conditions : []
|
|
93
|
+
const groups = [[]]
|
|
94
|
+
list.forEach((condition) => {
|
|
95
|
+
groups[groups.length - 1].push({ ...condition })
|
|
96
|
+
if (condition.logic === 'OR') groups.push([])
|
|
97
|
+
})
|
|
98
|
+
const last = groups[groups.length - 1]
|
|
99
|
+
if (last.length === 0) groups.pop()
|
|
100
|
+
if (groups.length === 0) groups.push([])
|
|
101
|
+
return groups
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function conditionsFromGroups(groups) {
|
|
105
|
+
const result = []
|
|
106
|
+
groups.forEach((group, groupIndex) => {
|
|
107
|
+
group.forEach((condition, index) => {
|
|
108
|
+
const isLastOfGroup = index === group.length - 1
|
|
109
|
+
const isLastGroup = groupIndex === groups.length - 1
|
|
110
|
+
result.push({
|
|
111
|
+
...condition,
|
|
112
|
+
logic: isLastOfGroup && !isLastGroup ? 'OR' : 'AND'
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
return result
|
|
117
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as FlowCanvas } from './FlowCanvas.vue'
|
|
2
|
+
export { default as ScWorkflow } from './ScWorkflow.vue'
|
|
3
|
+
export { default as NodeStatusBadge } from './NodeStatusBadge.vue'
|
|
4
|
+
export { default as NodeProgressDetail } from './NodeProgressDetail.vue'
|
|
5
|
+
export * from './conditionHelpers.js'
|
|
6
|
+
export { useScNodeStatus } from './useScNodeStatus.js'
|