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
c424ee76
authored
Mar 22, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vue3 重构:REVIEW 岗位
parent
320cffee
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
66 deletions
+62
-66
src/api/system/post/index.ts
+7
-19
src/views/bpm/taskAssignRule/index.vue
+2
-2
src/views/system/post/PostForm.vue
+10
-8
src/views/system/post/index.vue
+41
-35
src/views/system/user/index.vue
+2
-2
No files found.
src/api/system/post/index.ts
View file @
c424ee76
...
...
@@ -10,49 +10,37 @@ export interface PostVO {
createTime
?:
Date
}
export
interface
PostPageReqVO
extends
PageParam
{
code
?:
string
name
?:
string
status
?:
number
}
export
interface
PostExportReqVO
{
code
?:
string
name
?:
string
status
?:
number
}
// 查询岗位列表
export
const
getPostPage
Api
=
async
(
params
:
PostPageReqVO
)
=>
{
export
const
getPostPage
=
async
(
params
:
PageParam
)
=>
{
return
await
request
.
get
({
url
:
'/system/post/page'
,
params
})
}
// 获取岗位精简信息列表
export
const
listSimplePostsApi
=
async
()
=>
{
export
const
getSimplePostList
=
async
()
=>
{
return
await
request
.
get
({
url
:
'/system/post/list-all-simple'
})
}
// 查询岗位详情
export
const
getPost
Api
=
async
(
id
:
number
)
=>
{
export
const
getPost
=
async
(
id
:
number
)
=>
{
return
await
request
.
get
({
url
:
'/system/post/get?id='
+
id
})
}
// 新增岗位
export
const
createPost
Api
=
async
(
data
:
PostVO
)
=>
{
export
const
createPost
=
async
(
data
:
PostVO
)
=>
{
return
await
request
.
post
({
url
:
'/system/post/create'
,
data
})
}
// 修改岗位
export
const
updatePost
Api
=
async
(
data
:
PostVO
)
=>
{
export
const
updatePost
=
async
(
data
:
PostVO
)
=>
{
return
await
request
.
put
({
url
:
'/system/post/update'
,
data
})
}
// 删除岗位
export
const
deletePost
Api
=
async
(
id
:
number
)
=>
{
export
const
deletePost
=
async
(
id
:
number
)
=>
{
return
await
request
.
delete
({
url
:
'/system/post/delete?id='
+
id
})
}
// 导出岗位
export
const
exportPost
Api
=
async
(
params
:
PostExportReqVO
)
=>
{
export
const
exportPost
=
async
(
params
)
=>
{
return
await
request
.
download
({
url
:
'/system/post/export'
,
params
})
}
src/views/bpm/taskAssignRule/index.vue
View file @
c424ee76
...
...
@@ -139,7 +139,7 @@ import { FormInstance } from 'element-plus'
// 业务相关的 import
import
*
as
TaskAssignRuleApi
from
'@/api/bpm/taskAssignRule'
import
{
listSimpleRolesApi
}
from
'@/api/system/role'
import
{
listSimplePostsApi
}
from
'@/api/system/post'
import
{
getSimplePostList
}
from
'@/api/system/post'
import
{
getSimpleUserList
}
from
'@/api/system/user'
import
{
listSimpleUserGroup
}
from
'@/api/bpm/userGroup'
import
{
listSimpleDeptApi
}
from
'@/api/system/dept'
...
...
@@ -336,7 +336,7 @@ onMounted(() => {
})
// 获得岗位列表
postOptions
.
value
=
[]
listSimplePostsApi
().
then
((
data
)
=>
{
getSimplePostList
().
then
((
data
)
=>
{
postOptions
.
value
.
push
(...
data
)
})
// 获得用户列表
...
...
src/views/system/post/
f
orm.vue
→
src/views/system/post/
PostF
orm.vue
View file @
c424ee76
...
...
@@ -37,6 +37,7 @@
</template>
<
script
setup
lang=
"ts"
>
import
{
DICT_TYPE
,
getDictOptions
}
from
'@/utils/dict'
import
{
CommonStatusEnum
}
from
'@/utils/constants'
import
*
as
PostApi
from
'@/api/system/post'
const
{
t
}
=
useI18n
()
// 国际化
...
...
@@ -50,7 +51,8 @@ const formData = ref({
id
:
undefined
,
name
:
''
,
code
:
''
,
status
:
undefined
,
sort
:
undefined
,
status
:
CommonStatusEnum
.
ENABLE
,
remark
:
''
})
const
formRules
=
reactive
({
...
...
@@ -71,7 +73,7 @@ const openModal = async (type: string, id?: number) => {
if
(
id
)
{
formLoading
.
value
=
true
try
{
formData
.
value
=
await
PostApi
.
getPost
Api
(
id
)
formData
.
value
=
await
PostApi
.
getPost
(
id
)
}
finally
{
formLoading
.
value
=
false
}
...
...
@@ -91,10 +93,10 @@ const submitForm = async () => {
try
{
const
data
=
formData
.
value
as
unknown
as
PostApi
.
PostVO
if
(
formType
.
value
===
'create'
)
{
await
PostApi
.
createPost
Api
(
data
)
await
PostApi
.
createPost
(
data
)
message
.
success
(
t
(
'common.createSuccess'
))
}
else
{
await
PostApi
.
updatePost
Api
(
data
)
await
PostApi
.
updatePost
(
data
)
message
.
success
(
t
(
'common.updateSuccess'
))
}
modelVisible
.
value
=
false
...
...
@@ -109,10 +111,10 @@ const submitForm = async () => {
const
resetForm
=
()
=>
{
formData
.
value
=
{
id
:
undefined
,
titl
e
:
''
,
type
:
undefined
,
content
:
''
,
status
:
undefined
,
nam
e
:
''
,
code
:
''
,
sort
:
undefined
,
status
:
CommonStatusEnum
.
ENABLE
,
remark
:
''
}
formRef
.
value
?.
resetFields
()
...
...
src/views/system/post/index.vue
View file @
c424ee76
<
template
>
<
content-w
rap>
<
ContentW
rap>
<!-- 搜索工作栏 -->
<el-form
:model=
"queryParams"
ref=
"queryFormRef"
:inline=
"true"
label-width=
"68px"
>
<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"
...
...
@@ -21,10 +27,10 @@
<el-form-item
label=
"状态"
prop=
"status"
>
<el-select
v-model=
"queryParams.status"
placeholder=
"请选择状态"
clearable
>
<el-option
v-for=
"dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
:key=
"
parseInt(dict.value)
"
v-for=
"dict in get
Int
DictOptions(DICT_TYPE.COMMON_STATUS)"
:key=
"
dict.value
"
:label=
"dict.label"
:value=
"
parseInt(dict.value)
"
:value=
"
dict.value
"
/>
</el-select>
</el-form-item>
...
...
@@ -49,15 +55,16 @@
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table
v-loading=
"loading"
:data=
"list"
align=
"center"
>
<el-table-column
label=
"岗位编号"
align=
"center"
prop=
"id"
/>
<el-table-column
label=
"岗位名称"
align=
"center"
prop=
"name"
/>
<el-table-column
label=
"岗位编码"
align=
"center"
prop=
"code"
/>
<el-table-column
label=
"岗位顺序"
align=
"center"
prop=
"sort"
/>
<el-table-column
label=
"岗位备注"
align=
"center"
prop=
"remark"
/>
<el-table-column
label=
"状态"
align=
"center"
prop=
"status"
>
<template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.COMMON_STATUS"
:value=
"scope.row.status"
/>
...
...
@@ -98,18 +105,17 @@
v-model:limit=
"queryParams.pageSize"
@
pagination=
"getList"
/>
</
content-w
rap>
</
ContentW
rap>
<!-- 表单弹窗:添加/修改 -->
<
post-form
ref=
"modal
Ref"
@
success=
"getList"
/>
<
PostForm
ref=
"form
Ref"
@
success=
"getList"
/>
</template>
<
script
setup
lang=
"tsx"
>
import
*
as
PostApi
from
'@/api/system/post'
import
PostForm
from
'./form.vue'
import
{
DICT_TYPE
,
getDictOptions
}
from
'@/utils/dict'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
download
from
'@/utils/download'
import
{
DictTag
}
from
'@/components/DictTag'
import
*
as
PostApi
from
'@/api/system/post'
import
PostForm
from
'./PostForm.vue'
const
message
=
useMessage
()
// 消息弹窗
const
{
t
}
=
useI18n
()
// 国际化
...
...
@@ -118,20 +124,20 @@ const loading = ref(true) // 列表的加载中
const
total
=
ref
(
0
)
// 列表的总页数
const
list
=
ref
([])
// 列表的数据
const
queryParams
=
reactive
({
pageNo
:
1
,
pageSize
:
10
,
code
:
''
,
name
:
''
,
status
:
undefined
,
pageNo
:
1
,
pageSize
:
100
status
:
undefined
})
const
queryFormRef
=
ref
()
// 搜索的表单
const
exportLoading
=
ref
(
false
)
// 导出的加载中
/** 查询岗位列表 */
const
getList
=
async
()
=>
{
loading
.
value
=
true
try
{
const
data
=
await
PostApi
.
getPostPageApi
(
queryParams
)
const
data
=
await
PostApi
.
getPostPage
(
queryParams
)
list
.
value
=
data
.
list
total
.
value
=
data
.
total
}
finally
{
...
...
@@ -139,21 +145,6 @@ const getList = async () => {
}
}
/** 导出按钮操作 */
const
handleExport
=
async
()
=>
{
try
{
// 导出的二次确认
await
message
.
exportConfirm
()
// 发起导出
exportLoading
.
value
=
true
const
data
=
await
PostApi
.
exportPostApi
(
queryParams
)
download
.
excel
(
data
,
'岗位列表.xls'
)
}
catch
{
}
finally
{
exportLoading
.
value
=
false
}
}
/** 搜索按钮操作 */
const
handleQuery
=
()
=>
{
queryParams
.
pageNo
=
1
...
...
@@ -167,9 +158,9 @@ const resetQuery = () => {
}
/** 添加/修改操作 */
const
modal
Ref
=
ref
()
const
form
Ref
=
ref
()
const
openModal
=
(
type
:
string
,
id
?:
number
)
=>
{
modal
Ref
.
value
.
openModal
(
type
,
id
)
form
Ref
.
value
.
openModal
(
type
,
id
)
}
/** 删除按钮操作 */
...
...
@@ -178,13 +169,28 @@ const handleDelete = async (id: number) => {
// 删除的二次确认
await
message
.
delConfirm
()
// 发起删除
await
PostApi
.
deletePost
Api
(
id
)
await
PostApi
.
deletePost
(
id
)
message
.
success
(
t
(
'common.delSuccess'
))
// 刷新列表
await
getList
()
}
catch
{}
}
/** 导出按钮操作 */
const
handleExport
=
async
()
=>
{
try
{
// 导出的二次确认
await
message
.
exportConfirm
()
// 发起导出
exportLoading
.
value
=
true
const
data
=
await
PostApi
.
exportPost
(
queryParams
)
download
.
excel
(
data
,
'岗位列表.xls'
)
}
catch
{
}
finally
{
exportLoading
.
value
=
false
}
}
/** 初始化 **/
onMounted
(()
=>
{
getList
()
...
...
src/views/system/user/index.vue
View file @
c424ee76
...
...
@@ -273,7 +273,7 @@ import { rules, allSchemas } from './user.data'
import
*
as
UserApi
from
'@/api/system/user'
import
{
listSimpleDeptApi
}
from
'@/api/system/dept'
import
{
listSimpleRolesApi
}
from
'@/api/system/role'
import
{
listSimplePostsApi
,
PostVO
}
from
'@/api/system/post'
import
{
getSimplePostList
,
PostVO
}
from
'@/api/system/post'
import
{
aassignUserRoleApi
,
listUserRolesApi
,
...
...
@@ -329,7 +329,7 @@ const postOptions = ref<PostVO[]>([]) //岗位列表
// 获取岗位列表
const
getPostOptions
=
async
()
=>
{
const
res
=
await
listSimplePostsApi
()
const
res
=
await
getSimplePostList
()
postOptions
.
value
.
push
(...
res
)
}
const
dataFormater
=
(
val
)
=>
{
...
...
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