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
a26cb120
authored
Mar 02, 2025
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【功能新增】BPM:支持通过“历史”进行恢复
parent
2a73b9c4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
44 deletions
+76
-44
src/api/bpm/model/index.ts
+1
-0
src/views/bpm/model/CategoryDraggableModel.vue
+1
-7
src/views/bpm/model/definition/index.vue
+20
-0
src/views/bpm/model/form/index.vue
+54
-37
No files found.
src/api/bpm/model/index.ts
View file @
a26cb120
...
...
@@ -31,6 +31,7 @@ export const getModelList = async (name: string | undefined) => {
}
export
const
getModel
=
async
(
id
:
string
)
=>
{
debugger
return
await
request
.
get
({
url
:
'/bpm/model/get?id='
+
id
})
}
...
...
src/views/bpm/model/CategoryDraggableModel.vue
View file @
a26cb120
...
...
@@ -277,7 +277,6 @@ import { checkPermi } from '@/utils/permission'
import
{
useUserStoreWithOut
}
from
'@/store/modules/user'
import
{
useAppStore
}
from
'@/store/modules/app'
import
{
cloneDeep
,
isEqual
}
from
'lodash-es'
import
{
useTagsView
}
from
'@/hooks/web/useTagsView'
import
{
useDebounceFn
}
from
'@vueuse/core'
import
{
subString
}
from
'@/utils/index'
...
...
@@ -589,8 +588,7 @@ const handleDeleteCategory = async () => {
}
catch
{}
}
/** 添加流程模型弹窗 */
const
tagsView
=
useTagsView
()
/** 添加/修改/复制流程模型弹窗 */
const
openModelForm
=
async
(
type
:
string
,
id
?:
number
)
=>
{
if
(
type
===
'create'
)
{
await
push
({
name
:
'BpmModelCreate'
})
...
...
@@ -599,10 +597,6 @@ const openModelForm = async (type: string, id?: number) => {
name
:
'BpmModelUpdate'
,
params
:
{
id
,
type
}
})
// 设置标题
if
(
type
===
'copy'
)
{
tagsView
.
setTitle
(
'复制流程'
)
}
}
}
...
...
src/views/bpm/model/definition/index.vue
View file @
a26cb120
...
...
@@ -66,6 +66,18 @@
width=
"180"
:formatter=
"dateFormatter"
/>
<el-table-column
label=
"操作"
align=
"center"
>
<
template
#
default=
"scope"
>
<el-button
link
type=
"primary"
@
click=
"openModelForm(scope.row.id)"
v-hasPermi=
"['bpm:model:update']"
>
恢复
</el-button>
</
template
>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
...
...
@@ -134,6 +146,14 @@ const handleFormDetail = async (row: any) => {
}
}
/** 恢复流程模型弹窗 */
const
openModelForm
=
async
(
id
?:
number
)
=>
{
await
push
({
name
:
'BpmModelUpdate'
,
params
:
{
id
,
type
:
'definition'
}
})
}
/** 初始化 **/
onMounted
(()
=>
{
getList
()
...
...
src/views/bpm/model/form/index.vue
View file @
a26cb120
...
...
@@ -44,8 +44,13 @@
<!-- 右侧按钮 -->
<div
class=
"w-200px flex items-center justify-end gap-2"
>
<el-button
v-if=
"route.params.id"
type=
"success"
@
click=
"handleDeploy"
>
发 布
</el-button>
<el-button
type=
"primary"
@
click=
"handleSave"
>
保 存
</el-button>
<el-button
v-if=
"actionType === 'update'"
type=
"success"
@
click=
"handleDeploy"
>
发 布
</el-button>
<el-button
type=
"primary"
@
click=
"handleSave"
>
<span
v-if=
"actionType === 'definition'"
>
恢 复
</span>
<span
v-else
>
保 存
</span>
</el-button>
</div>
</div>
...
...
@@ -81,20 +86,23 @@
<
script
lang=
"ts"
setup
>
import
{
useRoute
,
useRouter
}
from
'vue-router'
import
{
useMessage
}
from
'@/hooks/web/useMessage'
import
{
useTagsViewStore
}
from
'@/store/modules/tagsView'
import
{
useUserStoreWithOut
}
from
'@/store/modules/user'
import
*
as
ModelApi
from
'@/api/bpm/model'
import
*
as
FormApi
from
'@/api/bpm/form'
import
{
CategoryApi
,
CategoryVO
}
from
'@/api/bpm/category'
import
*
as
UserApi
from
'@/api/system/user'
import
{
useUserStoreWithOut
}
from
'@/store/modules/user
'
import
*
as
DefinitionApi
from
'@/api/bpm/definition
'
import
{
BpmModelFormType
,
BpmModelType
,
BpmAutoApproveType
}
from
'@/utils/constants'
import
BasicInfo
from
'./BasicInfo.vue'
import
FormDesign
from
'./FormDesign.vue'
import
ProcessDesign
from
'./ProcessDesign.vue'
import
{
useTagsViewStore
}
from
'@/store/modules/tagsView'
import
ExtraSettings
from
'./ExtraSettings.vue'
import
{
useTagsView
}
from
'@/hooks/web/useTagsView'
const
router
=
useRouter
()
const
{
delView
}
=
useTagsViewStore
()
// 视图操作
const
tagsView
=
useTagsView
()
const
route
=
useRoute
()
const
message
=
useMessage
()
const
userStore
=
useUserStoreWithOut
()
...
...
@@ -165,7 +173,7 @@ const formData: any = ref({
}
})
//流程数据
//
流程数据
const
processData
=
ref
<
any
>
()
provide
(
'processData'
,
processData
)
...
...
@@ -177,20 +185,36 @@ const categoryList = ref<CategoryVO[]>([])
const
userList
=
ref
<
UserApi
.
UserVO
[]
>
([])
/** 初始化数据 */
const
actionType
=
route
.
params
.
type
as
string
const
initData
=
async
()
=>
{
if
(
actionType
===
'definition'
)
{
// 情况一:流程定义场景(恢复)
const
definitionId
=
route
.
params
.
id
as
string
const
data
=
await
DefinitionApi
.
getProcessDefinition
(
definitionId
)
// 将 definition => model,最终赋值
data
.
type
=
data
.
modelType
delete
data
.
modelType
data
.
id
=
data
.
modelId
delete
data
.
modelId
if
(
data
.
simpleModel
)
{
data
.
simpleModel
=
JSON
.
parse
(
data
.
simpleModel
)
}
formData
.
value
=
data
formData
.
value
.
startUserType
=
formData
.
value
.
startUserIds
?.
length
>
0
?
1
:
0
}
else
if
([
'update'
,
'copy'
].
includes
(
actionType
))
{
// 情况二:修改场景/复制场景
const
modelId
=
route
.
params
.
id
as
string
if
(
modelId
)
{
// 修改场景
formData
.
value
=
await
ModelApi
.
getModel
(
modelId
)
formData
.
value
.
startUserType
=
formData
.
value
.
startUserIds
?.
length
>
0
?
1
:
0
// 复制场景
if
(
route
.
params
.
t
ype
===
'copy'
)
{
//
特殊:
复制场景
if
(
actionT
ype
===
'copy'
)
{
delete
formData
.
value
.
id
formData
.
value
.
name
+=
'副本'
formData
.
value
.
key
+=
'_copy'
tagsView
.
setTitle
(
'复制流程'
)
}
}
else
{
// 新增场景
//
情况三:
新增场景
formData
.
value
.
startUserType
=
0
// 全体
formData
.
value
.
managerUserIds
.
push
(
userStore
.
getUser
.
id
)
}
...
...
@@ -271,37 +295,31 @@ const handleSave = async () => {
...
formData
.
value
}
if
(
formData
.
value
.
id
)
{
if
(
actionType
===
'definition'
)
{
// 情况一:流程定义场景(恢复)
await
ModelApi
.
updateModel
(
modelData
)
// 提示成功
message
.
success
(
'恢复成功,可点击【发布】按钮,进行发布模型'
)
}
else
if
(
actionType
===
'update'
)
{
// 修改场景
await
ModelApi
.
updateModel
(
modelData
)
// 询问是否发布流程
try
{
await
message
.
confirm
(
'修改流程成功,是否发布流程?'
)
// 用户点击确认,执行发布
await
handleDeploy
()
}
catch
{
// 用户点击取消,停留在当前页面
}
// 提示成功
message
.
success
(
'修改成功,可点击【发布】按钮,进行发布模型'
)
}
else
if
(
actionType
===
'copy'
)
{
// 情况三:复制场景
formData
.
value
.
id
=
await
ModelApi
.
createModel
(
modelData
)
// 提示成功
message
.
success
(
'复制成功,可点击【发布】按钮,进行发布模型'
)
}
else
{
// 新增场景
//
情况四:
新增场景
formData
.
value
.
id
=
await
ModelApi
.
createModel
(
modelData
)
try
{
await
message
.
confirm
(
'流程创建成功,是否继续编辑?'
)
// 用户点击继续编辑,跳转到编辑页面
await
nextTick
()
// 先删除当前页签
delView
(
unref
(
router
.
currentRoute
))
// 跳转到编辑页面
await
router
.
push
({
name
:
'BpmModelUpdate'
,
params
:
{
id
:
formData
.
value
.
id
}
})
}
catch
{
// 先删除当前页签
delView
(
unref
(
router
.
currentRoute
))
// 用户点击返回列表
await
router
.
push
({
name
:
'BpmModel'
})
// 提示成功
message
.
success
(
'新建成功,可点击【发布】按钮,进行发布模型'
)
}
// 返回列表页(排除更新的情况)
if
(
actionType
!==
'update'
)
{
await
router
.
push
({
name
:
'BpmModel'
})
}
}
catch
(
error
:
any
)
{
console
.
error
(
'保存失败:'
,
error
)
...
...
@@ -346,7 +364,6 @@ const handleDeploy = async () => {
/** 步骤切换处理 */
const
handleStepClick
=
async
(
index
:
number
)
=>
{
try
{
console
.
log
(
'index'
,
index
)
if
(
index
!==
0
)
{
await
validateBasic
()
}
...
...
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