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
643b3873
authored
Mar 31, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REVIEW 用户管理(列表)
parent
1434cdab
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
36 deletions
+26
-36
src/api/system/user/index.ts
+3
-18
src/views/system/tenantPackage/index.vue
+1
-1
src/views/system/user/DeptTree.vue
+17
-12
src/views/system/user/components/UserForm.vue
+5
-5
src/views/system/user/index.vue
+0
-0
No files found.
src/api/system/user/index.ts
View file @
643b3873
...
...
@@ -17,23 +17,8 @@ export interface UserVO {
createTime
:
Date
}
export
interface
UserPageReqVO
extends
PageParam
{
deptId
?:
number
username
?:
string
mobile
?:
string
status
?:
number
createTime
?:
Date
[]
}
export
interface
UserExportReqVO
{
code
?:
string
name
?:
string
status
?:
number
createTime
?:
Date
[]
}
// 查询用户管理列表
export
const
getUserPage
Api
=
(
params
:
UserPageReqVO
)
=>
{
export
const
getUserPage
=
(
params
:
PageParam
)
=>
{
return
request
.
get
({
url
:
'/system/user/page'
,
params
})
}
...
...
@@ -53,12 +38,12 @@ export const updateUserApi = (data: UserVO | Recordable) => {
}
// 删除用户
export
const
deleteUser
Api
=
(
id
:
number
)
=>
{
export
const
deleteUser
=
(
id
:
number
)
=>
{
return
request
.
delete
({
url
:
'/system/user/delete?id='
+
id
})
}
// 导出用户
export
const
exportUser
Api
=
(
params
:
UserExportReqVO
)
=>
{
export
const
exportUser
=
(
params
)
=>
{
return
request
.
download
({
url
:
'/system/user/export'
,
params
})
}
...
...
src/views/system/tenantPackage/index.vue
View file @
643b3873
...
...
@@ -112,7 +112,7 @@ const { t } = useI18n() // 国际化
const
loading
=
ref
(
true
)
// 列表的加载中
const
total
=
ref
(
0
)
// 列表的总页数
const
list
=
ref
([])
// 列表的数据
const
queryParams
:
Record
<
string
,
any
>
=
ref
<
Record
<
string
,
any
>>
({
const
queryParams
=
reactive
({
pageNo
:
1
,
pageSize
:
10
,
name
:
null
,
...
...
src/views/system/user/
components/User
DeptTree.vue
→
src/views/system/user/DeptTree.vue
View file @
643b3873
<
template
>
<div
class=
"head-container"
>
<el-input
v-model=
"deptName"
placeholder=
"请输入部门名称"
clearable
style=
"margin-bottom:
20px"
>
<el-input
v-model=
"deptName"
placeholder=
"请输入部门名称"
clearable
class=
"mb-
20px"
>
<template
#
prefix
>
<Icon
icon=
"ep:search"
/>
</
template
>
...
...
@@ -8,15 +8,15 @@
</div>
<div
class=
"head-container"
>
<el-tree
:data=
"dept
Options
"
:data=
"dept
List
"
:props=
"defaultProps"
node-key=
"id"
:expand-on-click-node=
"false"
:filter-node-method=
"filterNode"
ref=
"treeRef"
node-key=
"id"
default-expand-all
highlight-current
@
node-click=
"handle
Dept
NodeClick"
@
node-click=
"handleNodeClick"
/>
</div>
</template>
...
...
@@ -26,25 +26,30 @@ import { ElTree } from 'element-plus'
import
*
as
DeptApi
from
'@/api/system/dept'
import
{
defaultProps
,
handleTree
}
from
'@/utils/tree'
const
emits
=
defineEmits
([
'node-click'
])
const
deptName
=
ref
(
''
)
const
dept
Options
=
ref
<
Tree
[]
>
([])
// 树形结构
const
dept
List
=
ref
<
Tree
[]
>
([])
// 树形结构
const
treeRef
=
ref
<
InstanceType
<
typeof
ElTree
>>
()
/** 获得部门树 */
const
getTree
=
async
()
=>
{
const
res
=
await
DeptApi
.
getSimpleDeptList
()
dept
Options
.
value
=
[]
dept
Options
.
value
.
push
(...
handleTree
(
res
))
dept
List
.
value
=
[]
dept
List
.
value
.
push
(...
handleTree
(
res
))
}
const
filterNode
=
(
value
:
string
,
data
:
Tree
)
=>
{
if
(
!
value
)
return
true
return
data
.
name
.
includes
(
value
)
/** 基于名字过滤 */
const
filterNode
=
(
name
:
string
,
data
:
Tree
)
=>
{
if
(
!
name
)
return
true
return
data
.
name
.
includes
(
name
)
}
const
handleDeptNodeClick
=
async
(
row
:
{
[
key
:
string
]:
any
})
=>
{
/** 处理部门被点击 */
const
handleNodeClick
=
async
(
row
:
{
[
key
:
string
]:
any
})
=>
{
emits
(
'node-click'
,
row
)
}
const
emits
=
defineEmits
([
'node-click'
])
/** 初始化 */
onMounted
(
async
()
=>
{
await
getTree
()
})
...
...
src/views/system/user/components/UserForm.vue
View file @
643b3873
...
...
@@ -56,7 +56,7 @@
<el-select
v-model=
"formData.sex"
placeholder=
"请选择"
>
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.SYSTEM_USER_SEX)"
:key=
"dict.value
as number
"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
...
...
@@ -70,7 +70,7 @@
v-for=
"item in postOptions"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id
as number
"
:value=
"item.id"
/>
</el-select>
</el-form-item>
...
...
@@ -102,7 +102,6 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import
{
defaultProps
,
handleTree
}
from
'@/utils/tree'
import
{
ElForm
,
FormItemRule
}
from
'element-plus'
import
{
Arrayable
}
from
'element-plus/es/utils'
import
{
UserVO
}
from
'@/api/login/types'
type
Form
=
InstanceType
<
typeof
ElForm
>
...
...
@@ -210,7 +209,8 @@ const cancel = () => {
}
/* 打开弹框 */
const
openForm
=
(
row
:
undefined
|
UserVO
)
=>
{
const
open
=
(
type
:
string
,
id
?:
number
)
=>
{
console
.
log
(
type
,
id
)
resetForm
()
getTree
()
// 部门树
if
(
row
&&
row
.
id
)
{
...
...
@@ -232,6 +232,6 @@ onMounted(async () => {
defineExpose
({
resetForm
,
open
Form
open
})
</
script
>
src/views/system/user/index.vue
View file @
643b3873
This diff is collapsed.
Click to expand it.
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