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
d7891fe7
authored
Mar 28, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vue3 重构:流程实例的创建
parent
ddd6bbbe
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
102 deletions
+66
-102
src/api/bpm/processInstance/index.ts
+1
-0
src/router/modules/remaining.ts
+1
-1
src/views/bpm/processInstance/create/index.vue
+64
-62
src/views/bpm/processInstance/create/process.create.ts
+0
-39
No files found.
src/api/bpm/processInstance/index.ts
View file @
d7891fe7
...
...
@@ -4,6 +4,7 @@ export type Task = {
id
:
string
name
:
string
}
export
type
ProcessInstanceVO
=
{
id
:
number
name
:
string
...
...
src/router/modules/remaining.ts
View file @
d7891fe7
...
...
@@ -272,7 +272,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
},
{
path
:
'/process-instance/create'
,
component
:
()
=>
import
(
'@/views/bpm/processInstance/create.vue'
),
component
:
()
=>
import
(
'@/views/bpm/processInstance/create
/index
.vue'
),
name
:
'BpmProcessInstanceCreate'
,
meta
:
{
noCache
:
true
,
...
...
src/views/bpm/processInstance/create/index.vue
View file @
d7891fe7
<
template
>
<
ContentWrap
>
<!-- 第一步,通过流程定义的列表,选择对应的流程 --
>
<
div
v-if=
"!selectProcessInstance
"
>
<
XTable
@
register=
"registerTable"
>
<!-- 流程分类 --
>
<template
#
category_default=
"
{ row }
">
<
DictTag
:type=
"DICT_TYPE.BPM_MODEL_CATEGORY"
:value=
"Number(row?.category)
"
/>
<
!-- 第一步,通过流程定义的列表,选择对应的流程 --
>
<ContentWrap
v-if=
"!selectProcessInstance"
>
<
el-table
v-loading=
"loading"
:data=
"list
"
>
<
el-table-column
label=
"流程名称"
align=
"center"
prop=
"name"
/
>
<el-table-column
label=
"流程分类"
align=
"center"
prop=
"category"
>
<template
#
default=
"scope
"
>
<
dict-tag
:type=
"DICT_TYPE.BPM_MODEL_CATEGORY"
:value=
"scope.row.category
"
/>
</
template
>
<
template
#
version_default=
"{ row }"
>
<el-tag
v-if=
"row"
>
v
{{
row
.
version
}}
</el-tag>
</el-table-column>
<el-table-column
label=
"流程版本"
align=
"center"
prop=
"version"
>
<
template
#
default=
"scope"
>
<el-tag>
v
{{
scope
.
row
.
version
}}
</el-tag>
</
template
>
<
template
#
actionbtns_default=
"{ row }"
>
<XTextButton
preIcon=
"ep:plus"
title=
"选择"
@
click=
"handleSelect(row)"
/>
</el-table-column>
<el-table-column
label=
"流程描述"
align=
"center"
prop=
"description"
/>
<el-table-column
label=
"操作"
align=
"center"
>
<
template
#
default=
"scope"
>
<el-button
link
type=
"primary"
@
click=
"handleSelect(scope.row)"
>
<Icon
icon=
"ep:plus"
/>
选择
</el-button>
</
template
>
</XTable>
</div>
<!-- 第二步,填写表单,进行流程的提交 -->
<div
v-else
>
<el-card
class=
"box-card"
>
<div
class=
"clearfix"
>
<span
class=
"el-icon-document"
>
申请信息【{{ selectProcessInstance.name }}】
</span>
<XButton
style=
"float: right"
type=
"primary"
preIcon=
"ep:delete"
title=
"选择其它流程"
@
click=
"selectProcessInstance = undefined"
/>
</div>
<el-col
:span=
"16"
:offset=
"6"
style=
"margin-top: 20px"
>
<form-create
:rule=
"detailForm.rule"
v-model:api=
"fApi"
:option=
"detailForm.option"
@
submit=
"submitForm"
/>
</el-col>
</el-card>
<!-- 流程图预览 -->
<ProcessInstanceBpmnViewer
:bpmn-xml=
"bpmnXML"
/>
</div>
</el-table-column>
</el-table>
</ContentWrap>
<!-- 第二步,填写表单,进行流程的提交 -->
<ContentWrap
v-else
>
<el-card
class=
"box-card"
>
<div
class=
"clearfix"
>
<span
class=
"el-icon-document"
>
申请信息【{{ selectProcessInstance.name }}】
</span>
<el-button
style=
"float: right"
type=
"primary"
@
click=
"selectProcessInstance = undefined"
>
<Icon
icon=
"ep:delete"
/>
选择其它流程
</el-button>
</div>
<el-col
:span=
"16"
:offset=
"6"
style=
"margin-top: 20px"
>
<form-create
:rule=
"detailForm.rule"
v-model:api=
"fApi"
:option=
"detailForm.option"
@
submit=
"submitForm"
/>
</el-col>
</el-card>
<!-- 流程图预览 -->
<ProcessInstanceBpmnViewer
:bpmn-xml=
"bpmnXML"
/>
</ContentWrap>
</template>
<
script
setup
lang=
"ts"
>
import
{
DICT_TYPE
}
from
'@/utils/dict'
// 业务相关的 import
import
{
allSchemas
}
from
'./process.create'
import
*
as
DefinitionApi
from
'@/api/bpm/definition'
import
*
as
ProcessInstanceApi
from
'@/api/bpm/processInstance'
import
{
setConfAndFields2
}
from
'@/utils/formCreate'
...
...
@@ -55,28 +57,32 @@ const router = useRouter() // 路由
const
message
=
useMessage
()
// 消息
// ========== 列表相关 ==========
const
[
registerTable
]
=
useXTable
({
allSchemas
:
allSchemas
,
params
:
{
suspensionState
:
1
},
getListApi
:
DefinitionApi
.
getProcessDefinitionList
,
isList
:
true
const
loading
=
ref
(
true
)
// 列表的加载中
const
list
=
ref
([])
// 列表的数据
const
queryParams
=
reactive
({
suspensionState
:
1
})
// ========== 表单相关 ==========
/** 查询列表 */
const
getList
=
async
()
=>
{
loading
.
value
=
true
try
{
list
.
value
=
await
DefinitionApi
.
getProcessDefinitionList
(
queryParams
)
}
finally
{
loading
.
value
=
false
}
}
// ========== 表单相关 ==========
const
bpmnXML
=
ref
(
null
)
// BPMN 数据
const
fApi
=
ref
<
ApiAttrs
>
()
// 流程表单详情
const
detailForm
=
ref
({
// 流程表单详情
rule
:
[],
option
:
{}
})
// 流程表单
const
selectProcessInstance
=
ref
()
// 选择的流程实例
/** 处理选择流程的按钮操作 **/
const
handleSelect
=
async
(
row
)
=>
{
// 设置选择的流程
...
...
@@ -86,11 +92,8 @@ const handleSelect = async (row) => {
if
(
row
.
formType
==
10
)
{
// 设置表单
setConfAndFields2
(
detailForm
,
row
.
formConf
,
row
.
formFields
)
// 加载流程图
DefinitionApi
.
getProcessDefinitionBpmnXML
(
row
.
id
).
then
((
response
)
=>
{
bpmnXML
.
value
=
response
})
bpmnXML
.
value
=
await
DefinitionApi
.
getProcessDefinitionBpmnXML
(
row
.
id
)
// 情况二:业务表单
}
else
if
(
row
.
formCustomCreatePath
)
{
await
router
.
push
({
...
...
@@ -105,7 +108,6 @@ const submitForm = async (formData) => {
if
(
!
fApi
.
value
||
!
selectProcessInstance
.
value
)
{
return
}
// 提交请求
fApi
.
value
.
btn
.
loading
(
true
)
try
{
...
...
@@ -121,8 +123,8 @@ const submitForm = async (formData) => {
}
}
/
/ ========== 流程图相关 ==========
// // BPMN 数据
const
bpmnXML
=
ref
(
null
)
/
** 初始化 */
onMounted
(()
=>
{
getList
()
}
)
</
script
>
src/views/bpm/processInstance/create/process.create.ts
deleted
100644 → 0
View file @
ddd6bbbe
import
type
{
VxeCrudSchema
}
from
'@/hooks/web/useVxeCrudSchemas'
// crudSchemas
const
crudSchemas
=
reactive
<
VxeCrudSchema
>
({
primaryKey
:
'id'
,
primaryType
:
null
,
action
:
true
,
columns
:
[
{
title
:
'流程名称'
,
field
:
'name'
},
{
title
:
'流程分类'
,
field
:
'category'
,
dictType
:
DICT_TYPE
.
BPM_MODEL_CATEGORY
,
dictClass
:
'number'
,
table
:
{
slots
:
{
default
:
'category_default'
}
}
},
{
title
:
'流程版本'
,
field
:
'version'
,
table
:
{
slots
:
{
default
:
'version_default'
}
}
},
{
title
:
'流程描述'
,
field
:
'description'
}
]
})
export
const
{
allSchemas
}
=
useVxeCrudSchemas
(
crudSchemas
)
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