File tree Expand file tree Collapse file tree 3 files changed +38
-9
lines changed Expand file tree Collapse file tree 3 files changed +38
-9
lines changed Original file line number Diff line number Diff line change @@ -76,3 +76,13 @@ export const deployModel = async (id: number) => {
76
76
export const cleanModel = async ( id : number ) => {
77
77
return await request . delete ( { url : '/bpm/model/clean?id=' + id } )
78
78
}
79
+ /**
80
+ * 查询当前流程实例下是否存在正在进行中的单据
81
+ * @param processDefinitionId 流程定义id
82
+ * @returns true/false
83
+ */
84
+ export const getProcessInstance = async ( processDefinitionId : string ) => {
85
+ return await request . get ( {
86
+ url : '/bpm/task/manager-list?processDefinitionId=' + processDefinitionId
87
+ } )
88
+ }
Original file line number Diff line number Diff line change 159
159
<el-button
160
160
link
161
161
type =" primary"
162
- @click =" openModelForm('update', scope.row.id)"
162
+ @click =" openModelForm('update', scope.row.id, scope.row.processDefinition.id )"
163
163
v-if =" hasPermiUpdate"
164
164
:disabled =" !isManagerUser(scope.row)"
165
165
>
@@ -445,11 +445,17 @@ const handleChangeState = async (row: any) => {
445
445
/** 发布流程 */
446
446
const handleDeploy = async (row : any ) => {
447
447
try {
448
- // 删除的二次确认
449
- await message .confirm (' 是否部署该流程!!' )
448
+ // 发布的二次确认
449
+ await message .confirm (' 是否发布该流程!!' )
450
+ // 校验当前版本的流程下是否存在正在进行中的单据
451
+ const res = await ModelApi .getProcessInstance (row .processDefinition .id )
452
+ if (res ) {
453
+ message .error (' 当前版本下存在正在进行中的单据,请先结束单据后再发布' )
454
+ return
455
+ }
450
456
// 发起部署
451
457
await ModelApi .deployModel (row .id )
452
- message .success (t (' 部署成功 ' ))
458
+ message .success (t (' 发布成功 ' ))
453
459
// 刷新列表
454
460
emit (' success' )
455
461
} catch {}
@@ -587,7 +593,8 @@ const handleDeleteCategory = async () => {
587
593
588
594
/** 添加流程模型弹窗 */
589
595
const tagsView = useTagsView ()
590
- const openModelForm = async (type : string , id ? : number ) => {
596
+ const openModelForm = async (type : string , id ? : number , processDefinitionId ? : string ) => {
597
+ alert (processDefinitionId )
591
598
if (type === ' create' ) {
592
599
await push ({ name: ' BpmModelCreate' })
593
600
} else {
Original file line number Diff line number Diff line change @@ -162,7 +162,8 @@ const formData: any = ref({
162
162
summarySetting: {
163
163
enable: false ,
164
164
summary: []
165
- }
165
+ },
166
+ processDefinitionId: undefined
166
167
})
167
168
168
169
// 流程数据
@@ -285,17 +286,16 @@ const handleSave = async () => {
285
286
} else {
286
287
// 新增场景
287
288
formData .value .id = await ModelApi .createModel (modelData )
288
- message .success (' 新增成功' )
289
289
try {
290
- await message .confirm (' 创建流程成功 ,是否继续编辑?' )
290
+ await message .confirm (' 流程创建成功 ,是否继续编辑?' )
291
291
// 用户点击继续编辑,跳转到编辑页面
292
292
await nextTick ()
293
293
// 先删除当前页签
294
294
delView (unref (router .currentRoute ))
295
295
// 跳转到编辑页面
296
296
await router .push ({
297
297
name: ' BpmModelUpdate' ,
298
- params: { id: formData .value .id }
298
+ params: { id: formData .value .id , processDefinitionId: formData . value . processDefinitionId }
299
299
})
300
300
} catch {
301
301
// 先删除当前页签
@@ -318,6 +318,13 @@ const handleDeploy = async () => {
318
318
await message .confirm (' 是否确认发布该流程?' )
319
319
}
320
320
321
+ // 校验当前版本的流程下是否存在正在进行中的单据
322
+ const res = await ModelApi .getProcessInstance (row .processDefinition .id )
323
+ if (res ) {
324
+ message .error (' 当前版本下存在正在进行中的单据,请先结束单据后再发布' )
325
+ return
326
+ }
327
+
321
328
// 校验所有步骤
322
329
await validateAllSteps ()
323
330
@@ -345,6 +352,11 @@ const handleDeploy = async () => {
345
352
}
346
353
}
347
354
355
+ const validateProcessInstance = async (processDefinitionId ) => {
356
+ const valid = await ModelApi .getProcessInstance (processDefinitionId )
357
+ console .log (valid )
358
+ }
359
+
348
360
/** 步骤切换处理 */
349
361
const handleStepClick = async (index : number ) => {
350
362
try {
You can’t perform that action at this time.
0 commit comments