提交 | 用户 | 时间
|
722af2
|
1 |
<template> |
X |
2 |
<div class="app-container"> |
|
3 |
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> |
|
4 |
<el-form-item label="流程标识" prop="processKey"> |
|
5 |
<el-input |
|
6 |
v-model="queryParams.processKey" |
|
7 |
placeholder="请输入流程标识" |
|
8 |
clearable |
|
9 |
size="small" |
|
10 |
@keyup.enter.native="handleQuery" |
|
11 |
/> |
|
12 |
</el-form-item> |
|
13 |
<el-form-item label="流程名称" prop="processName"> |
|
14 |
<el-input |
|
15 |
v-model="queryParams.processName" |
|
16 |
placeholder="请输入流程名称" |
|
17 |
clearable |
|
18 |
size="small" |
|
19 |
@keyup.enter.native="handleQuery" |
|
20 |
/> |
|
21 |
</el-form-item> |
|
22 |
<el-form-item label="流程分类" prop="category"> |
|
23 |
<el-select v-model="queryParams.category" clearable placeholder="请选择" size="small"> |
|
24 |
<el-option |
|
25 |
v-for="item in categoryOptions" |
|
26 |
:key="item.categoryId" |
|
27 |
:label="item.categoryName" |
|
28 |
:value="item.code"> |
|
29 |
</el-option> |
|
30 |
</el-select> |
|
31 |
</el-form-item> |
|
32 |
<el-form-item label="提交时间"> |
|
33 |
<el-date-picker |
|
34 |
v-model="dateRange" |
|
35 |
style="width: 240px" |
|
36 |
value-format="yyyy-MM-dd HH:mm:ss" |
|
37 |
type="daterange" |
|
38 |
range-separator="-" |
|
39 |
start-placeholder="开始日期" |
|
40 |
end-placeholder="结束日期" |
|
41 |
:default-time="['00:00:00', '23:59:59']" |
|
42 |
></el-date-picker> |
|
43 |
</el-form-item> |
|
44 |
<el-form-item> |
|
45 |
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
|
46 |
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
|
47 |
</el-form-item> |
|
48 |
</el-form> |
|
49 |
|
|
50 |
<el-row :gutter="10" class="mb8"> |
|
51 |
<el-col :span="1.5"> |
|
52 |
<el-button |
|
53 |
type="danger" |
|
54 |
plain |
|
55 |
icon="el-icon-delete" |
|
56 |
size="mini" |
|
57 |
:disabled="multiple" |
|
58 |
@click="handleDelete" |
|
59 |
>删除</el-button> |
|
60 |
</el-col> |
|
61 |
<el-col :span="1.5"> |
|
62 |
<el-button |
|
63 |
type="warning" |
|
64 |
plain |
|
65 |
icon="el-icon-download" |
|
66 |
size="mini" |
|
67 |
v-hasPermi="['workflow:process:ownExport']" |
|
68 |
@click="handleExport" |
|
69 |
>导出</el-button> |
|
70 |
</el-col> |
|
71 |
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
|
72 |
</el-row> |
|
73 |
|
|
74 |
<el-table v-loading="loading" :data="ownProcessList" @selection-change="handleSelectionChange"> |
|
75 |
<el-table-column type="selection" width="55" align="center" /> |
|
76 |
<el-table-column label="流程编号" align="center" prop="procInsId" :show-overflow-tooltip="true"/> |
|
77 |
<el-table-column label="流程名称" align="center" prop="procDefName" :show-overflow-tooltip="true"/> |
|
78 |
<el-table-column label="流程类别" align="center" prop="category" :formatter="categoryFormat" /> |
|
79 |
<el-table-column label="流程版本" align="center" width="80px"> |
|
80 |
<template slot-scope="scope"> |
|
81 |
<el-tag size="medium" >v{{ scope.row.procDefVersion }}</el-tag> |
|
82 |
</template> |
|
83 |
</el-table-column> |
|
84 |
<el-table-column label="当前节点" align="center" prop="taskName"/> |
|
85 |
<el-table-column label="提交时间" align="center" prop="createTime" width="180"/> |
|
86 |
<el-table-column label="流程状态" align="center" width="100"> |
|
87 |
<template slot-scope="scope"> |
|
88 |
<dict-tag :options="dict.type.wf_process_status" :value="scope.row.processStatus"/> |
|
89 |
</template> |
|
90 |
</el-table-column> |
|
91 |
<el-table-column label="耗时" align="center" prop="duration" width="180"/> |
|
92 |
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
|
93 |
<template slot-scope="scope"> |
|
94 |
<el-button |
|
95 |
type="text" |
|
96 |
size="mini" |
|
97 |
icon="el-icon-tickets" |
|
98 |
@click="handleFlowRecord(scope.row)" |
|
99 |
v-hasPermi="['workflow:process:query']" |
|
100 |
>详情</el-button> |
|
101 |
<el-button |
|
102 |
type="text" |
|
103 |
size="mini" |
|
104 |
icon="el-icon-delete" |
|
105 |
@click="handleDelete(scope.row)" |
|
106 |
v-if="scope.row.finishTime" |
|
107 |
v-hasPermi="['workflow:process:remove']" |
|
108 |
>删除</el-button> |
|
109 |
<el-button |
|
110 |
type="text" |
|
111 |
size="mini" |
|
112 |
icon="el-icon-circle-close" |
|
113 |
@click="handleStop(scope.row)" |
|
114 |
v-hasPermi="['workflow:process:cancel']" |
|
115 |
>取消</el-button> |
|
116 |
<el-button |
|
117 |
type="text" |
|
118 |
size="mini" |
|
119 |
icon="el-icon-refresh-right" |
|
120 |
v-hasPermi="['workflow:process:start']" |
|
121 |
@click="handleAgain(scope.row)" |
|
122 |
>重新发起</el-button> |
|
123 |
</template> |
|
124 |
</el-table-column> |
|
125 |
</el-table> |
|
126 |
|
|
127 |
<pagination |
|
128 |
v-show="total>0" |
|
129 |
:total="total" |
|
130 |
:page.sync="queryParams.pageNum" |
|
131 |
:limit.sync="queryParams.pageSize" |
|
132 |
@pagination="getList" |
|
133 |
/> |
|
134 |
|
|
135 |
</div> |
|
136 |
</template> |
|
137 |
|
|
138 |
<script> |
|
139 |
import { listOwnProcess, stopProcess, delProcess } from '@/api/workflow/process'; |
|
140 |
import { listAllCategory } from '@/api/workflow/category'; |
|
141 |
export default { |
|
142 |
name: "Own", |
|
143 |
dicts: ['wf_process_status'], |
|
144 |
components: { |
|
145 |
}, |
|
146 |
data() { |
|
147 |
return { |
|
148 |
// 遮罩层 |
|
149 |
loading: true, |
|
150 |
processLoading: true, |
|
151 |
// 选中数组 |
|
152 |
ids: [], |
|
153 |
// 非单个禁用 |
|
154 |
single: true, |
|
155 |
// 非多个禁用 |
|
156 |
multiple: true, |
|
157 |
// 显示搜索条件 |
|
158 |
showSearch: true, |
|
159 |
// 总条数 |
|
160 |
total: 0, |
|
161 |
categoryOptions: [], |
|
162 |
processTotal:0, |
|
163 |
// 我发起的流程列表数据 |
|
164 |
ownProcessList: [], |
|
165 |
// 弹出层标题 |
|
166 |
title: "", |
|
167 |
// 是否显示弹出层 |
|
168 |
open: false, |
|
169 |
src: "", |
|
170 |
definitionList:[], |
|
171 |
// 日期范围 |
|
172 |
dateRange: [], |
|
173 |
// 查询参数 |
|
174 |
queryParams: { |
|
175 |
pageNum: 1, |
|
176 |
pageSize: 10, |
|
177 |
processKey: undefined, |
|
178 |
processName: undefined, |
|
179 |
category: undefined |
|
180 |
}, |
|
181 |
// 表单参数 |
|
182 |
form: {}, |
|
183 |
// 表单校验 |
|
184 |
rules: { |
|
185 |
}, |
|
186 |
}; |
|
187 |
}, |
|
188 |
created() { |
|
189 |
this.getCategoryList(); |
|
190 |
}, |
|
191 |
beforeRouteEnter(to, from, next) { |
|
192 |
next(vm => { |
|
193 |
vm.getList() |
|
194 |
}) |
|
195 |
}, |
|
196 |
methods: { |
|
197 |
/** 查询流程分类列表 */ |
|
198 |
getCategoryList() { |
|
199 |
listAllCategory().then(response => this.categoryOptions = response.data) |
|
200 |
}, |
|
201 |
/** 查询流程定义列表 */ |
|
202 |
getList() { |
|
203 |
this.loading = true; |
|
204 |
listOwnProcess(this.addDateRange(this.queryParams, this.dateRange)).then(response => { |
|
205 |
this.ownProcessList = response.rows; |
|
206 |
this.total = response.total; |
|
207 |
this.loading = false; |
|
208 |
}); |
|
209 |
}, |
|
210 |
// 取消按钮 |
|
211 |
cancel() { |
|
212 |
this.open = false; |
|
213 |
this.reset(); |
|
214 |
}, |
|
215 |
// 表单重置 |
|
216 |
reset() { |
|
217 |
this.form = { |
|
218 |
id: null, |
|
219 |
name: null, |
|
220 |
category: null, |
|
221 |
key: null, |
|
222 |
tenantId: null, |
|
223 |
deployTime: null, |
|
224 |
derivedFrom: null, |
|
225 |
derivedFromRoot: null, |
|
226 |
parentDeploymentId: null, |
|
227 |
engineVersion: null |
|
228 |
}; |
|
229 |
this.resetForm("form"); |
|
230 |
}, |
|
231 |
/** 搜索按钮操作 */ |
|
232 |
handleQuery() { |
|
233 |
this.queryParams.pageNum = 1; |
|
234 |
this.getList(); |
|
235 |
}, |
|
236 |
/** 重置按钮操作 */ |
|
237 |
resetQuery() { |
|
238 |
this.dateRange = []; |
|
239 |
this.resetForm("queryForm"); |
|
240 |
this.handleQuery(); |
|
241 |
}, |
|
242 |
// 多选框选中数据 |
|
243 |
handleSelectionChange(selection) { |
|
244 |
this.ids = selection.map(item => item.procInsId); |
|
245 |
this.single = selection.length !== 1; |
|
246 |
this.multiple = !selection.length; |
|
247 |
}, |
|
248 |
handleAgain(row) { |
|
249 |
this.$router.push({ |
|
250 |
path: '/workflow/process/start/' + row.deployId, |
|
251 |
query: { |
|
252 |
definitionId: row.procDefId, |
|
253 |
procInsId: row.procInsId |
|
254 |
} |
|
255 |
}) |
|
256 |
console.log(row); |
|
257 |
}, |
|
258 |
/** 取消流程申请 */ |
|
259 |
handleStop(row){ |
|
260 |
const params = { |
|
261 |
procInsId: row.procInsId |
|
262 |
} |
|
263 |
stopProcess(params).then( res => { |
|
264 |
this.$modal.msgSuccess(res.msg); |
|
265 |
this.getList(); |
|
266 |
}); |
|
267 |
}, |
|
268 |
/** 流程流转记录 */ |
|
269 |
handleFlowRecord(row) { |
|
270 |
this.$router.push({ |
|
271 |
path: '/workflow/process/detail/' + row.procInsId, |
|
272 |
query: { |
|
273 |
processed: false |
|
274 |
} |
|
275 |
}) |
|
276 |
}, |
|
277 |
/** 删除按钮操作 */ |
|
278 |
handleDelete(row) { |
|
279 |
const ids = row.procInsId || this.ids; |
|
280 |
this.$confirm('是否确认删除流程定义编号为"' + ids + '"的数据项?', "警告", { |
|
281 |
confirmButtonText: "确定", |
|
282 |
cancelButtonText: "取消", |
|
283 |
type: "warning" |
|
284 |
}).then(function() { |
|
285 |
return delProcess(ids); |
|
286 |
}).then(() => { |
|
287 |
this.getList(); |
|
288 |
this.$modal.msgSuccess("删除成功"); |
|
289 |
}) |
|
290 |
}, |
|
291 |
/** 导出按钮操作 */ |
|
292 |
handleExport() { |
|
293 |
this.download('workflow/process/ownExport', { |
|
294 |
...this.queryParams |
|
295 |
}, `wf_own_process_${new Date().getTime()}.xlsx`) |
|
296 |
}, |
|
297 |
categoryFormat(row, column) { |
|
298 |
return this.categoryOptions.find(k => k.code === row.category)?.categoryName ?? ''; |
|
299 |
} |
|
300 |
} |
|
301 |
}; |
|
302 |
</script> |