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
d0bc7f08
authored
Apr 06, 2023
by
Chika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VUE3【流程管理-我的流程】elment-plus改造
parent
173c375b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
211 additions
and
44 deletions
+211
-44
src/router/modules/remaining.ts
+12
-0
src/views/bpm/processInstance/index.vue
+199
-44
No files found.
src/router/modules/remaining.ts
View file @
d0bc7f08
...
...
@@ -341,6 +341,18 @@ const remainingRouter: AppRouteRecordRaw[] = [
title
:
'代办任务'
,
activeMenu
:
'bpm/task/todo/index'
}
},
{
path
:
'/bpm/processInstance'
,
component
:
()
=>
import
(
'@/views/bpm/processInstance/index.vue'
),
name
:
'processInstance'
,
meta
:
{
noCache
:
true
,
hidden
:
true
,
canTo
:
true
,
title
:
'流程办理'
,
activeMenu
:
'bpm/processInstance/index'
}
}
]
},
...
...
src/views/bpm/processInstance/index.vue
View file @
d0bc7f08
<
template
>
<ContentWrap>
<!-- 列表 -->
<XTable
@
register=
"registerTable"
>
<template
#
toolbar_buttons
>
<!-- 操作:新增 -->
<XButton
type=
"primary"
preIcon=
"ep:zoom-in"
title=
"发起流程"
v-hasPermi=
"['bpm:process-instance:query']"
@
click=
"handleCreate"
<!-- 搜索工作栏 -->
<el-form
class=
"-mb-15px"
:model=
"queryParams"
ref=
"queryFormRef"
:inline=
"true"
label-width=
"68px"
>
<el-form-item
label=
"流程名称"
prop=
"name"
>
<el-input
v-model=
"queryParams.name"
placeholder=
"请输入流程名称"
clearable
@
keyup
.
enter=
"handleQuery"
class=
"!w-240px"
/>
</
template
>
<!-- 流程分类 -->
<
template
#
category_default=
"{ row }"
>
<DictTag
:type=
"DICT_TYPE.BPM_MODEL_CATEGORY"
:value=
"Number(row?.category)"
/>
</
template
>
<!-- 当前审批任务 -->
<
template
#
tasks_default=
"{ row }"
>
<el-button
v-for=
"task in row.tasks"
:key=
"task.id"
link
>
<span>
{{
task
.
name
}}
</span>
</el-button>
</
template
>
<!-- 操作 -->
<
template
#
actionbtns_default=
"{ row }"
>
<XTextButton
preIcon=
"ep:view"
:title=
"t('action.detail')"
v-hasPermi=
"['bpm:process-instance:cancel']"
@
click=
"handleDetail(row)"
</el-form-item>
<el-form-item
label=
"所属流程"
prop=
"processDefinitionId"
>
<el-input
v-model=
"queryParams.processDefinitionId"
placeholder=
"请输入流程定义的编号"
clearable
@
keyup
.
enter=
"handleQuery"
class=
"!w-240px"
/>
<XTextButton
preIcon=
"ep:delete"
title=
"取消"
v-if=
"row.result === 1"
v-hasPermi=
"['bpm:process-instance:query']"
@
click=
"handleCancel(row)"
</el-form-item>
<el-form-item
label=
"流程分类"
prop=
"category"
>
<el-select
v-model=
"queryParams.category"
placeholder=
"请选择"
clearable
>
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.BPM_MODEL_CATEGORY)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-select
v-model=
"queryParams.status"
placeholder=
"请选择"
clearable
>
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"结果"
prop=
"result"
>
<el-select
v-model=
"queryParams.result"
placeholder=
"请选择"
clearable
>
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"提交时间"
prop=
"createTime"
>
<el-date-picker
v-model=
"queryParams.createTime"
value-format=
"YYYY-MM-DD HH:mm:ss"
type=
"daterange"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
:default-time=
"[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class=
"!w-240px"
/>
</
template
>
</XTable>
</el-form-item>
<el-form-item>
<el-button
@
click=
"handleQuery"
><Icon
icon=
"ep:search"
class=
"mr-5px"
/>
搜索
</el-button>
<el-button
@
click=
"resetQuery"
><Icon
icon=
"ep:refresh"
class=
"mr-5px"
/>
重置
</el-button>
</el-form-item>
</el-form>
<el-col>
<el-row>
<el-col>
<!-- 操作:新增 -->
<el-button
type=
"primary"
v-hasPermi=
"['bpm:process-instance:query']"
@
click=
"handleCreate"
>
发起流程
</el-button
>
</el-col>
</el-row>
</el-col>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table
v-loading=
"loading"
:data=
"list"
>
<el-table-column
label=
"流程编号"
align=
"center"
prop=
"id"
width=
"300px"
/>
<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
>
</el-table-column>
<el-table-column
label=
"当前审批任务"
align=
"center"
prop=
"tasks"
>
<
template
#
default=
"scope"
>
<el-button
type=
"primary"
v-for=
"task in scope.row.tasks"
:key=
"task.id"
link
>
<span>
{{
task
.
name
}}
</span>
</el-button>
</
template
>
</el-table-column>
<el-table-column
label=
"状态"
prop=
"status"
>
<
template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS"
:value=
"scope.row.status"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"结果"
prop=
"result"
>
<
template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT"
:value=
"scope.row.result"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"提交时间"
align=
"center"
prop=
"createTime"
width=
"180"
:formatter=
"dateFormatter"
/>
<el-table-column
label=
"结束时间"
align=
"center"
prop=
"endTime"
width=
"180"
:formatter=
"dateFormatter"
/>
<el-table-column
label=
"操作"
align=
"center"
>
<
template
#
default=
"scope"
>
<el-button
link
type=
"primary"
v-hasPermi=
"['bpm:process-instance:cancel']"
@
click=
"handleDetail(scope.row)"
>
详情
</el-button
>
<el-button
link
type=
"primary"
v-if=
"scope.row.result === 1"
v-hasPermi=
"['bpm:process-instance:query']"
@
click=
"handleCancel(scope.row)"
>
取消
</el-button
>
</
template
>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total=
"total"
v-model:page=
"queryParams.pageNo"
v-model:limit=
"queryParams.pageSize"
@
pagination=
"getList"
/>
</ContentWrap>
</template>
<
script
setup
lang=
"ts"
>
// 全局相关的 import
import
{
ElMessageBox
}
from
'element-plus'
import
{
DICT_TYPE
}
from
'@/utils/dict'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
// 业务相关的 import
import
*
as
ProcessInstanceApi
from
'@/api/bpm/processInstance'
import
{
allSchemas
}
from
'./process.data'
// import { allSchemas } from './process.data'
import
{
dateFormatter
}
from
'@/utils/formatTime'
const
loading
=
ref
(
true
)
// 列表的加载中
const
total
=
ref
(
0
)
// 列表的总页数
const
list
=
ref
([])
// 列表的数据
const
queryParams
=
reactive
({
pageNo
:
1
,
pageSize
:
10
,
name
:
''
,
processDefinitionId
:
undefined
,
category
:
undefined
,
status
:
undefined
,
result
:
undefined
,
createTime
:
[]
})
const
router
=
useRouter
()
// 路由
const
message
=
useMessage
()
// 消息弹窗
const
{
t
}
=
useI18n
()
// 国际化
const
queryFormRef
=
ref
()
// 搜索的表单
/** 查询列表 */
const
getList
=
async
()
=>
{
loading
.
value
=
true
try
{
const
data
=
await
ProcessInstanceApi
.
getMyProcessInstancePage
(
queryParams
)
list
.
value
=
data
.
list
total
.
value
=
data
.
total
}
finally
{
loading
.
value
=
false
}
}
/** 搜索按钮操作 */
const
handleQuery
=
()
=>
{
queryParams
.
pageNo
=
1
getList
()
}
/** 重置按钮操作 */
const
resetQuery
=
()
=>
{
queryFormRef
.
value
.
resetFields
()
handleQuery
()
}
// ========== 列表相关 ==========
const
[
registerTable
,
{
reload
}
]
=
useXTable
({
allSchemas
:
allSchemas
,
getListApi
:
ProcessInstanceApi
.
getMyProcessInstancePage
})
// const [reload
] = useXTable({
//
allSchemas: allSchemas,
//
getListApi: ProcessInstanceApi.getMyProcessInstancePage
//
})
/** 发起流程操作 **/
const
handleCreate
=
()
=>
{
...
...
@@ -87,7 +238,11 @@ const handleCancel = (row) => {
}).
then
(
async
({
value
})
=>
{
await
ProcessInstanceApi
.
cancelProcessInstance
(
row
.
id
,
value
)
message
.
success
(
'取消成功'
)
reload
()
//
reload()
})
}
/** 初始化 **/
onMounted
(()
=>
{
getList
()
})
</
script
>
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