vue3-admin-gpt 1.0.0
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/.env.development +14 -0
- package/.env.production +14 -0
- package/LICENSE +21 -0
- package/README.en.md +106 -0
- package/README.md +104 -0
- package/build-zip.cjs +53 -0
- package/cli.js +110 -0
- package/jsconfig.json +9 -0
- package/package.json +92 -0
- package/public/index.html +20 -0
- package/public/robots.txt +2 -0
- package/rspack.config.js +282 -0
- package/rspack.js +162 -0
- package/src/App.vue +9 -0
- package/src/api/icon.js +9 -0
- package/src/api/router.js +9 -0
- package/src/api/table.js +25 -0
- package/src/api/tree.js +9 -0
- package/src/api/user.js +34 -0
- package/src/assets/error_images/401.png +0 -0
- package/src/assets/error_images/404.png +0 -0
- package/src/assets/error_images/cloud.png +0 -0
- package/src/assets/login_images/background.jpg +0 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/qr_logo/lqr_logo.png +0 -0
- package/src/assets/vuejs-fill.svg +4 -0
- package/src/components/VabPageHeader/index.vue +133 -0
- package/src/config/index.js +7 -0
- package/src/config/net.config.js +20 -0
- package/src/config/permission.js +136 -0
- package/src/config/setting.config.js +62 -0
- package/src/config/settings.js +6 -0
- package/src/config/theme.config.js +14 -0
- package/src/layouts/EmptyLayout.vue +3 -0
- package/src/layouts/components/VabAppMain/index.vue +109 -0
- package/src/layouts/components/VabAvatar/index.vue +255 -0
- package/src/layouts/components/VabBreadcrumb/index.vue +61 -0
- package/src/layouts/components/VabFullScreen/index.vue +61 -0
- package/src/layouts/components/VabLogo/index.vue +94 -0
- package/src/layouts/components/VabNav/index.vue +176 -0
- package/src/layouts/components/VabSide/components/VabMenuItem.vue +80 -0
- package/src/layouts/components/VabSide/components/VabSideItem.vue +100 -0
- package/src/layouts/components/VabSide/components/VabSubmenu.vue +56 -0
- package/src/layouts/components/VabSide/index.vue +123 -0
- package/src/layouts/components/VabTabs/index.vue +500 -0
- package/src/layouts/components/VabTheme/index.vue +603 -0
- package/src/layouts/components/VabTop/index.vue +286 -0
- package/src/layouts/export.js +29 -0
- package/src/layouts/index.vue +339 -0
- package/src/main.js +40 -0
- package/src/plugins/echarts.js +4 -0
- package/src/plugins/index.js +44 -0
- package/src/plugins/support.js +16 -0
- package/src/router/index.js +400 -0
- package/src/store/index.js +26 -0
- package/src/store/modules/errorLog.js +27 -0
- package/src/store/modules/routes.js +60 -0
- package/src/store/modules/settings.js +73 -0
- package/src/store/modules/table.js +22 -0
- package/src/store/modules/tabsBar.js +109 -0
- package/src/store/modules/user.js +131 -0
- package/src/styles/element-variables.scss +13 -0
- package/src/styles/loading.scss +345 -0
- package/src/styles/nav-icons.scss +52 -0
- package/src/styles/normalize.scss +353 -0
- package/src/styles/spinner/dots.css +68 -0
- package/src/styles/spinner/gauge.css +104 -0
- package/src/styles/spinner/inner-circles.css +51 -0
- package/src/styles/spinner/plus.css +341 -0
- package/src/styles/themes/default.scss +1 -0
- package/src/styles/transition.scss +18 -0
- package/src/styles/vab.scss +476 -0
- package/src/styles/variables.scss +69 -0
- package/src/utils/accessToken.js +56 -0
- package/src/utils/eventBus.js +8 -0
- package/src/utils/handleRoutes.js +100 -0
- package/src/utils/index.js +231 -0
- package/src/utils/message.js +67 -0
- package/src/utils/pageTitle.js +11 -0
- package/src/utils/password.js +43 -0
- package/src/utils/permission.js +19 -0
- package/src/utils/request.js +187 -0
- package/src/utils/static.js +81 -0
- package/src/utils/vab.js +218 -0
- package/src/utils/validate.js +48 -0
- package/src/views/401.vue +302 -0
- package/src/views/404.vue +302 -0
- package/src/views/demo/index.vue +591 -0
- package/src/views/index/index.vue +1489 -0
- package/src/views/login/index.vue +456 -0
- package/src/views/register/index.vue +524 -0
- package/src/views/vab/calendar.vue +488 -0
- package/src/views/vab/campaign.vue +1006 -0
- package/src/views/vab/chart.vue +189 -0
- package/src/views/vab/customer.vue +666 -0
- package/src/views/vab/editor.vue +84 -0
- package/src/views/vab/form.vue +151 -0
- package/src/views/vab/help.vue +390 -0
- package/src/views/vab/icon.vue +113 -0
- package/src/views/vab/knowledge.vue +820 -0
- package/src/views/vab/nested/menu1/menu2/menu3.vue +29 -0
- package/src/views/vab/nested/menu1/menu2.vue +33 -0
- package/src/views/vab/nested/menu1.vue +33 -0
- package/src/views/vab/nested.vue +97 -0
- package/src/views/vab/notification.vue +416 -0
- package/src/views/vab/order.vue +507 -0
- package/src/views/vab/permissions.vue +214 -0
- package/src/views/vab/product.vue +724 -0
- package/src/views/vab/project.vue +559 -0
- package/src/views/vab/settings.vue +319 -0
- package/src/views/vab/statistics.vue +431 -0
- package/src/views/vab/table.vue +110 -0
- package/src/views/vab/task.vue +613 -0
- package/src/views/vab/team.vue +662 -0
- package/src/views/vab/tree.vue +44 -0
- package/src/views/vab/upload.vue +180 -0
- package/src/views/vab/vue3Demo/index.vue +103 -0
- package/src/views/vab/workflow.vue +863 -0
|
@@ -0,0 +1,863 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="workflow-container">
|
|
3
|
+
<el-card shadow="never">
|
|
4
|
+
<template #header>
|
|
5
|
+
<div class="card-header">
|
|
6
|
+
<span>工作流</span>
|
|
7
|
+
<div class="header-actions">
|
|
8
|
+
<el-input
|
|
9
|
+
v-model="searchText"
|
|
10
|
+
placeholder="搜索工作流..."
|
|
11
|
+
clearable
|
|
12
|
+
style="width: 200px; margin-right: 10px"
|
|
13
|
+
>
|
|
14
|
+
<template #prefix>
|
|
15
|
+
<el-icon><Search /></el-icon>
|
|
16
|
+
</template>
|
|
17
|
+
</el-input>
|
|
18
|
+
<el-button type="primary" @click="showAddWorkflowDialog">创建工作流</el-button>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<el-tabs v-model="activeTab" @tab-change="handleTabChange">
|
|
24
|
+
<el-tab-pane label="所有工作流" name="all">
|
|
25
|
+
<el-table
|
|
26
|
+
:data="filteredWorkflows"
|
|
27
|
+
style="width: 100%"
|
|
28
|
+
row-key="id"
|
|
29
|
+
v-loading="loading"
|
|
30
|
+
>
|
|
31
|
+
<el-table-column prop="name" label="工作流名称" min-width="200">
|
|
32
|
+
<template #default="{ row }">
|
|
33
|
+
<div class="workflow-name">
|
|
34
|
+
<el-icon :color="row.color"><Connection /></el-icon>
|
|
35
|
+
<span style="margin-left: 10px">{{ row.name }}</span>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
</el-table-column>
|
|
39
|
+
<el-table-column prop="description" label="描述" min-width="250">
|
|
40
|
+
<template #default="{ row }">
|
|
41
|
+
<div class="workflow-description">{{ row.description }}</div>
|
|
42
|
+
</template>
|
|
43
|
+
</el-table-column>
|
|
44
|
+
<el-table-column label="状态" width="100">
|
|
45
|
+
<template #default="{ row }">
|
|
46
|
+
<el-tag :type="getStatusType(row.status)">
|
|
47
|
+
{{ getStatusText(row.status) }}
|
|
48
|
+
</el-tag>
|
|
49
|
+
</template>
|
|
50
|
+
</el-table-column>
|
|
51
|
+
<el-table-column prop="creator" label="创建者" width="120" />
|
|
52
|
+
<el-table-column prop="createTime" label="创建时间" width="180" />
|
|
53
|
+
<el-table-column label="操作" width="250">
|
|
54
|
+
<template #default="{ row }">
|
|
55
|
+
<el-button type="text" @click="viewWorkflow(row)">查看</el-button>
|
|
56
|
+
<el-button type="text" @click="editWorkflow(row)">编辑</el-button>
|
|
57
|
+
<el-button type="text" @click="startWorkflow(row)">启动</el-button>
|
|
58
|
+
<el-button type="text" @click="deleteWorkflow(row)">删除</el-button>
|
|
59
|
+
</template>
|
|
60
|
+
</el-table-column>
|
|
61
|
+
</el-table>
|
|
62
|
+
</el-tab-pane>
|
|
63
|
+
|
|
64
|
+
<el-tab-pane label="我创建的" name="created">
|
|
65
|
+
<el-table
|
|
66
|
+
:data="myWorkflows"
|
|
67
|
+
style="width: 100%"
|
|
68
|
+
row-key="id"
|
|
69
|
+
>
|
|
70
|
+
<el-table-column prop="name" label="工作流名称" min-width="200">
|
|
71
|
+
<template #default="{ row }">
|
|
72
|
+
<div class="workflow-name">
|
|
73
|
+
<el-icon :color="row.color"><Connection /></el-icon>
|
|
74
|
+
<span style="margin-left: 10px">{{ row.name }}</span>
|
|
75
|
+
</div>
|
|
76
|
+
</template>
|
|
77
|
+
</el-table-column>
|
|
78
|
+
<el-table-column prop="description" label="描述" min-width="250" />
|
|
79
|
+
<el-table-column label="状态" width="100">
|
|
80
|
+
<template #default="{ row }">
|
|
81
|
+
<el-tag :type="getStatusType(row.status)">
|
|
82
|
+
{{ getStatusText(row.status) }}
|
|
83
|
+
</el-tag>
|
|
84
|
+
</template>
|
|
85
|
+
</el-table-column>
|
|
86
|
+
<el-table-column prop="createTime" label="创建时间" width="180" />
|
|
87
|
+
<el-table-column label="操作" width="200">
|
|
88
|
+
<template #default="{ row }">
|
|
89
|
+
<el-button type="text" @click="viewWorkflow(row)">查看</el-button>
|
|
90
|
+
<el-button type="text" @click="editWorkflow(row)">编辑</el-button>
|
|
91
|
+
<el-button type="text" @click="startWorkflow(row)">启动</el-button>
|
|
92
|
+
</template>
|
|
93
|
+
</el-table-column>
|
|
94
|
+
</el-table>
|
|
95
|
+
</el-tab-pane>
|
|
96
|
+
|
|
97
|
+
<el-tab-pane label="我参与的" name="participated">
|
|
98
|
+
<el-table
|
|
99
|
+
:data="participatedWorkflows"
|
|
100
|
+
style="width: 100%"
|
|
101
|
+
row-key="id"
|
|
102
|
+
>
|
|
103
|
+
<el-table-column prop="name" label="工作流名称" min-width="200">
|
|
104
|
+
<template #default="{ row }">
|
|
105
|
+
<div class="workflow-name">
|
|
106
|
+
<el-icon :color="row.color"><Connection /></el-icon>
|
|
107
|
+
<span style="margin-left: 10px">{{ row.name }}</span>
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
|
110
|
+
</el-table-column>
|
|
111
|
+
<el-table-column prop="description" label="描述" min-width="250" />
|
|
112
|
+
<el-table-column label="我的角色" width="120">
|
|
113
|
+
<template #default="{ row }">
|
|
114
|
+
<el-tag>{{ getMyRole(row) }}</el-tag>
|
|
115
|
+
</template>
|
|
116
|
+
</el-table-column>
|
|
117
|
+
<el-table-column label="状态" width="100">
|
|
118
|
+
<template #default="{ row }">
|
|
119
|
+
<el-tag :type="getStatusType(row.status)">
|
|
120
|
+
{{ getStatusText(row.status) }}
|
|
121
|
+
</el-tag>
|
|
122
|
+
</template>
|
|
123
|
+
</el-table-column>
|
|
124
|
+
<el-table-column prop="creator" label="创建者" width="120" />
|
|
125
|
+
<el-table-column label="操作" width="150">
|
|
126
|
+
<template #default="{ row }">
|
|
127
|
+
<el-button type="text" @click="viewWorkflow(row)">查看</el-button>
|
|
128
|
+
<el-button type="text" @click="processWorkflow(row)">处理</el-button>
|
|
129
|
+
</template>
|
|
130
|
+
</el-table-column>
|
|
131
|
+
</el-table>
|
|
132
|
+
</el-tab-pane>
|
|
133
|
+
</el-tabs>
|
|
134
|
+
|
|
135
|
+
<div class="pagination-container">
|
|
136
|
+
<el-pagination
|
|
137
|
+
v-model:current-page="currentPage"
|
|
138
|
+
v-model:page-size="pageSize"
|
|
139
|
+
:page-sizes="[10, 20, 50, 100]"
|
|
140
|
+
:total="totalWorkflows"
|
|
141
|
+
layout="total, sizes, prev, pager, next, jumper"
|
|
142
|
+
@size-change="handleSizeChange"
|
|
143
|
+
@current-change="handleCurrentChange"
|
|
144
|
+
/>
|
|
145
|
+
</div>
|
|
146
|
+
</el-card>
|
|
147
|
+
|
|
148
|
+
<!-- 添加/编辑工作流对话框 -->
|
|
149
|
+
<el-dialog
|
|
150
|
+
v-model="workflowDialogVisible"
|
|
151
|
+
:title="editingWorkflow ? '编辑工作流' : '创建工作流'"
|
|
152
|
+
width="800px"
|
|
153
|
+
>
|
|
154
|
+
<el-form
|
|
155
|
+
ref="workflowFormRef"
|
|
156
|
+
:model="workflowForm"
|
|
157
|
+
:rules="workflowRules"
|
|
158
|
+
label-width="100px"
|
|
159
|
+
>
|
|
160
|
+
<el-row :gutter="20">
|
|
161
|
+
<el-col :span="12">
|
|
162
|
+
<el-form-item label="工作流名称" prop="name">
|
|
163
|
+
<el-input v-model="workflowForm.name" />
|
|
164
|
+
</el-form-item>
|
|
165
|
+
|
|
166
|
+
<el-form-item label="描述" prop="description">
|
|
167
|
+
<el-input
|
|
168
|
+
v-model="workflowForm.description"
|
|
169
|
+
type="textarea"
|
|
170
|
+
:rows="3"
|
|
171
|
+
/>
|
|
172
|
+
</el-form-item>
|
|
173
|
+
|
|
174
|
+
<el-form-item label="创建者">
|
|
175
|
+
<el-input v-model="workflowForm.creator" disabled />
|
|
176
|
+
</el-form-item>
|
|
177
|
+
</el-col>
|
|
178
|
+
|
|
179
|
+
<el-col :span="12">
|
|
180
|
+
<el-form-item label="状态">
|
|
181
|
+
<el-select v-model="workflowForm.status" placeholder="请选择状态" style="width: 100%">
|
|
182
|
+
<el-option label="草稿" value="draft"></el-option>
|
|
183
|
+
<el-option label="已发布" value="published"></el-option>
|
|
184
|
+
<el-option label="已停用" value="disabled"></el-option>
|
|
185
|
+
</el-select>
|
|
186
|
+
</el-form-item>
|
|
187
|
+
|
|
188
|
+
<el-form-item label="工作流颜色">
|
|
189
|
+
<el-color-picker v-model="workflowForm.color" />
|
|
190
|
+
</el-form-item>
|
|
191
|
+
|
|
192
|
+
<el-form-item label="可见范围">
|
|
193
|
+
<el-select v-model="workflowForm.visibility" placeholder="请选择可见范围" style="width: 100%">
|
|
194
|
+
<el-option label="所有人" value="public"></el-option>
|
|
195
|
+
<el-option label="仅创建者" value="private"></el-option>
|
|
196
|
+
<el-option label="指定部门" value="department"></el-option>
|
|
197
|
+
</el-select>
|
|
198
|
+
</el-form-item>
|
|
199
|
+
</el-col>
|
|
200
|
+
</el-row>
|
|
201
|
+
|
|
202
|
+
<el-divider>流程节点</el-divider>
|
|
203
|
+
|
|
204
|
+
<div class="node-list">
|
|
205
|
+
<draggable
|
|
206
|
+
v-model="workflowForm.nodes"
|
|
207
|
+
item-key="id"
|
|
208
|
+
handle=".node-handle"
|
|
209
|
+
>
|
|
210
|
+
<template #item="{ element, index }">
|
|
211
|
+
<div class="node-item">
|
|
212
|
+
<div class="node-handle">
|
|
213
|
+
<el-icon><Rank /></el-icon>
|
|
214
|
+
</div>
|
|
215
|
+
<div class="node-content">
|
|
216
|
+
<el-form-item
|
|
217
|
+
:prop="`nodes.${index}.name`"
|
|
218
|
+
:rules="[{ required: true, message: '请输入节点名称', trigger: 'blur' }]"
|
|
219
|
+
>
|
|
220
|
+
<el-input v-model="element.name" placeholder="节点名称" />
|
|
221
|
+
</el-form-item>
|
|
222
|
+
|
|
223
|
+
<el-form-item
|
|
224
|
+
:prop="`nodes.${index}.assigneeType`"
|
|
225
|
+
:rules="[{ required: true, message: '请选择处理人类型', trigger: 'change' }]"
|
|
226
|
+
>
|
|
227
|
+
<el-select v-model="element.assigneeType" placeholder="处理人类型" style="width: 100%">
|
|
228
|
+
<el-option label="指定人员" value="user"></el-option>
|
|
229
|
+
<el-option label="指定角色" value="role"></el-option>
|
|
230
|
+
<el-option label="表单字段" value="field"></el-option>
|
|
231
|
+
</el-select>
|
|
232
|
+
</el-form-item>
|
|
233
|
+
|
|
234
|
+
<el-form-item
|
|
235
|
+
v-if="element.assigneeType === 'user'"
|
|
236
|
+
:prop="`nodes.${index}.assignee`"
|
|
237
|
+
:rules="[{ required: true, message: '请选择处理人', trigger: 'change' }]"
|
|
238
|
+
>
|
|
239
|
+
<el-select v-model="element.assignee" placeholder="处理人" style="width: 100%">
|
|
240
|
+
<el-option
|
|
241
|
+
v-for="user in users"
|
|
242
|
+
:key="user.id"
|
|
243
|
+
:label="user.name"
|
|
244
|
+
:value="user.id"
|
|
245
|
+
/>
|
|
246
|
+
</el-select>
|
|
247
|
+
</el-form-item>
|
|
248
|
+
|
|
249
|
+
<el-form-item
|
|
250
|
+
v-if="element.assigneeType === 'role'"
|
|
251
|
+
:prop="`nodes.${index}.role`"
|
|
252
|
+
:rules="[{ required: true, message: '请选择角色', trigger: 'change' }]"
|
|
253
|
+
>
|
|
254
|
+
<el-select v-model="element.role" placeholder="角色" style="width: 100%">
|
|
255
|
+
<el-option label="管理员" value="admin"></el-option>
|
|
256
|
+
<el-option label="经理" value="manager"></el-option>
|
|
257
|
+
<el-option label="员工" value="employee"></el-option>
|
|
258
|
+
</el-select>
|
|
259
|
+
</el-form-item>
|
|
260
|
+
</div>
|
|
261
|
+
<div class="node-actions">
|
|
262
|
+
<el-button
|
|
263
|
+
type="danger"
|
|
264
|
+
icon="Delete"
|
|
265
|
+
circle
|
|
266
|
+
@click="removeNode(index)"
|
|
267
|
+
/>
|
|
268
|
+
</div>
|
|
269
|
+
</div>
|
|
270
|
+
</template>
|
|
271
|
+
</draggable>
|
|
272
|
+
|
|
273
|
+
<div style="margin-top: 15px">
|
|
274
|
+
<el-button type="primary" @click="addNode">添加节点</el-button>
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
</el-form>
|
|
278
|
+
|
|
279
|
+
<template #footer>
|
|
280
|
+
<span class="dialog-footer">
|
|
281
|
+
<el-button @click="workflowDialogVisible = false">取消</el-button>
|
|
282
|
+
<el-button
|
|
283
|
+
type="primary"
|
|
284
|
+
@click="saveWorkflow"
|
|
285
|
+
>
|
|
286
|
+
保存
|
|
287
|
+
</el-button>
|
|
288
|
+
</span>
|
|
289
|
+
</template>
|
|
290
|
+
</el-dialog>
|
|
291
|
+
|
|
292
|
+
<!-- 工作流详情对话框 -->
|
|
293
|
+
<el-dialog
|
|
294
|
+
v-model="detailDialogVisible"
|
|
295
|
+
title="工作流详情"
|
|
296
|
+
width="800px"
|
|
297
|
+
>
|
|
298
|
+
<el-row :gutter="20">
|
|
299
|
+
<el-col :span="16">
|
|
300
|
+
<el-descriptions :column="1" border>
|
|
301
|
+
<el-descriptions-item label="工作流名称">{{ detailWorkflow.name }}</el-descriptions-item>
|
|
302
|
+
<el-descriptions-item label="描述">{{ detailWorkflow.description }}</el-descriptions-item>
|
|
303
|
+
<el-descriptions-item label="创建者">{{ detailWorkflow.creator }}</el-descriptions-item>
|
|
304
|
+
<el-descriptions-item label="状态">
|
|
305
|
+
<el-tag :type="getStatusType(detailWorkflow.status)">
|
|
306
|
+
{{ getStatusText(detailWorkflow.status) }}
|
|
307
|
+
</el-tag>
|
|
308
|
+
</el-descriptions-item>
|
|
309
|
+
<el-descriptions-item label="创建时间">{{ detailWorkflow.createTime }}</el-descriptions-item>
|
|
310
|
+
</el-descriptions>
|
|
311
|
+
</el-col>
|
|
312
|
+
<el-col :span="8">
|
|
313
|
+
<div class="workflow-icon-detail" :style="{ color: detailWorkflow.color }">
|
|
314
|
+
<el-icon :size="60"><Connection /></el-icon>
|
|
315
|
+
</div>
|
|
316
|
+
</el-col>
|
|
317
|
+
</el-row>
|
|
318
|
+
|
|
319
|
+
<el-tabs v-model="workflowActiveTab" style="margin-top: 20px">
|
|
320
|
+
<el-tab-pane label="流程图" name="diagram">
|
|
321
|
+
<div class="workflow-diagram">
|
|
322
|
+
<div
|
|
323
|
+
v-for="(node, index) in detailWorkflow.nodes"
|
|
324
|
+
:key="node.id"
|
|
325
|
+
class="workflow-node"
|
|
326
|
+
:class="{ 'active': activeNodeIndex === index }"
|
|
327
|
+
@click="activeNodeIndex = index"
|
|
328
|
+
>
|
|
329
|
+
<div class="node-index">{{ index + 1 }}</div>
|
|
330
|
+
<div class="node-name">{{ node.name }}</div>
|
|
331
|
+
<div class="node-assignee">
|
|
332
|
+
<span v-if="node.assigneeType === 'user'">
|
|
333
|
+
处理人: {{ getUserById(node.assignee)?.name || '未指定' }}
|
|
334
|
+
</span>
|
|
335
|
+
<span v-else-if="node.assigneeType === 'role'">
|
|
336
|
+
角色: {{ getRoleText(node.role) }}
|
|
337
|
+
</span>
|
|
338
|
+
<span v-else>
|
|
339
|
+
字段: {{ node.field || '未指定' }}
|
|
340
|
+
</span>
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
</div>
|
|
344
|
+
</el-tab-pane>
|
|
345
|
+
<el-tab-pane label="实例" name="instances">
|
|
346
|
+
<el-table :data="workflowInstances" style="width: 100%">
|
|
347
|
+
<el-table-column prop="id" label="实例ID" width="100" />
|
|
348
|
+
<el-table-column prop="title" label="标题" />
|
|
349
|
+
<el-table-column label="当前节点" width="150">
|
|
350
|
+
<template #default="{ row }">
|
|
351
|
+
{{ getCurrentNodeName(row.currentNodeId) }}
|
|
352
|
+
</template>
|
|
353
|
+
</el-table-column>
|
|
354
|
+
<el-table-column label="状态" width="100">
|
|
355
|
+
<template #default="{ row }">
|
|
356
|
+
<el-tag :type="getInstanceStatusType(row.status)">
|
|
357
|
+
{{ getInstanceStatusText(row.status) }}
|
|
358
|
+
</el-tag>
|
|
359
|
+
</template>
|
|
360
|
+
</el-table-column>
|
|
361
|
+
<el-table-column prop="startTime" label="开始时间" width="180" />
|
|
362
|
+
<el-table-column label="操作" width="150">
|
|
363
|
+
<template #default="{ row }">
|
|
364
|
+
<el-button type="text" @click="viewInstance(row)">查看</el-button>
|
|
365
|
+
</template>
|
|
366
|
+
</el-table-column>
|
|
367
|
+
</el-table>
|
|
368
|
+
</el-tab-pane>
|
|
369
|
+
</el-tabs>
|
|
370
|
+
|
|
371
|
+
<template #footer>
|
|
372
|
+
<span class="dialog-footer">
|
|
373
|
+
<el-button @click="detailDialogVisible = false">关闭</el-button>
|
|
374
|
+
</span>
|
|
375
|
+
</template>
|
|
376
|
+
</el-dialog>
|
|
377
|
+
</div>
|
|
378
|
+
</template>
|
|
379
|
+
|
|
380
|
+
<script>
|
|
381
|
+
import { Search, Connection, Rank, Delete } from "@element-plus/icons-vue";
|
|
382
|
+
import draggable from "vuedraggable";
|
|
383
|
+
|
|
384
|
+
export default {
|
|
385
|
+
name: "Workflow",
|
|
386
|
+
components: {
|
|
387
|
+
Search,
|
|
388
|
+
Connection,
|
|
389
|
+
Rank,
|
|
390
|
+
Delete,
|
|
391
|
+
draggable
|
|
392
|
+
},
|
|
393
|
+
data() {
|
|
394
|
+
return {
|
|
395
|
+
activeTab: "all",
|
|
396
|
+
workflowActiveTab: "diagram",
|
|
397
|
+
searchText: "",
|
|
398
|
+
currentPage: 1,
|
|
399
|
+
pageSize: 10,
|
|
400
|
+
totalWorkflows: 0,
|
|
401
|
+
loading: false,
|
|
402
|
+
workflowDialogVisible: false,
|
|
403
|
+
detailDialogVisible: false,
|
|
404
|
+
activeNodeIndex: 0,
|
|
405
|
+
editingWorkflow: null,
|
|
406
|
+
workflows: [
|
|
407
|
+
{
|
|
408
|
+
id: 1,
|
|
409
|
+
name: "请假申请",
|
|
410
|
+
description: "员工请假申请审批流程",
|
|
411
|
+
status: "published",
|
|
412
|
+
creator: "张三",
|
|
413
|
+
createTime: "2023-05-01 10:00:00",
|
|
414
|
+
color: "#409EFF",
|
|
415
|
+
visibility: "public",
|
|
416
|
+
nodes: [
|
|
417
|
+
{
|
|
418
|
+
id: 1,
|
|
419
|
+
name: "提交申请",
|
|
420
|
+
assigneeType: "user",
|
|
421
|
+
assignee: 1
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
id: 2,
|
|
425
|
+
name: "直属上级审批",
|
|
426
|
+
assigneeType: "role",
|
|
427
|
+
role: "manager"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
id: 3,
|
|
431
|
+
name: "人事审批",
|
|
432
|
+
assigneeType: "role",
|
|
433
|
+
role: "admin"
|
|
434
|
+
}
|
|
435
|
+
]
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
id: 2,
|
|
439
|
+
name: "报销申请",
|
|
440
|
+
description: "员工费用报销审批流程",
|
|
441
|
+
status: "published",
|
|
442
|
+
creator: "李四",
|
|
443
|
+
createTime: "2023-05-05 14:30:00",
|
|
444
|
+
color: "#67C23A",
|
|
445
|
+
visibility: "public",
|
|
446
|
+
nodes: [
|
|
447
|
+
{
|
|
448
|
+
id: 1,
|
|
449
|
+
name: "提交报销",
|
|
450
|
+
assigneeType: "user",
|
|
451
|
+
assignee: 2
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
id: 2,
|
|
455
|
+
name: "部门经理审批",
|
|
456
|
+
assigneeType: "role",
|
|
457
|
+
role: "manager"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
id: 3,
|
|
461
|
+
name: "财务审批",
|
|
462
|
+
assigneeType: "role",
|
|
463
|
+
role: "admin"
|
|
464
|
+
}
|
|
465
|
+
]
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
id: 3,
|
|
469
|
+
name: "入职流程",
|
|
470
|
+
description: "新员工入职办理流程",
|
|
471
|
+
status: "draft",
|
|
472
|
+
creator: "王五",
|
|
473
|
+
createTime: "2023-05-10 09:15:00",
|
|
474
|
+
color: "#E6A23C",
|
|
475
|
+
visibility: "private",
|
|
476
|
+
nodes: [
|
|
477
|
+
{
|
|
478
|
+
id: 1,
|
|
479
|
+
name: "填写入职信息",
|
|
480
|
+
assigneeType: "user",
|
|
481
|
+
assignee: 3
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
id: 2,
|
|
485
|
+
name: "部门分配",
|
|
486
|
+
assigneeType: "role",
|
|
487
|
+
role: "manager"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
id: 3,
|
|
491
|
+
name: "IT设备分配",
|
|
492
|
+
assigneeType: "role",
|
|
493
|
+
role: "admin"
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
id: 4,
|
|
497
|
+
name: "人事手续办理",
|
|
498
|
+
assigneeType: "role",
|
|
499
|
+
role: "admin"
|
|
500
|
+
}
|
|
501
|
+
]
|
|
502
|
+
}
|
|
503
|
+
],
|
|
504
|
+
users: [
|
|
505
|
+
{ id: 1, name: "张三" },
|
|
506
|
+
{ id: 2, name: "李四" },
|
|
507
|
+
{ id: 3, name: "王五" },
|
|
508
|
+
{ id: 4, name: "赵六" },
|
|
509
|
+
{ id: 5, name: "钱七" }
|
|
510
|
+
],
|
|
511
|
+
workflowForm: {
|
|
512
|
+
name: "",
|
|
513
|
+
description: "",
|
|
514
|
+
status: "draft",
|
|
515
|
+
creator: "当前用户",
|
|
516
|
+
color: "#409EFF",
|
|
517
|
+
visibility: "public",
|
|
518
|
+
nodes: []
|
|
519
|
+
},
|
|
520
|
+
detailWorkflow: {},
|
|
521
|
+
workflowRules: {
|
|
522
|
+
name: [
|
|
523
|
+
{ required: true, message: "请输入工作流名称", trigger: "blur" }
|
|
524
|
+
],
|
|
525
|
+
description: [
|
|
526
|
+
{ required: true, message: "请输入描述", trigger: "blur" }
|
|
527
|
+
]
|
|
528
|
+
},
|
|
529
|
+
workflowInstances: [
|
|
530
|
+
{
|
|
531
|
+
id: 1001,
|
|
532
|
+
title: "张三的年假申请",
|
|
533
|
+
currentNodeId: 2,
|
|
534
|
+
status: "in-progress",
|
|
535
|
+
startTime: "2023-05-15 09:30:00"
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
id: 1002,
|
|
539
|
+
title: "李四的差旅报销",
|
|
540
|
+
currentNodeId: 3,
|
|
541
|
+
status: "in-progress",
|
|
542
|
+
startTime: "2023-05-16 14:20:00"
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
id: 1003,
|
|
546
|
+
title: "王五的病假申请",
|
|
547
|
+
currentNodeId: 1,
|
|
548
|
+
status: "completed",
|
|
549
|
+
startTime: "2023-05-10 11:45:00",
|
|
550
|
+
endTime: "2023-05-10 16:30:00"
|
|
551
|
+
}
|
|
552
|
+
]
|
|
553
|
+
};
|
|
554
|
+
},
|
|
555
|
+
computed: {
|
|
556
|
+
filteredWorkflows() {
|
|
557
|
+
let result = this.workflows;
|
|
558
|
+
|
|
559
|
+
// 搜索过滤
|
|
560
|
+
if (this.searchText) {
|
|
561
|
+
result = result.filter(workflow =>
|
|
562
|
+
workflow.name.toLowerCase().includes(this.searchText.toLowerCase()) ||
|
|
563
|
+
workflow.description.toLowerCase().includes(this.searchText.toLowerCase())
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// 分页处理
|
|
568
|
+
const start = (this.currentPage - 1) * this.pageSize;
|
|
569
|
+
const end = start + this.pageSize;
|
|
570
|
+
return result.slice(start, end);
|
|
571
|
+
},
|
|
572
|
+
myWorkflows() {
|
|
573
|
+
return this.workflows.filter(workflow => workflow.creator === "张三");
|
|
574
|
+
},
|
|
575
|
+
participatedWorkflows() {
|
|
576
|
+
return this.workflows.filter(workflow =>
|
|
577
|
+
workflow.nodes.some(node =>
|
|
578
|
+
(node.assigneeType === "user" && node.assignee === 1) ||
|
|
579
|
+
(node.assigneeType === "role" && node.role === "admin")
|
|
580
|
+
)
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
methods: {
|
|
585
|
+
handleTabChange(tab) {
|
|
586
|
+
this.activeTab = tab;
|
|
587
|
+
this.currentPage = 1;
|
|
588
|
+
},
|
|
589
|
+
handleSizeChange(val) {
|
|
590
|
+
this.pageSize = val;
|
|
591
|
+
this.currentPage = 1;
|
|
592
|
+
},
|
|
593
|
+
handleCurrentChange(val) {
|
|
594
|
+
this.currentPage = val;
|
|
595
|
+
},
|
|
596
|
+
getStatusText(status) {
|
|
597
|
+
const statusMap = {
|
|
598
|
+
"draft": "草稿",
|
|
599
|
+
"published": "已发布",
|
|
600
|
+
"disabled": "已停用"
|
|
601
|
+
};
|
|
602
|
+
return statusMap[status] || status;
|
|
603
|
+
},
|
|
604
|
+
getStatusType(status) {
|
|
605
|
+
const typeMap = {
|
|
606
|
+
"draft": "info",
|
|
607
|
+
"published": "success",
|
|
608
|
+
"disabled": "danger"
|
|
609
|
+
};
|
|
610
|
+
return typeMap[status] || "info";
|
|
611
|
+
},
|
|
612
|
+
getInstanceStatusText(status) {
|
|
613
|
+
const statusMap = {
|
|
614
|
+
"pending": "待处理",
|
|
615
|
+
"in-progress": "进行中",
|
|
616
|
+
"completed": "已完成",
|
|
617
|
+
"rejected": "已拒绝"
|
|
618
|
+
};
|
|
619
|
+
return statusMap[status] || status;
|
|
620
|
+
},
|
|
621
|
+
getInstanceStatusType(status) {
|
|
622
|
+
const typeMap = {
|
|
623
|
+
"pending": "info",
|
|
624
|
+
"in-progress": "warning",
|
|
625
|
+
"completed": "success",
|
|
626
|
+
"rejected": "danger"
|
|
627
|
+
};
|
|
628
|
+
return typeMap[status] || "info";
|
|
629
|
+
},
|
|
630
|
+
getRoleText(role) {
|
|
631
|
+
const roleMap = {
|
|
632
|
+
"admin": "管理员",
|
|
633
|
+
"manager": "经理",
|
|
634
|
+
"employee": "员工"
|
|
635
|
+
};
|
|
636
|
+
return roleMap[role] || role;
|
|
637
|
+
},
|
|
638
|
+
getMyRole(workflow) {
|
|
639
|
+
if (workflow.creator === "张三") {
|
|
640
|
+
return "创建者";
|
|
641
|
+
}
|
|
642
|
+
return "处理人";
|
|
643
|
+
},
|
|
644
|
+
getUserById(id) {
|
|
645
|
+
return this.users.find(user => user.id === id);
|
|
646
|
+
},
|
|
647
|
+
getCurrentNodeName(nodeId) {
|
|
648
|
+
if (!this.detailWorkflow.nodes) return "";
|
|
649
|
+
const node = this.detailWorkflow.nodes.find(n => n.id === nodeId);
|
|
650
|
+
return node ? node.name : "";
|
|
651
|
+
},
|
|
652
|
+
showAddWorkflowDialog() {
|
|
653
|
+
this.editingWorkflow = null;
|
|
654
|
+
this.workflowForm = {
|
|
655
|
+
name: "",
|
|
656
|
+
description: "",
|
|
657
|
+
status: "draft",
|
|
658
|
+
creator: "当前用户",
|
|
659
|
+
color: "#409EFF",
|
|
660
|
+
visibility: "public",
|
|
661
|
+
nodes: [
|
|
662
|
+
{
|
|
663
|
+
id: Date.now(),
|
|
664
|
+
name: "节点1",
|
|
665
|
+
assigneeType: "user",
|
|
666
|
+
assignee: 1
|
|
667
|
+
}
|
|
668
|
+
]
|
|
669
|
+
};
|
|
670
|
+
this.workflowDialogVisible = true;
|
|
671
|
+
this.$nextTick(() => {
|
|
672
|
+
this.$refs.workflowFormRef.resetFields();
|
|
673
|
+
});
|
|
674
|
+
},
|
|
675
|
+
editWorkflow(workflow) {
|
|
676
|
+
this.editingWorkflow = workflow;
|
|
677
|
+
this.workflowForm = JSON.parse(JSON.stringify(workflow));
|
|
678
|
+
this.workflowDialogVisible = true;
|
|
679
|
+
},
|
|
680
|
+
viewWorkflow(workflow) {
|
|
681
|
+
this.detailWorkflow = { ...workflow };
|
|
682
|
+
this.detailDialogVisible = true;
|
|
683
|
+
},
|
|
684
|
+
startWorkflow(workflow) {
|
|
685
|
+
this.$message.success(`已启动工作流: ${workflow.name}`);
|
|
686
|
+
},
|
|
687
|
+
processWorkflow(workflow) {
|
|
688
|
+
this.$message.success(`开始处理工作流: ${workflow.name}`);
|
|
689
|
+
},
|
|
690
|
+
deleteWorkflow(workflow) {
|
|
691
|
+
this.$confirm(`确定要删除工作流"${workflow.name}"吗?`, "提示", {
|
|
692
|
+
confirmButtonText: "确定",
|
|
693
|
+
cancelButtonText: "取消",
|
|
694
|
+
type: "warning"
|
|
695
|
+
}).then(() => {
|
|
696
|
+
const index = this.workflows.findIndex(w => w.id === workflow.id);
|
|
697
|
+
if (index !== -1) {
|
|
698
|
+
this.workflows.splice(index, 1);
|
|
699
|
+
this.totalWorkflows = this.workflows.length;
|
|
700
|
+
this.$message.success("工作流删除成功");
|
|
701
|
+
}
|
|
702
|
+
}).catch(() => {
|
|
703
|
+
this.$message.info("已取消删除");
|
|
704
|
+
});
|
|
705
|
+
},
|
|
706
|
+
saveWorkflow() {
|
|
707
|
+
this.$refs.workflowFormRef.validate((valid) => {
|
|
708
|
+
if (valid) {
|
|
709
|
+
if (this.editingWorkflow) {
|
|
710
|
+
// 编辑工作流
|
|
711
|
+
const index = this.workflows.findIndex(w => w.id === this.editingWorkflow.id);
|
|
712
|
+
if (index !== -1) {
|
|
713
|
+
this.workflows[index] = { ...this.editingWorkflow, ...this.workflowForm };
|
|
714
|
+
this.$message.success("工作流更新成功");
|
|
715
|
+
}
|
|
716
|
+
} else {
|
|
717
|
+
// 添加工作流
|
|
718
|
+
const newWorkflow = {
|
|
719
|
+
id: Date.now(),
|
|
720
|
+
createTime: new Date().toLocaleString(),
|
|
721
|
+
...this.workflowForm
|
|
722
|
+
};
|
|
723
|
+
this.workflows.push(newWorkflow);
|
|
724
|
+
this.totalWorkflows = this.workflows.length;
|
|
725
|
+
this.$message.success("工作流创建成功");
|
|
726
|
+
}
|
|
727
|
+
this.workflowDialogVisible = false;
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
},
|
|
731
|
+
addNode() {
|
|
732
|
+
this.workflowForm.nodes.push({
|
|
733
|
+
id: Date.now() + Math.random(),
|
|
734
|
+
name: `节点${this.workflowForm.nodes.length + 1}`,
|
|
735
|
+
assigneeType: "user",
|
|
736
|
+
assignee: 1
|
|
737
|
+
});
|
|
738
|
+
},
|
|
739
|
+
removeNode(index) {
|
|
740
|
+
if (this.workflowForm.nodes.length <= 1) {
|
|
741
|
+
this.$message.warning("至少需要保留一个节点");
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
this.workflowForm.nodes.splice(index, 1);
|
|
745
|
+
},
|
|
746
|
+
viewInstance(instance) {
|
|
747
|
+
this.$message.info(`查看实例: ${instance.id}`);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
</script>
|
|
752
|
+
|
|
753
|
+
<style lang="scss" scoped>
|
|
754
|
+
.workflow-container {
|
|
755
|
+
padding: 20px;
|
|
756
|
+
|
|
757
|
+
.card-header {
|
|
758
|
+
display: flex;
|
|
759
|
+
justify-content: space-between;
|
|
760
|
+
align-items: center;
|
|
761
|
+
font-weight: bold;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
.workflow-name {
|
|
765
|
+
display: flex;
|
|
766
|
+
align-items: center;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
.workflow-description {
|
|
770
|
+
display: -webkit-box;
|
|
771
|
+
-webkit-box-orient: vertical;
|
|
772
|
+
-webkit-line-clamp: 2;
|
|
773
|
+
overflow: hidden;
|
|
774
|
+
text-overflow: ellipsis;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
.workflow-icon-detail {
|
|
778
|
+
text-align: center;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
.pagination-container {
|
|
782
|
+
margin-top: 20px;
|
|
783
|
+
text-align: right;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
.node-list {
|
|
787
|
+
.node-item {
|
|
788
|
+
display: flex;
|
|
789
|
+
align-items: center;
|
|
790
|
+
margin-bottom: 15px;
|
|
791
|
+
padding: 10px;
|
|
792
|
+
border: 1px solid #ebeef5;
|
|
793
|
+
border-radius: 4px;
|
|
794
|
+
|
|
795
|
+
.node-handle {
|
|
796
|
+
cursor: move;
|
|
797
|
+
margin-right: 10px;
|
|
798
|
+
color: #999;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
.node-content {
|
|
802
|
+
flex: 1;
|
|
803
|
+
|
|
804
|
+
:deep(.el-form-item) {
|
|
805
|
+
margin-bottom: 10px;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
.node-actions {
|
|
810
|
+
margin-left: 10px;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
.workflow-diagram {
|
|
816
|
+
display: flex;
|
|
817
|
+
flex-direction: column;
|
|
818
|
+
align-items: center;
|
|
819
|
+
|
|
820
|
+
.workflow-node {
|
|
821
|
+
width: 300px;
|
|
822
|
+
padding: 15px;
|
|
823
|
+
margin: 10px 0;
|
|
824
|
+
border: 1px solid #ebeef5;
|
|
825
|
+
border-radius: 4px;
|
|
826
|
+
cursor: pointer;
|
|
827
|
+
transition: all 0.3s;
|
|
828
|
+
|
|
829
|
+
&:hover {
|
|
830
|
+
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
&.active {
|
|
834
|
+
border-color: #409EFF;
|
|
835
|
+
box-shadow: 0 0 0 2px #c6e2ff;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
.node-index {
|
|
839
|
+
display: inline-block;
|
|
840
|
+
width: 20px;
|
|
841
|
+
height: 20px;
|
|
842
|
+
line-height: 20px;
|
|
843
|
+
text-align: center;
|
|
844
|
+
background-color: #409EFF;
|
|
845
|
+
color: white;
|
|
846
|
+
border-radius: 50%;
|
|
847
|
+
font-size: 12px;
|
|
848
|
+
margin-right: 10px;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
.node-name {
|
|
852
|
+
font-weight: bold;
|
|
853
|
+
margin-bottom: 5px;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
.node-assignee {
|
|
857
|
+
font-size: 12px;
|
|
858
|
+
color: #666;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
</style>
|