DefSetting.vue
13.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
<template>
<div>
<el-row :gutter="10">
<el-col :span="12">
<el-button
size="small"
@click="divertClick"
icon="icon-zhuanyi"
type="primary"
>转移</el-button
>
<el-button
size="small"
v-if="data.type == 'user'"
@click="copyClick"
icon="icon-fuzhi"
>复制</el-button
></el-col
>
<el-col
:span="12"
style="display: flex;
align-items: center;
justify-content: flex-end;"
>
<el-input
size="small"
clearable
placeholder="请输入流程名称"
prefix-icon="el-icon-search"
style="margin-right: 10px;"
v-model="tableData"
@keyup.enter.native="searchEnterFun"
></el-input>
<el-button
size="small"
type="primary"
@click="search"
icon="el-icon-search"
>搜索</el-button
>
<el-button size="small" @click="reset" icon="icon-my-todo-reset"
>重置</el-button
>
</el-col></el-row
>
<br />
<el-table
ref="defTable"
:data="defListRow"
style="width: 100%;"
:max-height="500"
border
header-cell-class-name="todo-header-row"
row-class-name="todo-row"
size="medium"
v-loading="fullscreenLoading"
>
<el-table-column
type="selection"
width="50"
align="center"
></el-table-column>
<el-table-column
type="index"
width="50"
align="center"
label="序号"
></el-table-column>
<el-table-column
prop="defName"
label="流程名称"
align="center"
></el-table-column>
<el-table-column
prop="defKey"
label="流程Key"
align="center"
width="130"
></el-table-column>
<el-table-column
prop="nodeName"
label="任务节点名称"
align="center"
></el-table-column>
<el-table-column
prop="nodeId"
label="任务节点key"
align="center"
width="150"
></el-table-column>
<el-table-column
prop="nodeType"
label="任务节点类型"
align="center"
width="120"
>
<template v-slot="{row}">
<el-tag type="warning" v-if="row.nodeType == 'signTask'"
>会签任务</el-tag
>
<el-tag type="success" v-if="row.nodeType == 'userTask'"
>用户任务</el-tag
>
</template>
</el-table-column>
<el-table-column
prop="isMain"
label="是否主版本"
align="center"
width="100"
>
<template v-slot="{row}">
<el-tag type="success" v-if="row.isMain == 'Y'">是</el-tag>
<el-tag type="warning" v-if="row.isMain == 'N'">否</el-tag>
</template>
</el-table-column>
<el-table-column
prop="bpmStatus"
label="流程状态"
align="center"
width="80"
>
<template v-slot="{row}">
<el-tag type="success" v-if="row.bpmStatus == 'deploy'">发布</el-tag>
</template>
</el-table-column>
<el-table-column
prop="version"
label="所属版本"
align="center"
width="80"
></el-table-column>
</el-table>
<el-footer height="50px" style="padding:10px 0">
<el-row type="flex" justify="end">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="currentChange"
:current-page="pageResult.page"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageResult.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="pageResult.total"
></el-pagination>
</el-row>
</el-footer>
<!--用户选择对话框 -->
<ht-user-dialog
ref="eipUserDialog"
@on-confirm="eipUserDialogOk"
append-to-body
/>
<!-- 组织选择对话框 -->
<ht-org-post-dialog
ref="eipOrgDialog"
@on-confirm="eipOrgDialogOk"
single
append-to-body
/>
<!-- 岗位选择对话框 -->
<ht-post-dialog
ref="eipPostDialog"
@on-confirm="eipPostDialogOk"
single
append-to-body
/>
<!-- 角色选择对话框 -->
<ht-role-dialog
ref="eipRoleDialog"
@on-confirm="eipRoleDialogOk"
single
append-to-body
/>
</div>
</template>
<script>
import req from '@/request.js'
const eipUserDialog = () => import('@/components/dialog/EipUserDialog.vue')
const eipOrgDialog = () => import('@/components/dialog/EipOrgDialog.vue')
const eipPostDialog = () => import('@/components/dialog/EipPostDialog.vue')
const eipRoleDialog = () => import('@/components/dialog/EipRoleDialog.vue')
export default {
components: {eipUserDialog, eipOrgDialog, eipPostDialog, eipRoleDialog},
name: 'def-setting',
props: ['data'],
data() {
return {
type: '', //1、转移,2、复制
selectDefs: [], //选择的要转移或复制流程配置信息
type: '',
maxHeight: '500', //列表高度
tableData: '', //查询条件内容
defList: [], //查询出来的全部数据
defListRow: [], //设置每页列表的显示数据
fullscreenLoading: true,
pageResult: {
page: 1,
pageSize: 20,
total: 0
}
}
},
watch: {
data: {
handler(newValue, oldValue) {
this.$nextTick(() => {
this.search()
})
},
deep: true,
immediate: true
}
},
methods: {
//转移
divertClick() {
this.type = ''
this.selectDefs = []
let selectSelection = this.$refs.defTable.selection
if (selectSelection && selectSelection.length == 0) {
this.$message.error('请选择要转移的数据')
return
}
for (let k = 0; k < selectSelection.length; k++) {
let objDef = {}
objDef.defId = selectSelection[k].defId
objDef.nodeId = selectSelection[k].nodeId
objDef.nodeName = selectSelection[k].nodeName
objDef.nodeType = selectSelection[k].nodeType
this.selectDefs.push(objDef)
}
this.type = '1'
if (this.data.type == 'user') {
this.$refs['eipUserDialog'].showDialog()
}
if (this.data.type == 'org') {
this.$refs['eipOrgDialog'].showDialog()
}
if (this.data.type == 'post') {
this.$refs['eipPostDialog'].showDialog()
}
if (this.data.type == 'role') {
this.$refs['eipRoleDialog'].showDialog()
}
},
//复制
copyClick() {
this.type = ''
this.selectDefs = []
let selectSelection = this.$refs.defTable.selection
if (selectSelection && selectSelection.length == 0) {
this.$message.error('请选择要复制的数据')
return
}
for (let k = 0; k < selectSelection.length; k++) {
let objDef = {}
objDef.defId = selectSelection[k].defId
objDef.nodeId = selectSelection[k].nodeId
objDef.nodeName = selectSelection[k].nodeName
objDef.nodeType = selectSelection[k].nodeType
this.selectDefs.push(objDef)
}
this.type = '2'
this.$refs['eipUserDialog'].showDialog()
},
operatingDefSetting(map) {
req
.post(`${window.context.bpmModel}/flow/def/v1/operatingDefSetting`, map)
.then(res => {
if (res.data.state) {
this.$message.success(res.data.message)
this.search()
}
this.fullscreenLoading = false
})
.catch(() => {
this.fullscreenLoading = false
})
},
//选择用户确认事件
eipUserDialogOk(data) {
if (data && data.length > 0) {
let userArray = []
for (let k = 0; k < data.length; k++) {
if (data[k].account != this.data.typeValue.account) {
userArray.push({
account: data[k].account,
fullname: data[k].fullname
})
}
}
if (userArray.length == 0) {
if (this.type == '1') {
this.$message.error('选择的要转移的用户不能是自己')
} else if (this.type == '2') {
this.$message.error('选择的要复制的用户不能是自己')
}
return
}
let oldUserObj = {
oldAccount: this.data.typeValue.account,
oldUserName: this.data.typeValue.fullname
}
let map = {
oldUserObj: oldUserObj,
paType: this.data.type,
userArray: userArray,
selectDefs: this.selectDefs,
type: this.type
}
this.operatingDefSetting(map)
}
},
//选择所属组织确认事件
eipOrgDialogOk(data) {
if (data[0]) {
if (data[0].id == this.data.typeValue.id) {
this.$message.error('选择的要转移的组织不能是自己')
return
}
let teamObj = {code: data[0].code, name: data[0].name}
let oldTeamObj = {
oldCode: this.data.typeValue.code,
oldName: this.data.typeValue.name
}
let map = {
oldTeamObj: oldTeamObj,
paType: this.data.type,
teamObj: teamObj,
selectDefs: this.selectDefs,
type: this.type
}
this.operatingDefSetting(map)
}
},
//选择所属岗位确认事件
eipPostDialogOk(data) {
if (data[0]) {
if (data[0].id == this.data.typeValue.id) {
this.$message.error('选择的要转移的岗位不能是自己')
return
}
let teamObj = {code: data[0].code, name: data[0].name}
let oldTeamObj = {
oldCode: this.data.typeValue.code,
oldName: this.data.typeValue.name
}
let map = {
oldTeamObj: oldTeamObj,
paType: this.data.type,
teamObj: teamObj,
selectDefs: this.selectDefs,
type: this.type
}
this.operatingDefSetting(map)
}
},
//选择所属角色确认事件
eipRoleDialogOk(data) {
if (data[0]) {
if (data[0].id == this.data.typeValue.id) {
this.$message.error('选择的要转移的角色不能是自己')
return
}
let teamObj = {code: data[0].code, name: data[0].name}
let oldTeamObj = {
oldCode: this.data.typeValue.code,
oldName: this.data.typeValue.name
}
let map = {
oldTeamObj: oldTeamObj,
paType: this.data.type,
teamObj: teamObj,
selectDefs: this.selectDefs,
type: this.type
}
this.operatingDefSetting(map)
}
},
//重置
reset() {
this.tableData = ''
this.search()
},
//查询
search() {
const this_ = this
this_.defList = []
this_.defListRow = []
let querys = []
let val = this_.data.typeValue.account
if (this_.data.type != 'user') {
val = this_.data.typeValue.code
}
let map = {
val: val,
type: this_.data.type,
tableData: this_.tableData
}
//初次加载默认pageBean
req
.post(
`${window.context.bpmModel}/flow/def/v1/getDefNodeUserByTeam`,
map
)
.then(response => {
if (response.data.state) {
let res = JSON.parse(response.data.value.results)
this_.defList = [...res] //全部数据
this_.pageResult.page = 1
this_.pageResult.pageSize = 10
this_.pageResult.total = res.length
for (let i = 0; i < 10; i++) {
if (res[i]) {
this_.defListRow.push(res[i])
} else {
continue
}
}
}
//页面加载调用tudo.js里面的分页方法
this_.fullscreenLoading = false
})
.catch(() => {
this_.fullscreenLoading = false
})
},
currentChange: function(currentPage) {
this.defListRow = []
this.pageResult.page = currentPage
let num =
currentPage * this.pageResult.pageSize - this.pageResult.pageSize
for (let i = num; i < currentPage * this.pageResult.pageSize; i++) {
if (this.defList[i]) {
this.defListRow.push(this.defList[i])
} else {
continue
}
}
},
handleSizeChange(val) {
this.pageResult.pageSize = val
this.currentChange(1)
},
//回车查询
searchEnterFun: function(e) {
var keyCode = window.event ? e.keyCode : e.which
if (keyCode == 13) {
this.search()
}
},
//动态计算列表高度
setMaxHeight(item) {
const this_ = this
setTimeout(() => {
if (window.innerHeight) {
this_.maxHeight = window.innerHeight
} else if (document.body && document.body.clientHeight) {
this_.maxHeight = document.body.clientHeight
}
this_.maxHeight = this_.maxHeight - item
}, 10)
}
},
created() {
const this_ = this
if (JSON.stringify(this_.data) == '{}') {
return '请选择查询对象'
}
this_.setMaxHeight(350) //动态计算列表高度
}
}
</script>
<style lang="scss" scoped>
.el-col_three {
text-align: right;
}
</style>