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
| <template>
| <el-dialog class="gd-dialog" v-model="visible" title="流程部署" append-to-body width="20%" @closed="visible = false">
| <avue-form ref="form" :option="optionDeploy" v-model="form" @submit="handleSubmit" />
| <template #footer>
| <span class="dialog-footer">
| <el-button @click="visible = false">取 消</el-button>
| <el-button type="primary" @click="handleDoDeploy" :loading="deployLoading">确 定</el-button>
| </span>
| </template>
| </el-dialog>
| </template>
|
| <script>
| import { deployModel } from '@/api/flow/flow'
| import { flowCategory } from '@/utils/flow'
| import { ElMessage } from 'element-plus'
|
| export default {
| data() {
| return {
| visible: false,
| form: {},
| selectionId: '',
| deployLoading: false,
| optionDeploy: {
| menuBtn: false,
| column: [
| {
| label: '流程类型',
| type: 'select',
| dicUrl: '/blade-system/dict/dictionary?code=flow',
| props: {
| label: 'dictValue',
| value: 'dictKey',
| },
| dataType: 'number',
| slot: true,
| prop: 'categoryValue',
| search: true,
| span: 24,
| rules: [
| {
| required: true,
| message: '请选择流程类型',
| trigger: 'blur',
| },
| ],
| },
| {
| label: '流程模式',
| prop: 'flowMode',
| type: 'radio',
| dicData: [
| {
| label: '通用流程',
| value: 1,
| },
| {
| label: '定制流程',
| value: 2,
| },
| ],
| value: 1,
| span: 24,
| rules: [
| {
| required: true,
| message: '请选择流程模式',
| trigger: 'blur',
| },
| ],
| },
| {
| label: '所属租户',
| prop: 'tenantId',
| type: 'tree',
| multiple: true,
| dicUrl: '/blade-system/tenant/select',
| props: {
| label: 'tenantName',
| value: 'tenantId',
| },
| display: false,
| span: 24,
| rules: [
| {
| required: true,
| message: '请选择所属租户',
| trigger: 'blur',
| },
| ],
| },
| ],
| },
| }
| },
| watch: {
| 'form.flowMode'() {
| this.$refs.form.option.column.filter(item => {
| if (item.prop === 'tenantId') {
| item.display = this.form.flowMode === 2
| }
| })
| },
| },
| methods: {
| // 打开弹框
| open(row) {
| this.visible = true
| this.selectionId = row.id
| },
| // 表单提交处理
| handleSubmit(form, done) {
| this.deployLoading = true
| deployModel({
| modelId: this.selectionId,
| category: flowCategory(form.categoryValue),
| tenantIds: form.tenantId ? form.tenantId.join(',') : '',
| }).then(res => {
| const data = res.data
| if (data.success) {
| ElMessage.success(data.msg)
| done()
| this.$refs.form.resetForm()
| this.visible = false
| this.deployLoading = false
| this.$emit('success')
| } else {
| done()
| this.deployLoading = false
| ElMessage.warning(data.msg)
| }
| })
| },
| // 触发表单提交
| handleDoDeploy() {
| this.$refs.form.submit()
| },
| },
| }
| </script>
|
| <style scoped lang="scss"></style>
|
|