8d73e917
陈威
初始化提交
|
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
|
<template>
<div class="approval-button-item revoke-button">
<el-button
type="danger"
:size="btnSize"
:disabled="disabled"
@click="handleRevoke"
>
{{ $t('task.Recall') }}
</el-button>
<approval-dialog
ref="approvalDialog"
:dialog-title="$t('task.RecallSettings')"
:is-show-upload="false"
:opinion-label="$t('task.RecallReason')"
:dialog-before-click="dialogBeforeClick"
:alias="alias"
@submit-form="handleSubmitForm"
></approval-dialog>
</div>
</template>
<script>
import ApprovalDialog from './ApprovalDialog'
import approvalButton from '@/mixins/approvalButton'
import { savaRevoke } from '@/api/process'
import { resultJudge } from '@/utils/event.js'
export default {
name: 'RevokeButton',
components: {
ApprovalDialog,
},
mixins: [approvalButton],
props: {
nodeId: {
type: String,
default: '',
},
},
computed: {
isRequest() {
return this.$route?.query?.type === 'request'
},
isDone() {
return this.$route?.query?.type === 'done'
},
},
methods: {
handleRevoke() {
if (this.beforeClick) {
resultJudge(this.beforeClick(this.alias)).then((result) => {
if (result) {
this.$refs.approvalDialog.openDialog()
}
})
} else {
this.$refs.approvalDialog.openDialog()
}
},
handleSubmitForm(dialogFormData, cb) {
const { opinion } = dialogFormData
let data = {
instanceId: this.instId,
isHandRevoke: this.isDone ? this.isDone : false,
cause: opinion,
taskId: this.doneTaskId,
}
if (this.nodeId) {
data.revokeNodeId = this.nodeId
}
savaRevoke(data)
.then((res) => {
if (!res.state) return this.$message.error(res.message)
if (res.value) {
this.filterHasHandleTask()
const query = {
taskId: res.value,
leaderId: 0,
instId: this.instId,
isGetApprovalBtn: true,
}
this.$router.push({
path: `/matter/approvalForm`,
query,
})
this.$baseEventBus.$emit('reload-router-view')
} else {
this.$router.push('/matter/myTask')
}
this.dialogAfterClick(this.alias)
})
.finally(() => {
cb()
})
},
},
}
</script>
<style lang="scss" scoped></style>
|