Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
有来技术
vue3-element-admin
提交
852ae82b
V
vue3-element-admin
项目概览
有来技术
/
vue3-element-admin
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue3-element-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
852ae82b
编写于
11月 08, 2022
作者:
H
haoxr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 页面问题修复
Former-commit-id:
e451b678
上级
93a25b6b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
102 addition
and
104 deletion
+102
-104
src/views/system/dept/index.vue
src/views/system/dept/index.vue
+18
-30
src/views/system/menu/index.vue
src/views/system/menu/index.vue
+18
-23
src/views/system/role/index.vue
src/views/system/role/index.vue
+17
-17
src/views/system/user/index.vue
src/views/system/user/index.vue
+49
-34
未找到文件。
src/views/system/dept/index.vue
浏览文件 @
852ae82b
<
script
lang=
"ts"
>
export
default
{
name
:
'
dept
'
,
name
:
'
dept
'
};
</
script
>
...
...
@@ -13,7 +13,7 @@ import {
updateDept
,
addDept
,
listDeptOptions
,
listDepartments
,
listDepartments
}
from
'
@/api/dept
'
;
import
{
Search
,
Plus
,
Refresh
,
Delete
}
from
'
@element-plus/icons-vue
'
;
...
...
@@ -34,15 +34,15 @@ const state = reactive({
queryParams
:
{}
as
DeptQuery
,
formData
:
{
sort
:
1
,
status
:
1
,
status
:
1
}
as
DeptForm
,
rules
:
{
parentId
:
[
{
required
:
true
,
message
:
'
上级部门不能为空
'
,
trigger
:
'
blur
'
}
,
{
required
:
true
,
message
:
'
上级部门不能为空
'
,
trigger
:
'
blur
'
}
],
name
:
[{
required
:
true
,
message
:
'
部门名称不能为空
'
,
trigger
:
'
blur
'
}],
sort
:
[{
required
:
true
,
message
:
'
显示排序不能为空
'
,
trigger
:
'
blur
'
}]
,
}
,
sort
:
[{
required
:
true
,
message
:
'
显示排序不能为空
'
,
trigger
:
'
blur
'
}]
}
});
const
{
...
...
@@ -53,7 +53,7 @@ const {
queryParams
,
formData
,
rules
,
dialog
,
dialog
}
=
toRefs
(
state
);
/**
...
...
@@ -84,11 +84,11 @@ function handleSelectionChange(selection: any) {
*/
async
function
getDeptOptions
()
{
const
deptOptions
:
any
[]
=
[];
listDeptOptions
().
then
(
(
response
)
=>
{
listDeptOptions
().
then
(
response
=>
{
const
rootDeptOption
=
{
value
:
'
0
'
,
label
:
'
顶级部门
'
,
children
:
response
.
data
,
children
:
response
.
data
};
deptOptions
.
push
(
rootDeptOption
);
state
.
deptOptions
=
deptOptions
;
...
...
@@ -104,7 +104,7 @@ function handleAdd(row: any) {
formData
.
value
.
parentId
=
row
.
id
;
dialog
.
value
=
{
title
:
'
添加部门
'
,
visible
:
true
,
visible
:
true
};
}
...
...
@@ -116,7 +116,7 @@ async function handleUpdate(row: any) {
const
deptId
=
row
.
id
||
state
.
ids
;
state
.
dialog
=
{
title
:
'
修改部门
'
,
visible
:
true
,
visible
:
true
};
getDeptForm
(
deptId
).
then
((
response
:
any
)
=>
{
state
.
formData
=
response
.
data
;
...
...
@@ -159,7 +159,7 @@ function handleDelete(row: any) {
ElMessageBox
.
confirm
(
`确认删除已选中的数据项?`
,
'
警告
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
,
type
:
'
warning
'
})
.
then
(()
=>
{
deleteDept
(
ids
)
...
...
@@ -263,26 +263,14 @@ onMounted(() => {
<el-table-column
label=
"操作"
align=
"center"
width=
"150"
>
<
template
#default=
"scope"
>
<el-button
type=
"primary"
link
@
click.stop=
"handleUpdate(scope.row)"
>
新增
<el-button
type=
"primary"
link
@
click.stop=
"handleAdd(scope.row)"
>
新增
</el-button>
<el-button
type=
"success"
link
@
click.stop=
"handleAdd(scope.row)"
>
修改
<el-button
type=
"success"
link
@
click.stop=
"handleUpdate(scope.row)"
>
编辑
</el-button>
<el-button
type=
"danger"
link
@
click.stop=
"handleDelete(scope.row)"
>
删除
<el-button
type=
"danger"
link
@
click.stop=
"handleDelete(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
...
...
src/views/system/menu/index.vue
浏览文件 @
852ae82b
...
...
@@ -102,26 +102,21 @@
type=
"success"
link
@
click.stop=
"handleAdd(scope.row)"
v-if=
"scope.row.type=='CATALOG' ||scope.row.type=='MENU'"
v-if=
"scope.row.type == 'CATALOG' || scope.row.type == 'MENU'"
>
新增
</el-button>
新增
</el-button>
<el-button
type=
"primary"
link
@
click.stop=
"handleUpdate(scope.row)"
>
修改
</el-button>
<el-button
type=
"danger"
link
@
click.stop=
"handleDelete(scope.row)"
>
删除
</el-button>
编辑
</el-button>
<el-button
type=
"danger"
link
@
click.stop=
"handleDelete(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
...
...
@@ -287,7 +282,7 @@ import {
listMenuOptions
,
addMenu
,
deleteMenus
,
updateMenu
,
updateMenu
}
from
'
@/api/menu
'
;
import
SvgIcon
from
'
@/components/SvgIcon/index.vue
'
;
...
...
@@ -315,7 +310,7 @@ const state = reactive({
visible
:
1
,
sort
:
1
,
component
:
undefined
,
type
:
'
MENU
'
,
type
:
'
MENU
'
}
as
MenuForm
,
rules
:
{
parentId
:
[{
required
:
true
,
message
:
'
请选择顶级菜单
'
,
trigger
:
'
blur
'
}],
...
...
@@ -323,8 +318,8 @@ const state = reactive({
type
:
[{
required
:
true
,
message
:
'
请选择菜单类型
'
,
trigger
:
'
blur
'
}],
path
:
[{
required
:
true
,
message
:
'
请输入路由路径
'
,
trigger
:
'
blur
'
}],
component
:
[
{
required
:
true
,
message
:
'
请输入组件完整路径
'
,
trigger
:
'
blur
'
}
,
]
,
{
required
:
true
,
message
:
'
请输入组件完整路径
'
,
trigger
:
'
blur
'
}
]
},
menuOptions
:
[]
as
OptionType
[],
currentRow
:
undefined
,
...
...
@@ -332,8 +327,8 @@ const state = reactive({
iconSelectVisible
:
false
,
cacheData
:
{
menuType
:
''
,
menuPath
:
''
,
}
,
menuPath
:
''
}
});
const
{
...
...
@@ -345,7 +340,7 @@ const {
rules
,
menuOptions
,
iconSelectVisible
,
cacheData
,
cacheData
}
=
toRefs
(
state
);
/**
...
...
@@ -394,7 +389,7 @@ async function handleAdd(row: any) {
await
loadMenuData
();
dialog
.
value
=
{
title
:
'
添加菜单
'
,
visible
:
true
,
visible
:
true
};
if
(
row
.
id
)
{
...
...
@@ -421,7 +416,7 @@ async function handleUpdate(row: MenuForm) {
await
loadMenuData
();
state
.
dialog
=
{
title
:
'
编辑菜单
'
,
visible
:
true
,
visible
:
true
};
const
id
=
row
.
id
as
string
;
getMenuDetail
(
id
).
then
(({
data
})
=>
{
...
...
@@ -475,7 +470,7 @@ function handleDelete(row: any) {
ElMessageBox
.
confirm
(
'
确认删除已选中的数据项?
'
,
'
警告
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
,
type
:
'
warning
'
})
.
then
(()
=>
{
deleteMenus
(
ids
).
then
(()
=>
{
...
...
src/views/system/role/index.vue
浏览文件 @
852ae82b
<
script
lang=
"ts"
>
export
default
{
name
:
'
role
'
,
name
:
'
role
'
};
</
script
>
...
...
@@ -13,7 +13,7 @@ import {
addRole
,
deleteRoles
,
getRoleMenuIds
,
updateRoleMenus
,
updateRoleMenus
}
from
'
@/api/role
'
;
import
{
listResources
}
from
'
@/api/menu
'
;
...
...
@@ -32,20 +32,20 @@ const state = reactive({
ids
:
[]
as
number
[],
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
pageSize
:
10
}
as
RoleQuery
,
roleList
:
[]
as
Role
[],
total
:
0
,
dialog
:
{
title
:
''
,
visible
:
false
,
visible
:
false
}
as
DialogType
,
formData
:
{}
as
RoleForm
,
rules
:
{
name
:
[{
required
:
true
,
message
:
'
请输入角色名称
'
,
trigger
:
'
blur
'
}],
code
:
[{
required
:
true
,
message
:
'
请输入角色编码
'
,
trigger
:
'
blur
'
}],
dataScope
:
[{
required
:
true
,
message
:
'
请选择数据权限
'
,
trigger
:
'
blur
'
}],
status
:
[{
required
:
true
,
message
:
'
请选择状态
'
,
trigger
:
'
blur
'
}]
,
status
:
[{
required
:
true
,
message
:
'
请选择状态
'
,
trigger
:
'
blur
'
}]
},
menuDialogVisible
:
false
,
resourceOptions
:
[]
as
OptionType
[],
...
...
@@ -56,8 +56,8 @@ const state = reactive({
// 选中的角色
checkedRole
:
{
id
:
''
,
name
:
''
,
}
,
name
:
''
}
});
const
{
...
...
@@ -71,7 +71,7 @@ const {
rules
,
menuDialogVisible
,
checkedRole
,
resourceOptions
,
resourceOptions
}
=
toRefs
(
state
);
/**
...
...
@@ -105,14 +105,14 @@ function handleRowClick(row: any) {
function
handleAdd
()
{
dialog
.
value
=
{
title
:
'
添加角色
'
,
visible
:
true
,
visible
:
true
};
}
function
handleUpdate
(
row
:
any
)
{
dialog
.
value
=
{
title
:
'
修改角色
'
,
visible
:
true
,
visible
:
true
};
const
roleId
=
row
.
id
||
state
.
ids
;
getRoleFormDetail
(
roleId
).
then
(({
data
})
=>
{
...
...
@@ -160,7 +160,7 @@ function handleDelete(row: any) {
ElMessageBox
.
confirm
(
'
确认删除已选中的数据项?
'
,
'
警告
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
,
type
:
'
warning
'
})
.
then
(()
=>
{
deleteRoles
(
ids
).
then
(()
=>
{
...
...
@@ -181,17 +181,17 @@ function showRoleMenuDialog(row: Role) {
const
roleId
:
any
=
row
.
id
;
checkedRole
.
value
=
{
id
:
roleId
,
name
:
row
.
name
,
name
:
row
.
name
};
// 获取所有的资源
listResources
().
then
(
(
response
)
=>
{
listResources
().
then
(
response
=>
{
resourceOptions
.
value
=
response
.
data
;
// 角色拥有的资源
getRoleMenuIds
(
roleId
).
then
(({
data
})
=>
{
// 勾选回显
const
checkedMenuIds
=
data
;
checkedMenuIds
.
forEach
(
(
menuId
)
=>
checkedMenuIds
.
forEach
(
menuId
=>
resourceRef
.
value
.
setChecked
(
menuId
,
true
)
);
...
...
@@ -207,7 +207,7 @@ function handleRoleResourceSubmit() {
.
getCheckedNodes
(
false
,
true
)
.
map
((
node
:
any
)
=>
node
.
value
);
updateRoleMenus
(
checkedRole
.
value
.
id
,
checkedMenuIds
).
then
(
(
res
)
=>
{
updateRoleMenus
(
checkedRole
.
value
.
id
,
checkedMenuIds
).
then
(
res
=>
{
ElMessage
.
success
(
'
分配权限成功
'
);
menuDialogVisible
.
value
=
false
;
handleQuery
();
...
...
@@ -286,7 +286,7 @@ onMounted(() => {
<el-table-column
prop=
"createTime"
label=
"创建时间"
width=
"160"
/>
<el-table-column
prop=
"updateTime"
label=
"修改时间"
width=
"160"
/>
<el-table-column
label=
"操作"
align=
"left"
>
<el-table-column
label=
"操作"
align=
"left"
>
<
template
#default=
"scope"
>
<el-button
type=
"success"
...
...
@@ -301,7 +301,7 @@ onMounted(() => {
link
@
click.stop=
"handleUpdate(scope.row)"
>
修改
编辑
</el-button>
<el-button
type=
"danger"
link
@
click.stop=
"handleDelete(scope.row)"
>
删除
...
...
src/views/system/user/index.vue
浏览文件 @
852ae82b
<
script
lang=
"ts"
>
export
default
{
name
:
'
user
'
,
name
:
'
user
'
};
</
script
>
...
...
@@ -11,7 +11,7 @@ import {
watchEffect
,
onMounted
,
getCurrentInstance
,
toRefs
,
toRefs
}
from
'
vue
'
;
// api
...
...
@@ -25,7 +25,7 @@ import {
updateUserPassword
,
downloadTemplate
,
exportUser
,
importUser
,
importUser
}
from
'
@/api/user
'
;
import
{
listDeptOptions
}
from
'
@/api/dept
'
;
import
{
listRoleOptions
}
from
'
@/api/role
'
;
...
...
@@ -35,7 +35,7 @@ import {
ElForm
,
ElMessageBox
,
ElMessage
,
UploadFile
,
UploadFile
}
from
'
element-plus
'
;
import
{
Search
,
...
...
@@ -44,13 +44,13 @@ import {
Delete
,
Download
,
Top
,
UploadFilled
,
UploadFilled
}
from
'
@element-plus/icons-vue
'
;
import
{
UserForm
,
UserImportData
,
UserQuery
,
UserType
,
UserType
}
from
'
@/api/user/types
'
;
const
deptTreeRef
=
ref
(
ElTree
);
// 部门树
...
...
@@ -69,7 +69,7 @@ const state = reactive({
total
:
0
,
userList
:
[]
as
UserType
[],
dialog
:
{
visible
:
false
,
visible
:
false
}
as
DialogType
,
deptName
:
undefined
,
// 部门下拉项
...
...
@@ -79,16 +79,16 @@ const state = reactive({
// 角色下拉项
roleOptions
:
[]
as
OptionType
[],
formData
:
{
status
:
1
,
status
:
1
}
as
UserForm
,
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
pageSize
:
10
}
as
UserQuery
,
rules
:
{
username
:
[{
required
:
true
,
message
:
'
用户名不能为空
'
,
trigger
:
'
blur
'
}],
nickname
:
[
{
required
:
true
,
message
:
'
用户昵称不能为空
'
,
trigger
:
'
blur
'
}
,
{
required
:
true
,
message
:
'
用户昵称不能为空
'
,
trigger
:
'
blur
'
}
],
deptId
:
[{
required
:
true
,
message
:
'
所属部门不能为空
'
,
trigger
:
'
blur
'
}],
roleIds
:
[{
required
:
true
,
message
:
'
用户角色不能为空
'
,
trigger
:
'
blur
'
}],
...
...
@@ -96,25 +96,25 @@ const state = reactive({
{
pattern
:
/
\w[
-
\w
.+
]
*@
([
A-Za-z0-9
][
-A-Za-z0-9
]
+
\.)
+
[
A-Za-z
]{2,14}
/
,
message
:
'
请输入正确的邮箱地址
'
,
trigger
:
'
blur
'
,
}
,
trigger
:
'
blur
'
}
],
mobile
:
[
{
pattern
:
/^1
[
3|4|5|6|7|8|9
][
0-9
]\d{8}
$/
,
message
:
'
请输入正确的手机号码
'
,
trigger
:
'
blur
'
,
}
,
]
,
trigger
:
'
blur
'
}
]
},
importDialog
:
{
title
:
'
用户
搭配
'
,
visible
:
false
,
title
:
'
用户
导入
'
,
visible
:
false
}
as
DialogType
,
importFormData
:
{}
as
UserImportData
,
excelFile
:
undefined
as
any
,
excelFilelist
:
[]
as
File
[]
,
excelFilelist
:
[]
as
File
[]
});
const
{
...
...
@@ -131,7 +131,7 @@ const {
roleOptions
,
importDialog
,
importFormData
,
excelFilelist
,
excelFilelist
}
=
toRefs
(
state
);
watchEffect
(
...
...
@@ -139,7 +139,7 @@ watchEffect(
deptTreeRef
.
value
.
filter
(
state
.
deptName
);
},
{
flush
:
'
post
'
,
// watchEffect会在DOM挂载或者更新之前就会触发,此属性控制在DOM元素更新后运行
flush
:
'
post
'
// watchEffect会在DOM挂载或者更新之前就会触发,此属性控制在DOM元素更新后运行
}
);
...
...
@@ -165,7 +165,7 @@ function handleDeptNodeClick(data: { [key: string]: any }) {
* 获取角色下拉项
*/
async
function
getRoleOptions
()
{
listRoleOptions
().
then
(
(
response
)
=>
{
listRoleOptions
().
then
(
response
=>
{
state
.
roleOptions
=
response
.
data
;
});
}
...
...
@@ -181,7 +181,7 @@ function handleStatusChange(row: { [key: string]: any }) {
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
,
type
:
'
warning
'
}
)
.
then
(()
=>
{
...
...
@@ -231,7 +231,7 @@ function resetPassword(row: { [key: string]: any }) {
'
重置密码
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
cancelButtonText
:
'
取消
'
}
)
.
then
(({
value
})
=>
{
...
...
@@ -252,7 +252,7 @@ function resetPassword(row: { [key: string]: any }) {
async
function
handleAdd
()
{
state
.
dialog
=
{
title
:
'
添加用户
'
,
visible
:
true
,
visible
:
true
};
await
getDeptOptions
();
await
getRoleOptions
();
...
...
@@ -264,7 +264,7 @@ async function handleAdd() {
async
function
handleUpdate
(
row
:
{
[
key
:
string
]:
any
})
{
dialog
.
value
=
{
title
:
'
修改用户
'
,
visible
:
true
,
visible
:
true
};
const
userId
=
row
.
id
||
state
.
ids
;
...
...
@@ -310,7 +310,7 @@ function handleDelete(row: { [key: string]: any }) {
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
,
type
:
'
warning
'
}
)
.
then
(
function
()
{
...
...
@@ -335,7 +335,7 @@ function closeDialog() {
* 获取部门下拉项
*/
async
function
getDeptOptions
()
{
listDeptOptions
().
then
(
(
response
)
=>
{
listDeptOptions
().
then
(
response
=>
{
state
.
deptOptions
=
response
.
data
;
});
}
...
...
@@ -355,7 +355,7 @@ function getGenderOptions() {
function
handleDownloadTemplate
()
{
downloadTemplate
().
then
((
response
:
any
)
=>
{
const
blob
=
new
Blob
([
response
.
data
],
{
type
:
'
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
'
,
type
:
'
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
'
});
const
a
=
document
.
createElement
(
'
a
'
);
const
href
=
window
.
URL
.
createObjectURL
(
blob
);
// 下载链接
...
...
@@ -407,7 +407,7 @@ function submitImportForm() {
const
deptId
=
state
.
importFormData
.
deptId
;
const
roleIds
=
state
.
importFormData
.
roleIds
.
join
(
'
,
'
);
importUser
(
deptId
,
roleIds
,
state
.
excelFile
).
then
(
(
response
)
=>
{
importUser
(
deptId
,
roleIds
,
state
.
excelFile
).
then
(
response
=>
{
ElMessage
.
success
(
response
.
data
);
closeImportDialog
();
handleQuery
();
...
...
@@ -432,7 +432,7 @@ function closeImportDialog() {
function
handleExport
()
{
exportUser
(
queryParams
.
value
).
then
((
response
:
any
)
=>
{
const
blob
=
new
Blob
([
response
.
data
],
{
type
:
'
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
'
,
type
:
'
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
'
});
const
a
=
document
.
createElement
(
'
a
'
);
const
href
=
window
.
URL
.
createObjectURL
(
blob
);
// 下载的链接
...
...
@@ -580,11 +580,26 @@ onMounted(() => {
align=
"center"
prop=
"username"
/>
<el-table-column
label=
"用户昵称"
width=
"120"
align=
"center"
prop=
"nickname"
/>
<el-table-column
label=
"用户昵称"
width=
"120"
align=
"center"
prop=
"nickname"
/>
<el-table-column
label=
"性别"
width=
"100"
align=
"center"
prop=
"genderLabel"
/>
<el-table-column
label=
"性别"
width=
"100"
align=
"center"
prop=
"genderLabel"
/>
<el-table-column
label=
"部门"
width=
"120"
align=
"center"
prop=
"deptName"
/>
<el-table-column
label=
"部门"
width=
"120"
align=
"center"
prop=
"deptName"
/>
<el-table-column
label=
"手机号码"
align=
"center"
...
...
@@ -618,7 +633,7 @@ onMounted(() => {
link
@
click=
"handleUpdate(scope.row)"
v-hasPerm=
"['sys:user:edit']"
>
修改
</el-button
>
编辑
</el-button
>
<el-button
type=
"danger"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录