Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1b0fe232
authored
Feb 11, 2025
by
lizhixian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 发布流程时校验当前流程版本是否存在正在进行中的单据
parent
85c69711
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
9 deletions
+38
-9
src/api/bpm/model/index.ts
+10
-0
src/views/bpm/model/CategoryDraggableModel.vue
+12
-5
src/views/bpm/model/form/index.vue
+16
-4
No files found.
src/api/bpm/model/index.ts
View file @
1b0fe232
...
...
@@ -76,3 +76,13 @@ export const deployModel = async (id: number) => {
export
const
cleanModel
=
async
(
id
:
number
)
=>
{
return
await
request
.
delete
({
url
:
'/bpm/model/clean?id='
+
id
})
}
/**
* 查询当前流程实例下是否存在正在进行中的单据
* @param processDefinitionId 流程定义id
* @returns true/false
*/
export
const
getProcessInstance
=
async
(
processDefinitionId
:
string
)
=>
{
return
await
request
.
get
({
url
:
'/bpm/task/manager-list?processDefinitionId='
+
processDefinitionId
})
}
src/views/bpm/model/CategoryDraggableModel.vue
View file @
1b0fe232
...
...
@@ -159,7 +159,7 @@
<el-button
link
type=
"primary"
@
click=
"openModelForm('update', scope.row.id)"
@
click=
"openModelForm('update', scope.row.id
, scope.row.processDefinition.id
)"
v-if=
"hasPermiUpdate"
:disabled=
"!isManagerUser(scope.row)"
>
...
...
@@ -445,11 +445,17 @@ const handleChangeState = async (row: any) => {
/** 发布流程 */
const
handleDeploy
=
async
(
row
:
any
)
=>
{
try
{
// 删除的二次确认
await
message
.
confirm
(
'是否部署该流程!!'
)
// 发布的二次确认
await
message
.
confirm
(
'是否发布该流程!!'
)
//校验当前版本的流程下是否存在正在进行中的单据
const
res
=
await
ModelApi
.
getProcessInstance
(
row
.
processDefinition
.
id
)
if
(
res
)
{
message
.
error
(
'当前版本下存在正在进行中的单据,请先结束单据后再发布'
)
return
}
// 发起部署
await
ModelApi
.
deployModel
(
row
.
id
)
message
.
success
(
t
(
'
部署
成功'
))
message
.
success
(
t
(
'
发布
成功'
))
// 刷新列表
emit
(
'success'
)
}
catch
{}
...
...
@@ -587,7 +593,8 @@ const handleDeleteCategory = async () => {
/** 添加流程模型弹窗 */
const
tagsView
=
useTagsView
()
const
openModelForm
=
async
(
type
:
string
,
id
?:
number
)
=>
{
const
openModelForm
=
async
(
type
:
string
,
id
?:
number
,
processDefinitionId
?:
string
)
=>
{
alert
(
processDefinitionId
)
if
(
type
===
'create'
)
{
await
push
({
name
:
'BpmModelCreate'
})
}
else
{
...
...
src/views/bpm/model/form/index.vue
View file @
1b0fe232
...
...
@@ -162,7 +162,8 @@ const formData: any = ref({
summarySetting
:
{
enable
:
false
,
summary
:
[]
}
},
processDefinitionId
:
undefined
})
//流程数据
...
...
@@ -285,9 +286,8 @@ const handleSave = async () => {
}
else
{
// 新增场景
formData
.
value
.
id
=
await
ModelApi
.
createModel
(
modelData
)
message
.
success
(
'新增成功'
)
try
{
await
message
.
confirm
(
'
创建流程
成功,是否继续编辑?'
)
await
message
.
confirm
(
'
流程创建
成功,是否继续编辑?'
)
// 用户点击继续编辑,跳转到编辑页面
await
nextTick
()
// 先删除当前页签
...
...
@@ -295,7 +295,7 @@ const handleSave = async () => {
// 跳转到编辑页面
await
router
.
push
({
name
:
'BpmModelUpdate'
,
params
:
{
id
:
formData
.
value
.
id
}
params
:
{
id
:
formData
.
value
.
id
,
processDefinitionId
:
formData
.
value
.
processDefinitionId
}
})
}
catch
{
// 先删除当前页签
...
...
@@ -318,6 +318,13 @@ const handleDeploy = async () => {
await
message
.
confirm
(
'是否确认发布该流程?'
)
}
//校验当前版本的流程下是否存在正在进行中的单据
const
res
=
await
ModelApi
.
getProcessInstance
(
row
.
processDefinition
.
id
)
if
(
res
)
{
message
.
error
(
'当前版本下存在正在进行中的单据,请先结束单据后再发布'
)
return
}
// 校验所有步骤
await
validateAllSteps
()
...
...
@@ -345,6 +352,11 @@ const handleDeploy = async () => {
}
}
const
validateProcessInstance
=
async
(
processDefinitionId
)
=>
{
const
valid
=
await
ModelApi
.
getProcessInstance
(
processDefinitionId
)
console
.
log
(
valid
)
}
/** 步骤切换处理 */
const
handleStepClick
=
async
(
index
:
number
)
=>
{
try
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment