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
4dabb710
authored
Apr 15, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 OA 请假,create 和 detail 使用独立路由,可接入工作流
parent
de5b1216
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
56 deletions
+51
-56
src/router/modules/remaining.ts
+13
-1
src/views/bpm/oa/leave/create.vue
+9
-30
src/views/bpm/oa/leave/detail.vue
+21
-13
src/views/bpm/oa/leave/index.vue
+8
-12
No files found.
src/router/modules/remaining.ts
View file @
4dabb710
...
@@ -313,7 +313,19 @@ const remainingRouter: AppRouteRecordRaw[] = [
...
@@ -313,7 +313,19 @@ const remainingRouter: AppRouteRecordRaw[] = [
hidden
:
true
,
hidden
:
true
,
canTo
:
true
,
canTo
:
true
,
title
:
'发起 OA 请假'
,
title
:
'发起 OA 请假'
,
activeMenu
:
'bpm/oa/leave/create'
activeMenu
:
'/bpm/oa/leave'
}
},
{
path
:
'/bpm/oa/leave/detail'
,
component
:
()
=>
import
(
'@/views/bpm/oa/leave/detail.vue'
),
name
:
'OALeaveDetail'
,
meta
:
{
noCache
:
true
,
hidden
:
true
,
canTo
:
true
,
title
:
'查看 OA 请假'
,
activeMenu
:
'/bpm/oa/leave'
}
}
}
}
]
]
...
...
src/views/bpm/oa/leave/create.vue
View file @
4dabb710
<
template
>
<
template
>
<Dialog
title=
"发起 OA 请假流程"
v-model=
"dialogVisible"
>
<el-form
<el-form
ref=
"formRef"
ref=
"formRef"
:model=
"formData"
:model=
"formData"
...
@@ -38,19 +37,19 @@
...
@@ -38,19 +37,19 @@
<el-form-item
label=
"原因"
prop=
"reason"
>
<el-form-item
label=
"原因"
prop=
"reason"
>
<el-input
v-model=
"formData.reason"
type=
"textarea"
placeholder=
"请输请假原因"
/>
<el-input
v-model=
"formData.reason"
type=
"textarea"
placeholder=
"请输请假原因"
/>
</el-form-item>
</el-form-item>
</el-form>
<el-form-item>
<template
#
footer
>
<el-button
@
click=
"submitForm"
type=
"primary"
:disabled=
"formLoading"
>
确 定
</el-button>
<el-button
@
click=
"submitForm"
type=
"primary"
:disabled=
"formLoading"
>
确 定
</el-button>
<el-button
@
click=
"dialogVisible = false"
>
取 消
</el-button>
</el-form-item>
</
template
>
</el-form>
</Dialog>
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
*
as
LeaveApi
from
'@/api/bpm/leave'
import
*
as
LeaveApi
from
'@/api/bpm/leave'
import
{
useTagsViewStore
}
from
'@/store/modules/tagsView'
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
const
{
delView
}
=
useTagsViewStore
()
// 视图操作
const
{
currentRoute
}
=
useRouter
()
// 路由
const
dialogVisible
=
ref
(
false
)
// 弹窗的是否展示
const
formLoading
=
ref
(
false
)
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const
formLoading
=
ref
(
false
)
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const
formData
=
ref
({
const
formData
=
ref
({
type
:
undefined
,
type
:
undefined
,
...
@@ -66,15 +65,7 @@ const formRules = reactive({
...
@@ -66,15 +65,7 @@ const formRules = reactive({
})
})
const
formRef
=
ref
()
// 表单 Ref
const
formRef
=
ref
()
// 表单 Ref
/** 打开弹窗 */
const
open
=
async
()
=>
{
dialogVisible
.
value
=
true
resetForm
()
}
defineExpose
({
open
})
// 提供 open 方法,用于打开弹窗
/** 提交表单 */
/** 提交表单 */
const
emit
=
defineEmits
([
'success'
])
// 定义 success 事件,用于操作成功后的回调
const
submitForm
=
async
()
=>
{
const
submitForm
=
async
()
=>
{
// 校验表单
// 校验表单
if
(
!
formRef
)
return
if
(
!
formRef
)
return
...
@@ -85,23 +76,11 @@ const submitForm = async () => {
...
@@ -85,23 +76,11 @@ const submitForm = async () => {
try
{
try
{
const
data
=
formData
.
value
as
unknown
as
LeaveApi
.
LeaveVO
const
data
=
formData
.
value
as
unknown
as
LeaveApi
.
LeaveVO
await
LeaveApi
.
createLeave
(
data
)
await
LeaveApi
.
createLeave
(
data
)
message
.
success
(
'新增成功'
)
message
.
success
(
'发起成功'
)
dialogVisible
.
value
=
false
// 关闭当前 Tab
// 发送操作成功的事件
delView
(
unref
(
currentRoute
))
emit
(
'success'
)
}
finally
{
}
finally
{
formLoading
.
value
=
false
formLoading
.
value
=
false
}
}
}
}
/** 重置表单 */
const
resetForm
=
()
=>
{
formData
.
value
=
{
type
:
undefined
,
reason
:
undefined
,
startTime
:
undefined
,
endTime
:
undefined
}
formRef
.
value
?.
resetFields
()
}
</
script
>
</
script
>
src/views/bpm/oa/leave/detail.vue
View file @
4dabb710
<
template
>
<
template
>
<
Dialog
title=
"详情"
v-model=
"dialogVisible"
:scroll=
"true"
:max-height=
"200"
>
<
ContentWrap
>
<el-descriptions
border
:column=
"1"
>
<el-descriptions
border
:column=
"1"
>
<el-descriptions-item
label=
"请假类型"
>
<el-descriptions-item
label=
"请假类型"
>
<dict-tag
:type=
"DICT_TYPE.BPM_OA_LEAVE_TYPE"
:value=
"detailData.type"
/>
<dict-tag
:type=
"DICT_TYPE.BPM_OA_LEAVE_TYPE"
:value=
"detailData.type"
/>
</el-descriptions-item>
</el-descriptions-item>
<el-descriptions-item
label=
"开始时间"
>
<el-descriptions-item
label=
"开始时间"
>
{{
formatDate
(
detailData
.
startTime
)
}}
{{
formatDate
(
detailData
.
startTime
,
'YYYY-MM-DD'
)
}}
</el-descriptions-item>
</el-descriptions-item>
<el-descriptions-item
label=
"结束时间"
>
<el-descriptions-item
label=
"结束时间"
>
{{
formatDate
(
detailData
.
endTime
)
}}
{{
formatDate
(
detailData
.
endTime
,
'YYYY-MM-DD'
)
}}
</el-descriptions-item>
</el-descriptions-item>
<el-descriptions-item
label=
"原因"
>
<el-descriptions-item
label=
"原因"
>
{{
detailData
.
reason
}}
{{
detailData
.
reason
}}
</el-descriptions-item>
</el-descriptions-item>
</el-descriptions>
</el-descriptions>
</
Dialog
>
</
ContentWrap
>
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
name=
"OALeaveCreate"
>
import
{
DICT_TYPE
}
from
'@/utils/dict'
import
{
DICT_TYPE
}
from
'@/utils/dict'
import
{
formatDate
}
from
'@/utils/formatTime'
import
{
formatDate
}
from
'@/utils/formatTime'
import
{
propTypes
}
from
'@/utils/propTypes'
import
*
as
LeaveApi
from
'@/api/bpm/leave'
import
*
as
LeaveApi
from
'@/api/bpm/leave'
const
{
query
}
=
useRoute
()
// 查询参数
const
dialogVisible
=
ref
(
false
)
// 弹窗的是否展示
const
props
=
defineProps
({
id
:
propTypes
.
number
.
def
(
undefined
)
})
const
detailLoading
=
ref
(
false
)
// 表单的加载中
const
detailLoading
=
ref
(
false
)
// 表单的加载中
const
detailData
=
ref
()
// 详情数据
const
detailData
=
ref
({})
// 详情数据
const
queryId
=
query
.
id
as
unknown
as
number
// 从 URL 传递过来的 id 编号
/** 打开弹窗 */
/** 获得数据 */
const
open
=
async
(
data
:
LeaveApi
.
LeaveVO
)
=>
{
const
getInfo
=
async
()
=>
{
dialogVisible
.
value
=
true
// 设置数据
detailLoading
.
value
=
true
detailLoading
.
value
=
true
try
{
try
{
detailData
.
value
=
data
detailData
.
value
=
await
LeaveApi
.
getLeave
(
queryId
||
props
.
id
)
}
finally
{
}
finally
{
detailLoading
.
value
=
false
detailLoading
.
value
=
false
}
}
}
}
defineExpose
({
open
})
// 提供 open 方法,用于打开弹窗
defineExpose
({
open
:
getInfo
})
// 提供 open 方法,用于打开弹窗
/** 初始化 **/
onMounted
(()
=>
{
getInfo
()
})
</
script
>
</
script
>
src/views/bpm/oa/leave/index.vue
View file @
4dabb710
...
@@ -137,19 +137,12 @@
...
@@ -137,19 +137,12 @@
@
pagination=
"getList"
@
pagination=
"getList"
/>
/>
</ContentWrap>
</ContentWrap>
<!-- 表单弹窗:详情 -->
<LeaveDetail
ref=
"detailRef"
/>
<!-- 表单弹窗:添加 -->
<LeaveForm
ref=
"formRef"
@
success=
"getList"
/>
</template>
</template>
<
script
setup
lang=
"ts"
name=
"BpmOALeave"
>
<
script
setup
lang=
"ts"
name=
"BpmOALeave"
>
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
*
as
LeaveApi
from
'@/api/bpm/leave'
import
*
as
LeaveApi
from
'@/api/bpm/leave'
import
*
as
ProcessInstanceApi
from
'@/api/bpm/processInstance'
import
*
as
ProcessInstanceApi
from
'@/api/bpm/processInstance'
import
LeaveDetail
from
'./detail.vue'
import
LeaveForm
from
'./create.vue'
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
const
router
=
useRouter
()
// 路由
const
router
=
useRouter
()
// 路由
const
{
t
}
=
useI18n
()
// 国际化
const
{
t
}
=
useI18n
()
// 国际化
...
@@ -192,15 +185,18 @@ const resetQuery = () => {
...
@@ -192,15 +185,18 @@ const resetQuery = () => {
}
}
/** 添加操作 */
/** 添加操作 */
const
formRef
=
ref
()
const
handleCreate
=
()
=>
{
const
handleCreate
=
()
=>
{
formRef
.
value
.
open
(
)
router
.
push
({
name
:
'OALeaveCreate'
}
)
}
}
/** 详情操作 */
/** 详情操作 */
const
detailRef
=
ref
()
const
handleDetail
=
(
row
:
LeaveApi
.
LeaveVO
)
=>
{
const
handleDetail
=
(
data
:
LeaveApi
.
LeaveVO
)
=>
{
router
.
push
({
detailRef
.
value
.
open
(
data
)
name
:
'OALeaveDetail'
,
query
:
{
id
:
row
.
id
}
})
}
}
/** 取消请假操作 */
/** 取消请假操作 */
...
...
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