33
33
</el-form-item >
34
34
</el-form >
35
35
<div style =" margin-left : 10% ; margin-bottom : 20px ; font-size : 14px " >
36
- <XButton
37
- pre-icon =" ep:select"
38
- type =" success"
39
- title =" 通过"
40
- @click =" handleAudit(item, true)"
41
- />
42
- <XButton
43
- pre-icon =" ep:close"
44
- type =" danger"
45
- title =" 不通过"
46
- @click =" handleAudit(item, false)"
47
- />
48
- <XButton
49
- pre-icon =" ep:edit"
50
- type =" primary"
51
- title =" 转办"
52
- @click =" handleUpdateAssignee(item)"
53
- />
54
- <XButton
55
- pre-icon =" ep:position"
56
- type =" primary"
57
- title =" 委派"
58
- @click =" handleDelegate(item)"
59
- />
60
- <XButton pre-icon =" ep:back" type =" warning" title =" 委派" @click =" handleBack(item)" />
36
+ <el-button type =" success" @click =" handleAudit(item, true)" >
37
+ <Icon icon =" ep:select" /> 通过
38
+ </el-button >
39
+ <el-button type =" danger" @click =" handleAudit(item, false)" >
40
+ <Icon icon =" ep:close" /> 不通过
41
+ </el-button >
42
+ <el-button type =" primary" @click =" openTaskUpdateAssigneeForm(item.id)" >
43
+ <Icon icon =" ep:edit" /> 转办
44
+ </el-button >
45
+ <el-button type =" primary" @click =" handleDelegate(item)" >
46
+ <Icon icon =" ep:position" /> 委派
47
+ </el-button >
48
+ <el-button type =" warning" @click =" handleBack(item)" >
49
+ <Icon icon =" ep:back" /> 回退
50
+ </el-button >
61
51
</div >
62
52
</el-col >
63
53
</el-card >
85
75
processInstance.businessKey
86
76
"
87
77
>
88
- <XButton type =" primary" preIcon =" ep:view" title = " 点击查看 " / >
78
+ <el-button type =" primary" >< Icon icon =" ep:view" /> 点击查看</ el-button >
89
79
</router-link >
90
80
</div >
91
81
</el-card >
153
143
/>
154
144
</el-card >
155
145
156
- <!-- 对话框(转派审批人) -->
157
- <XModal v-model =" updateAssigneeVisible" title =" 转派审批人" width =" 500" >
158
- <el-form
159
- ref =" updateAssigneeFormRef"
160
- :model =" updateAssigneeForm"
161
- :rules =" updateAssigneeRules"
162
- label-width =" 110px"
163
- >
164
- <el-form-item label =" 新审批人" prop =" assigneeUserId" >
165
- <el-select v-model =" updateAssigneeForm.assigneeUserId" clearable style =" width : 100% " >
166
- <el-option
167
- v-for =" item in userOptions"
168
- :key =" parseInt(item.id)"
169
- :label =" item.nickname"
170
- :value =" parseInt(item.id)"
171
- />
172
- </el-select >
173
- </el-form-item >
174
- </el-form >
175
- <!-- 操作按钮 -->
176
- <template #footer >
177
- <!-- 按钮:保存 -->
178
- <XButton
179
- type =" primary"
180
- :title =" t('action.save')"
181
- :loading =" updateAssigneeLoading"
182
- @click =" submitUpdateAssigneeForm"
183
- />
184
- <!-- 按钮:关闭 -->
185
- <XButton
186
- :loading =" updateAssigneeLoading"
187
- :title =" t('dialog.close')"
188
- @click =" updateAssigneeLoading = false"
189
- />
190
- </template >
191
- </XModal >
146
+ <!-- 弹窗:转派审批人 -->
147
+ <TaskUpdateAssigneeForm ref =" taskUpdateAssigneeFormRef" @success =" getDetail" />
192
148
</ContentWrap >
193
149
</template >
194
150
<script setup lang="ts">
@@ -200,13 +156,12 @@ import * as TaskApi from '@/api/bpm/task'
200
156
import * as ActivityApi from ' @/api/bpm/activity'
201
157
import { formatPast2 } from ' @/utils/formatTime'
202
158
import { setConfAndFields2 } from ' @/utils/formCreate'
203
- // import { OptionAttrs } from '@form-create/element-ui/types/config'
204
159
import type { ApiAttrs } from ' @form-create/element-ui/types/config'
205
160
import { useUserStore } from ' @/store/modules/user'
161
+ import TaskUpdateAssigneeForm from ' ./TaskUpdateAssigneeForm.vue'
206
162
207
163
const { query } = useRoute () // 查询参数
208
164
const message = useMessage () // 消息弹窗
209
- const { t } = useI18n () // 国际化
210
165
const { proxy } = getCurrentInstance () as any
211
166
212
167
// ========== 审批信息 ==========
@@ -294,55 +249,11 @@ const getTimelineItemType = (item) => {
294
249
}
295
250
296
251
// ========== 审批记录 ==========
297
- const updateAssigneeVisible = ref (false )
298
- const updateAssigneeLoading = ref (false )
299
- const updateAssigneeForm = ref ({
300
- id: undefined ,
301
- assigneeUserId: undefined
302
- })
303
- const updateAssigneeRules = ref ({
304
- assigneeUserId: [{ required: true , message: ' 新审批人不能为空' , trigger: ' change' }]
305
- })
306
- const updateAssigneeFormRef = ref ()
307
- const userOptions = ref <any []>([])
308
-
309
- // 处理转派审批人
310
- const handleUpdateAssignee = (task ) => {
311
- // 设置表单
312
- resetUpdateAssigneeForm ()
313
- updateAssigneeForm .value .id = task .id
314
- // 设置为打开
315
- updateAssigneeVisible .value = true
316
- }
317
252
318
- // 提交转派审批人
319
- const submitUpdateAssigneeForm = async () => {
320
- // 1. 校验表单
321
- const elForm = unref (updateAssigneeFormRef )
322
- if (! elForm ) return
323
- const valid = await elForm .validate ()
324
- if (! valid ) return
325
-
326
- // 2.1 提交审批
327
- updateAssigneeLoading .value = true
328
- try {
329
- await TaskApi .updateTaskAssignee (updateAssigneeForm .value )
330
- // 2.2 设置为隐藏
331
- updateAssigneeVisible .value = false
332
- // 加载最新数据
333
- getDetail ()
334
- } finally {
335
- updateAssigneeLoading .value = false
336
- }
337
- }
338
-
339
- // 重置转派审批人表单
340
- const resetUpdateAssigneeForm = () => {
341
- updateAssigneeForm .value = {
342
- id: undefined ,
343
- assigneeUserId: undefined
344
- }
345
- updateAssigneeFormRef .value ?.resetFields ()
253
+ /** 转派审批人 */
254
+ const taskUpdateAssigneeFormRef = ref ()
255
+ const openTaskUpdateAssigneeForm = (id : string ) => {
256
+ taskUpdateAssigneeFormRef .value .open (id )
346
257
}
347
258
348
259
/** 处理审批退回的操作 */
@@ -375,7 +286,6 @@ const activityList = ref([])
375
286
376
287
// ========== 初始化 ==========
377
288
onMounted (() => {
378
- // 加载详情
379
289
getDetail ()
380
290
// 加载用户的列表
381
291
UserApi .getSimpleUserList ().then ((data ) => {
0 commit comments