| 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
 | | <template> |  |   <div> |  |     <Modal |  |       title="确认撤回" |  |       v-model="modalCancelVisible" |  |       :mask-closable="false" |  |       :width="500" |  |     > |  |       <Form ref="delForm" v-model="cancelForm" :label-width="70"> |  |         <FormItem label="撤回原因" prop="reason"> |  |           <Input type="textarea" v-model="cancelForm.reason" :rows="4" /> |  |         </FormItem> |  |       </Form> |  |       <div slot="footer"> |  |         <Button type="text" @click="modalCancelVisible = false">取消</Button> |  |         <Button |  |           type="primary" |  |           :loading="submitLoading" |  |           @click="handelSubmitCancel" |  |           >提交</Button |  |         > |  |       </div> |  |     </Modal> |  |   </div> |  | </template> |  |   |  | <script> |  | import { cancelApply } from "@/api/activiti"; |  | export default { |  |   name: "processCancel", |  |   props: { |  |     value: { |  |       type: Boolean, |  |       default: false, |  |     }, |  |     actBusinessId: String, |  |     procInstId: String, |  |   }, |  |   data() { |  |     return { |  |       submitLoading: false, |  |       modalCancelVisible: this.value, |  |       cancelForm: { |  |         reason: "", |  |       }, |  |     }; |  |   }, |  |   methods: { |  |     init() {}, |  |     show() { |  |       if (!this.actBusinessId) { |  |         this.$Message.error("请传入ActBusiness的ID"); |  |         this.$emit("input", false); |  |         return; |  |       } |  |       if (!this.procInstId) { |  |         this.$Message.error("请传入流程实例的ID"); |  |         this.$emit("input", false); |  |         return; |  |       } |  |       this.cancelForm.id = this.actBusinessId; |  |       this.cancelForm.procInstId = this.procInstId; |  |       this.modalCancelVisible = true; |  |     }, |  |     handelSubmitCancel() { |  |       this.submitLoading = true; |  |       cancelApply(this.cancelForm).then((res) => { |  |         this.submitLoading = false; |  |         if (res.success) { |  |           this.$Message.success("操作成功"); |  |           this.$emit("on-submit", true); |  |           this.modalCancelVisible = false; |  |         } |  |       }); |  |     }, |  |     close() { |  |       this.modalCancelVisible = false; |  |     }, |  |   }, |  |   watch: { |  |     value(val) { |  |       if (val == true) { |  |         this.show(); |  |       } |  |     }, |  |     modalCancelVisible(value) { |  |       this.$emit("input", value); |  |     }, |  |   }, |  |   mounted() { |  |     this.init(); |  |   }, |  | }; |  | </script> |  |   |  | <style lang="less"> |  | </style> | 
 |