35
35
placeholder =" 请输入流程名称"
36
36
/>
37
37
</el-form-item >
38
- <el-form-item v-if = " formData.id " label =" 流程分类" prop =" category" >
38
+ <el-form-item label =" 流程分类" prop =" category" >
39
39
<el-select
40
40
v-model =" formData.category"
41
41
clearable
50
50
/>
51
51
</el-select >
52
52
</el-form-item >
53
- <el-form-item v-if = " formData.id " label =" 流程图标" prop =" icon" >
54
- <UploadImg v-model =" formData.icon" :limit =" 1" height =" 128px " width =" 128px " />
53
+ <el-form-item label =" 流程图标" prop =" icon" >
54
+ <UploadImg v-model =" formData.icon" :limit =" 1" height =" 64px " width =" 64px " />
55
55
</el-form-item >
56
56
<el-form-item label =" 流程描述" prop =" description" >
57
57
<el-input v-model =" formData.description" clearable type =" textarea" />
58
58
</el-form-item >
59
- <div v-if =" formData.id" >
60
- <el-form-item label =" 表单类型" prop =" formType" >
61
- <el-radio-group v-model =" formData.formType" >
62
- <el-radio
63
- v-for =" dict in getIntDictOptions(DICT_TYPE.BPM_MODEL_FORM_TYPE)"
64
- :key =" dict.value"
65
- :label =" dict.value"
66
- >
67
- {{ dict.label }}
68
- </el-radio >
69
- </el-radio-group >
70
- </el-form-item >
71
- <el-form-item v-if =" formData.formType === 10" label =" 流程表单" prop =" formId" >
72
- <el-select v-model =" formData.formId" clearable style =" width : 100% " >
73
- <el-option
74
- v-for =" form in formList"
75
- :key =" form.id"
76
- :label =" form.name"
77
- :value =" form.id"
78
- />
79
- </el-select >
80
- </el-form-item >
81
- <el-form-item
82
- v-if =" formData.formType === 20"
83
- label =" 表单提交路由"
84
- prop =" formCustomCreatePath"
85
- >
86
- <el-input
87
- v-model =" formData.formCustomCreatePath"
88
- placeholder =" 请输入表单提交路由"
89
- style =" width : 330px "
90
- />
91
- <el-tooltip
92
- class =" item"
93
- content =" 自定义表单的提交路径,使用 Vue 的路由地址,例如说:bpm/oa/leave/create"
94
- effect =" light"
95
- placement =" top"
59
+ <el-form-item label =" 流程类型" prop =" type" >
60
+ <el-radio-group v-model =" formData.type" >
61
+ <el-radio
62
+ v-for =" dict in getIntDictOptions(DICT_TYPE.BPM_MODEL_TYPE)"
63
+ :key =" dict.value"
64
+ :label =" dict.value"
65
+ >
66
+ {{ dict.label }}
67
+ </el-radio >
68
+ </el-radio-group >
69
+ </el-form-item >
70
+ <el-form-item label =" 表单类型" prop =" formType" >
71
+ <el-radio-group v-model =" formData.formType" >
72
+ <el-radio
73
+ v-for =" dict in getIntDictOptions(DICT_TYPE.BPM_MODEL_FORM_TYPE)"
74
+ :key =" dict.value"
75
+ :label =" dict.value"
96
76
>
97
- <i class =" el-icon-question" style =" padding-left : 5px " ></i >
98
- </el-tooltip >
99
- </el-form-item >
100
- <el-form-item
101
- v-if =" formData.formType === 20"
102
- label =" 表单查看地址"
103
- prop =" formCustomViewPath"
77
+ {{ dict.label }}
78
+ </el-radio >
79
+ </el-radio-group >
80
+ </el-form-item >
81
+ <el-form-item v-if =" formData.formType === 10" label =" 流程表单" prop =" formId" >
82
+ <el-select v-model =" formData.formId" clearable style =" width : 100% " >
83
+ <el-option v-for =" form in formList" :key =" form.id" :label =" form.name" :value =" form.id" />
84
+ </el-select >
85
+ </el-form-item >
86
+ <el-form-item
87
+ v-if =" formData.formType === 20"
88
+ label =" 表单提交路由"
89
+ prop =" formCustomCreatePath"
90
+ >
91
+ <el-input
92
+ v-model =" formData.formCustomCreatePath"
93
+ placeholder =" 请输入表单提交路由"
94
+ style =" width : 330px "
95
+ />
96
+ <el-tooltip
97
+ class =" item"
98
+ content =" 自定义表单的提交路径,使用 Vue 的路由地址,例如说:bpm/oa/leave/create.vue"
99
+ effect =" light"
100
+ placement =" top"
104
101
>
105
- <el-input
106
- v-model =" formData.formCustomViewPath"
107
- placeholder =" 请输入表单查看的组件地址"
108
- style =" width : 330px "
109
- />
110
- <el-tooltip
111
- class =" item"
112
- content =" 自定义表单的查看组件地址,使用 Vue 的组件地址,例如说:bpm/oa/leave/detail"
113
- effect =" light"
114
- placement =" top"
102
+ <i class =" el-icon-question" style =" padding-left : 5px " ></i >
103
+ </el-tooltip >
104
+ </el-form-item >
105
+ <el-form-item v-if =" formData.formType === 20" label =" 表单查看地址" prop =" formCustomViewPath" >
106
+ <el-input
107
+ v-model =" formData.formCustomViewPath"
108
+ placeholder =" 请输入表单查看的组件地址"
109
+ style =" width : 330px "
110
+ />
111
+ <el-tooltip
112
+ class =" item"
113
+ content =" 自定义表单的查看组件地址,使用 Vue 的组件地址,例如说:bpm/oa/leave/detail.vue"
114
+ effect =" light"
115
+ placement =" top"
116
+ >
117
+ <i class =" el-icon-question" style =" padding-left : 5px " ></i >
118
+ </el-tooltip >
119
+ </el-form-item >
120
+ <el-form-item label =" 是否可见" prop =" visible" >
121
+ <el-radio-group v-model =" formData.visible" >
122
+ <el-radio
123
+ v-for =" dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
124
+ :key =" dict.value as string"
125
+ :label =" dict.value"
115
126
>
116
- < i class = " el-icon-question " style = " padding-left : 5 px " ></ i >
117
- </el-tooltip >
118
- </el-form-item >
119
- </div >
127
+ {{ dict.label }}
128
+ </el-radio >
129
+ </el-radio-group >
130
+ </el-form-item >
120
131
</el-form >
121
132
<template #footer >
122
133
<el-button :disabled =" formLoading" type =" primary" @click =" submitForm" >确 定</el-button >
125
136
</Dialog >
126
137
</template >
127
138
<script lang="ts" setup>
128
- import { DICT_TYPE , getIntDictOptions } from ' @/utils/dict'
139
+ import { DICT_TYPE , getBoolDictOptions , getIntDictOptions } from ' @/utils/dict'
129
140
import { ElMessageBox } from ' element-plus'
130
141
import * as ModelApi from ' @/api/bpm/model'
131
142
import * as FormApi from ' @/api/bpm/form'
132
143
import { CategoryApi } from ' @/api/bpm/category'
144
+ import { BpmModelFormType , BpmModelType } from ' @/utils/constants'
133
145
134
146
defineOptions ({ name: ' ModelForm' })
135
147
@@ -141,21 +153,27 @@ const dialogTitle = ref('') // 弹窗的标题
141
153
const formLoading = ref (false ) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
142
154
const formType = ref (' ' ) // 表单的类型:create - 新增;update - 修改
143
155
const formData = ref ({
144
- formType: 10 ,
145
156
name: ' ' ,
146
157
category: undefined ,
147
158
icon: undefined ,
148
159
description: ' ' ,
160
+ type: BpmModelType .BPMN ,
161
+ formType: BpmModelFormType .NORMAL ,
149
162
formId: ' ' ,
150
163
formCustomCreatePath: ' ' ,
151
- formCustomViewPath: ' '
164
+ formCustomViewPath: ' ' ,
165
+ visible: true
152
166
})
153
167
const formRules = reactive ({
154
- name: [{ required: true , message: ' 参数名称不能为空' , trigger: ' blur' }],
155
- key: [{ required: true , message: ' 参数键名不能为空' , trigger: ' blur' }],
156
- category: [{ required: true , message: ' 参数分类不能为空' , trigger: ' blur' }],
157
- icon: [{ required: true , message: ' 参数图标不能为空' , trigger: ' blur' }],
158
- value: [{ required: true , message: ' 参数键值不能为空' , trigger: ' blur' }],
168
+ name: [{ required: true , message: ' 流程名称不能为空' , trigger: ' blur' }],
169
+ key: [{ required: true , message: ' 流程标识不能为空' , trigger: ' blur' }],
170
+ category: [{ required: true , message: ' 流程分类不能为空' , trigger: ' blur' }],
171
+ icon: [{ required: true , message: ' 流程图标不能为空' , trigger: ' blur' }],
172
+ type: [{ required: true , message: ' 是否可见不能为空' , trigger: ' blur' }],
173
+ formType: [{ required: true , message: ' 是否可见不能为空' , trigger: ' blur' }],
174
+ formId: [{ required: true , message: ' 流程表单不能为空' , trigger: ' blur' }],
175
+ formCustomCreatePath: [{ required: true , message: ' 表单提交路由不能为空' , trigger: ' blur' }],
176
+ formCustomViewPath: [{ required: true , message: ' 表单查看地址不能为空' , trigger: ' blur' }],
159
177
visible: [{ required: true , message: ' 是否可见不能为空' , trigger: ' blur' }]
160
178
})
161
179
const formRef = ref () // 表单 Ref
@@ -225,14 +243,16 @@ const submitForm = async () => {
225
243
/** 重置表单 */
226
244
const resetForm = () => {
227
245
formData .value = {
228
- formType: 10 ,
229
246
name: ' ' ,
230
247
category: undefined ,
231
- icon: ' ' ,
248
+ icon: undefined ,
232
249
description: ' ' ,
250
+ type: BpmModelType .BPMN ,
251
+ formType: BpmModelFormType .NORMAL ,
233
252
formId: ' ' ,
234
253
formCustomCreatePath: ' ' ,
235
- formCustomViewPath: ' '
254
+ formCustomViewPath: ' ' ,
255
+ visible: true
236
256
}
237
257
formRef .value ?.resetFields ()
238
258
}
0 commit comments