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
1bb6a23f
authored
Nov 02, 2024
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【功能实现】工作流:流程模型的分类、模型读取 list 接口
【功能实现】工作流:流程模型的分类名的修改实现
parent
fec7af45
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
53 deletions
+67
-53
pnpm-lock.yaml
+0
-0
src/api/bpm/model/index.ts
+2
-2
src/views/bpm/model/CategoryDraggableModel.vue
+34
-21
src/views/bpm/model/index.vue
+30
-29
src/views/bpm/model/index_old.vue
+1
-1
No files found.
pnpm-lock.yaml
View file @
1bb6a23f
This diff is collapsed.
Click to expand it.
src/api/bpm/model/index.ts
View file @
1bb6a23f
...
@@ -26,8 +26,8 @@ export type ModelVO = {
...
@@ -26,8 +26,8 @@ export type ModelVO = {
bpmnXml
:
string
bpmnXml
:
string
}
}
export
const
getModel
Page
=
async
(
params
)
=>
{
export
const
getModel
List
=
async
(
name
:
string
|
undefined
)
=>
{
return
await
request
.
get
({
url
:
'/bpm/model/
page'
,
params
})
return
await
request
.
get
({
url
:
'/bpm/model/
list'
,
params
:
{
name
}
})
}
}
export
const
getModel
=
async
(
id
:
string
)
=>
{
export
const
getModel
=
async
(
id
:
string
)
=>
{
...
...
src/views/bpm/model/CategoryDraggableModel.vue
View file @
1bb6a23f
...
@@ -39,7 +39,10 @@
...
@@ -39,7 +39,10 @@
<Icon
icon=
"fa:plus"
class=
"mr-5px"
/>
<Icon
icon=
"fa:plus"
class=
"mr-5px"
/>
新建
新建
</el-button>
</el-button>
<el-dropdown
@
command=
"(command) => handleCategoryCommand(command)"
placement=
"bottom"
>
<el-dropdown
@
command=
"(command) => handleCategoryCommand(command, categoryInfo)"
placement=
"bottom"
>
<el-button
link
type=
"info"
>
<el-button
link
type=
"info"
>
<Icon
icon=
"ep:setting"
class=
"mr-5px"
/>
<Icon
icon=
"ep:setting"
class=
"mr-5px"
/>
分类
分类
...
@@ -47,7 +50,7 @@
...
@@ -47,7 +50,7 @@
<template
#
dropdown
>
<template
#
dropdown
>
<el-dropdown-menu>
<el-dropdown-menu>
<el-dropdown-item
command=
"handleRename"
>
重命名
</el-dropdown-item>
<el-dropdown-item
command=
"handleRename"
>
重命名
</el-dropdown-item>
<el-dropdown-item
command=
"handleDelete
Group
"
>
删除该类
</el-dropdown-item>
<el-dropdown-item
command=
"handleDelete
Category
"
>
删除该类
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown-menu>
</
template
>
</
template
>
</el-dropdown>
</el-dropdown>
...
@@ -178,7 +181,7 @@
...
@@ -178,7 +181,7 @@
</el-button>
</el-button>
<el-dropdown
<el-dropdown
class=
"!align-middle ml-5px"
class=
"!align-middle ml-5px"
@
command=
"(command) => handleCommand(command, scope.row)"
@
command=
"(command) => handle
Model
Command(command, scope.row)"
v-hasPermi=
"['bpm:process-definition:query', 'bpm:model:update', 'bpm:model:delete']"
v-hasPermi=
"['bpm:process-definition:query', 'bpm:model:update', 'bpm:model:delete']"
>
>
<el-button
type=
"primary"
link
>
更多
</el-button>
<el-button
type=
"primary"
link
>
更多
</el-button>
...
@@ -215,27 +218,28 @@
...
@@ -215,27 +218,28 @@
</el-collapse-transition>
</el-collapse-transition>
<!-- 弹窗:重命名分类 -->
<!-- 弹窗:重命名分类 -->
<Dialog
:fullscreen=
"false"
class=
"rename-dialog"
v-model=
"renameVisible"
width=
"400"
>
<Dialog
:fullscreen=
"false"
class=
"rename-dialog"
v-model=
"rename
Category
Visible"
width=
"400"
>
<
template
#
title
>
<
template
#
title
>
<div
class=
"pl-10px font-bold text-18px"
>
重命名分类
</div>
<div
class=
"pl-10px font-bold text-18px"
>
重命名分类
</div>
</
template
>
</
template
>
<div
class=
"px-30px"
>
<div
class=
"px-30px"
>
<el-input
v-model=
"rename
Val
"
/>
<el-input
v-model=
"rename
CategoryForm.name
"
/>
</div>
</div>
<
template
#
footer
>
<
template
#
footer
>
<div
class=
"pr-25px pb-25px"
>
<div
class=
"pr-25px pb-25px"
>
<el-button
@
click=
"renameVisible = false"
>
取 消
</el-button>
<el-button
@
click=
"rename
Category
Visible = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"handleRenameConfirm"
>
确 定
</el-button>
<el-button
type=
"primary"
@
click=
"handleRenameConfirm"
>
确 定
</el-button>
</div>
</div>
</
template
>
</
template
>
</Dialog>
</Dialog>
<!-- 表单弹窗:添加流程模型 -->
<!-- 表单弹窗:添加流程模型 -->
<ModelForm
:categoryId=
"categoryInfo.code"
ref=
"modelFormRef"
@
success=
"emit('success')"
/>
<ModelForm
:categoryId=
"categoryInfo.code"
ref=
"modelFormRef"
@
success=
"emit('success')"
/>
</template>
</template>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
ModelForm
from
'./ModelForm.vue'
import
ModelForm
from
'./ModelForm.vue'
import
{
CategoryApi
}
from
'@/api/bpm/category'
import
{
CategoryApi
,
CategoryVO
}
from
'@/api/bpm/category'
import
Sortable
from
'sortablejs'
import
Sortable
from
'sortablejs'
import
{
propTypes
}
from
'@/utils/propTypes'
import
{
propTypes
}
from
'@/utils/propTypes'
import
{
formatDate
}
from
'@/utils/formatTime'
import
{
formatDate
}
from
'@/utils/formatTime'
...
@@ -250,7 +254,6 @@ import { cloneDeep } from 'lodash-es'
...
@@ -250,7 +254,6 @@ import { cloneDeep } from 'lodash-es'
defineOptions
({
name
:
'BpmModel'
})
defineOptions
({
name
:
'BpmModel'
})
const
renameVisible
=
ref
(
false
)
const
props
=
defineProps
({
const
props
=
defineProps
({
// 分类后的数据
// 分类后的数据
categoryInfo
:
propTypes
.
object
.
def
([]),
categoryInfo
:
propTypes
.
object
.
def
([]),
...
@@ -267,8 +270,9 @@ const isModelSorting = ref(false) // 是否正处于排序状态
...
@@ -267,8 +270,9 @@ const isModelSorting = ref(false) // 是否正处于排序状态
const
tableData
:
any
=
ref
([])
const
tableData
:
any
=
ref
([])
const
originalData
:
any
=
ref
([])
// 原始数据
const
originalData
:
any
=
ref
([])
// 原始数据
const
isExpand
=
ref
(
false
)
// 是否处于展开状态
const
isExpand
=
ref
(
false
)
// 是否处于展开状态
/** '更多'操作按钮 */
/** '更多'操作按钮 */
const
handleCommand
=
(
command
:
string
,
row
:
any
)
=>
{
const
handle
Model
Command
=
(
command
:
string
,
row
:
any
)
=>
{
switch
(
command
)
{
switch
(
command
)
{
case
'handleDefinitionList'
:
case
'handleDefinitionList'
:
handleDefinitionList
(
row
)
handleDefinitionList
(
row
)
...
@@ -284,15 +288,15 @@ const handleCommand = (command: string, row: any) => {
...
@@ -284,15 +288,15 @@ const handleCommand = (command: string, row: any) => {
}
}
}
}
/* '分类'操作按钮 */
/*
*
'分类'操作按钮 */
const
handleCategoryCommand
=
(
command
:
string
)
=>
{
const
handleCategoryCommand
=
async
(
command
:
string
,
row
:
any
)
=>
{
switch
(
command
)
{
switch
(
command
)
{
case
'handleRename'
:
case
'handleRename'
:
rename
Val
.
value
=
props
.
categoryInfo
.
name
rename
CategoryForm
.
value
=
await
CategoryApi
.
getCategory
(
row
.
id
)
renameVisible
.
value
=
true
rename
Category
Visible
.
value
=
true
break
break
case
'handleDelete
Group
'
:
case
'handleDelete
Category
'
:
handleDeleteGroup
()
await
handleDeleteCategory
()
break
break
default
:
default
:
break
break
...
@@ -364,7 +368,7 @@ const handleDeploy = async (row: any) => {
...
@@ -364,7 +368,7 @@ const handleDeploy = async (row: any) => {
}
}
/** 跳转到指定流程定义列表 */
/** 跳转到指定流程定义列表 */
const
handleDefinitionList
=
(
row
)
=>
{
const
handleDefinitionList
=
(
row
:
any
)
=>
{
push
({
push
({
name
:
'BpmProcessDefinition'
,
name
:
'BpmProcessDefinition'
,
query
:
{
query
:
{
...
@@ -450,16 +454,25 @@ const updateTableData = () => {
...
@@ -450,16 +454,25 @@ const updateTableData = () => {
}
}
}
}
const
renameVal
=
ref
(
''
)
/** 重命名弹窗确定 */
// 重命名弹窗确定
const
renameCategoryVisible
=
ref
(
false
)
const
handleRenameConfirm
=
()
=>
{
const
renameCategoryForm
=
ref
({
if
(
!
renameVal
.
value
)
{
name
:
''
})
const
handleRenameConfirm
=
async
()
=>
{
if
(
renameCategoryForm
.
value
?.
name
.
length
===
0
)
{
return
message
.
warning
(
'请输入名称'
)
return
message
.
warning
(
'请输入名称'
)
}
}
// 发起修改
await
CategoryApi
.
updateCategory
(
renameCategoryForm
.
value
as
CategoryVO
)
message
.
success
(
'修改成功'
)
// 刷新列表
renameCategoryVisible
.
value
=
false
emit
(
'success'
)
}
}
// 删除分类
// 删除分类
const
handleDelete
Group
=
async
()
=>
{
const
handleDelete
Category
=
async
()
=>
{
try
{
try
{
if
(
props
.
categoryInfo
.
modelList
.
length
>
0
)
{
if
(
props
.
categoryInfo
.
modelList
.
length
>
0
)
{
return
message
.
warning
(
'该分类下仍有流程定义,不允许删除'
)
return
message
.
warning
(
'该分类下仍有流程定义,不允许删除'
)
...
...
src/views/bpm/model/index.vue
View file @
1bb6a23f
...
@@ -12,9 +12,9 @@
...
@@ -12,9 +12,9 @@
label-width=
"68px"
label-width=
"68px"
@
submit
.
prevent
@
submit
.
prevent
>
>
<el-form-item
align=
"right"
prop=
"key
"
class=
"ml-auto"
>
<el-form-item
prop=
"name
"
class=
"ml-auto"
>
<el-input
<el-input
v-model=
"queryParams.
key
"
v-model=
"queryParams.
name
"
placeholder=
"搜索流程"
placeholder=
"搜索流程"
clearable
clearable
@
keyup
.
enter=
"handleQuery"
@
keyup
.
enter=
"handleQuery"
...
@@ -25,12 +25,12 @@
...
@@ -25,12 +25,12 @@
</
template
>
</
template
>
</el-input>
</el-input>
</el-form-item>
</el-form-item>
<!-- 右上角:新建模型、更多操作 -->
<el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"openForm('create')"
v-hasPermi=
"['bpm:model:create']"
>
<el-button
type=
"primary"
@
click=
"openForm('create')"
v-hasPermi=
"['bpm:model:create']"
>
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
新建模型
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
新建模型
</el-button>
</el-button>
</el-form-item>
</el-form-item>
<el-form-item>
<el-form-item>
<el-dropdown
@
command=
"(command) => handleCommand(command)"
placement=
"bottom-end"
>
<el-dropdown
@
command=
"(command) => handleCommand(command)"
placement=
"bottom-end"
>
<el-button
class=
"w-30px"
plain
>
<el-button
class=
"w-30px"
plain
>
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
<el-divider
/>
<el-divider
/>
<!--
分类卡片组
-->
<!--
按照分类,展示其所属的模型列表
-->
<div
class=
"px-15px"
>
<div
class=
"px-15px"
>
<draggable
<draggable
:disabled=
"!isCategorySorting"
:disabled=
"!isCategorySorting"
...
@@ -75,7 +75,6 @@
...
@@ -75,7 +75,6 @@
:key="element.id"
:key="element.id"
>
>
<CategoryDraggableModel
<CategoryDraggableModel
ref=
"categoryDraggableModelRef"
:isCategorySorting=
"isCategorySorting"
:isCategorySorting=
"isCategorySorting"
:categoryInfo=
"element"
:categoryInfo=
"element"
@
success=
"getList"
@
success=
"getList"
...
@@ -88,7 +87,7 @@
...
@@ -88,7 +87,7 @@
<!-- 表单弹窗:添加/修改流程 -->
<!-- 表单弹窗:添加/修改流程 -->
<ModelForm
ref=
"formRef"
@
success=
"getList"
/>
<ModelForm
ref=
"formRef"
@
success=
"getList"
/>
<!-- 表单弹窗:添加
/修改
分类 -->
<!-- 表单弹窗:添加分类 -->
<CategoryForm
ref=
"categoryFormRef"
@
success=
"getList"
/>
<CategoryForm
ref=
"categoryFormRef"
@
success=
"getList"
/>
<!-- 弹窗:表单详情 -->
<!-- 弹窗:表单详情 -->
<Dialog
title=
"表单详情"
v-model=
"formDetailVisible"
width=
"800"
>
<Dialog
title=
"表单详情"
v-model=
"formDetailVisible"
width=
"800"
>
...
@@ -107,34 +106,30 @@ import CategoryDraggableModel from './CategoryDraggableModel.vue'
...
@@ -107,34 +106,30 @@ import CategoryDraggableModel from './CategoryDraggableModel.vue'
defineOptions
({
name
:
'BpmModel'
})
defineOptions
({
name
:
'BpmModel'
})
const
categoryDraggableModelRef
=
ref
()
const
categoryFormRef
=
ref
()
const
categoryFormRef
=
ref
()
const
loading
=
ref
(
true
)
// 列表的加载中
const
loading
=
ref
(
true
)
// 列表的加载中
const
isCategorySorting
=
ref
(
false
)
// 是否正处于排序状态
const
isCategorySorting
=
ref
(
false
)
// 是否
category
正处于排序状态
const
queryParams
=
reactive
({
const
queryParams
=
reactive
({
pageNo
:
1
,
name
:
undefined
pageSize
:
10
,
key
:
undefined
,
name
:
undefined
,
category
:
undefined
})
})
const
queryFormRef
=
ref
()
// 搜索的表单
const
queryFormRef
=
ref
()
// 搜索的表单
const
categoryGroup
:
any
=
ref
([])
// 按照category分组的数据
const
categoryGroup
:
any
=
ref
([])
// 按照 category 分组的数据
const
originalData
:
any
=
ref
([])
const
originalData
:
any
=
ref
([])
// 原始数据
// 查询所有分类数据
/** 查询所有分类 */
const
getAllCategory
=
async
()
=>
{
const
getAllCategory
=
async
()
=>
{
// TODO 芋艿:这里需要一个不分页查全部的流程分类接口
const
list
=
await
CategoryApi
.
getCategorySimpleList
()
const
data
=
await
CategoryApi
.
getCategoryPage
(
queryParams
)
categoryGroup
.
value
=
list
.
map
((
item
:
any
)
=>
({
...
item
,
modelList
:
[]
}))
categoryGroup
.
value
=
data
.
list
.
map
((
item
)
=>
({
...
item
,
modelList
:
[]
}))
}
}
/** 查询所有流程模型接口 */
/** 查询所有流程模型接口 */
const
getAllModel
=
async
()
=>
{
const
getAllModel
=
async
()
=>
{
// TODO 芋艿:这里需要一个不分页查全部的流程模型接口
// 查询所有流程模型
const
data
=
await
ModelApi
.
getModelPage
(
queryParams
)
const
list
=
await
ModelApi
.
getModelList
(
queryParams
.
name
)
const
groupedData
=
groupBy
(
data
.
list
,
'categoryName'
)
// 按照 categoryName 分组
const
groupedData
=
groupBy
(
list
,
'categoryName'
)
Object
.
keys
(
groupedData
).
forEach
((
key
)
=>
{
Object
.
keys
(
groupedData
).
forEach
((
key
)
=>
{
const
category
=
categoryGroup
.
value
.
find
((
item
)
=>
item
.
name
===
key
)
const
category
=
categoryGroup
.
value
.
find
((
item
:
any
)
=>
item
.
name
===
key
)
if
(
category
)
{
if
(
category
)
{
category
.
modelList
=
groupedData
[
key
]
category
.
modelList
=
groupedData
[
key
]
}
}
...
@@ -143,7 +138,6 @@ const getAllModel = async () => {
...
@@ -143,7 +138,6 @@ const getAllModel = async () => {
/** 搜索按钮操作 */
/** 搜索按钮操作 */
const
handleQuery
=
()
=>
{
const
handleQuery
=
()
=>
{
queryParams
.
pageNo
=
1
getList
()
getList
()
}
}
...
@@ -152,6 +146,7 @@ const formRef = ref()
...
@@ -152,6 +146,7 @@ const formRef = ref()
const
openForm
=
(
type
:
string
,
id
?:
number
)
=>
{
const
openForm
=
(
type
:
string
,
id
?:
number
)
=>
{
formRef
.
value
.
open
(
type
,
id
)
formRef
.
value
.
open
(
type
,
id
)
}
}
/** 流程表单的详情按钮操作 */
/** 流程表单的详情按钮操作 */
const
formDetailVisible
=
ref
(
false
)
const
formDetailVisible
=
ref
(
false
)
const
formDetailPreview
=
ref
({
const
formDetailPreview
=
ref
({
...
@@ -173,27 +168,33 @@ const handleCommand = (command: string) => {
...
@@ -173,27 +168,33 @@ const handleCommand = (command: string) => {
}
}
}
}
/
/ 新建分类
/
** 新建分类 */
const
handleAddCategory
=
()
=>
{
const
handleAddCategory
=
()
=>
{
categoryFormRef
.
value
.
open
(
'create'
)
categoryFormRef
.
value
.
open
(
'create'
)
}
}
// 分类排序
// TODO 芋艿:需要实现
/** 分类排序 */
const
handleSort
=
()
=>
{
const
handleSort
=
()
=>
{
// 保存初始数据
// 保存初始数据
originalData
.
value
=
cloneDeep
(
categoryGroup
.
value
)
originalData
.
value
=
cloneDeep
(
categoryGroup
.
value
)
isCategorySorting
.
value
=
true
isCategorySorting
.
value
=
true
}
}
// 取消排序
// TODO 芋艿:需要实现
/** 取消排序 */
const
cancelSort
=
()
=>
{
const
cancelSort
=
()
=>
{
// 恢复初始数据
// 恢复初始数据
categoryGroup
.
value
=
cloneDeep
(
originalData
.
value
)
categoryGroup
.
value
=
cloneDeep
(
originalData
.
value
)
isCategorySorting
.
value
=
false
isCategorySorting
.
value
=
false
}
}
// 保存排序
/** 保存排序 */
const
saveSort
=
()
=>
{
const
saveSort
=
()
=>
{
// TODO 芋艿:这里需要一个保存分类排序接口
// TODO 芋艿:这里需要一个保存分类排序接口
}
}
/** 加载数据 */
const
getList
=
async
()
=>
{
const
getList
=
async
()
=>
{
loading
.
value
=
true
loading
.
value
=
true
try
{
try
{
...
@@ -205,7 +206,7 @@ const getList = async () => {
...
@@ -205,7 +206,7 @@ const getList = async () => {
}
}
/** 初始化 **/
/** 初始化 **/
onMounted
(
async
()
=>
{
onMounted
(()
=>
{
getList
()
getList
()
})
})
</
script
>
</
script
>
...
...
src/views/bpm/model/index_old.vue
View file @
1bb6a23f
...
@@ -252,7 +252,7 @@ const categoryList = ref([]) // 流程分类列表
...
@@ -252,7 +252,7 @@ const categoryList = ref([]) // 流程分类列表
const
getList
=
async
()
=>
{
const
getList
=
async
()
=>
{
loading
.
value
=
true
loading
.
value
=
true
try
{
try
{
const
data
=
await
ModelApi
.
getModel
Page
(
queryParams
)
const
data
=
await
ModelApi
.
getModel
List
(
queryParams
)
list
.
value
=
data
.
list
list
.
value
=
data
.
list
total
.
value
=
data
.
total
total
.
value
=
data
.
total
}
finally
{
}
finally
{
...
...
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